feat(entities): light_radius + getLightCenter a Entity i Player
This commit is contained in:
1 parent
68be8e55ec
commit
ebb161f1f5
5 files changed
+67
No files matched your search
@@ -155,6 +155,17 @@ namespace {
|
||||
return c["height"].get_value<int>();
|
||||
}
|
||||
|
||||
// Bloc opcional `light: { radius: N }` de la plantilla. Si manca, el
|
||||
// radi és 0 i l'entitat no entra a la pasada d'il·luminació. La forma
|
||||
// del gradient (3 anells) viu a data/config/lighting.yaml — no cal
|
||||
// declarar-la per entitat.
|
||||
auto readLightRadius(const fkyaml::node& tmpl) -> int {
|
||||
if (!tmpl.contains("light")) { return 0; }
|
||||
const auto& l = tmpl["light"];
|
||||
if (!l.contains("radius")) { return 0; }
|
||||
return l["radius"].get_value<int>();
|
||||
}
|
||||
|
||||
// Bloc `collision: { size: [w, h], base_size: [bw, bh]?, offset: [x, y]? }`
|
||||
// de la plantilla d'entitat.
|
||||
// - Sense `base_size` ni `offset`: la caja queda alineada a la vora
|
||||
@@ -277,6 +288,7 @@ namespace {
|
||||
entity->setCollisionBox(*BOX);
|
||||
}
|
||||
entity->setHeight(readHeight(tmpl));
|
||||
entity->setLightRadius(readLightRadius(tmpl));
|
||||
anchor_out = readAnchor(tmpl);
|
||||
return entity;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user