Now have dead bodies working but need art for it.

master
Zed A. Shaw 4 days ago
parent fc4eacadb0
commit b9656013b0
  1. 14
      assets/devices.json
  2. 26
      assets/map_tiles.json
  3. BIN
      assets/map_tiles.png
  4. 28
      systems.cpp

@ -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}
]
}
}

@ -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
}
]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

@ -144,11 +144,10 @@ void System::distribute_loot(GameLevel &level, Position target_pos) {
auto& world = *level.world;
auto& config = world.get_the<GameConfig>();
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<ritual::JunkPile>(junk_entity, pile);
components::configure_entity(world, loot_entity, entity_data["components"]);
world.set<ritual::JunkPile>(loot_entity, pile);
// BUG: inventory_count here isn't really used to remove it
world.set<InventoryItem>(junk_entity, {inventory_count, entity_data});
world.set<InventoryItem>(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>(Events::GUI::ENTITY_SPAWN, junk_entity, {});
level.world->send<Events::GUI>(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>(Events::GUI::ENTITY_SPAWN, loot_entity, {});
}
}

Loading…
Cancel
Save