Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Introduce luautils::callGlobal helper #6780

Merged
merged 6 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/filewatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void Filewatcher::handleFileAction(efsw::WatchID watchid, std::string const& dir
}
}

auto Filewatcher::getChangedLuaFiles() -> std::vector<std::pair<std::filesystem::path, Action>>
auto Filewatcher::popChangedLuaFilesList() -> std::vector<std::pair<std::filesystem::path, Action>>
{
std::set<std::pair<std::filesystem::path, Action>> actions; // For de-duping

Expand Down
2 changes: 1 addition & 1 deletion src/common/filewatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Filewatcher : public efsw::FileWatchListener
Moved = 4,
};

auto getChangedLuaFiles() -> std::vector<std::pair<std::filesystem::path, Action>>;
auto popChangedLuaFilesList() -> std::vector<std::pair<std::filesystem::path, Action>>;

private:
std::unique_ptr<efsw::FileWatcher> fileWatcherImpl;
Expand Down
6 changes: 3 additions & 3 deletions src/map/ai/ai_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ bool CAIContainer::Trigger(CCharEntity* player)
{
// TODO: ensure idempotency of all onTrigger lua calls (i.e. chests can only be opened once)
bool isDoor = luautils::OnTrigger(player, PEntity) == -1;
PEntity->PAI->EventHandler.triggerListener("ON_TRIGGER", CLuaBaseEntity(player), CLuaBaseEntity(PEntity));
PEntity->PAI->EventHandler.triggerListener("ON_TRIGGER", player, PEntity);
if (CanChangeState())
{
auto ret = ChangeState<CTriggerState>(PEntity, player->targid, isDoor);
Expand Down Expand Up @@ -418,7 +418,7 @@ void CAIContainer::Tick(time_point _tick)
m_Tick = _tick;

// TODO: timestamp in the event?
EventHandler.triggerListener("TICK", CLuaBaseEntity(PEntity));
EventHandler.triggerListener("TICK", PEntity);
PEntity->Tick(_tick);

// TODO: check this in the controller instead maybe? (might not want to check every tick)
Expand All @@ -431,7 +431,7 @@ void CAIContainer::Tick(time_point _tick)
PathFind->FollowPath(_tick);
if (PathFind->OnPoint())
{
EventHandler.triggerListener("PATH", CLuaBaseEntity(PEntity));
EventHandler.triggerListener("PATH", PEntity);
luautils::OnPath(PEntity);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/map/ai/controllers/automaton_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ bool CAutomatonController::TryAction()
if (m_Tick > m_LastActionTime + (m_actionCooldown - std::chrono::milliseconds(PAutomaton->getMod(Mod::AUTO_DECISION_DELAY) * 10)))
{
m_LastActionTime = m_Tick;
PAutomaton->PAI->EventHandler.triggerListener("AUTOMATON_AI_TICK", CLuaBaseEntity(PAutomaton), CLuaBaseEntity(PTarget));
PAutomaton->PAI->EventHandler.triggerListener("AUTOMATON_AI_TICK", PAutomaton, PTarget);

return true;
}
Expand Down Expand Up @@ -1594,7 +1594,7 @@ bool CAutomatonController::TryAttachment()
return false;
}

PAutomaton->PAI->EventHandler.triggerListener("AUTOMATON_ATTACHMENT_CHECK", CLuaBaseEntity(PAutomaton), CLuaBaseEntity(PTarget));
PAutomaton->PAI->EventHandler.triggerListener("AUTOMATON_ATTACHMENT_CHECK", PAutomaton, PTarget);

return false;
}
Expand Down
10 changes: 5 additions & 5 deletions src/map/ai/controllers/mob_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ void CMobController::DoCombatTick(time_point tick)

TryLink();

PMob->PAI->EventHandler.triggerListener("COMBAT_TICK", CLuaBaseEntity(PMob));
PMob->PAI->EventHandler.triggerListener("COMBAT_TICK", PMob);
luautils::OnMobFight(PMob, PTarget);

if (PMob->PAI->IsCurrentState<CInactiveState>() || !PMob->PAI->CanChangeState())
Expand All @@ -604,7 +604,7 @@ void CMobController::DoCombatTick(time_point tick)
}
else
{
PMob->PAI->EventHandler.triggerListener("RUN_AWAY", CLuaBaseEntity(PMob), CLuaBaseEntity(PFollowTarget));
PMob->PAI->EventHandler.triggerListener("RUN_AWAY", PMob, PFollowTarget);
ClearFollowTarget();
}
return;
Expand Down Expand Up @@ -1024,7 +1024,7 @@ void CMobController::DoRoamTick(time_point tick)
else if (PMob->m_roamFlags & ROAMFLAG_SCRIPTED)
{
// allow custom event action
PMob->PAI->EventHandler.triggerListener("ROAM_ACTION", CLuaBaseEntity(PMob));
PMob->PAI->EventHandler.triggerListener("ROAM_ACTION", PMob);
luautils::OnMobRoamAction(PMob);
m_LastActionTime = m_Tick;
}
Expand Down Expand Up @@ -1063,7 +1063,7 @@ void CMobController::DoRoamTick(time_point tick)
}
if (m_Tick >= m_LastRoamScript + 3s)
{
PMob->PAI->EventHandler.triggerListener("ROAM_TICK", CLuaBaseEntity(PMob));
PMob->PAI->EventHandler.triggerListener("ROAM_TICK", PMob);
luautils::OnMobRoam(PMob);
m_LastRoamScript = m_Tick;
}
Expand Down Expand Up @@ -1121,7 +1121,7 @@ void CMobController::FollowRoamPath()

