fix other script calls

This commit is contained in:
Aaron Kimbre 2023-06-13 22:01:51 -05:00
parent 31be1fbe4c
commit fdd98ab825
10 changed files with 52 additions and 136 deletions

View File

@ -832,9 +832,7 @@ void Entity::Update(const float deltaTime) {
Wake(); Wake();
} }
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnUpdate(this);
script->OnUpdate(this);
}
for (const auto& pair : m_Components) { for (const auto& pair : m_Components) {
if (pair.second == nullptr) continue; if (pair.second == nullptr) continue;
@ -851,9 +849,7 @@ void Entity::OnCollisionProximity(LWOOBJID otherEntity, const std::string& proxN
Entity* other = EntityManager::Instance()->GetEntity(otherEntity); Entity* other = EntityManager::Instance()->GetEntity(otherEntity);
if (!other) return; if (!other) return;
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnProximityUpdate(this, other, proxName, status);
script->OnProximityUpdate(this, other, proxName, status);
}
auto* rocketComp = GetComponent<RocketLaunchpadControlComponent>(); auto* rocketComp = GetComponent<RocketLaunchpadControlComponent>();
if (!rocketComp) return; if (!rocketComp) return;
@ -865,9 +861,7 @@ void Entity::OnCollisionPhantom(const LWOOBJID otherEntity) {
auto* other = EntityManager::Instance()->GetEntity(otherEntity); auto* other = EntityManager::Instance()->GetEntity(otherEntity);
if (!other) return; if (!other) return;
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnCollisionPhantom(this, other);
script->OnCollisionPhantom(this, other);
}
for (const auto& callback : m_PhantomCollisionCallbacks) { for (const auto& callback : m_PhantomCollisionCallbacks) {
callback(other); callback(other);
@ -912,9 +906,7 @@ void Entity::OnCollisionLeavePhantom(const LWOOBJID otherEntity) {
auto* other = EntityManager::Instance()->GetEntity(otherEntity); auto* other = EntityManager::Instance()->GetEntity(otherEntity);
if (!other) return; if (!other) return;
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnOffCollisionPhantom(this, other);
script->OnOffCollisionPhantom(this, other);
}
TriggerEvent(eTriggerEventType::EXIT, other); TriggerEvent(eTriggerEventType::EXIT, other);
@ -931,44 +923,32 @@ void Entity::OnCollisionLeavePhantom(const LWOOBJID otherEntity) {
} }
void Entity::OnFireEventServerSide(Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) { void Entity::OnFireEventServerSide(Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnFireEventServerSide(this, sender, args, param1, param2, param3);
script->OnFireEventServerSide(this, sender, args, param1, param2, param3);
}
} }
void Entity::OnActivityStateChangeRequest(LWOOBJID senderID, int32_t value1, int32_t value2, const std::u16string& stringValue) { void Entity::OnActivityStateChangeRequest(LWOOBJID senderID, int32_t value1, int32_t value2, const std::u16string& stringValue) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnActivityStateChangeRequest(this, senderID, value1, value2, stringValue);
script->OnActivityStateChangeRequest(this, senderID, value1, value2, stringValue);
}
} }
void Entity::OnCinematicUpdate(Entity* self, Entity* sender, eCinematicEvent event, const std::u16string& pathName, void Entity::OnCinematicUpdate(Entity* self, Entity* sender, eCinematicEvent event, const std::u16string& pathName,
float_t pathTime, float_t totalTime, int32_t waypoint) { float_t pathTime, float_t totalTime, int32_t waypoint) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnCinematicUpdate(self, sender, event, pathName, pathTime, totalTime, waypoint);
script->OnCinematicUpdate(self, sender, event, pathName, pathTime, totalTime, waypoint);
}
} }
void Entity::NotifyObject(Entity* sender, const std::string& name, int32_t param1, int32_t param2) { void Entity::NotifyObject(Entity* sender, const std::string& name, int32_t param1, int32_t param2) {
GameMessages::SendNotifyObject(GetObjectID(), sender->GetObjectID(), GeneralUtils::ASCIIToUTF16(name), UNASSIGNED_SYSTEM_ADDRESS); GameMessages::SendNotifyObject(GetObjectID(), sender->GetObjectID(), GeneralUtils::ASCIIToUTF16(name), UNASSIGNED_SYSTEM_ADDRESS);
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnNotifyObject(this, sender, name, param1, param2);
script->OnNotifyObject(this, sender, name, param1, param2);
}
} }
void Entity::OnEmoteReceived(const int32_t emote, Entity* target) { void Entity::OnEmoteReceived(const int32_t emote, Entity* target) {
for (auto* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnEmoteReceived(this, emote, target);
script->OnEmoteReceived(this, emote, target);
}
} }
void Entity::OnUse(Entity* originator) { void Entity::OnUse(Entity* originator) {
TriggerEvent(eTriggerEventType::INTERACT, originator); TriggerEvent(eTriggerEventType::INTERACT, originator);
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnUse(this, originator);
script->OnUse(this, originator);
}
// component base class when // component base class when
@ -980,82 +960,56 @@ void Entity::OnUse(Entity* originator) {
} }
void Entity::OnHitOrHealResult(Entity* attacker, int32_t damage) { void Entity::OnHitOrHealResult(Entity* attacker, int32_t damage) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnHitOrHealResult(this, attacker, damage);
script->OnHitOrHealResult(this, attacker, damage);
}
} }
void Entity::OnHit(Entity* attacker) { void Entity::OnHit(Entity* attacker) {
TriggerEvent(eTriggerEventType::HIT, attacker); TriggerEvent(eTriggerEventType::HIT, attacker);
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnHit(this, attacker);
script->OnHit(this, attacker);
}
} }
void Entity::OnZonePropertyEditBegin() { void Entity::OnZonePropertyEditBegin() {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnZonePropertyEditBegin(this);
script->OnZonePropertyEditBegin(this);
}
} }
void Entity::OnZonePropertyEditEnd() { void Entity::OnZonePropertyEditEnd() {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnZonePropertyEditEnd(this);
script->OnZonePropertyEditEnd(this);
}
} }
void Entity::OnZonePropertyModelEquipped() { void Entity::OnZonePropertyModelEquipped() {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnZonePropertyModelEquipped(this);
script->OnZonePropertyModelEquipped(this);
}
} }
void Entity::OnZonePropertyModelPlaced(Entity* player) { void Entity::OnZonePropertyModelPlaced(Entity* player) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnZonePropertyModelPlaced(this, player);
script->OnZonePropertyModelPlaced(this, player);
}
} }
void Entity::OnZonePropertyModelPickedUp(Entity* player) { void Entity::OnZonePropertyModelPickedUp(Entity* player) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnZonePropertyModelPickedUp(this, player);
script->OnZonePropertyModelPickedUp(this, player);
}
} }
void Entity::OnZonePropertyModelRemoved(Entity* player) { void Entity::OnZonePropertyModelRemoved(Entity* player) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnZonePropertyModelRemoved(this, player);
script->OnZonePropertyModelRemoved(this, player);
}
} }
void Entity::OnZonePropertyModelRemovedWhileEquipped(Entity* player) { void Entity::OnZonePropertyModelRemovedWhileEquipped(Entity* player) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnZonePropertyModelRemovedWhileEquipped(this, player);
script->OnZonePropertyModelRemovedWhileEquipped(this, player);
}
} }
void Entity::OnZonePropertyModelRotated(Entity* player) { void Entity::OnZonePropertyModelRotated(Entity* player) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnZonePropertyModelRotated(this, player);
script->OnZonePropertyModelRotated(this, player);
}
} }
void Entity::OnMessageBoxResponse(Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) { void Entity::OnMessageBoxResponse(Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnMessageBoxResponse(this, sender, button, identifier, userData);
script->OnMessageBoxResponse(this, sender, button, identifier, userData);
}
} }
void Entity::OnChoiceBoxResponse(Entity* sender, int32_t button, const std::u16string& buttonIdentifier, const std::u16string& identifier) { void Entity::OnChoiceBoxResponse(Entity* sender, int32_t button, const std::u16string& buttonIdentifier, const std::u16string& identifier) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnChoiceBoxResponse(this, sender, button, buttonIdentifier, identifier);
script->OnChoiceBoxResponse(this, sender, button, buttonIdentifier, identifier);
}
} }
void Entity::RequestActivityExit(Entity* sender, const LWOOBJID& player, const bool canceled) { void Entity::RequestActivityExit(Entity* sender, const LWOOBJID& player, const bool canceled) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnRequestActivityExit(sender, player, canceled);
script->OnRequestActivityExit(sender, player, canceled);
}
} }
void Entity::Smash(const LWOOBJID source, const eKillType killType, const std::u16string& deathType) { void Entity::Smash(const LWOOBJID source, const eKillType killType, const std::u16string& deathType) {
@ -1088,9 +1042,7 @@ void Entity::Kill(Entity* murderer) {
//OMAI WA MOU, SHINDERIU //OMAI WA MOU, SHINDERIU
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) { GetScript()->OnDie(this, murderer);
script->OnDie(this, murderer);
}
if (m_Spawner != nullptr) { if (m_Spawner != nullptr) {
m_Spawner->NotifyOfEntityDeath(m_ObjectID); m_Spawner->NotifyOfEntityDeath(m_ObjectID);

View File

@ -282,16 +282,12 @@ Player::~Player() {
if (IsPlayer()) { if (IsPlayer()) {
Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity(); Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) { zoneControl->GetScript()->OnPlayerExit(zoneControl, this);
script->OnPlayerExit(zoneControl, this);
}
std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY); std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY);
for (Entity* scriptEntity : scriptedActs) { for (Entity* scriptEntity : scriptedActs) {
if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds
for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) { scriptEntity->GetScript()->OnPlayerExit(scriptEntity, this);
script->OnPlayerExit(scriptEntity, this);
}
} }
} }
} }

