diff --git a/assets/devices.json b/assets/devices.json index 2bf5533..1ab700a 100644 --- a/assets/devices.json +++ b/assets/devices.json @@ -7,7 +7,7 @@ "inventory_count": 0, "randomized": false, "components": [ - {"_type": "Tile", "display": 10949, + {"_type": "Tile", "display": 6105, "foreground": "devices/fg:stairs_down", "background": "devices/bg:stairs_down" }, @@ -75,5 +75,17 @@ {"_type": "Sprite", "name": "grave_stone", "width": 256, "height": 256, "scale": 1.0}, {"_type": "Sound", "attack": "pickup", "death": "blank"} ] + }, + "DEAD_BODY": { + "id": "DEAD_BODY", + "name": "Something Dead", + "description": "You can't loot this, weirdo.", + "components": [ + {"_type": "Tile", "display": 42613, + "foreground": "devices/fg:grave_stone", + "background": "devices/bg:grave_stone" + }, + {"_type": "Sprite", "name": "dubious_combination", "width": 256, "height": 256, "scale": 1.0} + ] } } diff --git a/assets/map_tiles.json b/assets/map_tiles.json index 7a8adb0..ad01672 100644 --- a/assets/map_tiles.json +++ b/assets/map_tiles.json @@ -67,62 +67,68 @@ }, { "centered": true, - "display": 8687, + "display": 42613, "x": 64, "y": 64 }, { "centered": true, - "display": 10949, + "display": 8687, "x": 128, "y": 64 }, { "centered": true, - "display": 8793, + "display": 6105, "x": 192, "y": 64 }, { "centered": true, - "display": 95, + "display": 8793, "x": 256, "y": 64 }, { "centered": true, - "display": 1898, + "display": 95, "x": 320, "y": 64 }, { "centered": true, - "display": 42586, + "display": 1898, "x": 384, "y": 64 }, { "centered": true, - "display": 2189, + "display": 42586, "x": 448, "y": 64 }, { "centered": true, - "display": 10733, + "display": 2189, "x": 512, "y": 64 }, { "centered": true, - "display": 2220, + "display": 10733, "x": 576, "y": 64 }, { "centered": true, - "display": 1218, + "display": 2220, "x": 0, "y": 128 + }, + { + "centered": true, + "display": 1218, + "x": 64, + "y": 128 } ] diff --git a/assets/map_tiles.png b/assets/map_tiles.png index 5c958ab..2270f94 100644 Binary files a/assets/map_tiles.png and b/assets/map_tiles.png differ diff --git a/systems.cpp b/systems.cpp index c959385..d4d5165 100644 --- a/systems.cpp +++ b/systems.cpp @@ -144,11 +144,10 @@ void System::distribute_loot(GameLevel &level, Position target_pos) { auto& world = *level.world; auto& config = world.get_the(); int inventory_count = Random::uniform(0, 3); + auto loot_entity = world.entity(); if(inventory_count > 0) { - // do a clone of the things we need, like Position - auto junk_entity = world.entity(); - + // this means the entity dropped loot, so make a lootable tombstone ritual::JunkPile pile; auto& junk = config.rituals["junk"]; @@ -164,23 +163,20 @@ void System::distribute_loot(GameLevel &level, Position target_pos) { } auto entity_data = config.devices["GRAVE_STONE"]; - components::configure_entity(world, junk_entity, entity_data["components"]); - world.set(junk_entity, pile); + components::configure_entity(world, loot_entity, entity_data["components"]); + world.set(loot_entity, pile); // BUG: inventory_count here isn't really used to remove it - world.set(junk_entity, {inventory_count, entity_data}); + world.set(loot_entity, {inventory_count, entity_data}); - set_position(world, *level.collision, junk_entity, target_pos); + set_position(world, *level.collision, loot_entity, target_pos); - level.world->send(Events::GUI::ENTITY_SPAWN, junk_entity, {}); + level.world->send(Events::GUI::ENTITY_SPAWN, loot_entity, {}); } else { - dbc::log("DEAD BODY NOT IMPLEMENTED, for now just removing enemy"); - // BUG: should maybe add a component to the world for "dead thing no loot" that - // has no collision or goes away after some kind of animation - // Something like: - // auto entity_data = config.devices["DEAD_BODY"]; - // components::configure_entity(world, ent, entity_data["components"]); - // then give it a collision device that makes it go away and make a sound - // or maybe you can walk over dead bodies and they make a noise + // this creates a dead body on the ground + auto entity_data = config.devices["DEAD_BODY"]; + components::configure_entity(world, loot_entity, entity_data["components"]); + set_position(world, *level.collision, loot_entity, target_pos); + level.world->send(Events::GUI::ENTITY_SPAWN, loot_entity, {}); } }