if (PMob->PAI->PathFind->OnPoint())
{
PMob->PAI->EventHandler.triggerListener("PATH", CLuaBaseEntity(PMob));
PMob->PAI->EventHandler.triggerListener("PATH", PMob);
luautils::OnPath(PMob);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/map/ai/controllers/trust_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void CTrustController::DoCombatTick(time_point tick)

m_GambitsContainer->Tick(tick);

POwner->PAI->EventHandler.triggerListener("COMBAT_TICK", CLuaBaseEntity(POwner), CLuaBaseEntity(POwner->PMaster), CLuaBaseEntity(PTarget));
POwner->PAI->EventHandler.triggerListener("COMBAT_TICK", POwner, POwner->PMaster, PTarget);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/map/ai/helpers/action_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void CAIActionQueue::handleAction(queueAction_t& action)
{
if (action.lua_func.valid())
{
auto result = action.lua_func(CLuaBaseEntity(PEntity));
auto result = action.lua_func(PEntity);
if (!result.valid())
{
sol::error err = result;
Expand Down
10 changes: 5 additions & 5 deletions src/map/ai/states/ability_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ CAbilityState::CAbilityState(CBattleEntity* PEntity, uint16 targid, uint16 abili
actionTarget.messageID = 326;
actionTarget.param = PAbility->getID();
PEntity->loc.zone->PushPacket(PEntity, CHAR_INRANGE_SELF, std::make_unique<CActionPacket>(action));
m_PEntity->PAI->EventHandler.triggerListener("ABILITY_START", CLuaBaseEntity(m_PEntity), CLuaAbility(PAbility));
m_PEntity->PAI->EventHandler.triggerListener("ABILITY_START", m_PEntity, PAbility);

// face toward target
battleutils::turnTowardsTarget(m_PEntity, PTarget);
}
else
{
m_PEntity->PAI->EventHandler.triggerListener("ABILITY_START", CLuaBaseEntity(m_PEntity), CLuaAbility(PAbility));
m_PEntity->PAI->EventHandler.triggerListener("ABILITY_START", m_PEntity, PAbility);
}
}

Expand Down Expand Up @@ -133,11 +133,11 @@ bool CAbilityState::Update(time_point tick)
{
action_t action;
m_PEntity->OnAbility(*this, action);
m_PEntity->PAI->EventHandler.triggerListener("ABILITY_USE", CLuaBaseEntity(m_PEntity), CLuaBaseEntity(GetTarget()), CLuaAbility(m_PAbility.get()), CLuaAction(&action));
m_PEntity->PAI->EventHandler.triggerListener("ABILITY_USE", m_PEntity, GetTarget(), m_PAbility.get(), &action);
m_PEntity->loc.zone->PushPacket(m_PEntity, CHAR_INRANGE_SELF, std::make_unique<CActionPacket>(action));
if (auto* target = GetTarget())
{
target->PAI->EventHandler.triggerListener("ABILITY_TAKE", CLuaBaseEntity(target), CLuaBaseEntity(m_PEntity), CLuaAbility(m_PAbility.get()), CLuaAction(&action));
target->PAI->EventHandler.triggerListener("ABILITY_TAKE", target, m_PEntity, m_PAbility.get(), &action);
}
}
else if (m_castTime > 0s) // Instant abilities do not need to be interrupted
Expand Down Expand Up @@ -168,7 +168,7 @@ bool CAbilityState::Update(time_point tick)
CCharEntity* PChar = static_cast<CCharEntity*>(m_PEntity);
PChar->m_charHistory.abilitiesUsed++;
}
m_PEntity->PAI->EventHandler.triggerListener("ABILITY_STATE_EXIT", CLuaBaseEntity(m_PEntity), CLuaAbility(m_PAbility.get()));
m_PEntity->PAI->EventHandler.triggerListener("ABILITY_STATE_EXIT", m_PEntity, m_PAbility.get());
return true;
}

Expand Down
6 changes: 3 additions & 3 deletions src/map/ai/states/item_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ CItemState::CItemState(CCharEntity* PEntity, uint16 targid, uint8 loc, uint8 slo
actionTarget.messageID = 28;
actionTarget.knockback = 0;

m_PEntity->PAI->EventHandler.triggerListener("ITEM_START", CLuaBaseEntity(PTarget), CLuaItem(m_PItem), CLuaAction(&action));
m_PEntity->PAI->EventHandler.triggerListener("ITEM_START", PTarget, m_PItem, &action);
m_PEntity->loc.zone->PushPacket(m_PEntity, CHAR_INRANGE_SELF, std::make_unique<CActionPacket>(action));

m_PItem->setSubType(ITEM_LOCKED);
Expand Down Expand Up @@ -188,7 +188,7 @@ bool CItemState::Update(time_point tick)
{
FinishItem(action);
}
m_PEntity->PAI->EventHandler.triggerListener("ITEM_USE", CLuaBaseEntity(m_PEntity), CLuaItem(m_PItem), CLuaAction(&action));
m_PEntity->PAI->EventHandler.triggerListener("ITEM_USE", m_PEntity, m_PItem, &action);
m_PEntity->loc.zone->PushPacket(m_PEntity, CHAR_INRANGE_SELF, std::make_unique<CActionPacket>(action));
Complete();
}
Expand All @@ -199,7 +199,7 @@ bool CItemState::Update(time_point tick)
CCharEntity* PChar = m_PEntity;
PChar->m_charHistory.itemsUsed++;
}
m_PEntity->PAI->EventHandler.triggerListener("ITEM_STATE_EXIT", CLuaBaseEntity(m_PEntity), CLuaItem(m_PItem));
m_PEntity->PAI->EventHandler.triggerListener("ITEM_STATE_EXIT", m_PEntity, m_PItem);
return true;
}
return false;
Expand Down
8 changes: 4 additions & 4 deletions src/map/ai/states/magic_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ CMagicState::CMagicState(CBattleEntity* PEntity, uint16 targid, SpellID spellid,
}