View File

@ -9,9 +9,7 @@ void SkillEventBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit
auto* caster = EntityManager::Instance()->GetEntity(context->originator); auto* caster = EntityManager::Instance()->GetEntity(context->originator);
if (caster != nullptr && target != nullptr && this->m_effectHandle != nullptr && !this->m_effectHandle->empty()) { if (caster != nullptr && target != nullptr && this->m_effectHandle != nullptr && !this->m_effectHandle->empty()) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(target)) { target->GetScript()->OnSkillEventFired(target, caster, *this->m_effectHandle);
script->OnSkillEventFired(target, caster, *this->m_effectHandle);
}
} }
} }
@ -21,8 +19,6 @@ SkillEventBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitSt
auto* caster = EntityManager::Instance()->GetEntity(context->originator); auto* caster = EntityManager::Instance()->GetEntity(context->originator);
if (caster != nullptr && target != nullptr && this->m_effectHandle != nullptr && !this->m_effectHandle->empty()) { if (caster != nullptr && target != nullptr && this->m_effectHandle != nullptr && !this->m_effectHandle->empty()) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(target)) { target->GetScript()->OnSkillEventFired(target, caster, *this->m_effectHandle);
script->OnSkillEventFired(target, caster, *this->m_effectHandle);
}
} }
} }

