diff --git a/assets/devices.json b/assets/devices.json index ad294d4..285edba 100644 --- a/assets/devices.json +++ b/assets/devices.json @@ -49,20 +49,5 @@ "events": ["Events::GUI::TRAP"]}, {"_type": "Sprite", "name": "tripwire_trap"} ] - }, - "GRAVE_STONE": { - "id": "GRAVE_STONE", - "name": "Grave Stone", - "description": "Something died here. Was this your doing?", - "inventory_count": 0, - "components": [ - {"_type": "Tile", "display": "\u21ef", - "foreground": [32, 123, 164], - "background": [24, 205, 189] - }, - {"_type": "LightSource", "strength": 50, "radius": 0.5}, - {"_type": "Device", "config": {"test": true}, "events": []}, - {"_type": "Sprite", "name": "grave_stone"} - ] } } diff --git a/assets/items.json b/assets/items.json index c7cb5f1..0f4383b 100644 --- a/assets/items.json +++ b/assets/items.json @@ -68,5 +68,19 @@ {"_type": "Curative", "hp": 200}, {"_type": "Sprite", "name": "healing_potion_small"} ] + }, + "GRAVE_STONE": { + "id": "GRAVE_STONE", + "name": "Grave Stone", + "description": "Something died here. Was this your doing?", + "inventory_count": 1, + "components": [ + {"_type": "Tile", "display": "\u21ef", + "foreground": [32, 123, 164], + "background": [24, 205, 189] + }, + {"_type": "Loot", "amount": 10}, + {"_type": "Sprite", "name": "grave_stone"} + ] } } diff --git a/systems.cpp b/systems.cpp index 8e619b2..17d8a8d 100644 --- a/systems.cpp +++ b/systems.cpp @@ -132,8 +132,11 @@ void System::death(GameLevel &level, components::ComponentMap& components) { world.remove(ent); world.remove(ent); - auto entity_data = config.devices["GRAVE_STONE"]; + auto entity_data = config.items["GRAVE_STONE"]; components::configure_entity(components, world, ent, entity_data["components"]); + if(entity_data["inventory_count"] > 0) { + world.set(ent, {entity_data["inventory_count"], entity_data}); + } } }