// TODO: weaponskill lua object
m_PEntity->PAI->EventHandler.triggerListener("MAGIC_START", CLuaBaseEntity(m_PEntity), CLuaSpell(m_PSpell.get()), CLuaAction(&action));
m_PEntity->PAI->EventHandler.triggerListener("MAGIC_START", m_PEntity, m_PSpell.get(), &action);

m_PEntity->loc.zone->PushPacket(m_PEntity, CHAR_INRANGE_SELF, std::make_unique<CActionPacket>(action));
}
Expand Down Expand Up @@ -247,8 +247,8 @@ bool CMagicState::Update(time_point tick)
else
{
m_PEntity->OnCastFinished(*this, action);
m_PEntity->PAI->EventHandler.triggerListener("MAGIC_USE", CLuaBaseEntity(m_PEntity), CLuaBaseEntity(PTarget), CLuaSpell(m_PSpell.get()), CLuaAction(&action));
PTarget->PAI->EventHandler.triggerListener("MAGIC_TAKE", CLuaBaseEntity(PTarget), CLuaBaseEntity(m_PEntity), CLuaSpell(m_PSpell.get()), CLuaAction(&action));
m_PEntity->PAI->EventHandler.triggerListener("MAGIC_USE", m_PEntity, PTarget, m_PSpell.get(), &action);
PTarget->PAI->EventHandler.triggerListener("MAGIC_TAKE", PTarget, m_PEntity, m_PSpell.get(), &action);
}