View File

@ -822,16 +822,12 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
} }
Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity(); Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) { zoneControl->GetScript()->OnPlayerDied(zoneControl, m_ParentEntity);
script->OnPlayerDied(zoneControl, m_ParentEntity);
}
std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY); std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY);
for (Entity* scriptEntity : scriptedActs) { for (Entity* scriptEntity : scriptedActs) {
if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds
for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) { scriptEntity->GetScript()->OnPlayerDied(scriptEntity, m_ParentEntity);
script->OnPlayerDied(scriptEntity, m_ParentEntity);
}
} }
} }
} }

View File

@ -183,9 +183,7 @@ void MovingPlatformComponent::StartPathing() {
const auto travelNext = subComponent->mWaitTime + travelTime; const auto travelNext = subComponent->mWaitTime + travelTime;
m_ParentEntity->AddCallbackTimer(travelTime, [subComponent, this] { m_ParentEntity->AddCallbackTimer(travelTime, [subComponent, this] {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_ParentEntity)) { m_ParentEntity>GetScript()->OnWaypointReached(m_ParentEntity, subComponent->mNextWaypointIndex);
script->OnWaypointReached(m_ParentEntity, subComponent->mNextWaypointIndex);
}
}); });
m_ParentEntity->AddCallbackTimer(travelNext, [this] { m_ParentEntity->AddCallbackTimer(travelNext, [this] {
@ -295,9 +293,7 @@ void MovingPlatformComponent::ContinuePathing() {
const auto travelNext = subComponent->mWaitTime + travelTime; const auto travelNext = subComponent->mWaitTime + travelTime;
m_ParentEntity->AddCallbackTimer(travelTime, [subComponent, this] { m_ParentEntity->AddCallbackTimer(travelTime, [subComponent, this] {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_ParentEntity)) { m_ParentEntity->GetScript()->OnWaypointReached(m_ParentEntity, subComponent->mNextWaypointIndex);
script->OnWaypointReached(m_ParentEntity, subComponent->mNextWaypointIndex);
}
}); });
m_ParentEntity->AddCallbackTimer(travelNext, [this] { m_ParentEntity->AddCallbackTimer(travelNext, [this] {

View File

@ -317,9 +317,8 @@ void PetComponent::OnUse(Entity* originator) {
currentActivities.insert_or_assign(m_Tamer, m_ParentEntity->GetObjectID()); currentActivities.insert_or_assign(m_Tamer, m_ParentEntity->GetObjectID());
// Notify the start of a pet taming minigame // Notify the start of a pet taming minigame
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_ParentEntity)) { m_ParentEntity->GetScript()->OnNotifyPetTamingMinigame(m_ParentEntity, originator, ePetTamingNotifyType::BEGIN);
script->OnNotifyPetTamingMinigame(m_ParentEntity, originator, ePetTamingNotifyType::BEGIN);
}
} }
void PetComponent::Update(float deltaTime) { void PetComponent::Update(float deltaTime) {
@ -694,9 +693,8 @@ void PetComponent::RequestSetPetName(std::u16string name) {
m_Tamer = LWOOBJID_EMPTY; m_Tamer = LWOOBJID_EMPTY;
// Notify the end of a pet taming minigame // Notify the end of a pet taming minigame
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_ParentEntity)) { m_ParentEntity->GetScript()->OnNotifyPetTamingMinigame(m_ParentEntity, tamer, ePetTamingNotifyType::SUCCESS);
script->OnNotifyPetTamingMinigame(m_ParentEntity, tamer, ePetTamingNotifyType::SUCCESS);
}
} }
void PetComponent::ClientExitTamingMinigame(bool voluntaryExit) { void PetComponent::ClientExitTamingMinigame(bool voluntaryExit) {
@ -735,9 +733,8 @@ void PetComponent::ClientExitTamingMinigame(bool voluntaryExit) {
EntityManager::Instance()->SerializeEntity(m_ParentEntity); EntityManager::Instance()->SerializeEntity(m_ParentEntity);
// Notify the end of a pet taming minigame // Notify the end of a pet taming minigame
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_ParentEntity)) { m_ParentEntity->GetScript()->OnNotifyPetTamingMinigame(m_ParentEntity, tamer, ePetTamingNotifyType::QUIT);
script->OnNotifyPetTamingMinigame(m_ParentEntity, tamer, ePetTamingNotifyType::QUIT);
}
} }
void PetComponent::StartTimer() { void PetComponent::StartTimer() {
@ -786,9 +783,8 @@ void PetComponent::ClientFailTamingMinigame() {
EntityManager::Instance()->SerializeEntity(m_ParentEntity); EntityManager::Instance()->SerializeEntity(m_ParentEntity);
// Notify the end of a pet taming minigame // Notify the end of a pet taming minigame
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_ParentEntity)) { m_ParentEntity->GetScript()->OnNotifyPetTamingMinigame(m_ParentEntity, tamer, ePetTamingNotifyType::FAILED);
script->OnNotifyPetTamingMinigame(m_ParentEntity, tamer, ePetTamingNotifyType::FAILED);
}
} }
void PetComponent::Wander() { void PetComponent::Wander() {

View File

@ -241,9 +241,7 @@ bool PropertyManagementComponent::Claim(const LWOOBJID playerId) {
} }
auto* zoneControlObject = dZoneManager::Instance()->GetZoneControlObject(); auto* zoneControlObject = dZoneManager::Instance()->GetZoneControlObject();
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControlObject)) { zoneControlObject->GetScript()->OnZonePropertyRented(zoneControlObject, entity);
script->OnZonePropertyRented(zoneControlObject, entity);
}
return true; return true;
} }

