mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-14 19:38:08 +00:00
Merge branch 'main' into npc-pathing
This commit is contained in:
@@ -9,7 +9,7 @@ void ActMine::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void ActMine::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (state == eRebuildState::REBUILD_COMPLETED) {
|
||||
if (state == eRebuildState::COMPLETED) {
|
||||
auto* rebuild = self->GetComponent<RebuildComponent>();
|
||||
if (rebuild) {
|
||||
auto* builder = rebuild->GetBuilder();
|
||||
|
@@ -40,7 +40,7 @@ void ActVehicleDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
}
|
||||
|
||||
|
||||
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, VIOLENT, u"", 0, 0, 0, true, false, 0);
|
||||
GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0, true, false, 0);
|
||||
|
||||
auto* zoneController = dZoneManager::Instance()->GetZoneControlObject();
|
||||
|
||||
|
@@ -37,7 +37,7 @@ void BaseFootRaceManager::OnFireEventServerSide(Entity* self, Entity* sender, st
|
||||
if (character != nullptr) {
|
||||
character->SetPlayerFlag(115, false);
|
||||
if (param2 != -1) // Certain footraces set a flag
|
||||
character->SetPlayerFlag(param2, true);
|
||||
character->SetPlayerFlag(static_cast<uint32_t>(param2), true);
|
||||
}
|
||||
|
||||
StopActivity(self, player->GetObjectID(), 0, param1);
|
||||
|
@@ -5,113 +5,55 @@
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void AgJetEffectServer::OnUse(Entity* self, Entity* user) {
|
||||
if (inUse) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (inUse || self->GetLOT() != 6859) return;
|
||||
GameMessages::SendNotifyClientObject(
|
||||
self->GetObjectID(),
|
||||
u"isInUse",
|
||||
0,
|
||||
0,
|
||||
LWOOBJID_EMPTY,
|
||||
"",
|
||||
UNASSIGNED_SYSTEM_ADDRESS
|
||||
self->GetObjectID(), u"toggleInUse", 1, 0, LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS
|
||||
);
|
||||
|
||||
inUse = true;
|
||||
|
||||
auto entities = EntityManager::Instance()->GetEntitiesInGroup("Jet_FX");
|
||||
|
||||
if (entities.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* effect = entities[0];
|
||||
|
||||
GameMessages::SendPlayFXEffect(effect, 641, u"create", "radarDish", LWOOBJID_EMPTY, 1, 1, true);
|
||||
|
||||
self->AddTimer("radarDish", 2);
|
||||
self->AddTimer("CineDone", 9);
|
||||
if (entities.empty()) return;
|
||||
GameMessages::SendPlayFXEffect(entities.at(0), 641, u"create", "radarDish", LWOOBJID_EMPTY, 1, 1, true);
|
||||
self->AddTimer("radarDish", 2.0f);
|
||||
self->AddTimer("PlayEffect", 2.5f);
|
||||
self->AddTimer("CineDone", 7.5f + 5.0f); // 7.5f is time the cinematic takes to play
|
||||
}
|
||||
|
||||
void AgJetEffectServer::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
if (self->GetLOT() != 6209) return;
|
||||
auto entities = EntityManager::Instance()->GetEntitiesInGroup("Jet_FX");
|
||||
if (entities.empty()) return;
|
||||
GameMessages::SendPlayAnimation(entities.at(0), u"jetFX");
|
||||
|
||||
if (entities.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* effect = entities[0];
|
||||
|
||||
auto groups = self->GetGroups();
|
||||
|
||||
if (groups.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// So we can give kill credit to person who build this
|
||||
builder = target->GetObjectID();
|
||||
|
||||
const auto group = groups[0];
|
||||
|
||||
GameMessages::SendPlayAnimation(effect, u"jetFX");
|
||||
|
||||
self->AddTimer("PlayEffect", 2.5f);
|
||||
|
||||
if (group == "Base_Radar") {
|
||||
self->AddTimer("CineDone", 5);
|
||||
auto groups = self->GetGroups();
|
||||
if (!groups.empty() && groups.at(0) == "Base_Radar") {
|
||||
self->AddTimer("PlayEffect", 2.5f);
|
||||
self->AddTimer("CineDone", 7.5f + 5.0f); // 7.5f is time the cinematic takes to play
|
||||
}
|
||||
}
|
||||
|
||||
void AgJetEffectServer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "radarDish") {
|
||||
GameMessages::SendStopFXEffect(self, true, "radarDish");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (timerName == "PlayEffect") {
|
||||
} else if (timerName == "PlayEffect") {
|
||||
auto entities = EntityManager::Instance()->GetEntitiesInGroup("mortarMain");
|
||||
if (entities.empty()) return;
|
||||
|
||||
if (entities.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto size = entities.size();
|
||||
|
||||
if (size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto selected = GeneralUtils::GenerateRandomNumber<int>(0, size - 1);
|
||||
|
||||
auto* mortar = entities[selected];
|
||||
|
||||
Game::logger->Log("AgJetEffectServer", "Mortar (%i) (&d)", mortar->GetLOT(), mortar->HasComponent(eReplicaComponentType::SKILL));
|
||||
const auto selected = GeneralUtils::GenerateRandomNumber<int>(0, entities.size() - 1);
|
||||
auto* mortar = entities.at(selected);
|
||||
|
||||
// so we give proper credit to the builder for the kills from this skill
|
||||
mortar->SetOwnerOverride(builder);
|
||||
|
||||
SkillComponent* skillComponent;
|
||||
if (!mortar->TryGetComponent(eReplicaComponentType::SKILL, skillComponent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
skillComponent->CalculateBehavior(318, 3727, LWOOBJID_EMPTY, true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (timerName == "CineDone") {
|
||||
auto* skillComponent = mortar->GetComponent<SkillComponent>();
|
||||
if (skillComponent) skillComponent->CastSkill(318);
|
||||
} else if (timerName == "CineDone") {
|
||||
GameMessages::SendNotifyClientObject(
|
||||
self->GetObjectID(),
|
||||
u"toggleInUse",
|
||||
-1,
|
||||
0,
|
||||
LWOOBJID_EMPTY,
|
||||
"",
|
||||
UNASSIGNED_SYSTEM_ADDRESS
|
||||
self->GetObjectID(), u"toggleInUse", -1, 0, LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS
|
||||
);
|
||||
|
||||
inUse = false;
|
||||
}
|
||||
}
|
||||
|
@@ -2,9 +2,10 @@
|
||||
#include "Loot.h"
|
||||
#include "GameMessages.h"
|
||||
#include "Entity.h"
|
||||
#include "eTerminateType.h"
|
||||
|
||||
void AgPicnicBlanket::OnUse(Entity* self, Entity* user) {
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
|
||||
if (self->GetVar<bool>(u"active"))
|
||||
return;
|
||||
self->SetVar<bool>(u"active", true);
|
||||
|
@@ -49,7 +49,7 @@ void AgQbElevator::OnTimerDone(Entity* self, std::string timerName) {
|
||||
} else if (timerName == "startKillTimer") {
|
||||
killTimerStartup(self);
|
||||
} else if (timerName == "KillTimer") {
|
||||
self->Smash(self->GetObjectID(), VIOLENT);
|
||||
self->Smash(self->GetObjectID(), eKillType::VIOLENT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#include "AgShipPlayerShockServer.h"
|
||||
#include "GameMessages.h"
|
||||
#include "eTerminateType.h"
|
||||
|
||||
void AgShipPlayerShockServer::OnUse(Entity* self, Entity* user) {
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
|
||||
|
78
dScripts/ai/FV/ActNinjaSensei.cpp
Normal file
78
dScripts/ai/FV/ActNinjaSensei.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
#include "ActNinjaSensei.h"
|
||||
#include "Entity.h"
|
||||
#include "EntityManager.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void ActNinjaSensei::OnStartup(Entity* self) {
|
||||
auto students = EntityManager::Instance()->GetEntitiesInGroup(this->m_StudentGroup);
|
||||
std::vector<Entity*> validStudents = {};
|
||||
for (auto* student : students) {
|
||||
if (student && student->GetLOT() == this->m_StudentLOT) validStudents.push_back(student);
|
||||
}
|
||||
self->SetVar(u"students", validStudents);
|
||||
self->AddTimer("crane", 5);
|
||||
}
|
||||
|
||||
void ActNinjaSensei::OnTimerDone(Entity* self, std::string timerName) {
|
||||
auto students = self->GetVar<std::vector<Entity*>>(u"students");
|
||||
if (students.empty()) return;
|
||||
|
||||
if (timerName == "crane") {
|
||||
for (auto student : students) {
|
||||
if (student) GameMessages::SendPlayAnimation(student, u"crane");
|
||||
}
|
||||
GameMessages::SendPlayAnimation(self, u"crane");
|
||||
self->AddTimer("bow", 15.33);
|
||||
}
|
||||
|
||||
if (timerName == "bow") {
|
||||
GameMessages::SendPlayAnimation(self, u"bow");
|
||||
for (auto student : students) {
|
||||
if (student) GameMessages::SendPlayAnimation(student, u"bow");
|
||||
}
|
||||
GameMessages::SendPlayAnimation(self, u"bow");
|
||||
self->AddTimer("tiger", 5);
|
||||
}
|
||||
|
||||
if (timerName == "tiger") {
|
||||
GameMessages::SendPlayAnimation(self, u"tiger");
|
||||
for (auto student : students) {
|
||||
if (student) GameMessages::SendPlayAnimation(student, u"tiger");
|
||||
}
|
||||
GameMessages::SendPlayAnimation(self, u"tiger");
|
||||
self->AddTimer("bow2", 15.33);
|
||||
}
|
||||
|
||||
if (timerName == "bow2") {
|
||||
GameMessages::SendPlayAnimation(self, u"bow");
|
||||
for (auto student : students) {
|
||||
if (student) GameMessages::SendPlayAnimation(student, u"bow");
|
||||
}
|
||||
GameMessages::SendPlayAnimation(self, u"bow");
|
||||
self->AddTimer("mantis", 5);
|
||||
}
|
||||
|
||||
if (timerName == "mantis") {
|
||||
GameMessages::SendPlayAnimation(self, u"mantis");
|
||||
for (auto student : students) {
|
||||
if (student) GameMessages::SendPlayAnimation(student, u"mantis");
|
||||
}
|
||||
GameMessages::SendPlayAnimation(self, u"mantis");
|
||||
self->AddTimer("bow3", 15.3);
|
||||
}
|
||||
|
||||
if (timerName == "bow3") {
|
||||
GameMessages::SendPlayAnimation(self, u"bow");
|
||||
for (auto student : students) {
|
||||
if (student) GameMessages::SendPlayAnimation(student, u"bow");
|
||||
}
|
||||
GameMessages::SendPlayAnimation(self, u"bow");
|
||||
self->AddTimer("repeat", 5);
|
||||
}
|
||||
|
||||
if (timerName == "repeat") {
|
||||
self->CancelAllTimers();
|
||||
self->AddTimer("crane", 5);
|
||||
}
|
||||
}
|
||||
|
10
dScripts/ai/FV/ActNinjaSensei.h
Normal file
10
dScripts/ai/FV/ActNinjaSensei.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class ActNinjaSensei : public CppScripts::Script {
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
private:
|
||||
std::string m_StudentGroup = "Sensei_kids";
|
||||
LOT m_StudentLOT = 2497;
|
||||
};
|
@@ -1,9 +1,10 @@
|
||||
#include "ActNinjaTurret.h"
|
||||
#include "eRebuildState.h"
|
||||
|
||||
void ActNinjaTurret::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (state == eRebuildState::REBUILD_COMPLETED) {
|
||||
if (state == eRebuildState::COMPLETED) {
|
||||
self->SetVar(u"AmBuilt", true);
|
||||
} else if (state == eRebuildState::REBUILD_RESETTING) {
|
||||
} else if (state == eRebuildState::RESETTING) {
|
||||
self->SetVar(u"AmBuilt", false);
|
||||
}
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ void ActParadoxPipeFix::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
|
||||
auto* rebuildComponent = object->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent->GetState() == REBUILD_COMPLETED) {
|
||||
if (rebuildComponent->GetState() == eRebuildState::COMPLETED) {
|
||||
indexCount++;
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ void ActParadoxPipeFix::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
}
|
||||
|
||||
void ActParadoxPipeFix::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (state == REBUILD_RESETTING) {
|
||||
if (state == eRebuildState::RESETTING) {
|
||||
const auto refinery = EntityManager::Instance()->GetEntitiesInGroup("Paradox");
|
||||
|
||||
if (!refinery.empty()) {
|
||||
|
@@ -1,4 +1,5 @@
|
||||
set(DSCRIPTS_SOURCES_AI_FV
|
||||
set(DSCRIPTS_SOURCES_AI_FV
|
||||
"ActNinjaSensei.cpp"
|
||||
"ActNinjaTurret.cpp"
|
||||
"FvFlyingCreviceDragon.cpp"
|
||||
"FvDragonSmashingGolemQb.cpp"
|
||||
@@ -15,4 +16,5 @@ set(DSCRIPTS_SOURCES_AI_FV
|
||||
"FvPassThroughWall.cpp"
|
||||
"FvBounceOverWall.cpp"
|
||||
"FvMaelstromGeyser.cpp"
|
||||
"TriggerGas.cpp"
|
||||
PARENT_SCOPE)
|
||||
|
@@ -61,8 +61,8 @@ void FvBrickPuzzleServer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "reset") {
|
||||
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent != nullptr && rebuildComponent->GetState() == REBUILD_OPEN) {
|
||||
self->Smash(self->GetObjectID(), SILENT);
|
||||
if (rebuildComponent != nullptr && rebuildComponent->GetState() == eRebuildState::OPEN) {
|
||||
self->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,8 @@
|
||||
#include "FvConsoleLeftQuickbuild.h"
|
||||
#include "EntityManager.h"
|
||||
#include "GameMessages.h"
|
||||
#include "eTerminateType.h"
|
||||
#include "eRebuildState.h"
|
||||
|
||||
void FvConsoleLeftQuickbuild::OnStartup(Entity* self) {
|
||||
self->SetVar(u"IAmBuilt", false);
|
||||
@@ -8,7 +10,7 @@ void FvConsoleLeftQuickbuild::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void FvConsoleLeftQuickbuild::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (state == REBUILD_COMPLETED) {
|
||||
if (state == eRebuildState::COMPLETED) {
|
||||
self->SetVar(u"IAmBuilt", true);
|
||||
|
||||
const auto objects = EntityManager::Instance()->GetEntitiesInGroup("Facility");
|
||||
@@ -16,7 +18,7 @@ void FvConsoleLeftQuickbuild::OnRebuildNotifyState(Entity* self, eRebuildState s
|
||||
if (!objects.empty()) {
|
||||
objects[0]->NotifyObject(self, "ConsoleLeftUp");
|
||||
}
|
||||
} else if (state == REBUILD_RESETTING) {
|
||||
} else if (state == eRebuildState::RESETTING) {
|
||||
self->SetVar(u"IAmBuilt", false);
|
||||
self->SetVar(u"AmActive", false);
|
||||
|
||||
@@ -43,5 +45,5 @@ void FvConsoleLeftQuickbuild::OnUse(Entity* self, Entity* user) {
|
||||
}
|
||||
}
|
||||
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
|
||||
}
|
||||
|
@@ -1,6 +1,8 @@
|
||||
#include "FvConsoleRightQuickbuild.h"
|
||||
#include "EntityManager.h"
|
||||
#include "GameMessages.h"
|
||||
#include "eTerminateType.h"
|
||||
#include "eRebuildState.h"
|
||||
|
||||
void FvConsoleRightQuickbuild::OnStartup(Entity* self) {
|
||||
self->SetVar(u"IAmBuilt", false);
|
||||
@@ -8,7 +10,7 @@ void FvConsoleRightQuickbuild::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void FvConsoleRightQuickbuild::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (state == REBUILD_COMPLETED) {
|
||||
if (state == eRebuildState::COMPLETED) {
|
||||
self->SetVar(u"IAmBuilt", true);
|
||||
|
||||
const auto objects = EntityManager::Instance()->GetEntitiesInGroup("Facility");
|
||||
@@ -16,7 +18,7 @@ void FvConsoleRightQuickbuild::OnRebuildNotifyState(Entity* self, eRebuildState
|
||||
if (!objects.empty()) {
|
||||
objects[0]->NotifyObject(self, "ConsoleRightUp");
|
||||
}
|
||||
} else if (state == REBUILD_RESETTING) {
|
||||
} else if (state == eRebuildState::RESETTING) {
|
||||
self->SetVar(u"IAmBuilt", false);
|
||||
self->SetVar(u"AmActive", false);
|
||||
|
||||
@@ -43,5 +45,5 @@ void FvConsoleRightQuickbuild::OnUse(Entity* self, Entity* user) {
|
||||
}
|
||||
}
|
||||
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "FvDragonSmashingGolemQb.h"
|
||||
#include "GameMessages.h"
|
||||
#include "EntityManager.h"
|
||||
#include "eRebuildState.h"
|
||||
|
||||
void FvDragonSmashingGolemQb::OnStartup(Entity* self) {
|
||||
self->AddTimer("GolemBreakTimer", 10.5f);
|
||||
@@ -13,7 +14,7 @@ void FvDragonSmashingGolemQb::OnTimerDone(Entity* self, std::string timerName) {
|
||||
}
|
||||
|
||||
void FvDragonSmashingGolemQb::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (state == eRebuildState::REBUILD_COMPLETED) {
|
||||
if (state == eRebuildState::COMPLETED) {
|
||||
GameMessages::SendPlayAnimation(self, u"dragonsmash");
|
||||
|
||||
const auto dragonId = self->GetVar<LWOOBJID>(u"Dragon");
|
||||
|
@@ -56,7 +56,7 @@ void FvFacilityBrick::OnNotifyObject(Entity* self, Entity* sender, const std::st
|
||||
object = EntityManager::Instance()->GetEntitiesInGroup("Canister")[0];
|
||||
|
||||
if (object != nullptr) {
|
||||
object->Smash(self->GetObjectID(), SILENT);
|
||||
object->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
}
|
||||
|
||||
canisterSpawner->Reset();
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "FvPandaServer.h"
|
||||
#include "PetComponent.h"
|
||||
#include "Character.h"
|
||||
#include "ePetTamingNotifyType.h"
|
||||
|
||||
void FvPandaServer::OnStartup(Entity* self) {
|
||||
const auto* petComponent = self->GetComponent<PetComponent>();
|
||||
@@ -10,12 +11,12 @@ void FvPandaServer::OnStartup(Entity* self) {
|
||||
}
|
||||
}
|
||||
|
||||
void FvPandaServer::OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, eNotifyType type) {
|
||||
if (type == NOTIFY_TYPE_BEGIN) {
|
||||
void FvPandaServer::OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, ePetTamingNotifyType type) {
|
||||
if (type == ePetTamingNotifyType::BEGIN) {
|
||||
self->CancelAllTimers();
|
||||
} else if (type == NOTIFY_TYPE_QUIT || type == NOTIFY_TYPE_FAILED) {
|
||||
} else if (type == ePetTamingNotifyType::QUIT || type == ePetTamingNotifyType::FAILED) {
|
||||
self->Smash();
|
||||
} else if (type == NOTIFY_TYPE_SUCCESS) {
|
||||
} else if (type == ePetTamingNotifyType::SUCCESS) {
|
||||
// TODO: Remove from groups
|
||||
|
||||
auto* character = tamer->GetCharacter();
|
||||
@@ -29,7 +30,7 @@ void FvPandaServer::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "killSelf") {
|
||||
const auto* petComponent = self->GetComponent<PetComponent>();
|
||||
if (petComponent != nullptr && petComponent->GetOwner() == nullptr) {
|
||||
self->Smash(self->GetObjectID(), SILENT);
|
||||
self->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -3,6 +3,6 @@
|
||||
|
||||
class FvPandaServer : public CppScripts::Script {
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, eNotifyType type) override;
|
||||
void OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, ePetTamingNotifyType type) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
};
|
||||
|
49
dScripts/ai/FV/TriggerGas.cpp
Normal file
49
dScripts/ai/FV/TriggerGas.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include "TriggerGas.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "Entity.h"
|
||||
#include "dLogger.h"
|
||||
|
||||
|
||||
void TriggerGas::OnStartup(Entity* self) {
|
||||
self->AddTimer(this->m_TimerName, this->m_Time);
|
||||
}
|
||||
|
||||
void TriggerGas::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
if (!target->IsPlayer()) return;
|
||||
auto players = self->GetVar<std::vector<Entity*>>(u"players");
|
||||
players.push_back(target);
|
||||
self->SetVar(u"players", players);
|
||||
}
|
||||
|
||||
void TriggerGas::OnOffCollisionPhantom(Entity* self, Entity* target) {
|
||||
auto players = self->GetVar<std::vector<Entity*>>(u"players");
|
||||
if (!target->IsPlayer() || players.empty()) return;
|
||||
auto position = std::find(players.begin(), players.end(), target);
|
||||
if (position != players.end()) players.erase(position);
|
||||
self->SetVar(u"players", players);
|
||||
}
|
||||
|
||||
void TriggerGas::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName != this->m_TimerName) return;
|
||||
auto players = self->GetVar<std::vector<Entity*>>(u"players");
|
||||
for (auto player : players) {
|
||||
if (player->GetIsDead() || !player){
|
||||
auto position = std::find(players.begin(), players.end(), player);
|
||||
if (position != players.end()) players.erase(position);
|
||||
continue;
|
||||
}
|
||||
auto inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||
if (inventoryComponent) {
|
||||
if (!inventoryComponent->IsEquipped(this->m_MaelstromHelmet)) {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (skillComponent) {
|
||||
skillComponent->CastSkill(this->m_FogDamageSkill, player->GetObjectID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self->SetVar(u"players", players);
|
||||
self->AddTimer(this->m_TimerName, this->m_Time);
|
||||
}
|
||||
|
14
dScripts/ai/FV/TriggerGas.h
Normal file
14
dScripts/ai/FV/TriggerGas.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class TriggerGas : public CppScripts::Script {
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnCollisionPhantom(Entity* self, Entity* target) override;
|
||||
void OnOffCollisionPhantom(Entity* self, Entity* target) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
private:
|
||||
std::string m_TimerName = "gasTriggerDamage";
|
||||
float m_Time = 3.0f;
|
||||
uint32_t m_MaelstromHelmet = 3068;
|
||||
uint32_t m_FogDamageSkill = 103;
|
||||
};
|
@@ -3,6 +3,7 @@
|
||||
#include "Player.h"
|
||||
#include "Character.h"
|
||||
#include "dServer.h"
|
||||
#include "eTerminateType.h"
|
||||
|
||||
void InstanceExitTransferPlayerToLastNonInstance::OnUse(Entity* self, Entity* user) {
|
||||
auto transferText = self->GetVar<std::u16string>(u"transferText");
|
||||
|
@@ -11,7 +11,7 @@ void LegoDieRoll::OnStartup(Entity* self) {
|
||||
|
||||
void LegoDieRoll::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "DoneRolling") {
|
||||
self->Smash(self->GetObjectID(), SILENT);
|
||||
self->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
} else if (timerName == "ThrowDice") {
|
||||
int dieRoll = GeneralUtils::GenerateRandomNumber<int>(1, 6);
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "GfJailWalls.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "GeneralUtils.h"
|
||||
#include "eRebuildState.h"
|
||||
|
||||
void GfJailWalls::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
const auto wall = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"Wall"));
|
||||
@@ -15,7 +16,7 @@ void GfJailWalls::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
}
|
||||
|
||||
void GfJailWalls::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (state != eRebuildState::REBUILD_RESETTING) return;
|
||||
if (state != eRebuildState::RESETTING) return;
|
||||
|
||||
const auto wall = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"Wall"));
|
||||
|
||||
|
@@ -46,6 +46,6 @@ void PetDigBuild::OnDie(Entity* self, Entity* killer) {
|
||||
|
||||
// If the quick build expired and the treasure was not collected, hide the treasure
|
||||
if (!treasure->GetIsDead()) {
|
||||
treasure->Smash(self->GetObjectID(), SILENT);
|
||||
treasure->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
}
|
||||
}
|
||||
|
@@ -2,12 +2,13 @@
|
||||
#include "Character.h"
|
||||
#include "eMissionState.h"
|
||||
#include "Entity.h"
|
||||
#include "ePlayerFlag.h"
|
||||
|
||||
void PirateRep::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
||||
if (missionID == m_PirateRepMissionID && missionState >= eMissionState::READY_TO_COMPLETE) {
|
||||
auto* character = target->GetCharacter();
|
||||
if (character) {
|
||||
character->SetPlayerFlag(ePlayerFlags::GF_PIRATE_REP, true);
|
||||
character->SetPlayerFlag(ePlayerFlag::GF_PIRATE_REP, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include "InventoryComponent.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "eGameActivity.h"
|
||||
|
||||
void SGCannon::OnStartup(Entity* self) {
|
||||
Game::logger->Log("SGCannon", "OnStartup");
|
||||
@@ -102,7 +103,7 @@ void SGCannon::OnActivityStateChangeRequest(Entity* self, LWOOBJID senderID, int
|
||||
|
||||
if (characterComponent != nullptr) {
|
||||
characterComponent->SetIsRacing(true);
|
||||
characterComponent->SetCurrentActivity(2);
|
||||
characterComponent->SetCurrentActivity(eGameActivity::SHOOTING_GALLERY);
|
||||
auto possessor = player->GetComponent<PossessorComponent>();
|
||||
if (possessor) {
|
||||
possessor->SetPossessable(self->GetObjectID());
|
||||
@@ -558,7 +559,7 @@ void SGCannon::StopGame(Entity* self, bool cancel) {
|
||||
auto* inventory = player->GetComponent<InventoryComponent>();
|
||||
if (inventory != nullptr) {
|
||||
for (const auto rewardLot : self->GetVar<std::vector<LOT>>(RewardsVariable)) {
|
||||
inventory->AddItem(rewardLot, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY, eInventoryType::MODELS);
|
||||
inventory->AddItem(rewardLot, 1, eLootSourceType::ACTIVITY, eInventoryType::MODELS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@ void NsConcertInstrument::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void NsConcertInstrument::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (state == REBUILD_RESETTING || state == REBUILD_OPEN) {
|
||||
if (state == eRebuildState::RESETTING || state == eRebuildState::OPEN) {
|
||||
self->SetVar<LWOOBJID>(u"activePlayer", LWOOBJID_EMPTY);
|
||||
}
|
||||
}
|
||||
@@ -96,7 +96,7 @@ void NsConcertInstrument::OnTimerDone(Entity* self, std::string name) {
|
||||
if (rebuildComponent != nullptr)
|
||||
rebuildComponent->ResetRebuild(false);
|
||||
|
||||
self->Smash(self->GetObjectID(), VIOLENT);
|
||||
self->Smash(self->GetObjectID(), eKillType::VIOLENT);
|
||||
self->SetVar<LWOOBJID>(u"activePlayer", LWOOBJID_EMPTY);
|
||||
} else if (activePlayer != nullptr && name == "achievement") {
|
||||
auto* missionComponent = activePlayer->GetComponent<MissionComponent>();
|
||||
@@ -199,7 +199,7 @@ void NsConcertInstrument::EquipInstruments(Entity* self, Entity* player) {
|
||||
// Equip the left hand instrument
|
||||
const auto leftInstrumentLot = instrumentLotLeft.find(GetInstrumentLot(self))->second;
|
||||
if (leftInstrumentLot != LOT_NULL) {
|
||||
inventory->AddItem(leftInstrumentLot, 1, eLootSourceType::LOOT_SOURCE_NONE, TEMP_ITEMS, {}, LWOOBJID_EMPTY, false);
|
||||
inventory->AddItem(leftInstrumentLot, 1, eLootSourceType::NONE, TEMP_ITEMS, {}, LWOOBJID_EMPTY, false);
|
||||
auto* leftInstrument = inventory->FindItemByLot(leftInstrumentLot, TEMP_ITEMS);
|
||||
leftInstrument->Equip();
|
||||
}
|
||||
@@ -207,7 +207,7 @@ void NsConcertInstrument::EquipInstruments(Entity* self, Entity* player) {
|
||||
// Equip the right hand instrument
|
||||
const auto rightInstrumentLot = instrumentLotRight.find(GetInstrumentLot(self))->second;
|
||||
if (rightInstrumentLot != LOT_NULL) {
|
||||
inventory->AddItem(rightInstrumentLot, 1, eLootSourceType::LOOT_SOURCE_NONE, TEMP_ITEMS, {}, LWOOBJID_EMPTY, false);
|
||||
inventory->AddItem(rightInstrumentLot, 1, eLootSourceType::NONE, TEMP_ITEMS, {}, LWOOBJID_EMPTY, false);
|
||||
auto* rightInstrument = inventory->FindItemByLot(rightInstrumentLot, TEMP_ITEMS);
|
||||
rightInstrument->Equip();
|
||||
}
|
||||
|
@@ -58,7 +58,7 @@ void NsConcertQuickBuild::OnStartup(Entity* self) {
|
||||
// Destroys the quick build after a while if it wasn't built
|
||||
self->AddCallbackTimer(resetActivatorTime, [self]() {
|
||||
self->SetNetworkVar<float>(u"startEffect", -1.0f);
|
||||
self->Smash(self->GetObjectID(), SILENT);
|
||||
self->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
#include "MissionComponent.h"
|
||||
#include "Character.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "ePlayerFlag.h"
|
||||
|
||||
void NsGetFactionMissionServer::OnRespondToMission(Entity* self, int missionID, Entity* player, int reward) {
|
||||
if (missionID != 474) return;
|
||||
@@ -10,7 +11,7 @@ void NsGetFactionMissionServer::OnRespondToMission(Entity* self, int missionID,
|
||||
if (reward != LOT_NULL) {
|
||||
std::vector<int> factionMissions;
|
||||
int celebrationID = -1;
|
||||
int flagID = -1;
|
||||
int32_t flagID = -1;
|
||||
|
||||
if (reward == 6980) {
|
||||
// Venture League
|
||||
@@ -41,7 +42,7 @@ void NsGetFactionMissionServer::OnRespondToMission(Entity* self, int missionID,
|
||||
}
|
||||
|
||||
if (flagID != -1) {
|
||||
player->GetCharacter()->SetPlayerFlag(ePlayerFlags::JOINED_A_FACTION, true);
|
||||
player->GetCharacter()->SetPlayerFlag(ePlayerFlag::JOINED_A_FACTION, true);
|
||||
player->GetCharacter()->SetPlayerFlag(flagID, true);
|
||||
}
|
||||
|
||||
|
@@ -1,3 +1,5 @@
|
||||
set(DSCRIPTS_SOURCES_AI_SPEC
|
||||
"SpecialImaginePowerupSpawner.cpp"
|
||||
set(DSCRIPTS_SOURCES_AI_SPEC
|
||||
"SpecialCoinSpawner.cpp"
|
||||
"SpecialPowerupSpawner.cpp"
|
||||
"SpecialSpeedBuffSpawner.cpp"
|
||||
PARENT_SCOPE)
|
||||
|
16
dScripts/ai/SPEC/SpecialCoinSpawner.cpp
Normal file
16
dScripts/ai/SPEC/SpecialCoinSpawner.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "SpecialCoinSpawner.h"
|
||||
#include "CharacterComponent.h"
|
||||
|
||||
void SpecialCoinSpawner::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(1.5f, "powerupEnter");
|
||||
}
|
||||
|
||||
void SpecialCoinSpawner::OnProximityUpdate(Entity* self, Entity* entering, const std::string name, const std::string status) {
|
||||
if (name != "powerupEnter" && status != "ENTER") return;
|
||||
if (!entering->IsPlayer()) return;
|
||||
auto character = entering->GetCharacter();
|
||||
if (!character) return;
|
||||
GameMessages::SendPlayFXEffect(self, -1, u"pickup", "", LWOOBJID_EMPTY, 1, 1, true);
|
||||
character->SetCoins(character->GetCoins() + this->m_CurrencyDenomination, eLootSourceType::CURRENCY);
|
||||
self->Smash(entering->GetObjectID(), eKillType::SILENT);
|
||||
}
|
13
dScripts/ai/SPEC/SpecialCoinSpawner.h
Normal file
13
dScripts/ai/SPEC/SpecialCoinSpawner.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class SpecialCoinSpawner : public CppScripts::Script {
|
||||
public:
|
||||
SpecialCoinSpawner(uint32_t CurrencyDenomination) {
|
||||
m_CurrencyDenomination = CurrencyDenomination;
|
||||
};
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, const std::string name, const std::string status) override;
|
||||
private:
|
||||
int32_t m_CurrencyDenomination = 0;
|
||||
};
|
@@ -1,48 +0,0 @@
|
||||
#include "SpecialImaginePowerupSpawner.h"
|
||||
|
||||
#include "GameMessages.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void SpecialImaginePowerupSpawner::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(1.5f, "powerupEnter");
|
||||
self->SetVar(u"bIsDead", false);
|
||||
}
|
||||
|
||||
void SpecialImaginePowerupSpawner::OnProximityUpdate(Entity* self, Entity* entering, const std::string name, const std::string status) {
|
||||
if (name != "powerupEnter" && status != "ENTER") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (entering->GetLOT() != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self->GetVar<bool>(u"bIsDead")) {
|
||||
return;
|
||||
}
|
||||
|
||||
GameMessages::SendPlayFXEffect(self, -1, u"pickup", "", LWOOBJID_EMPTY, 1, 1, true);
|
||||
|
||||
SkillComponent* skillComponent;
|
||||
if (!self->TryGetComponent(eReplicaComponentType::SKILL, skillComponent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto source = entering->GetObjectID();
|
||||
|
||||
skillComponent->CalculateBehavior(13, 20, source);
|
||||
|
||||
DestroyableComponent* destroyableComponent;
|
||||
if (!self->TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
self->SetVar(u"bIsDead", true);
|
||||
|
||||
self->AddCallbackTimer(1.0f, [self]() {
|
||||
EntityManager::Instance()->ScheduleForKill(self);
|
||||
});
|
||||
}
|
26
dScripts/ai/SPEC/SpecialPowerupSpawner.cpp
Normal file
26
dScripts/ai/SPEC/SpecialPowerupSpawner.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "SpecialPowerupSpawner.h"
|
||||
|
||||
#include "GameMessages.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void SpecialPowerupSpawner::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(1.5f, "powerupEnter");
|
||||
self->SetVar(u"bIsDead", false);
|
||||
}
|
||||
|
||||
void SpecialPowerupSpawner::OnProximityUpdate(Entity* self, Entity* entering, const std::string name, const std::string status) {
|
||||
if (name != "powerupEnter" && status != "ENTER") return;
|
||||
if (!entering->IsPlayer()) return;
|
||||
if (self->GetVar<bool>(u"bIsDead")) return;
|
||||
|
||||
GameMessages::SendPlayFXEffect(self, -1, u"pickup", "", LWOOBJID_EMPTY, 1, 1, true);
|
||||
|
||||
auto skillComponent = self->GetComponent<SkillComponent>();
|
||||
if (!skillComponent) return;
|
||||
skillComponent->CastSkill(this->m_SkillId, entering->GetObjectID());
|
||||
|
||||
self->SetVar(u"bIsDead", true);
|
||||
self->Smash(entering->GetObjectID(), eKillType::SILENT);
|
||||
}
|
13
dScripts/ai/SPEC/SpecialPowerupSpawner.h
Normal file
13
dScripts/ai/SPEC/SpecialPowerupSpawner.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class SpecialPowerupSpawner : public CppScripts::Script {
|
||||
public:
|
||||
SpecialPowerupSpawner(uint32_t skillId) {
|
||||
m_SkillId = skillId;
|
||||
};
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
private:
|
||||
uint32_t m_SkillId = 0;
|
||||
};
|
26
dScripts/ai/SPEC/SpecialSpeedBuffSpawner.cpp
Normal file
26
dScripts/ai/SPEC/SpecialSpeedBuffSpawner.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "SpecialSpeedBuffSpawner.h"
|
||||
|
||||
#include "GameMessages.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void SpecialSpeedBuffSpawner::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(1.5f, "powerupEnter");
|
||||
self->SetVar(u"bIsDead", false);
|
||||
}
|
||||
|
||||
void SpecialSpeedBuffSpawner::OnProximityUpdate(Entity* self, Entity* entering, const std::string name, const std::string status) {
|
||||
if (name != "powerupEnter" && status != "ENTER") return;
|
||||
if (!entering->IsPlayer()) return;
|
||||
if (self->GetVar<bool>(u"bIsDead")) return;
|
||||
|
||||
GameMessages::SendPlayFXEffect(self, -1, u"pickup", "", LWOOBJID_EMPTY, 1, 1, true);
|
||||
|
||||
auto skillComponent = entering->GetComponent<SkillComponent>();
|
||||
if (!skillComponent) return;
|
||||
skillComponent->CastSkill(this->m_SkillId, entering->GetObjectID());
|
||||
|
||||
self->SetVar(u"bIsDead", true);
|
||||
self->Smash(entering->GetObjectID(), eKillType::SILENT);
|
||||
}
|
@@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class SpecialImaginePowerupSpawner final : public CppScripts::Script
|
||||
{
|
||||
class SpecialSpeedBuffSpawner : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
private:
|
||||
uint32_t m_SkillId = 500;
|
||||
};
|
@@ -4,5 +4,8 @@ set(DSCRIPTS_SOURCES_AI_WILD
|
||||
"WildAmbientCrab.cpp"
|
||||
"WildAndScared.cpp"
|
||||
"WildGfGlowbug.cpp"
|
||||
"WildNinjaBricks.cpp"
|
||||
"WildNinjaStudent.cpp"
|
||||
"WildNinjaSensei.cpp"
|
||||
"WildPants.cpp"
|
||||
PARENT_SCOPE)
|
||||
|
13
dScripts/ai/WILD/WildNinjaBricks.cpp
Normal file
13
dScripts/ai/WILD/WildNinjaBricks.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "WildNinjaBricks.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void WildNinjaBricks::OnStartup(Entity* self) {
|
||||
self->AddToGroup("Ninjastuff");
|
||||
}
|
||||
|
||||
void WildNinjaBricks::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) {
|
||||
if (name == "Crane") GameMessages::SendPlayAnimation(self, u"crane");
|
||||
else if (name == "Tiger") GameMessages::SendPlayAnimation(self, u"tiger");
|
||||
else if (name == "Mantis") GameMessages::SendPlayAnimation(self, u"mantis");
|
||||
}
|
||||
|
9
dScripts/ai/WILD/WildNinjaBricks.h
Normal file
9
dScripts/ai/WILD/WildNinjaBricks.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class WildNinjaBricks : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1 = 0, int32_t param2 = 0) override;
|
||||
};
|
||||
|
36
dScripts/ai/WILD/WildNinjaSensei.cpp
Normal file
36
dScripts/ai/WILD/WildNinjaSensei.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "WildNinjaSensei.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void WildNinjaSensei::OnStartup(Entity* self) {
|
||||
GameMessages::SendPlayAnimation(self, u"bow");
|
||||
self->AddTimer("CraneStart", 5);
|
||||
}
|
||||
|
||||
void WildNinjaSensei::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "CraneStart") {
|
||||
auto ninjas = EntityManager::Instance()->GetEntitiesInGroup("Ninjastuff");
|
||||
for (auto ninja : ninjas) ninja->NotifyObject(self, "Crane");
|
||||
self->AddTimer("Bow", 15.5f);
|
||||
self->AddTimer("TigerStart", 25);
|
||||
GameMessages::SendPlayAnimation(self, u"crane");
|
||||
} else if (timerName == "TigerStart") {
|
||||
auto ninjas = EntityManager::Instance()->GetEntitiesInGroup("Ninjastuff");
|
||||
GameMessages::SendPlayAnimation(self, u"bow");
|
||||
for (auto ninja : ninjas) ninja->NotifyObject(self, "Tiger");
|
||||
self->AddTimer("Bow", 15.5f);
|
||||
self->AddTimer("MantisStart", 25);
|
||||
GameMessages::SendPlayAnimation(self, u"tiger");
|
||||
} else if (timerName == "MantisStart") {
|
||||
auto ninjas = EntityManager::Instance()->GetEntitiesInGroup("Ninjastuff");
|
||||
GameMessages::SendPlayAnimation(self, u"tiger");
|
||||
for (auto ninja : ninjas) ninja->NotifyObject(self, "Mantis");
|
||||
self->AddTimer("Bow", 15.5f);
|
||||
self->AddTimer("CraneStart", 25);
|
||||
GameMessages::SendPlayAnimation(self, u"mantis");
|
||||
} else if (timerName == "Bow") {
|
||||
auto ninjas = EntityManager::Instance()->GetEntitiesInGroup("Ninjastuff");
|
||||
for (auto ninja : ninjas) ninja->NotifyObject(self, "Bow");
|
||||
GameMessages::SendPlayAnimation(self, u"bow");
|
||||
}
|
||||
}
|
||||
|
9
dScripts/ai/WILD/WildNinjaSensei.h
Normal file
9
dScripts/ai/WILD/WildNinjaSensei.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class WildNinjaSensei : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self);
|
||||
void OnTimerDone(Entity* self, std::string timerName);
|
||||
};
|
||||
|
14
dScripts/ai/WILD/WildNinjaStudent.cpp
Normal file
14
dScripts/ai/WILD/WildNinjaStudent.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "WildNinjaStudent.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void WildNinjaStudent::OnStartup(Entity* self) {
|
||||
self->AddToGroup("Ninjastuff");
|
||||
GameMessages::SendPlayAnimation(self, u"bow");
|
||||
}
|
||||
|
||||
void WildNinjaStudent::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) {
|
||||
if (name == "Crane") GameMessages::SendPlayAnimation(self, u"crane");
|
||||
else if (name == "Tiger") GameMessages::SendPlayAnimation(self, u"tiger");
|
||||
else if (name == "Mantis") GameMessages::SendPlayAnimation(self, u"mantis");
|
||||
else if (name == "Bow") GameMessages::SendPlayAnimation(self, u"bow");
|
||||
}
|
9
dScripts/ai/WILD/WildNinjaStudent.h
Normal file
9
dScripts/ai/WILD/WildNinjaStudent.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class WildNinjaStudent : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1 = 0, int32_t param2 = 0) override;
|
||||
};
|
||||
|
Reference in New Issue
Block a user