Pathfinding data
This commit is contained in:
@@ -444,6 +444,11 @@ const entity_schema = z.object({
|
||||
max_health: z.number().min(0).optional(),
|
||||
// minecraft's per tick speed, 0.25 for most animals
|
||||
movement_speed: z.number().min(0).optional(),
|
||||
// whether it jumps, onto blocks in its way and up its path, true when not set. one that doesn't still steps up its
|
||||
// step height, and swims up in water. see PATHFINDING.md
|
||||
jumps: z.boolean().optional(),
|
||||
// how many blocks it drops on its way, 3 when not set. 0 never walks off an edge, so it keeps out of pits
|
||||
max_fall: z.number().int().min(0).optional(),
|
||||
// what its hits do, for monsters. 2 when not set, like minecraft's
|
||||
attack_damage: z.number().min(0).optional(),
|
||||
// protection from physical and from arcane damage, not used yet
|
||||
|
||||
@@ -32,6 +32,8 @@ and players. Mods define new kinds in their `entities/` folder, and draw them wi
|
||||
| `width`, `height` | required | Its collision box in blocks, up to 16. `width` is for both x and z. Its eyes are at 85% of the height. |
|
||||
| `max_health` | `10` | In half hearts. |
|
||||
| `movement_speed` | `0.25` | Minecraft's per tick speed, 0.25 for most animals. |
|
||||
| `jumps` | `true` | Whether it jumps onto blocks in its way. Without, it still steps up 0.6 blocks and swims up in water. |
|
||||
| `max_fall` | `3` | How many blocks it drops on its way. `0` never walks off an edge, to keep monsters out of pits. |
|
||||
| `attack_damage` | `2` | What a monster's hits do, in half hearts. |
|
||||
| `physical_shielding` | `0` | Protection from physical damage. Not used yet. |
|
||||
| `arcane_shielding` | `0` | Protection from arcane damage. Not used yet. |
|
||||
|
||||
@@ -78,6 +78,14 @@ back. Depend on the mod whose tag you change, so your file loads after its. chec
|
||||
| `#bworld:leaves` | blocks | Every kind of leaves. |
|
||||
| `#c:ingots` | items | `#c:ingots/copper`, `#c:ingots/tin`, `#c:ingots/iron`, `#c:ingots/gold`. |
|
||||
|
||||
## The Engine's Tags
|
||||
|
||||
The engine reads these by name. No mod owns `cubi`, so adding to them needs no dependency.
|
||||
|
||||
| Tag | Registry | What's in it |
|
||||
| ------------------------- | -------- | ------------------------------------------------------------------------------------------------- |
|
||||
| `#cubi:mobs_path_through` | blocks | Blocks mobs' paths go through, like doors: a mob runs into a closed one and waits for it to open. |
|
||||
|
||||
## Using Tags in Data
|
||||
|
||||
- **Recipes**: anywhere a recipe takes an item (shaped `key` values, smelting `input`, fuel `item`) it can take an item
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
"height": 1.9,
|
||||
"max_health": 40,
|
||||
"movement_speed": 0.23,
|
||||
"jumps": false,
|
||||
"max_fall": 0,
|
||||
"attack_damage": 5,
|
||||
"physical_shielding": 3
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"format_version": 1,
|
||||
"tag": {
|
||||
"values": [
|
||||
"dangerous_business:factory_door"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -87,6 +87,13 @@ Deno.test("an entity without a model is drawn as its texture, and a scripted one
|
||||
assertEquals(validate_entity({ id: "a:b", texture: "a:b", behavior: "a:flying", width: 0.25, height: 0.25 }), []);
|
||||
});
|
||||
|
||||
Deno.test("an entity can say it doesn't jump and how far it drops, in whole blocks", () => {
|
||||
const entity = { id: "a:b", texture: "a:b", width: 1, height: 1 };
|
||||
assertEquals(validate_entity({ ...entity, jumps: false, max_fall: 0 }), []);
|
||||
assertEquals(validate_entity({ ...entity, max_fall: 1.5 }).length, 1);
|
||||
assertEquals(validate_entity({ ...entity, max_fall: -1 }).length, 1);
|
||||
});
|
||||
|
||||
Deno.test("an entity's category is monster for monsters unless it says otherwise", () => {
|
||||
const entity = { id: "a:b", texture: "a:b", width: 1, height: 1 };
|
||||
assertEquals(entity_category(entity), "creature");
|
||||
|
||||
Reference in New Issue
Block a user