Reworked the way that entities are loaded so they're more dynamic and can be configured without modifying C++code.

This commit is contained in:
Zed A. Shaw 2025-01-08 16:09:22 -05:00
parent 1f7214fcd4
commit 9ce4fbd552
6 changed files with 94 additions and 42 deletions

View file

@ -148,12 +148,16 @@ void System::collision(DinkyECS::World &world, Player &player) {
world.set<LightSource>(player.entity, new_light);
inventory.light = new_light;
world.remove<LightSource>(entity);
} else if(world.has<Weapon>(entity)) {
}
if(world.has<Weapon>(entity)) {
inventory.add(item);
auto &weapon = world.get<Weapon>(entity);
player_combat.damage = weapon.damage;
world.remove<Weapon>(entity);
} else if(world.has<Loot>(entity)) {
}
if(world.has<Loot>(entity)) {
auto &loot = world.get<Loot>(entity);
inventory.gold += loot.amount;
world.remove<Loot>(entity);