m_PEntity->loc.zone->PushPacket(m_PEntity, CHAR_INRANGE_SELF, std::make_unique<CActionPacket>(action));
Expand All @@ -262,7 +262,7 @@ bool CMagicState::Update(time_point tick)
CCharEntity* PChar = static_cast<CCharEntity*>(m_PEntity);
PChar->m_charHistory.spellsCast++;
}
m_PEntity->PAI->EventHandler.triggerListener("MAGIC_STATE_EXIT", CLuaBaseEntity(m_PEntity), CLuaSpell(m_PSpell.get()));
m_PEntity->PAI->EventHandler.triggerListener("MAGIC_STATE_EXIT", m_PEntity, m_PSpell.get());
return true;
}
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/map/ai/states/mobskill_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ CMobSkillState::CMobSkillState(CBattleEntity* PEntity, uint16 targid, uint16 wsi
// face toward target // TODO : add force param to turnTowardsTarget on certain TP moves like Petro Eyes
battleutils::turnTowardsTarget(m_PEntity, PTarget);
}
m_PEntity->PAI->EventHandler.triggerListener("WEAPONSKILL_STATE_ENTER", CLuaBaseEntity(m_PEntity), m_PSkill->getID());
m_PEntity->PAI->EventHandler.triggerListener("WEAPONSKILL_STATE_ENTER", m_PEntity, m_PSkill->getID());
SpendCost();
}

Expand Down Expand Up @@ -145,7 +145,7 @@ bool CMobSkillState::Update(time_point tick)
{
static_cast<CMobEntity*>(PTarget)->PEnmityContainer->UpdateEnmity(m_PEntity, 0, 0);
}
m_PEntity->PAI->EventHandler.triggerListener("WEAPONSKILL_STATE_EXIT", CLuaBaseEntity(m_PEntity), m_PSkill->getID());
m_PEntity->PAI->EventHandler.triggerListener("WEAPONSKILL_STATE_EXIT", m_PEntity, m_PSkill->getID());

if (m_PEntity->objtype == TYPE_PET && m_PEntity->PMaster && m_PEntity->PMaster->objtype == TYPE_PC && (m_PSkill->isBloodPactRage() || m_PSkill->isBloodPactWard()))
{
Expand Down
4 changes: 2 additions & 2 deletions src/map/ai/states/petskill_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ CPetSkillState::CPetSkillState(CPetEntity* PEntity, uint16 targid, uint16 wsid)
actionTarget.messageID = 326; // Seems hardcoded? TODO: Verify on more pet actions. Tested on Wyvern and SMN BPs.
m_PEntity->loc.zone->PushPacket(m_PEntity, CHAR_INRANGE, std::make_unique<CActionPacket>(action));
}
m_PEntity->PAI->EventHandler.triggerListener("WEAPONSKILL_STATE_ENTER", CLuaBaseEntity(m_PEntity), m_PSkill->getID());
m_PEntity->PAI->EventHandler.triggerListener("WEAPONSKILL_STATE_ENTER", m_PEntity, m_PSkill->getID());
SpendCost();
}

