Rule-updated entities should get new burnable/sinkable

This commit is contained in:
Logan Hunt 2022-04-19 20:53:06 -06:00
parent 3b6282c152
commit 3f6a14e142

View File

@ -90,8 +90,11 @@ game.system.Logic = (entitiesGrid) => {
const entity = entities[id]; const entity = entities[id];
if (entity.hasComponent("name") && entity.components.name.selector == entityName) { if (entity.hasComponent("name") && entity.components.name.selector == entityName) {
const e = nounsToEntityCreators[applicationEntityName](); const e = nounsToEntityCreators[applicationEntityName]();
entity.components.name = e.components.name; ["name", "sprite", "burnable", "sinkable"].map((name) => {
entity.components.sprite = e.components.sprite; if (e.hasComponent(name)) {
entity.components[name] = e.components[name];
}
});
} }
} }
} }