View File

@ -452,15 +452,11 @@ void QuickBuildComponent::StartRebuild(Entity* user) {
movingPlatform->OnRebuildInitilized(); movingPlatform->OnRebuildInitilized();
} }
for (auto* script : CppScripts::GetEntityScripts(m_ParentEntity)) { m_ParentEntity->GetScript()->OnRebuildStart(m_ParentEntity, user);
script->OnRebuildStart(m_ParentEntity, user);
}
// Notify scripts and possible subscribers // Notify scripts and possible subscribers
for (auto* script : CppScripts::GetEntityScripts(m_ParentEntity)) m_ParentEntity->GetScript()->OnRebuildNotifyState(m_ParentEntity, m_State);
script->OnRebuildNotifyState(m_ParentEntity, m_State); for (const auto& cb : m_RebuildStateCallbacks) cb(m_State);
for (const auto& cb : m_RebuildStateCallbacks)
cb(m_State);
} }
} }
@ -525,10 +521,8 @@ void QuickBuildComponent::CompleteRebuild(Entity* user) {
} }
// Notify scripts // Notify scripts
for (auto* script : CppScripts::GetEntityScripts(m_ParentEntity)) { m_ParentEntity->GetScript()->OnRebuildComplete(m_ParentEntity, user);
script->OnRebuildComplete(m_ParentEntity, user); m_ParentEntity->GetScript()->OnRebuildNotifyState(m_ParentEntity, m_State);
script->OnRebuildNotifyState(m_ParentEntity, m_State);
}
// Notify subscribers // Notify subscribers
for (const auto& callback : m_RebuildStateCallbacks) for (const auto& callback : m_RebuildStateCallbacks)
@ -579,10 +573,8 @@ void QuickBuildComponent::ResetRebuild(bool failed) {
EntityManager::Instance()->SerializeEntity(m_ParentEntity); EntityManager::Instance()->SerializeEntity(m_ParentEntity);
// Notify scripts and possible subscribers // Notify scripts and possible subscribers
for (auto* script : CppScripts::GetEntityScripts(m_ParentEntity)) m_ParentEntity->GetScript()->OnRebuildNotifyState(m_ParentEntity, m_State);
script->OnRebuildNotifyState(m_ParentEntity, m_State); for (const auto& cb : m_RebuildStateCallbacks) cb(m_State);
for (const auto& cb : m_RebuildStateCallbacks)
cb(m_State);
m_ParentEntity->ScheduleKillAfterUpdate(); m_ParentEntity->ScheduleKillAfterUpdate();
@ -611,10 +603,8 @@ void QuickBuildComponent::CancelRebuild(Entity* entity, eQuickBuildFailReason fa
m_StateDirty = true; m_StateDirty = true;
// Notify scripts and possible subscribers // Notify scripts and possible subscribers
for (auto* script : CppScripts::GetEntityScripts(m_ParentEntity)) m_ParentEntity->GetScript()->OnRebuildNotifyState(m_ParentEntity, m_State);
script->OnRebuildNotifyState(m_ParentEntity, m_State); for (const auto& cb : m_RebuildStateCallbacks) cb(m_State);
for (const auto& cb : m_RebuildStateCallbacks)
cb(m_State);
EntityManager::Instance()->SerializeEntity(m_ParentEntity); EntityManager::Instance()->SerializeEntity(m_ParentEntity);
} }

View File

@ -268,9 +268,7 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
behavior->Calculate(context, bitStream, { target, 0 }); behavior->Calculate(context, bitStream, { target, 0 });
for (auto* script : CppScripts::GetEntityScripts(m_ParentEntity)) { m_ParentEntity->GetScript()->OnSkillCast(m_ParentEntity, skillId);
script->OnSkillCast(m_ParentEntity, skillId);
}
if (!context->foundTarget) { if (!context->foundTarget) {
delete bitStream; delete bitStream;

View File

@ -184,9 +184,7 @@ std::vector<Entity*> TriggerComponent::GatherTargets(LUTriggers::Command* comman
} }
void TriggerComponent::HandleFireEvent(Entity* targetEntity, std::string args) { void TriggerComponent::HandleFireEvent(Entity* targetEntity, std::string args) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(targetEntity)) { targetEntity->GetScript()->OnFireEventServerSide(targetEntity, m_ParentEntity, args, 0, 0, 0);
script->OnFireEventServerSide(targetEntity, m_ParentEntity, args, 0, 0, 0);
}
} }
void TriggerComponent::HandleDestroyObject(Entity* targetEntity, std::string args){ void TriggerComponent::HandleDestroyObject(Entity* targetEntity, std::string args){