Start working on entities
This commit is contained in:
+7
-2
@@ -7,6 +7,7 @@ import {
|
||||
type BlockJson,
|
||||
choice_list,
|
||||
type EffectJson,
|
||||
entity_category,
|
||||
type EntityJson,
|
||||
type EntityModelJson,
|
||||
type FluidJson,
|
||||
@@ -380,6 +381,8 @@ export function check_references(mods: LoadedMod[], engine_textures: Iterable<st
|
||||
if (json.model !== undefined) uses(file, json.model, "entity model");
|
||||
uses(file, json.texture, "texture");
|
||||
if (json.loot_table) uses(file, json.loot_table, "loot table");
|
||||
// scripts register behaviors, the server checks them when it starts
|
||||
if (json.behavior?.includes(":")) check_namespace(file, json.behavior);
|
||||
}
|
||||
for (const { file, json } of mod.loot_tables ?? []) {
|
||||
const refs = loot_references(json);
|
||||
@@ -527,8 +530,10 @@ export function check_references(mods: LoadedMod[], engine_textures: Iterable<st
|
||||
check_namespace(file, json.entity);
|
||||
const entity = entity_jsons.get(json.entity);
|
||||
if (!entity) errors.push(`${file}: entity ${json.entity} doesn't exist`);
|
||||
else if (entity.behavior !== "monster") {
|
||||
errors.push(`${file}: ${json.entity} isn't a monster, only monsters spawn on their own for now`);
|
||||
else if (entity_category(entity) !== "monster") {
|
||||
errors.push(
|
||||
`${file}: ${json.entity} isn't in the monster category, only monsters spawn on their own for now`,
|
||||
);
|
||||
}
|
||||
for (const biome of json.biomes ?? []) {
|
||||
check_namespace(file, biome);
|
||||
|
||||
Reference in New Issue
Block a user