Now systems.cpp is disconnected from levelmanager. That leaves the GUIs and then to completely remove it and clean up the api.

This commit is contained in:
Zed A. Shaw 2025-08-19 11:05:32 -04:00
parent 81e25f73bb
commit d5ff57e025
9 changed files with 106 additions and 89 deletions

View file

@ -73,7 +73,7 @@ namespace gui {
void FSM::MOVING(Event ) {
// this should be an optional that returns a point
if(auto move_to = $main_ui.play_move()) {
System::plan_motion(Game::current(), *move_to);
System::plan_motion(*move_to);
run_systems();
$main_ui.dirty();
state(State::IDLE);
@ -84,7 +84,7 @@ namespace gui {
using enum Event;
switch(ev) {
case TICK: {
System::combat(Game::current(), $temp_attack_id);
System::combat($temp_attack_id);
run_systems();
state(State::IN_COMBAT);
} break;
@ -195,7 +195,7 @@ namespace gui {
auto gui_id = std::any_cast<guecs::Entity>(data);
auto& slot_name = $status_ui.$gui.name_for(gui_id);
if(System::use_item(Game::current(), slot_name)) {
if(System::use_item(slot_name)) {
$status_ui.update();
}
} break;
@ -207,7 +207,7 @@ namespace gui {
mouse_action({1 << guecs::ModBit::hover});
} break;
case AIM_CLICK:
System::pickup(Game::current());
System::pickup();
break;
default:
break; // ignore everything else
@ -362,9 +362,8 @@ namespace gui {
event(Event::LOOT_OPEN);
break;
case KEY::Z: {
auto& level = Game::current();
auto& player_pos = Game::player_position();
System::distribute_loot(level, {player_pos.aiming_at});
System::distribute_loot({player_pos.aiming_at});
} break;
case KEY::X:
event(Event::STAIRS_DOWN);
@ -422,14 +421,13 @@ namespace gui {
}
void FSM::run_systems() {
auto& level = Game::current();
System::generate_paths(level);
System::enemy_ai_initialize(level);
System::enemy_pathing(level);
System::collision(level);
System::motion(level);
System::lighting(level);
System::death(level);
System::generate_paths();
System::enemy_ai_initialize();
System::enemy_pathing();
System::collision();
System::motion();
System::lighting();
System::death();
}
bool FSM::active() {
@ -504,7 +502,7 @@ namespace gui {
event(Event::LOOT_OPEN);
} break;
case eGUI::HP_STATUS:
System::player_status(Game::current());
System::player_status();
break;
case eGUI::NEW_RITUAL:
$combat_ui.init();