There's now a Collision component that determines collision if its set. Closes #72.
This commit is contained in:
parent
9bf6926dc3
commit
fc4eacadb0
6 changed files with 27 additions and 13 deletions
|
@ -88,23 +88,18 @@ DinkyECS::Entity WorldBuilder::configure_entity_in_map(DinkyECS::World &world, j
|
|||
dbc::check(found, "Failed to find a place for this thing.");
|
||||
|
||||
auto item = world.entity();
|
||||
// NOTE: aiming_at is set by the rayview since it knows that
|
||||
world.set<Position>(item, {pos.x, pos.y});
|
||||
|
||||
// BUG: See #72, but this will change to a setting for collision
|
||||
int inv_count = entity_data.contains("inventory_count") ? (int)entity_data["inventory_count"] : 0;
|
||||
bool has_collision = true;
|
||||
|
||||
if(inv_count > 0) {
|
||||
world.set<InventoryItem>(item, {entity_data["inventory_count"], entity_data});
|
||||
has_collision = false;
|
||||
}
|
||||
|
||||
if(entity_data.contains("components")) {
|
||||
components::configure_entity(world, item, entity_data["components"]);
|
||||
}
|
||||
|
||||
$collision.insert(pos, item, has_collision);
|
||||
System::set_position(world, $collision, item, {pos.x, pos.y});
|
||||
|
||||
return item;
|
||||
}
|
||||
|
@ -209,8 +204,7 @@ void WorldBuilder::place_entities(DinkyECS::World &world) {
|
|||
placed = find_open_spot(player_pos.location);
|
||||
dbc::check(placed, "WorldBuild.find_open_spot also failed to position player");
|
||||
|
||||
world.set<Position>(player.entity, player_pos);
|
||||
$collision.insert(player_pos.location, player.entity, true);
|
||||
System::set_position(world, $collision, player.entity, player_pos);
|
||||
} else {
|
||||
auto player_data = config.enemies["PLAYER_TILE"];
|
||||
auto player_ent = configure_entity_in_room(world, player_data, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue