mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-06 18:54:13 +00:00
fix other script calls
This commit is contained in:
@@ -822,16 +822,12 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
|
||||
}
|
||||
|
||||
Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) {
|
||||
script->OnPlayerDied(zoneControl, m_ParentEntity);
|
||||
}
|
||||
zoneControl->GetScript()->OnPlayerDied(zoneControl, m_ParentEntity);
|
||||
|
||||
std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY);
|
||||
for (Entity* scriptEntity : scriptedActs) {
|
||||
if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) {
|
||||
script->OnPlayerDied(scriptEntity, m_ParentEntity);
|
||||
}
|
||||
scriptEntity->GetScript()->OnPlayerDied(scriptEntity, m_ParentEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -183,9 +183,7 @@ void MovingPlatformComponent::StartPathing() {
|
||||
const auto travelNext = subComponent->mWaitTime + travelTime;
|
||||
|
||||
m_ParentEntity->AddCallbackTimer(travelTime, [subComponent, this] {
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_ParentEntity)) {
|
||||
script->OnWaypointReached(m_ParentEntity, subComponent->mNextWaypointIndex);
|
||||
}
|
||||
m_ParentEntity>GetScript()->OnWaypointReached(m_ParentEntity, subComponent->mNextWaypointIndex);
|
||||
});
|
||||
|
||||
m_ParentEntity->AddCallbackTimer(travelNext, [this] {
|
||||
@@ -295,9 +293,7 @@ void MovingPlatformComponent::ContinuePathing() {
|
||||
const auto travelNext = subComponent->mWaitTime + travelTime;
|
||||
|
||||
m_ParentEntity->AddCallbackTimer(travelTime, [subComponent, this] {
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_ParentEntity)) {
|
||||
script->OnWaypointReached(m_ParentEntity, subComponent->mNextWaypointIndex);
|
||||
}
|
||||
m_ParentEntity->GetScript()->OnWaypointReached(m_ParentEntity, subComponent->mNextWaypointIndex);
|
||||
});
|
||||
|
||||
m_ParentEntity->AddCallbackTimer(travelNext, [this] {
|
||||
|
@@ -317,9 +317,8 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
currentActivities.insert_or_assign(m_Tamer, m_ParentEntity->GetObjectID());
|
||||
|
||||
// Notify the start of a pet taming minigame
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_ParentEntity)) {
|
||||
script->OnNotifyPetTamingMinigame(m_ParentEntity, originator, ePetTamingNotifyType::BEGIN);
|
||||
}
|
||||
m_ParentEntity->GetScript()->OnNotifyPetTamingMinigame(m_ParentEntity, originator, ePetTamingNotifyType::BEGIN);
|
||||
|
||||
}
|
||||
|
||||
void PetComponent::Update(float deltaTime) {
|
||||
@@ -694,9 +693,8 @@ void PetComponent::RequestSetPetName(std::u16string name) {
|
||||
m_Tamer = LWOOBJID_EMPTY;
|
||||
|
||||
// Notify the end of a pet taming minigame
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_ParentEntity)) {
|
||||
script->OnNotifyPetTamingMinigame(m_ParentEntity, tamer, ePetTamingNotifyType::SUCCESS);
|
||||
}
|
||||
m_ParentEntity->GetScript()->OnNotifyPetTamingMinigame(m_ParentEntity, tamer, ePetTamingNotifyType::SUCCESS);
|
||||
|
||||
}
|
||||
|
||||
void PetComponent::ClientExitTamingMinigame(bool voluntaryExit) {
|
||||
@@ -735,9 +733,8 @@ void PetComponent::ClientExitTamingMinigame(bool voluntaryExit) {
|
||||
EntityManager::Instance()->SerializeEntity(m_ParentEntity);
|
||||
|
||||
// Notify the end of a pet taming minigame
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_ParentEntity)) {
|
||||
script->OnNotifyPetTamingMinigame(m_ParentEntity, tamer, ePetTamingNotifyType::QUIT);
|
||||
}
|
||||
m_ParentEntity->GetScript()->OnNotifyPetTamingMinigame(m_ParentEntity, tamer, ePetTamingNotifyType::QUIT);
|
||||
|
||||
}
|
||||
|
||||
void PetComponent::StartTimer() {
|
||||
@@ -786,9 +783,8 @@ void PetComponent::ClientFailTamingMinigame() {
|
||||
EntityManager::Instance()->SerializeEntity(m_ParentEntity);
|
||||
|
||||
// Notify the end of a pet taming minigame
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_ParentEntity)) {
|
||||
script->OnNotifyPetTamingMinigame(m_ParentEntity, tamer, ePetTamingNotifyType::FAILED);
|
||||
}
|
||||
m_ParentEntity->GetScript()->OnNotifyPetTamingMinigame(m_ParentEntity, tamer, ePetTamingNotifyType::FAILED);
|
||||
|
||||
}
|
||||
|
||||
void PetComponent::Wander() {
|
||||
|
@@ -241,9 +241,7 @@ bool PropertyManagementComponent::Claim(const LWOOBJID playerId) {
|
||||
}
|
||||
|
||||
auto* zoneControlObject = dZoneManager::Instance()->GetZoneControlObject();
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControlObject)) {
|
||||
script->OnZonePropertyRented(zoneControlObject, entity);
|
||||
}
|
||||
zoneControlObject->GetScript()->OnZonePropertyRented(zoneControlObject, entity);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -452,15 +452,11 @@ void QuickBuildComponent::StartRebuild(Entity* user) {
|
||||
movingPlatform->OnRebuildInitilized();
|
||||
}
|
||||
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_ParentEntity)) {
|
||||
script->OnRebuildStart(m_ParentEntity, user);
|
||||
}
|
||||
m_ParentEntity->GetScript()->OnRebuildStart(m_ParentEntity, user);
|
||||
|
||||
// Notify scripts and possible subscribers
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_ParentEntity))
|
||||
script->OnRebuildNotifyState(m_ParentEntity, m_State);
|
||||
for (const auto& cb : m_RebuildStateCallbacks)
|
||||
cb(m_State);
|
||||
m_ParentEntity->GetScript()->OnRebuildNotifyState(m_ParentEntity, m_State);
|
||||
for (const auto& cb : m_RebuildStateCallbacks) cb(m_State);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -525,10 +521,8 @@ void QuickBuildComponent::CompleteRebuild(Entity* user) {
|
||||
}
|
||||
|
||||
// Notify scripts
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_ParentEntity)) {
|
||||
script->OnRebuildComplete(m_ParentEntity, user);
|
||||
script->OnRebuildNotifyState(m_ParentEntity, m_State);
|
||||
}
|
||||
m_ParentEntity->GetScript()->OnRebuildComplete(m_ParentEntity, user);
|
||||
m_ParentEntity->GetScript()->OnRebuildNotifyState(m_ParentEntity, m_State);
|
||||
|
||||
// Notify subscribers
|
||||
for (const auto& callback : m_RebuildStateCallbacks)
|
||||
@@ -579,10 +573,8 @@ void QuickBuildComponent::ResetRebuild(bool failed) {
|
||||
EntityManager::Instance()->SerializeEntity(m_ParentEntity);
|
||||
|
||||
// Notify scripts and possible subscribers
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_ParentEntity))
|
||||
script->OnRebuildNotifyState(m_ParentEntity, m_State);
|
||||
for (const auto& cb : m_RebuildStateCallbacks)
|
||||
cb(m_State);
|
||||
m_ParentEntity->GetScript()->OnRebuildNotifyState(m_ParentEntity, m_State);
|
||||
for (const auto& cb : m_RebuildStateCallbacks) cb(m_State);
|
||||
|
||||
m_ParentEntity->ScheduleKillAfterUpdate();
|
||||
|
||||
@@ -611,10 +603,8 @@ void QuickBuildComponent::CancelRebuild(Entity* entity, eQuickBuildFailReason fa
|
||||
m_StateDirty = true;
|
||||
|
||||
// Notify scripts and possible subscribers
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_ParentEntity))
|
||||
script->OnRebuildNotifyState(m_ParentEntity, m_State);
|
||||
for (const auto& cb : m_RebuildStateCallbacks)
|
||||
cb(m_State);
|
||||
m_ParentEntity->GetScript()->OnRebuildNotifyState(m_ParentEntity, m_State);
|
||||
for (const auto& cb : m_RebuildStateCallbacks) cb(m_State);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_ParentEntity);
|
||||
}
|
||||
|
@@ -268,9 +268,7 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
|
||||
|
||||
behavior->Calculate(context, bitStream, { target, 0 });
|
||||
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_ParentEntity)) {
|
||||
script->OnSkillCast(m_ParentEntity, skillId);
|
||||
}
|
||||
m_ParentEntity->GetScript()->OnSkillCast(m_ParentEntity, skillId);
|
||||
|
||||
if (!context->foundTarget) {
|
||||
delete bitStream;
|
||||
|
@@ -184,9 +184,7 @@ std::vector<Entity*> TriggerComponent::GatherTargets(LUTriggers::Command* comman
|
||||
}
|
||||
|
||||
void TriggerComponent::HandleFireEvent(Entity* targetEntity, std::string args) {
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(targetEntity)) {
|
||||
script->OnFireEventServerSide(targetEntity, m_ParentEntity, args, 0, 0, 0);
|
||||
}
|
||||
targetEntity->GetScript()->OnFireEventServerSide(targetEntity, m_ParentEntity, args, 0, 0, 0);
|
||||
}
|
||||
|
||||
void TriggerComponent::HandleDestroyObject(Entity* targetEntity, std::string args){
|
||||
|
Reference in New Issue
Block a user