Rename to GameDB and GameDB::Level.
This commit is contained in:
parent
c46927ea10
commit
a20d701096
23 changed files with 142 additions and 151 deletions
|
@ -7,9 +7,9 @@ template<typename Comp>
|
|||
int number_left() {
|
||||
int count = 0;
|
||||
|
||||
Game::current_world()->query<components::Position, Comp>(
|
||||
GameDB::current_world()->query<components::Position, Comp>(
|
||||
[&](const auto ent, auto&, auto&) {
|
||||
if(ent != Game::current().player) {
|
||||
if(ent != GameDB::current().player) {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
|
@ -19,15 +19,15 @@ int number_left() {
|
|||
|
||||
template<typename Comp>
|
||||
Pathing compute_paths() {
|
||||
auto& walls_original = Game::current().map->$walls;
|
||||
auto& walls_original = GameDB::current().map->$walls;
|
||||
auto walls_copy = walls_original;
|
||||
|
||||
Pathing paths{matrix::width(walls_copy), matrix::height(walls_copy)};
|
||||
|
||||
Game::current().world->query<components::Position>(
|
||||
GameDB::current().world->query<components::Position>(
|
||||
[&](const auto ent, auto& position) {
|
||||
if(ent != Game::current().player) {
|
||||
if(Game::current().world->has<Comp>(ent)) {
|
||||
if(ent != GameDB::current().player) {
|
||||
if(GameDB::current().world->has<Comp>(ent)) {
|
||||
paths.set_target(position.location);
|
||||
} else {
|
||||
// this will mark that spot as a wall so we don't path there temporarily
|
||||
|
@ -89,7 +89,7 @@ void Autowalker::process_combat() {
|
|||
}
|
||||
|
||||
Point Autowalker::get_current_position() {
|
||||
return Game::player_position().location;
|
||||
return GameDB::player_position().location;
|
||||
}
|
||||
|
||||
void Autowalker::path_fail(Matrix& bad_paths, Point pos) {
|
||||
|
@ -110,7 +110,7 @@ bool Autowalker::path_player(Pathing& paths, Point& target_out) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!Game::current().map->can_move(target_out)) {
|
||||
if(!GameDB::current().map->can_move(target_out)) {
|
||||
path_fail(paths.$paths, target_out);
|
||||
return false;
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ void Autowalker::process_move(Pathing& paths) {
|
|||
// what are we aiming at?
|
||||
auto aimed_at = fsm.$main_ui.camera_aim();
|
||||
|
||||
if(aimed_at && Game::current_world()->has<components::InventoryItem>(aimed_at)) {
|
||||
if(aimed_at && GameDB::current_world()->has<components::InventoryItem>(aimed_at)) {
|
||||
// NOTE: if we're aiming at an item then pick it up
|
||||
// for now just loot it then close to get it off the map
|
||||
send_event(gui::Event::LOOT_ITEM);
|
||||
|
@ -349,8 +349,8 @@ void Autowalker::send_event(gui::Event ev) {
|
|||
}
|
||||
|
||||
bool Autowalker::player_health_good() {
|
||||
auto world = Game::current_world();
|
||||
auto combat = world->get<components::Combat>(Game::the_player());
|
||||
auto world = GameDB::current_world();
|
||||
auto combat = world->get<components::Combat>(GameDB::the_player());
|
||||
return float(combat.hp) / float(combat.max_hp) > 0.5f;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue