1+ /*
2+ * Copyright 2025 Lambda
3+ *
4+ * This program is free software: you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation, either version 3 of the License, or
7+ * (at your option) any later version.
8+ *
9+ * This program is distributed in the hope that it will be useful,
10+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+ * GNU General Public License for more details.
13+ *
14+ * You should have received a copy of the GNU General Public License
15+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
16+ */
17+
18+ package com.lambda.pathing.move
19+
20+ import com.lambda.pathing.Node
21+ import com.lambda.pathing.Node.Companion.toNode
22+ import com.lambda.pathing.goal.Goal
23+ import com.lambda.util.world.FastVector
24+ import com.lambda.util.world.offset
25+ import kotlin.math.abs
26+
27+ enum class Move (val x : Int , val y : Int , val z : Int ) {
28+ TRAVERSE_NORTH (0 , 0 , - 1 ),
29+ TRAVERSE_NORTH_EAST (1 , 0 , - 1 ),
30+ TRAVERSE_EAST (1 , 0 , 0 ),
31+ TRAVERSE_SOUTH_EAST (1 , 0 , 1 ),
32+ TRAVERSE_SOUTH (0 , 0 , 1 ),
33+ TRAVERSE_SOUTH_WEST (- 1 , 0 , 1 ),
34+ TRAVERSE_WEST (- 1 , 0 , 0 ),
35+ TRAVERSE_NORTH_WEST (- 1 , 0 , - 1 ),
36+ PILLAR (0 , 1 , 0 ),
37+ ASCEND_NORTH (0 , 1 , - 1 ),
38+ ASCEND_EAST (1 , 1 , 0 ),
39+ ASCEND_SOUTH (0 , 1 , 1 ),
40+ ASCEND_WEST (- 1 , 1 , 0 ),
41+ FALL (0 , - 1 , 0 ),
42+ DESCEND_NORTH (0 , - 1 , - 1 ),
43+ DESCEND_EAST (1 , - 1 , 0 ),
44+ DESCEND_SOUTH (0 , - 1 , 1 ),
45+ DESCEND_WEST (- 1 , - 1 , 0 );
46+
47+ fun cost (): Int = abs(x) + abs(y) + abs(z)
48+
49+ // ToDo: Use DirectionMask
50+ fun node (origin : FastVector , goal : Goal ): Node = origin.offset(x, y, z).toNode(goal)
51+ }
0 commit comments