Expand Down Expand Up @@ -116,7 +116,7 @@ bool CPetSkillState::Update(time_point tick)
{
static_cast<CMobEntity*>(PTarget)->PEnmityContainer->UpdateEnmity(m_PEntity, 0, 0);
}
m_PEntity->PAI->EventHandler.triggerListener("WEAPONSKILL_STATE_EXIT", CLuaBaseEntity(m_PEntity), m_PSkill->getID());
m_PEntity->PAI->EventHandler.triggerListener("WEAPONSKILL_STATE_EXIT", m_PEntity, m_PSkill->getID());

if (m_PEntity->objtype == TYPE_PET && m_PEntity->PMaster && m_PEntity->PMaster->objtype == TYPE_PC && (m_PSkill->isBloodPactRage() || m_PSkill->isBloodPactWard()))
{
Expand Down
6 changes: 3 additions & 3 deletions src/map/ai/states/range_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ CRangeState::CRangeState(CBattleEntity* PEntity, uint16 targid)
actionTarget_t& actionTarget = actionList.getNewActionTarget();
actionTarget.animation = ANIMATION_RANGED;

m_PEntity->PAI->EventHandler.triggerListener("RANGE_START", CLuaBaseEntity(m_PEntity), CLuaAction(&action));
m_PEntity->PAI->EventHandler.triggerListener("RANGE_START", m_PEntity, &action);

m_PEntity->loc.zone->PushPacket(m_PEntity, CHAR_INRANGE_SELF, std::make_unique<CActionPacket>(action));
}
Expand Down Expand Up @@ -155,15 +155,15 @@ bool CRangeState::Update(time_point tick)
// reset aim time so interrupted players only have to wait the correct 2.7s until next shot
m_aimTime = std::chrono::seconds(0);
m_PEntity->loc.zone->PushPacket(m_PEntity, CHAR_INRANGE_SELF, std::make_unique<CActionPacket>(action));
m_PEntity->PAI->EventHandler.triggerListener("RANGE_STATE_EXIT", CLuaBaseEntity(m_PEntity), nullptr, CLuaAction(&action));
m_PEntity->PAI->EventHandler.triggerListener("RANGE_STATE_EXIT", m_PEntity, nullptr, &action);
}
else
{
m_errorMsg.reset();

m_PEntity->OnRangedAttack(*this, action);
m_PEntity->loc.zone->PushPacket(m_PEntity, CHAR_INRANGE_SELF, std::make_unique<CActionPacket>(action));
m_PEntity->PAI->EventHandler.triggerListener("RANGE_STATE_EXIT", CLuaBaseEntity(m_PEntity), CLuaBaseEntity(PTarget), CLuaAction(&action));
m_PEntity->PAI->EventHandler.triggerListener("RANGE_STATE_EXIT", m_PEntity, PTarget, &action);
}

Complete();
Expand Down
6 changes: 3 additions & 3 deletions src/map/ai/states/weaponskill_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ bool CWeaponSkillState::Update(time_point tick)
uint32 weaponskillVar = PTarget->GetLocalVar("weaponskillHit");
uint32 weaponskillDamage = weaponskillVar & 0xFFFFFF;

m_PEntity->PAI->EventHandler.triggerListener("WEAPONSKILL_USE", CLuaBaseEntity(m_PEntity), CLuaBaseEntity(PTarget), m_PSkill->getID(), m_spent, CLuaAction(&action), weaponskillDamage);
PTarget->PAI->EventHandler.triggerListener("WEAPONSKILL_TAKE", CLuaBaseEntity(PTarget), CLuaBaseEntity(m_PEntity), m_PSkill->getID(), m_spent, CLuaAction(&action));
m_PEntity->PAI->EventHandler.triggerListener("WEAPONSKILL_USE", m_PEntity, PTarget, m_PSkill->getID(), m_spent, &action, weaponskillDamage);
PTarget->PAI->EventHandler.triggerListener("WEAPONSKILL_TAKE", PTarget, m_PEntity, m_PSkill->getID(), m_spent, &action);

