Now have dead bodies working but need art for it.

master
Zed A. Shaw 6 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, "inventory_count": 0,
"randomized": false, "randomized": false,
"components": [ "components": [
{"_type": "Tile", "display": 10949, {"_type": "Tile", "display": 6105,
"foreground": "devices/fg:stairs_down", "foreground": "devices/fg:stairs_down",
"background": "devices/bg:stairs_down" "background": "devices/bg:stairs_down"
}, },
@ -75,5 +75,17 @@
{"_type": "Sprite", "name": "grave_stone", "width": 256, "height": 256, "scale": 1.0}, {"_type": "Sprite", "name": "grave_stone", "width": 256, "height": 256, "scale": 1.0},
{"_type": "Sound", "attack": "pickup", "death": "blank"} {"_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, "centered": true,
"display": 8687, "display": 42613,
"x": 64, "x": 64,
"y": 64 "y": 64
}, },
{ {
"centered": true, "centered": true,
"display": 10949, "display": 8687,
"x": 128, "x": 128,
"y": 64 "y": 64
}, },
{ {
"centered": true, "centered": true,
"display": 8793, "display": 6105,
"x": 192, "x": 192,
"y": 64 "y": 64
}, },
{ {
"centered": true, "centered": true,
"display": 95, "display": 8793,
"x": 256, "x": 256,
"y": 64 "y": 64
}, },
{ {
"centered": true, "centered": true,
"display": 1898, "display": 95,
"x": 320, "x": 320,
"y": 64 "y": 64
}, },
{ {
"centered": true, "centered": true,
"display": 42586, "display": 1898,
"x": 384, "x": 384,
"y": 64 "y": 64
}, },
{ {
"centered": true, "centered": true,
"display": 2189, "display": 42586,
"x": 448, "x": 448,
"y": 64 "y": 64
}, },
{ {
"centered": true, "centered": true,
"display": 10733, "display": 2189,
"x": 512, "x": 512,
"y": 64 "y": 64
}, },
{ {
"centered": true, "centered": true,
"display": 2220, "display": 10733,
"x": 576, "x": 576,
"y": 64 "y": 64
}, },
{ {
"centered": true, "centered": true,
"display": 1218, "display": 2220,
"x": 0, "x": 0,
"y": 128 "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& world = *level.world;
auto& config = world.get_the<GameConfig>(); auto& config = world.get_the<GameConfig>();
int inventory_count = Random::uniform(0, 3); int inventory_count = Random::uniform(0, 3);
auto loot_entity = world.entity();
if(inventory_count > 0) { if(inventory_count > 0) {
// do a clone of the things we need, like Position // this means the entity dropped loot, so make a lootable tombstone
auto junk_entity = world.entity();
ritual::JunkPile pile; ritual::JunkPile pile;
auto& junk = config.rituals["junk"]; 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"]; auto entity_data = config.devices["GRAVE_STONE"];
components::configure_entity(world, junk_entity, entity_data["components"]); components::configure_entity(world, loot_entity, entity_data["components"]);
world.set<ritual::JunkPile>(junk_entity, pile); world.set<ritual::JunkPile>(loot_entity, pile);
// BUG: inventory_count here isn't really used to remove it // 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 { } else {
dbc::log("DEAD BODY NOT IMPLEMENTED, for now just removing enemy"); // this creates a dead body on the ground
// BUG: should maybe add a component to the world for "dead thing no loot" that auto entity_data = config.devices["DEAD_BODY"];
// has no collision or goes away after some kind of animation components::configure_entity(world, loot_entity, entity_data["components"]);
// Something like: set_position(world, *level.collision, loot_entity, target_pos);
// auto entity_data = config.devices["DEAD_BODY"]; level.world->send<Events::GUI>(Events::GUI::ENTITY_SPAWN, loot_entity, {});
// 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
} }
} }

Loading…
Cancel
Save