mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2025-11-30 04:20:06 +00:00
(WIP) Add src param to transition + certain hooks
Should all hooks have src? I think not
This commit is contained in:
@@ -128,7 +128,7 @@ void CombatNPC::step(time_t currTime) {
|
||||
}
|
||||
}
|
||||
|
||||
void CombatNPC::transition(AIState newState) {
|
||||
void CombatNPC::transition(AIState newState, EntityRef src) {
|
||||
state = newState;
|
||||
switch (newState) {
|
||||
case AIState::INACTIVE:
|
||||
@@ -138,13 +138,13 @@ void CombatNPC::transition(AIState newState) {
|
||||
onRoamStart();
|
||||
break;
|
||||
case AIState::COMBAT:
|
||||
onCombatStart();
|
||||
onCombatStart(src);
|
||||
break;
|
||||
case AIState::RETREAT:
|
||||
onRetreat();
|
||||
break;
|
||||
case AIState::DEAD:
|
||||
onDeath();
|
||||
onDeath(src);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -303,7 +303,7 @@ void Combat::npcAttackPc(Mob *mob, time_t currTime) {
|
||||
PlayerManager::sendToViewable(mob->target, respbuf, P_FE2CL_NPC_ATTACK_PCs);
|
||||
|
||||
if (plr->HP <= 0) {
|
||||
mob->transition(AIState::RETREAT);
|
||||
mob->transition(AIState::RETREAT, mob->target);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user