if (m_PEntity->objtype == TYPE_PC)
{
Expand Down Expand Up @@ -190,7 +190,7 @@ bool CWeaponSkillState::Update(time_point tick)
CCharEntity* PChar = static_cast<CCharEntity*>(m_PEntity);
PChar->m_charHistory.wsUsed++;
}
m_PEntity->PAI->EventHandler.triggerListener("WEAPONSKILL_STATE_EXIT", CLuaBaseEntity(m_PEntity), m_PSkill->getID());
m_PEntity->PAI->EventHandler.triggerListener("WEAPONSKILL_STATE_EXIT", m_PEntity, m_PSkill->getID());
return true;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/map/attack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ bool CAttack::CheckCounter()
}
else
{
m_attacker->PAI->EventHandler.triggerListener("MELEE_SWING_MISS", CLuaBaseEntity(m_attacker), CLuaBaseEntity(m_victim), CLuaAttack(this));
m_attacker->PAI->EventHandler.triggerListener("MELEE_SWING_MISS", m_attacker, m_victim, this);
}
}
else if (m_victim->StatusEffectContainer->HasStatusEffect(EFFECT_PERFECT_COUNTER))
Expand Down
6 changes: 3 additions & 3 deletions src/map/battlefield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ void CBattlefield::handleDeath(CBaseEntity* PEntity)

if (group.deathCallback.valid())
{
auto result = group.deathCallback(CLuaBattlefield(this), CLuaBaseEntity(PEntity), deathCount);
auto result = group.deathCallback(this, PEntity, deathCount);
if (!result.valid())
{
sol::error err = result;
Expand All @@ -938,7 +938,7 @@ void CBattlefield::handleDeath(CBaseEntity* PEntity)

if (group.allDeathCallback.valid() && deathCount >= group.mobIds.size())
{
auto result = group.allDeathCallback(CLuaBattlefield(this), CLuaBaseEntity(PEntity));
auto result = group.allDeathCallback(this, PEntity);
if (!result.valid())
{
sol::error err = result;
Expand All @@ -948,7 +948,7 @@ void CBattlefield::handleDeath(CBaseEntity* PEntity)

if (group.randomDeathCallback.valid() && mobId == group.randomMobId)
{
auto result = group.randomDeathCallback(CLuaBattlefield(this), CLuaBaseEntity(PEntity));
auto result = group.randomDeathCallback(this, PEntity);
if (!result.valid())
{
sol::error err = result;
Expand Down
2 changes: 1 addition & 1 deletion src/map/command_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ int32 CCommandHandler::call(sol::state& lua, CCharEntity* PChar, const std::stri
}

// Call the function
auto result = onTrigger(CLuaBaseEntity(PChar), sol::as_args(args));
auto result = onTrigger(PChar, sol::as_args(args));
if (!result.valid())
{
sol::error err = result;
Expand Down
2 changes: 1 addition & 1 deletion src/map/entities/automatonentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void CAutomatonEntity::Spawn()
status = allegiance == ALLEGIANCE_TYPE::MOB ? STATUS_TYPE::UPDATE : STATUS_TYPE::NORMAL;
updatemask |= UPDATE_HP;
PAI->Reset();
PAI->EventHandler.triggerListener("SPAWN", CLuaBaseEntity(this));
PAI->EventHandler.triggerListener("SPAWN", this);
animation = ANIMATION_NONE;
m_OwnerID.clean();
HideName(false);
Expand Down
2 changes: 1 addition & 1 deletion src/map/entities/baseentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void CBaseEntity::Spawn()
updatemask |= UPDATE_HP;
ResetLocalVars();
PAI->Reset();
PAI->EventHandler.triggerListener("SPAWN", CLuaBaseEntity(this));
PAI->EventHandler.triggerListener("SPAWN", this);
}

void CBaseEntity::FadeOut()
Expand Down
Loading
Loading