mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2025-12-23 04:10:06 +00:00
Quick fix for Fuse boss fight NPCEvent logic
Will be replaced with a proper rework immediately.
This commit is contained in:
@@ -307,19 +307,21 @@ void CombatNPC::step(time_t currTime) {
|
||||
}
|
||||
|
||||
void CombatNPC::transition(AIState newState, EntityRef src) {
|
||||
|
||||
state = newState;
|
||||
|
||||
if (transitionHandlers.find(newState) != transitionHandlers.end())
|
||||
transitionHandlers[newState](this, src);
|
||||
else {
|
||||
std::cout << "[WARN] Transition to " << (int)state << " has no handler; going inactive" << std::endl;
|
||||
transition(AIState::INACTIVE, id);
|
||||
}
|
||||
/* TODO: fire any triggered events
|
||||
for (NPCEvent& event : NPCManager::NPCEvents)
|
||||
if (event.trigger == ON_KILLED && event.npcType == type)
|
||||
event.handler(src, this);
|
||||
*/
|
||||
|
||||
// TODO: Properly refactor this
|
||||
if (newState == AIState::DEAD && src.kind == EntityKind::PLAYER) {
|
||||
for (NPCEvent& event : NPCManager::NPCEvents)
|
||||
if (event.trigger == ON_KILLED && event.npcType == type)
|
||||
event.handler(src.sock, this);
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user