mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-05-09 17:07:53 +00:00
Merge branch 'main' into guild_temp
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();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "ActPlayerDeathTrigger.h"
|
||||
|
||||
#include "Entity.h"
|
||||
|
||||
void ActPlayerDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
if (!target->IsPlayer() || target->GetIsDead() || !target->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ void ActVehicleDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
Entity* player;
|
||||
|
||||
if (possessableComponent != nullptr) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
|
||||
auto* player = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
|
||||
|
||||
if (player == nullptr) {
|
||||
return;
|
||||
@@ -28,7 +28,7 @@ void ActVehicleDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
return;
|
||||
}
|
||||
|
||||
vehicle = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable());
|
||||
vehicle = Game::entityManager->GetEntity(possessorComponent->GetPossessable());
|
||||
|
||||
if (vehicle == nullptr) {
|
||||
return;
|
||||
@@ -40,9 +40,9 @@ 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();
|
||||
auto* zoneController = Game::zoneManager->GetZoneControlObject();
|
||||
|
||||
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#include "BaseFootRaceManager.h"
|
||||
#include "EntityManager.h"
|
||||
#include "Character.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void BaseFootRaceManager::OnStartup(Entity* self) {
|
||||
// TODO: Add to FootRaceStarter group
|
||||
}
|
||||
|
||||
void BaseFootRaceManager::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
|
||||
int32_t param2, int32_t param3) {
|
||||
void BaseFootRaceManager::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
|
||||
const auto splitArguments = GeneralUtils::SplitString(args, '_');
|
||||
if (splitArguments.size() > 1) {
|
||||
|
||||
const auto eventName = splitArguments[0];
|
||||
const auto player = EntityManager::Instance()->GetEntity(std::stoull(splitArguments[1]));
|
||||
const auto player = Game::entityManager->GetEntity(std::stoull(splitArguments[1]));
|
||||
|
||||
if (player != nullptr) {
|
||||
if (eventName == "updatePlayer") {
|
||||
@@ -41,6 +41,7 @@ void BaseFootRaceManager::OnFireEventServerSide(Entity* self, Entity* sender, st
|
||||
}
|
||||
|
||||
StopActivity(self, player->GetObjectID(), 0, param1);
|
||||
SaveScore(self, player->GetObjectID(), static_cast<float>(param1), static_cast<float>(param2), static_cast<float>(param3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ActSharkPlayerDeathTrigger.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "MissionTaskType.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void ActSharkPlayerDeathTrigger::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
|
||||
@@ -9,7 +9,7 @@ void ActSharkPlayerDeathTrigger::OnFireEventServerSide(Entity* self, Entity* sen
|
||||
auto missionComponent = sender->GetComponent<MissionComponent>();
|
||||
if (!missionComponent) return;
|
||||
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, 8419);
|
||||
missionComponent->Progress(eMissionTaskType::SCRIPT, 8419);
|
||||
|
||||
if (sender->GetIsDead() || !sender->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@ void AgBusDoor::OnProximityUpdate(Entity* self, Entity* entering, std::string na
|
||||
m_OuterCounter = 0;
|
||||
|
||||
for (const auto& pair : proximityMonitorComponent->GetProximityObjects("busDoor")) {
|
||||
auto* entity = EntityManager::Instance()->GetEntity(pair.first);
|
||||
auto* entity = Game::entityManager->GetEntity(pair.first);
|
||||
if (entity != nullptr && entity->IsPlayer()) m_Counter++;
|
||||
}
|
||||
|
||||
for (const auto& pair : proximityMonitorComponent->GetProximityObjects("busDoorOuter")) {
|
||||
auto* entity = EntityManager::Instance()->GetEntity(pair.first);
|
||||
auto* entity = Game::entityManager->GetEntity(pair.first);
|
||||
if (entity != nullptr && entity->IsPlayer()) m_OuterCounter++;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
#include "GameMessages.h"
|
||||
#include "PhantomPhysicsComponent.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void AgFans::OnStartup(Entity* self) {
|
||||
self->SetVar<bool>(u"alive", true);
|
||||
@@ -11,7 +14,7 @@ void AgFans::OnStartup(Entity* self) {
|
||||
|
||||
ToggleFX(self, false);
|
||||
|
||||
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
|
||||
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
|
||||
|
||||
if (renderComponent == nullptr) {
|
||||
return;
|
||||
@@ -22,9 +25,9 @@ void AgFans::OnStartup(Entity* self) {
|
||||
|
||||
void AgFans::ToggleFX(Entity* self, bool hit) {
|
||||
std::string fanGroup = self->GetGroups()[0];
|
||||
std::vector<Entity*> fanVolumes = EntityManager::Instance()->GetEntitiesInGroup(fanGroup);
|
||||
std::vector<Entity*> fanVolumes = Game::entityManager->GetEntitiesInGroup(fanGroup);
|
||||
|
||||
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
|
||||
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
|
||||
|
||||
if (renderComponent == nullptr) {
|
||||
return;
|
||||
@@ -33,35 +36,35 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
|
||||
if (fanVolumes.size() == 0 || !self->GetVar<bool>(u"alive")) return;
|
||||
|
||||
if (self->GetVar<bool>(u"on")) {
|
||||
GameMessages::SendPlayAnimation(self, u"fan-off");
|
||||
RenderComponent::PlayAnimation(self, u"fan-off");
|
||||
|
||||
renderComponent->StopEffect("fanOn");
|
||||
self->SetVar<bool>(u"on", false);
|
||||
|
||||
for (Entity* volume : fanVolumes) {
|
||||
PhantomPhysicsComponent* volumePhys = static_cast<PhantomPhysicsComponent*>(volume->GetComponent(COMPONENT_TYPE_PHANTOM_PHYSICS));
|
||||
PhantomPhysicsComponent* volumePhys = static_cast<PhantomPhysicsComponent*>(volume->GetComponent(eReplicaComponentType::PHANTOM_PHYSICS));
|
||||
if (!volumePhys) continue;
|
||||
volumePhys->SetPhysicsEffectActive(false);
|
||||
EntityManager::Instance()->SerializeEntity(volume);
|
||||
Game::entityManager->SerializeEntity(volume);
|
||||
if (!hit) {
|
||||
Entity* fxObj = EntityManager::Instance()->GetEntitiesInGroup(fanGroup + "fx")[0];
|
||||
GameMessages::SendPlayAnimation(fxObj, u"trigger");
|
||||
Entity* fxObj = Game::entityManager->GetEntitiesInGroup(fanGroup + "fx")[0];
|
||||
RenderComponent::PlayAnimation(fxObj, u"trigger");
|
||||
}
|
||||
}
|
||||
} else if (!self->GetVar<bool>(u"on") && self->GetVar<bool>(u"alive")) {
|
||||
GameMessages::SendPlayAnimation(self, u"fan-on");
|
||||
RenderComponent::PlayAnimation(self, u"fan-on");
|
||||
|
||||
renderComponent->PlayEffect(495, u"fanOn", "fanOn");
|
||||
self->SetVar<bool>(u"on", true);
|
||||
|
||||
for (Entity* volume : fanVolumes) {
|
||||
PhantomPhysicsComponent* volumePhys = static_cast<PhantomPhysicsComponent*>(volume->GetComponent(COMPONENT_TYPE_PHANTOM_PHYSICS));
|
||||
PhantomPhysicsComponent* volumePhys = static_cast<PhantomPhysicsComponent*>(volume->GetComponent(eReplicaComponentType::PHANTOM_PHYSICS));
|
||||
if (!volumePhys) continue;
|
||||
volumePhys->SetPhysicsEffectActive(true);
|
||||
EntityManager::Instance()->SerializeEntity(volume);
|
||||
Game::entityManager->SerializeEntity(volume);
|
||||
if (!hit) {
|
||||
Entity* fxObj = EntityManager::Instance()->GetEntitiesInGroup(fanGroup + "fx")[0];
|
||||
GameMessages::SendPlayAnimation(fxObj, u"idle");
|
||||
Entity* fxObj = Game::entityManager->GetEntitiesInGroup(fanGroup + "fx")[0];
|
||||
RenderComponent::PlayAnimation(fxObj, u"idle");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
#include "EntityManager.h"
|
||||
#include "GeneralUtils.h"
|
||||
#include "GameMessages.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void AgImagSmashable::OnDie(Entity* self, Entity* killer) {
|
||||
bool maxImagGreaterThanZero = false;
|
||||
|
||||
if (killer) {
|
||||
DestroyableComponent* dest = static_cast<DestroyableComponent*>(killer->GetComponent(COMPONENT_TYPE_DESTROYABLE));
|
||||
DestroyableComponent* dest = static_cast<DestroyableComponent*>(killer->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||
if (dest) {
|
||||
maxImagGreaterThanZero = dest->GetMaxImagination() > 0;
|
||||
}
|
||||
@@ -34,9 +36,9 @@ void AgImagSmashable::CrateAnimal(Entity* self) {
|
||||
info.spawnerID = self->GetSpawnerID();
|
||||
info.spawnerNodeID = 0;
|
||||
|
||||
Entity* newEntity = EntityManager::Instance()->CreateEntity(info, nullptr);
|
||||
Entity* newEntity = Game::entityManager->CreateEntity(info, nullptr);
|
||||
if (newEntity) {
|
||||
EntityManager::Instance()->ConstructEntity(newEntity);
|
||||
Game::entityManager->ConstructEntity(newEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,115 +2,59 @@
|
||||
#include "GameMessages.h"
|
||||
#include "EntityManager.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "RenderComponent.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);
|
||||
auto entities = Game::entityManager->GetEntitiesInGroup("Jet_FX");
|
||||
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) {
|
||||
auto entities = EntityManager::Instance()->GetEntitiesInGroup("Jet_FX");
|
||||
|
||||
if (entities.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* effect = entities[0];
|
||||
|
||||
auto groups = self->GetGroups();
|
||||
|
||||
if (groups.empty()) {
|
||||
return;
|
||||
}
|
||||
if (self->GetLOT() != 6209) return;
|
||||
auto entities = Game::entityManager->GetEntitiesInGroup("Jet_FX");
|
||||
if (entities.empty()) return;
|
||||
RenderComponent::PlayAnimation(entities.at(0), u"jetFX");
|
||||
|
||||
// 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");
|
||||
} else if (timerName == "PlayEffect") {
|
||||
auto entities = Game::entityManager->GetEntitiesInGroup("mortarMain");
|
||||
if (entities.empty()) return;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (timerName == "PlayEffect") {
|
||||
auto entities = EntityManager::Instance()->GetEntitiesInGroup("mortarMain");
|
||||
|
||||
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(COMPONENT_TYPE_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(COMPONENT_TYPE_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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
#include "AgPicnicBlanket.h"
|
||||
#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);
|
||||
|
||||
auto lootTable = std::unordered_map<LOT, int32_t>{ {935, 3} };
|
||||
LootGenerator::Instance().DropLoot(user, self, lootTable, 0, 0);
|
||||
Loot::DropLoot(user, self, lootTable, 0, 0);
|
||||
|
||||
self->AddCallbackTimer(5.0f, [self]() {
|
||||
self->SetVar<bool>(u"active", false);
|
||||
|
||||
@@ -15,7 +15,7 @@ void AgQbElevator::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
if (delayTime < 1) delayTime = 1;
|
||||
|
||||
GameMessages::SendPlatformResync(self, UNASSIGNED_SYSTEM_ADDRESS, true, 0,
|
||||
0, 0, MovementPlatformState::Stationary);
|
||||
0, 0, eMovementPlatformState::Stationary);
|
||||
|
||||
//add a timer that will kill the QB if no players get on in the killTime
|
||||
self->AddTimer("startKillTimer", killTime);
|
||||
@@ -26,14 +26,14 @@ void AgQbElevator::OnProximityUpdate(Entity* self, Entity* entering, std::string
|
||||
if (self->GetBoolean(u"qbPlayerRdy")) return;
|
||||
|
||||
if (status == "ENTER") {
|
||||
Entity* builder = EntityManager::Instance()->GetEntity(self->GetI64(u"qbPlayer"));
|
||||
Entity* builder = Game::entityManager->GetEntity(self->GetI64(u"qbPlayer"));
|
||||
if (builder && builder == entering) {
|
||||
//the builder has entered so cancel the start timer and just start moving
|
||||
self->SetBoolean(u"qbPlayerRdy", true);
|
||||
self->CancelTimer("StartElevator");
|
||||
|
||||
GameMessages::SendPlatformResync(self, UNASSIGNED_SYSTEM_ADDRESS, true, 0,
|
||||
1, 1, MovementPlatformState::Moving);
|
||||
1, 1, eMovementPlatformState::Moving);
|
||||
} else if (!self->GetBoolean(u"StartTimer")) {
|
||||
self->SetBoolean(u"StartTimer", true);
|
||||
self->AddTimer("StartElevator", startTime);
|
||||
@@ -45,11 +45,11 @@ void AgQbElevator::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
if (timerName == "StartElevator") {
|
||||
GameMessages::SendPlatformResync(self, UNASSIGNED_SYSTEM_ADDRESS, true, 0,
|
||||
1, 1, MovementPlatformState::Moving);
|
||||
1, 1, eMovementPlatformState::Moving);
|
||||
} else if (timerName == "startKillTimer") {
|
||||
killTimerStartup(self);
|
||||
} else if (timerName == "KillTimer") {
|
||||
self->Smash(self->GetObjectID(), VIOLENT);
|
||||
self->Smash(self->GetObjectID(), eKillType::VIOLENT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ void AgQbWall::OnRebuildComplete(Entity* self, Entity* player) {
|
||||
self->SetVar(u"player", player->GetObjectID());
|
||||
auto targetWallSpawners = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"spawner"));
|
||||
if (targetWallSpawners != "") {
|
||||
auto groupObjs = EntityManager::Instance()->GetEntitiesInGroup(targetWallSpawners);
|
||||
auto groupObjs = Game::entityManager->GetEntitiesInGroup(targetWallSpawners);
|
||||
for (auto* obj : groupObjs) {
|
||||
if (obj) {
|
||||
obj->SetVar(u"player", player->GetObjectID());
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#include "AgSalutingNpcs.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
#include "RenderComponent.h"
|
||||
|
||||
void AgSalutingNpcs::OnEmoteReceived(Entity* self, const int32_t emote, Entity* target) {
|
||||
if (emote != 356) {
|
||||
return;
|
||||
}
|
||||
|
||||
GameMessages::SendPlayAnimation(self, u"salutePlayer");
|
||||
RenderComponent::PlayAnimation(self, u"salutePlayer");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include "AgShipPlayerShockServer.h"
|
||||
#include "GameMessages.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "Entity.h"
|
||||
#include "eTerminateType.h"
|
||||
|
||||
void AgShipPlayerShockServer::OnUse(Entity* self, Entity* user) {
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
|
||||
@@ -7,7 +10,7 @@ void AgShipPlayerShockServer::OnUse(Entity* self, Entity* user) {
|
||||
return;
|
||||
}
|
||||
active = true;
|
||||
GameMessages::SendPlayAnimation(user, shockAnim);
|
||||
RenderComponent::PlayAnimation(user, shockAnim);
|
||||
GameMessages::SendKnockback(user->GetObjectID(), self->GetObjectID(), self->GetObjectID(), 0, NiPoint3(-20, 10, -20));
|
||||
|
||||
GameMessages::SendPlayFXEffect(self, 1430, u"create", "console_sparks", LWOOBJID_EMPTY, 1.0, 1.0, true);
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#include "AgSpaceStuff.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "GeneralUtils.h"
|
||||
#include "GameMessages.h"
|
||||
#include "EntityManager.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void AgSpaceStuff::OnStartup(Entity* self) {
|
||||
self->AddTimer("FloaterScale", 5.0f);
|
||||
@@ -12,9 +15,9 @@ void AgSpaceStuff::OnStartup(Entity* self) {
|
||||
info.lot = 33;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* ref = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* ref = Game::entityManager->CreateEntity(info);
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(ref);
|
||||
Game::entityManager->ConstructEntity(ref);
|
||||
|
||||
self->SetVar(u"ShakeObject", ref->GetObjectID());
|
||||
|
||||
@@ -26,13 +29,13 @@ void AgSpaceStuff::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "FloaterScale") {
|
||||
int scaleType = GeneralUtils::GenerateRandomNumber<int>(1, 5);
|
||||
|
||||
GameMessages::SendPlayAnimation(self, u"scale_0" + GeneralUtils::to_u16string(scaleType));
|
||||
RenderComponent::PlayAnimation(self, u"scale_0" + GeneralUtils::to_u16string(scaleType));
|
||||
self->AddTimer("FloaterPath", 0.4);
|
||||
} else if (timerName == "FloaterPath") {
|
||||
int pathType = GeneralUtils::GenerateRandomNumber<int>(1, 4);
|
||||
int randTime = GeneralUtils::GenerateRandomNumber<int>(20, 25);
|
||||
|
||||
GameMessages::SendPlayAnimation(self, u"path_0" + (GeneralUtils::to_u16string(pathType)));
|
||||
RenderComponent::PlayAnimation(self, u"path_0" + (GeneralUtils::to_u16string(pathType)));
|
||||
self->AddTimer("FloaterScale", randTime);
|
||||
} else if (timerName == "ShipShakeExplode") {
|
||||
DoShake(self, true);
|
||||
@@ -44,7 +47,7 @@ void AgSpaceStuff::OnTimerDone(Entity* self, std::string timerName) {
|
||||
void AgSpaceStuff::DoShake(Entity* self, bool explodeIdle) {
|
||||
|
||||
if (!explodeIdle) {
|
||||
auto* ref = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"ShakeObject"));
|
||||
auto* ref = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"ShakeObject"));
|
||||
|
||||
const auto randomTime = self->GetVar<int>(u"RandomTime");
|
||||
auto time = GeneralUtils::GenerateRandomNumber<int>(0, randomTime + 1);
|
||||
@@ -75,21 +78,21 @@ void AgSpaceStuff::DoShake(Entity* self, bool explodeIdle) {
|
||||
|
||||
auto* shipFxObject2 = GetEntityInGroup(ShipFX2);
|
||||
if (shipFxObject2)
|
||||
GameMessages::SendPlayAnimation(shipFxObject2, u"explosion");
|
||||
RenderComponent::PlayAnimation(shipFxObject2, u"explosion");
|
||||
} else {
|
||||
auto* shipFxObject = GetEntityInGroup(ShipFX);
|
||||
auto* shipFxObject2 = GetEntityInGroup(ShipFX2);
|
||||
|
||||
if (shipFxObject)
|
||||
GameMessages::SendPlayAnimation(shipFxObject, u"idle");
|
||||
RenderComponent::PlayAnimation(shipFxObject, u"idle");
|
||||
|
||||
if (shipFxObject2)
|
||||
GameMessages::SendPlayAnimation(shipFxObject2, u"idle");
|
||||
RenderComponent::PlayAnimation(shipFxObject2, u"idle");
|
||||
}
|
||||
}
|
||||
|
||||
Entity* AgSpaceStuff::GetEntityInGroup(const std::string& group) {
|
||||
auto entities = EntityManager::Instance()->GetEntitiesInGroup(group);
|
||||
auto entities = Game::entityManager->GetEntitiesInGroup(group);
|
||||
Entity* en = nullptr;
|
||||
|
||||
for (auto entity : entities) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "AgStromlingProperty.h"
|
||||
#include "MovementAIComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void AgStromlingProperty::OnStartup(Entity* self) {
|
||||
auto movementInfo = MovementAIInfo{
|
||||
@@ -11,6 +12,5 @@ void AgStromlingProperty::OnStartup(Entity* self) {
|
||||
4
|
||||
};
|
||||
|
||||
auto* movementAIComponent = new MovementAIComponent(self, movementInfo);
|
||||
self->AddComponent(COMPONENT_TYPE_MOVEMENT_AI, movementAIComponent);
|
||||
self->AddComponent<MovementAIComponent>(movementInfo);
|
||||
}
|
||||
|
||||
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 = Game::entityManager->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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
#include "RebuildComponent.h"
|
||||
#include "GameMessages.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "eEndBehavior.h"
|
||||
|
||||
void ActParadoxPipeFix::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
const auto myGroup = "AllPipes";
|
||||
|
||||
const auto groupObjs = EntityManager::Instance()->GetEntitiesInGroup(myGroup);
|
||||
const auto groupObjs = Game::entityManager->GetEntitiesInGroup(myGroup);
|
||||
|
||||
auto indexCount = 0;
|
||||
|
||||
@@ -20,20 +21,20 @@ void ActParadoxPipeFix::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
|
||||
auto* rebuildComponent = object->GetComponent<RebuildComponent>();
|
||||
|
||||
if (rebuildComponent->GetState() == REBUILD_COMPLETED) {
|
||||
if (rebuildComponent->GetState() == eRebuildState::COMPLETED) {
|
||||
indexCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (indexCount >= 2) {
|
||||
const auto refinery = EntityManager::Instance()->GetEntitiesInGroup("Paradox");
|
||||
const auto refinery = Game::entityManager->GetEntitiesInGroup("Paradox");
|
||||
|
||||
if (!refinery.empty()) {
|
||||
GameMessages::SendPlayFXEffect(refinery[0]->GetObjectID(), 3999, u"create", "pipeFX");
|
||||
}
|
||||
|
||||
for (auto* object : groupObjs) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(object->GetVar<LWOOBJID>(u"PlayerID"));
|
||||
auto* player = Game::entityManager->GetEntity(object->GetVar<LWOOBJID>(u"PlayerID"));
|
||||
|
||||
if (player != nullptr) {
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
@@ -42,7 +43,7 @@ void ActParadoxPipeFix::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
missionComponent->ForceProgressTaskType(769, 1, 1, false);
|
||||
}
|
||||
|
||||
GameMessages::SendPlayCinematic(player->GetObjectID(), u"ParadoxPipeFinish", player->GetSystemAddress(), true, true, false, false, 0, false, 2.0f);
|
||||
GameMessages::SendPlayCinematic(player->GetObjectID(), u"ParadoxPipeFinish", player->GetSystemAddress(), true, true, false, false, eEndBehavior::RETURN, false, 2.0f);
|
||||
}
|
||||
|
||||
object->SetVar(u"PlayerID", LWOOBJID_EMPTY);
|
||||
@@ -51,8 +52,8 @@ void ActParadoxPipeFix::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
}
|
||||
|
||||
void ActParadoxPipeFix::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (state == REBUILD_RESETTING) {
|
||||
const auto refinery = EntityManager::Instance()->GetEntitiesInGroup("Paradox");
|
||||
if (state == eRebuildState::RESETTING) {
|
||||
const auto refinery = Game::entityManager->GetEntitiesInGroup("Paradox");
|
||||
|
||||
if (!refinery.empty()) {
|
||||
GameMessages::SendStopFXEffect(refinery[0], true, "pipeFX");
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
set(DSCRIPTS_SOURCES_AI_FV
|
||||
set(DSCRIPTS_SOURCES_AI_FV
|
||||
"ActNinjaSensei.cpp"
|
||||
"ActNinjaTurret.cpp"
|
||||
"FvFlyingCreviceDragon.cpp"
|
||||
"FvDragonSmashingGolemQb.cpp"
|
||||
@@ -16,4 +17,5 @@ set(DSCRIPTS_SOURCES_AI_FV
|
||||
"FvPassThroughWall.cpp"
|
||||
"FvBounceOverWall.cpp"
|
||||
"FvMaelstromGeyser.cpp"
|
||||
"TriggerGas.cpp"
|
||||
PARENT_SCOPE)
|
||||
|
||||
@@ -29,7 +29,7 @@ void FvBrickPuzzleServer::OnDie(Entity* self, Entity* killer) {
|
||||
|
||||
const auto nextPipeNum = pipeNum + 1;
|
||||
|
||||
const auto samePipeSpawners = dZoneManager::Instance()->GetSpawnersByName(myGroup);
|
||||
const auto samePipeSpawners = Game::zoneManager->GetSpawnersByName(myGroup);
|
||||
|
||||
if (!samePipeSpawners.empty()) {
|
||||
samePipeSpawners[0]->SoftReset();
|
||||
@@ -40,7 +40,7 @@ void FvBrickPuzzleServer::OnDie(Entity* self, Entity* killer) {
|
||||
if (killer != nullptr && killer->IsPlayer()) {
|
||||
const auto nextPipe = pipeGroup + std::to_string(nextPipeNum);
|
||||
|
||||
const auto nextPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe);
|
||||
const auto nextPipeSpawners = Game::zoneManager->GetSpawnersByName(nextPipe);
|
||||
|
||||
if (!nextPipeSpawners.empty()) {
|
||||
nextPipeSpawners[0]->Activate();
|
||||
@@ -48,7 +48,7 @@ void FvBrickPuzzleServer::OnDie(Entity* self, Entity* killer) {
|
||||
} else {
|
||||
const auto nextPipe = pipeGroup + "1";
|
||||
|
||||
const auto firstPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe);
|
||||
const auto firstPipeSpawners = Game::zoneManager->GetSpawnersByName(nextPipe);
|
||||
|
||||
if (!firstPipeSpawners.empty()) {
|
||||
firstPipeSpawners[0]->Activate();
|
||||
@@ -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,19 +10,19 @@ 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");
|
||||
const auto objects = Game::entityManager->GetEntitiesInGroup("Facility");
|
||||
|
||||
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);
|
||||
|
||||
const auto objects = EntityManager::Instance()->GetEntitiesInGroup("Facility");
|
||||
const auto objects = Game::entityManager->GetEntitiesInGroup("Facility");
|
||||
|
||||
if (!objects.empty()) {
|
||||
objects[0]->NotifyObject(self, "ConsoleLeftDown");
|
||||
@@ -36,12 +38,12 @@ void FvConsoleLeftQuickbuild::OnUse(Entity* self, Entity* user) {
|
||||
if (self->GetVar<bool>(u"IAmBuilt")) {
|
||||
self->SetVar(u"AmActive", true);
|
||||
|
||||
const auto objects = EntityManager::Instance()->GetEntitiesInGroup("Facility");
|
||||
const auto objects = Game::entityManager->GetEntitiesInGroup("Facility");
|
||||
|
||||
if (!objects.empty()) {
|
||||
objects[0]->NotifyObject(self, "ConsoleLeftActive");
|
||||
}
|
||||
}
|
||||
|
||||
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,19 +10,19 @@ 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");
|
||||
const auto objects = Game::entityManager->GetEntitiesInGroup("Facility");
|
||||
|
||||
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);
|
||||
|
||||
const auto objects = EntityManager::Instance()->GetEntitiesInGroup("Facility");
|
||||
const auto objects = Game::entityManager->GetEntitiesInGroup("Facility");
|
||||
|
||||
if (!objects.empty()) {
|
||||
objects[0]->NotifyObject(self, "ConsoleRightDown");
|
||||
@@ -36,12 +38,12 @@ void FvConsoleRightQuickbuild::OnUse(Entity* self, Entity* user) {
|
||||
if (self->GetVar<bool>(u"IAmBuilt")) {
|
||||
self->SetVar(u"AmActive", true);
|
||||
|
||||
const auto objects = EntityManager::Instance()->GetEntitiesInGroup("Facility");
|
||||
const auto objects = Game::entityManager->GetEntitiesInGroup("Facility");
|
||||
|
||||
if (!objects.empty()) {
|
||||
objects[0]->NotifyObject(self, "ConsoleRightActive");
|
||||
}
|
||||
}
|
||||
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#include "FvDragonSmashingGolemQb.h"
|
||||
#include "GameMessages.h"
|
||||
#include "EntityManager.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "Entity.h"
|
||||
#include "eRebuildState.h"
|
||||
|
||||
void FvDragonSmashingGolemQb::OnStartup(Entity* self) {
|
||||
self->AddTimer("GolemBreakTimer", 10.5f);
|
||||
@@ -13,12 +16,12 @@ void FvDragonSmashingGolemQb::OnTimerDone(Entity* self, std::string timerName) {
|
||||
}
|
||||
|
||||
void FvDragonSmashingGolemQb::OnRebuildNotifyState(Entity* self, eRebuildState state) {
|
||||
if (state == eRebuildState::REBUILD_COMPLETED) {
|
||||
GameMessages::SendPlayAnimation(self, u"dragonsmash");
|
||||
if (state == eRebuildState::COMPLETED) {
|
||||
RenderComponent::PlayAnimation(self, u"dragonsmash");
|
||||
|
||||
const auto dragonId = self->GetVar<LWOOBJID>(u"Dragon");
|
||||
|
||||
auto* dragon = EntityManager::Instance()->GetEntity(dragonId);
|
||||
auto* dragon = Game::entityManager->GetEntity(dragonId);
|
||||
|
||||
if (dragon != nullptr) {
|
||||
dragon->OnFireEventServerSide(self, "rebuildDone");
|
||||
|
||||
@@ -9,9 +9,9 @@ void FvFacilityBrick::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void FvFacilityBrick::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) {
|
||||
auto* brickSpawner = dZoneManager::Instance()->GetSpawnersByName("ImaginationBrick")[0];
|
||||
auto* bugSpawner = dZoneManager::Instance()->GetSpawnersByName("MaelstromBug")[0];
|
||||
auto* canisterSpawner = dZoneManager::Instance()->GetSpawnersByName("BrickCanister")[0];
|
||||
auto* brickSpawner = Game::zoneManager->GetSpawnersByName("ImaginationBrick")[0];
|
||||
auto* bugSpawner = Game::zoneManager->GetSpawnersByName("MaelstromBug")[0];
|
||||
auto* canisterSpawner = Game::zoneManager->GetSpawnersByName("BrickCanister")[0];
|
||||
|
||||
if (name == "ConsoleLeftUp") {
|
||||
GameMessages::SendStopFXEffect(self, true, "LeftPipeOff");
|
||||
@@ -46,17 +46,17 @@ void FvFacilityBrick::OnNotifyObject(Entity* self, Entity* sender, const std::st
|
||||
}
|
||||
|
||||
if (self->GetVar<bool>(u"ConsoleLEFTActive") && self->GetVar<bool>(u"ConsoleRIGHTActive")) {
|
||||
auto* object = EntityManager::Instance()->GetEntitiesInGroup("Brick")[0];
|
||||
auto* object = Game::entityManager->GetEntitiesInGroup("Brick")[0];
|
||||
|
||||
if (object != nullptr) {
|
||||
GameMessages::SendPlayFXEffect(object->GetObjectID(), 122, u"create", "bluebrick");
|
||||
GameMessages::SendPlayFXEffect(object->GetObjectID(), 1034, u"cast", "imaginationexplosion");
|
||||
}
|
||||
|
||||
object = EntityManager::Instance()->GetEntitiesInGroup("Canister")[0];
|
||||
object = Game::entityManager->GetEntitiesInGroup("Canister")[0];
|
||||
|
||||
if (object != nullptr) {
|
||||
object->Smash(self->GetObjectID(), SILENT);
|
||||
object->Smash(self->GetObjectID(), eKillType::SILENT);
|
||||
}
|
||||
|
||||
canisterSpawner->Reset();
|
||||
@@ -64,7 +64,7 @@ void FvFacilityBrick::OnNotifyObject(Entity* self, Entity* sender, const std::st
|
||||
} else if (self->GetVar<bool>(u"ConsoleLEFTActive") || self->GetVar<bool>(u"ConsoleRIGHTActive")) {
|
||||
brickSpawner->Activate();
|
||||
|
||||
auto* object = EntityManager::Instance()->GetEntitiesInGroup("Brick")[0];
|
||||
auto* object = Game::entityManager->GetEntitiesInGroup("Brick")[0];
|
||||
|
||||
if (object != nullptr) {
|
||||
GameMessages::SendStopFXEffect(object, true, "bluebrick");
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "EntityManager.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "GeneralUtils.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
void FvFlyingCreviceDragon::OnStartup(Entity* self) {
|
||||
self->AddTimer("waypoint", 5);
|
||||
@@ -33,7 +34,7 @@ void FvFlyingCreviceDragon::OnTimerDone(Entity* self, std::string timerName) {
|
||||
groupName = "dragonFireballs3";
|
||||
}
|
||||
|
||||
const auto& group = EntityManager::Instance()->GetEntitiesInGroup(groupName);
|
||||
const auto& group = Game::entityManager->GetEntitiesInGroup(groupName);
|
||||
|
||||
if (group.empty()) {
|
||||
return;
|
||||
@@ -67,12 +68,12 @@ void FvFlyingCreviceDragon::OnArrived(Entity* self) {
|
||||
auto point = self->GetVar<int32_t>(u"waypoint");
|
||||
|
||||
if (point == 4) {
|
||||
GameMessages::SendPlayAnimation(self, u"attack1", 2);
|
||||
RenderComponent::PlayAnimation(self, u"attack1", 2.0f);
|
||||
self->AddTimer("platform1attack", 1.75f);
|
||||
} else if (point == 12) {
|
||||
GameMessages::SendPlayAnimation(self, u"attack2", 2);
|
||||
RenderComponent::PlayAnimation(self, u"attack2", 2.0f);
|
||||
|
||||
const auto& group2 = EntityManager::Instance()->GetEntitiesInGroup("dragonFireballs2");
|
||||
const auto& group2 = Game::entityManager->GetEntitiesInGroup("dragonFireballs2");
|
||||
|
||||
if (group2.empty()) {
|
||||
return;
|
||||
@@ -101,7 +102,7 @@ void FvFlyingCreviceDragon::OnArrived(Entity* self) {
|
||||
}
|
||||
}
|
||||
} else if (point == 16) {
|
||||
GameMessages::SendPlayAnimation(self, u"attack3", 2);
|
||||
RenderComponent::PlayAnimation(self, u"attack3", 2.0f);
|
||||
self->AddTimer("platform3attack", 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "FvFreeGfNinjas.h"
|
||||
#include "Character.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "eMissionState.h"
|
||||
|
||||
void FvFreeGfNinjas::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
if (missionID == 705 && missionState == MissionState::MISSION_STATE_AVAILABLE) {
|
||||
void FvFreeGfNinjas::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
||||
if (missionID == 705 && missionState == eMissionState::AVAILABLE) {
|
||||
auto* missionComponent = target->GetComponent<MissionComponent>();
|
||||
if (missionComponent == nullptr)
|
||||
return;
|
||||
@@ -29,7 +30,7 @@ void FvFreeGfNinjas::OnUse(Entity* self, Entity* user) {
|
||||
if (missionComponent == nullptr)
|
||||
return;
|
||||
|
||||
if (missionComponent->GetMissionState(705) == MissionState::MISSION_STATE_ACTIVE) {
|
||||
if (missionComponent->GetMissionState(705) == eMissionState::ACTIVE) {
|
||||
auto* character = user->GetCharacter();
|
||||
if (character != nullptr)
|
||||
character->SetPlayerFlag(68, true);
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
|
||||
class FvFreeGfNinjas : public CppScripts::Script {
|
||||
public:
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "FvNinjaGuard.h"
|
||||
#include "GameMessages.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
void FvNinjaGuard::OnStartup(Entity* self) {
|
||||
if (self->GetLOT() == 7412) {
|
||||
@@ -12,24 +14,24 @@ void FvNinjaGuard::OnStartup(Entity* self) {
|
||||
|
||||
void FvNinjaGuard::OnEmoteReceived(Entity* self, const int32_t emote, Entity* target) {
|
||||
if (emote != 392) {
|
||||
GameMessages::SendPlayAnimation(self, u"no");
|
||||
RenderComponent::PlayAnimation(self, u"no");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
GameMessages::SendPlayAnimation(self, u"scared");
|
||||
RenderComponent::PlayAnimation(self, u"scared");
|
||||
|
||||
if (self->GetLOT() == 7412) {
|
||||
auto* rightGuard = EntityManager::Instance()->GetEntity(m_RightGuard);
|
||||
auto* rightGuard = Game::entityManager->GetEntity(m_RightGuard);
|
||||
|
||||
if (rightGuard != nullptr) {
|
||||
GameMessages::SendPlayAnimation(rightGuard, u"laugh_rt");
|
||||
RenderComponent::PlayAnimation(rightGuard, u"laugh_rt");
|
||||
}
|
||||
} else if (self->GetLOT() == 11128) {
|
||||
auto* leftGuard = EntityManager::Instance()->GetEntity(m_LeftGuard);
|
||||
auto* leftGuard = Game::entityManager->GetEntity(m_LeftGuard);
|
||||
|
||||
if (leftGuard != nullptr) {
|
||||
GameMessages::SendPlayAnimation(leftGuard, u"laugh_lt");
|
||||
RenderComponent::PlayAnimation(leftGuard, u"laugh_lt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
#include "Character.h"
|
||||
#include "EntityManager.h"
|
||||
#include "GameMessages.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "ScriptedActivityComponent.h"
|
||||
|
||||
void FvPandaSpawnerServer::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
auto* character = target->GetCharacter();
|
||||
if (character != nullptr && character->GetPlayerFlag(81)) {
|
||||
|
||||
auto raceObjects = EntityManager::Instance()->GetEntitiesInGroup("PandaRaceObject");
|
||||
auto raceObjects = Game::entityManager->GetEntitiesInGroup("PandaRaceObject");
|
||||
if (raceObjects.empty())
|
||||
return;
|
||||
|
||||
@@ -18,7 +19,7 @@ void FvPandaSpawnerServer::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
return;
|
||||
|
||||
// If the player already spawned a panda
|
||||
auto playerPandas = EntityManager::Instance()->GetEntitiesInGroup("panda" + std::to_string(target->GetObjectID()));
|
||||
auto playerPandas = Game::entityManager->GetEntitiesInGroup("panda" + std::to_string(target->GetObjectID()));
|
||||
if (!playerPandas.empty()) {
|
||||
GameMessages::SendFireEventClientSide(self->GetObjectID(), target->GetSystemAddress(), u"playerPanda",
|
||||
target->GetObjectID(), 0, 0, target->GetObjectID());
|
||||
@@ -26,7 +27,7 @@ void FvPandaSpawnerServer::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
}
|
||||
|
||||
// If there's already too many spawned pandas
|
||||
auto pandas = EntityManager::Instance()->GetEntitiesInGroup("pandas");
|
||||
auto pandas = Game::entityManager->GetEntitiesInGroup("pandas");
|
||||
if (pandas.size() > 4) {
|
||||
GameMessages::SendFireEventClientSide(self->GetObjectID(), target->GetSystemAddress(), u"tooManyPandas",
|
||||
target->GetObjectID(), 0, 0, target->GetObjectID());
|
||||
@@ -42,7 +43,7 @@ void FvPandaSpawnerServer::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
new LDFData<std::u16string>(u"groupID", u"panda" + (GeneralUtils::to_u16string(target->GetObjectID())) + u";pandas")
|
||||
};
|
||||
|
||||
auto* panda = EntityManager::Instance()->CreateEntity(info);
|
||||
EntityManager::Instance()->ConstructEntity(panda);
|
||||
auto* panda = Game::entityManager->CreateEntity(info);
|
||||
Game::entityManager->ConstructEntity(panda);
|
||||
}
|
||||
}
|
||||
|
||||
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 "Logger.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");
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#include "Entity.h"
|
||||
#include "GameMessages.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "eMissionState.h"
|
||||
|
||||
void LegoDieRoll::OnStartup(Entity* self) {
|
||||
self->AddTimer("DoneRolling", 10.0f);
|
||||
@@ -10,36 +12,36 @@ 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);
|
||||
|
||||
switch (dieRoll) {
|
||||
case 1:
|
||||
GameMessages::SendPlayAnimation(self, u"roll-die-1");
|
||||
RenderComponent::PlayAnimation(self, u"roll-die-1");
|
||||
break;
|
||||
case 2:
|
||||
GameMessages::SendPlayAnimation(self, u"roll-die-2");
|
||||
RenderComponent::PlayAnimation(self, u"roll-die-2");
|
||||
break;
|
||||
case 3:
|
||||
GameMessages::SendPlayAnimation(self, u"roll-die-3");
|
||||
RenderComponent::PlayAnimation(self, u"roll-die-3");
|
||||
break;
|
||||
case 4:
|
||||
GameMessages::SendPlayAnimation(self, u"roll-die-4");
|
||||
RenderComponent::PlayAnimation(self, u"roll-die-4");
|
||||
break;
|
||||
case 5:
|
||||
GameMessages::SendPlayAnimation(self, u"roll-die-5");
|
||||
RenderComponent::PlayAnimation(self, u"roll-die-5");
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
GameMessages::SendPlayAnimation(self, u"roll-die-6");
|
||||
RenderComponent::PlayAnimation(self, u"roll-die-6");
|
||||
// tracking the It's Truly Random Achievement
|
||||
auto* owner = self->GetOwner();
|
||||
auto* missionComponent = owner->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr) {
|
||||
const auto rollMissionState = missionComponent->GetMissionState(756);
|
||||
if (rollMissionState == MissionState::MISSION_STATE_ACTIVE) {
|
||||
if (rollMissionState == eMissionState::ACTIVE) {
|
||||
missionComponent->ForceProgress(756, 1103, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "Entity.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "EntityManager.h"
|
||||
|
||||
void GfBanana::SpawnBanana(Entity* self) {
|
||||
@@ -19,9 +20,9 @@ void GfBanana::SpawnBanana(Entity* self) {
|
||||
info.lot = 6909;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* entity = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* entity = Game::entityManager->CreateEntity(info);
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(entity);
|
||||
Game::entityManager->ConstructEntity(entity);
|
||||
|
||||
self->SetVar(u"banana", entity->GetObjectID());
|
||||
|
||||
@@ -45,7 +46,7 @@ void GfBanana::OnHit(Entity* self, Entity* attacker) {
|
||||
|
||||
if (bananaId == LWOOBJID_EMPTY) return;
|
||||
|
||||
auto* bananaEntity = EntityManager::Instance()->GetEntity(bananaId);
|
||||
auto* bananaEntity = Game::entityManager->GetEntity(bananaId);
|
||||
|
||||
if (bananaEntity == nullptr) {
|
||||
self->SetVar(u"banana", LWOOBJID_EMPTY);
|
||||
@@ -78,12 +79,12 @@ void GfBanana::OnHit(Entity* self, Entity* attacker) {
|
||||
info.lot = 6718;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
|
||||
auto* entity = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* entity = Game::entityManager->CreateEntity(info);
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(entity, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
Game::entityManager->ConstructEntity(entity, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
*/
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
Game::entityManager->SerializeEntity(self);
|
||||
}
|
||||
|
||||
void GfBanana::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
#include "MissionComponent.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void GfCampfire::OnStartup(Entity* self) {
|
||||
self->SetI32(u"counter", static_cast<int32_t>(0));
|
||||
self->SetProximityRadius(2.0f, "placeholder");
|
||||
self->SetBoolean(u"isBurning", true);
|
||||
|
||||
auto* render = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
|
||||
auto* render = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
|
||||
if (render == nullptr)
|
||||
return;
|
||||
|
||||
@@ -20,7 +21,7 @@ void GfCampfire::OnStartup(Entity* self) {
|
||||
void GfCampfire::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) {
|
||||
if (args == "physicsReady") {
|
||||
auto* render = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER));
|
||||
auto* render = static_cast<RenderComponent*>(self->GetComponent(eReplicaComponentType::RENDER));
|
||||
|
||||
render->PlayEffect(295, u"running", "Burn");
|
||||
}
|
||||
@@ -82,7 +83,7 @@ void GfCampfire::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
const auto targetId = self->GetVar<LWOOBJID>("target");
|
||||
|
||||
auto* entering = EntityManager::Instance()->GetEntity(targetId);
|
||||
auto* entering = Game::entityManager->GetEntity(targetId);
|
||||
|
||||
if (entering == nullptr)
|
||||
{
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
#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"));
|
||||
|
||||
for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName("Jail0" + wall)) {
|
||||
for (auto* spawner : Game::zoneManager->GetSpawnersByName("Jail0" + wall)) {
|
||||
spawner->Deactivate();
|
||||
}
|
||||
|
||||
for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName("JailCaptain0" + wall)) {
|
||||
for (auto* spawner : Game::zoneManager->GetSpawnersByName("JailCaptain0" + wall)) {
|
||||
spawner->Deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
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"));
|
||||
|
||||
for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName("Jail0" + wall)) {
|
||||
for (auto* spawner : Game::zoneManager->GetSpawnersByName("Jail0" + wall)) {
|
||||
spawner->Activate();
|
||||
}
|
||||
|
||||
for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName("JailCaptain0" + wall)) {
|
||||
for (auto* spawner : Game::zoneManager->GetSpawnersByName("JailCaptain0" + wall)) {
|
||||
spawner->Activate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
#include "GfJailkeepMission.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "Character.h"
|
||||
#include "eMissionState.h"
|
||||
|
||||
void GfJailkeepMission::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
void GfJailkeepMission::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
||||
auto* missionComponent = target->GetComponent<MissionComponent>();
|
||||
if (missionComponent == nullptr)
|
||||
return;
|
||||
|
||||
if (missionID == 385 && missionState == MissionState::MISSION_STATE_AVAILABLE) {
|
||||
if (missionID == 385 && missionState == eMissionState::AVAILABLE) {
|
||||
missionComponent->AcceptMission(386, true);
|
||||
missionComponent->AcceptMission(387, true);
|
||||
missionComponent->AcceptMission(388, true);
|
||||
missionComponent->AcceptMission(390, true);
|
||||
} else if (missionID == 385 && missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
|
||||
} else if (missionID == 385 && missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
|
||||
auto* character = target->GetCharacter();
|
||||
if (character != nullptr && character->GetPlayerFlag(68)) {
|
||||
missionComponent->AcceptMission(701);
|
||||
@@ -28,7 +29,7 @@ void GfJailkeepMission::OnUse(Entity* self, Entity* user) {
|
||||
if (missionComponent == nullptr)
|
||||
return;
|
||||
|
||||
if (missionComponent->GetMissionState(385) == MissionState::MISSION_STATE_ACTIVE) {
|
||||
if (missionComponent->GetMissionState(385) == eMissionState::ACTIVE) {
|
||||
missionComponent->AcceptMission(386, true);
|
||||
missionComponent->AcceptMission(387, true);
|
||||
missionComponent->AcceptMission(388, true);
|
||||
|
||||
@@ -5,5 +5,5 @@ class GfJailkeepMission final : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "GfOrgan.h"
|
||||
#include "GameMessages.h"
|
||||
#include "Entity.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
void GfOrgan::OnUse(Entity* self, Entity* user) {
|
||||
if (self->GetBoolean(u"bIsInUse")) {
|
||||
@@ -11,7 +13,7 @@ void GfOrgan::OnUse(Entity* self, Entity* user) {
|
||||
self->SetBoolean(u"bIsInUse", true);
|
||||
self->AddTimer("reset", 5.0f);
|
||||
|
||||
GameMessages::SendPlayAnimation(user, u"jig");
|
||||
RenderComponent::PlayAnimation(user, u"jig");
|
||||
}
|
||||
|
||||
void GfOrgan::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "GfParrotCrash.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "Entity.h"
|
||||
#include "dLogger.h"
|
||||
#include "Logger.h"
|
||||
|
||||
void GfParrotCrash::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
|
||||
auto* skillComponent = self->GetComponent<SkillComponent>();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "PetDigBuild.h"
|
||||
#include "EntityManager.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "eMissionState.h"
|
||||
|
||||
void PetDigBuild::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
auto flagNumber = self->GetVar<std::u16string>(u"flagNum");
|
||||
@@ -21,15 +23,15 @@ void PetDigBuild::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
info.settings.push_back(new LDFData<std::u16string>(u"groupID", u"Flag" + flagNumber));
|
||||
} else {
|
||||
auto* missionComponent = target->GetComponent<MissionComponent>();
|
||||
if (missionComponent != nullptr && missionComponent->GetMissionState(746) == MissionState::MISSION_STATE_ACTIVE) {
|
||||
if (missionComponent != nullptr && missionComponent->GetMissionState(746) == eMissionState::ACTIVE) {
|
||||
info.lot = 9307; // Special Captain Jack treasure that drops a mission item
|
||||
} else {
|
||||
info.lot = 3495; // Normal AG treasure
|
||||
}
|
||||
}
|
||||
|
||||
auto* treasure = EntityManager::Instance()->CreateEntity(info);
|
||||
EntityManager::Instance()->ConstructEntity(treasure);
|
||||
auto* treasure = Game::entityManager->CreateEntity(info);
|
||||
Game::entityManager->ConstructEntity(treasure);
|
||||
self->SetVar<LWOOBJID>(u"chestObj", treasure->GetObjectID());
|
||||
}
|
||||
|
||||
@@ -38,12 +40,12 @@ void PetDigBuild::OnDie(Entity* self, Entity* killer) {
|
||||
if (treasureID == LWOOBJID_EMPTY)
|
||||
return;
|
||||
|
||||
auto treasure = EntityManager::Instance()->GetEntity(treasureID);
|
||||
auto treasure = Game::entityManager->GetEntity(treasureID);
|
||||
if (treasure == nullptr)
|
||||
return;
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
#include "PirateRep.h"
|
||||
#include "Character.h"
|
||||
#include "eMissionState.h"
|
||||
#include "Entity.h"
|
||||
#include "ePlayerFlag.h"
|
||||
|
||||
void PirateRep::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
if (missionID == m_PirateRepMissionID && missionState >= MissionState::MISSION_STATE_READY_TO_COMPLETE) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
class PirateRep : public CppScripts::Script {
|
||||
public:
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
|
||||
private:
|
||||
const int m_PirateRepMissionID = 301;
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ void TriggerAmbush::OnProximityUpdate(Entity* self, Entity* entering, std::strin
|
||||
|
||||
self->SetVar(u"triggered", true);
|
||||
|
||||
const auto spawners = dZoneManager::Instance()->GetSpawnersByName("Ambush");
|
||||
const auto spawners = Game::zoneManager->GetSpawnersByName("Ambush");
|
||||
|
||||
for (auto* spawner : spawners) {
|
||||
spawner->Activate();
|
||||
@@ -27,7 +27,7 @@ void TriggerAmbush::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
self->SetVar(u"triggered", false);
|
||||
|
||||
const auto spawners = dZoneManager::Instance()->GetSpawnersByName("Ambush");
|
||||
const auto spawners = Game::zoneManager->GetSpawnersByName("Ambush");
|
||||
|
||||
for (auto* spawner : spawners) {
|
||||
spawner->Reset();
|
||||
|
||||
@@ -11,10 +11,15 @@
|
||||
#include "MovementAIComponent.h"
|
||||
#include "../dWorldServer/ObjectIDManager.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "Loot.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "eGameActivity.h"
|
||||
|
||||
void SGCannon::OnStartup(Entity* self) {
|
||||
Game::logger->Log("SGCannon", "OnStartup");
|
||||
LOG("OnStartup");
|
||||
|
||||
m_Waves = GetWaves();
|
||||
constants = GetConstants();
|
||||
@@ -60,7 +65,7 @@ void SGCannon::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void SGCannon::OnPlayerLoaded(Entity* self, Entity* player) {
|
||||
Game::logger->Log("SGCannon", "Player loaded");
|
||||
LOG("Player loaded");
|
||||
self->SetVar<LWOOBJID>(PlayerIDVariable, player->GetObjectID());
|
||||
}
|
||||
|
||||
@@ -71,15 +76,15 @@ void SGCannon::OnFireEventServerSide(Entity* self, Entity* sender, std::string a
|
||||
|
||||
void SGCannon::OnActivityStateChangeRequest(Entity* self, LWOOBJID senderID, int32_t value1, int32_t value2,
|
||||
const std::u16string& stringValue) {
|
||||
Game::logger->Log("SGCannon", "Got activity state change request: %s", GeneralUtils::UTF16ToWTF8(stringValue).c_str());
|
||||
LOG("Got activity state change request: %s", GeneralUtils::UTF16ToWTF8(stringValue).c_str());
|
||||
if (stringValue == u"clientready") {
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (player != nullptr) {
|
||||
Game::logger->Log("SGCannon", "Player is ready");
|
||||
/*GameMessages::SendSetStunned(player->GetObjectID(), PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
|
||||
LOG("Player is ready");
|
||||
/*GameMessages::SendSetStunned(player->GetObjectID(), eStateChangeType::PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
|
||||
true, true, true, true, true, true, true);*/
|
||||
|
||||
Game::logger->Log("SGCannon", "Sending ActivityEnter");
|
||||
LOG("Sending ActivityEnter");
|
||||
|
||||
GameMessages::SendActivityEnter(self->GetObjectID(), player->GetSystemAddress());
|
||||
|
||||
@@ -88,25 +93,25 @@ void SGCannon::OnActivityStateChangeRequest(Entity* self, LWOOBJID senderID, int
|
||||
if (shootingGalleryComponent != nullptr) {
|
||||
shootingGalleryComponent->SetCurrentPlayerID(player->GetObjectID());
|
||||
|
||||
Game::logger->Log("SGCannon", "Setting player ID");
|
||||
LOG("Setting player ID");
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
Game::entityManager->SerializeEntity(self);
|
||||
} else {
|
||||
Game::logger->Log("SGCannon", "Shooting gallery component is null");
|
||||
LOG("Shooting gallery component is null");
|
||||
}
|
||||
|
||||
auto* characterComponent = player->GetComponent<CharacterComponent>();
|
||||
|
||||
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());
|
||||
possessor->SetPossessableType(ePossessionType::NO_POSSESSION);
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(player);
|
||||
Game::entityManager->SerializeEntity(player);
|
||||
}
|
||||
|
||||
self->SetNetworkVar<bool>(HideScoreBoardVariable, true);
|
||||
@@ -124,207 +129,227 @@ void SGCannon::OnActivityStateChangeRequest(Entity* self, LWOOBJID senderID, int
|
||||
|
||||
//GameMessages::SendRequestActivityEnter(self->GetObjectID(), player->GetSystemAddress(), false, player->GetObjectID());
|
||||
} else {
|
||||
Game::logger->Log("SGCannon", "Player not found");
|
||||
LOG("Player not found");
|
||||
}
|
||||
} else if (value1 == 1200) {
|
||||
StartGame(self);
|
||||
}
|
||||
}
|
||||
|
||||
void SGCannon::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier,
|
||||
const std::u16string& userData) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (player != nullptr) {
|
||||
if (button == 1 && identifier == u"Shooting_Gallery_Stop") {
|
||||
void SGCannon::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) {
|
||||
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (!player) return;
|
||||
|
||||
if (identifier == u"Scoreboardinfo") {
|
||||
GameMessages::SendDisplayMessageBox(player->GetObjectID(), true,
|
||||
Game::zoneManager->GetZoneControlObject()->GetObjectID(),
|
||||
u"Shooting_Gallery_Retry", 2, u"Retry?",
|
||||
u"", player->GetSystemAddress());
|
||||
} else {
|
||||
if ((button == 1 && (identifier == u"Shooting_Gallery_Retry" || identifier == u"RePlay")) || identifier == u"SG1" || button == 0) {
|
||||
if (IsPlayerInActivity(self, player->GetObjectID())) return;
|
||||
self->SetNetworkVar<bool>(ClearVariable, true);
|
||||
StartGame(self);
|
||||
} else if (button == 0 && ((identifier == u"Shooting_Gallery_Retry" || identifier == u"RePlay"))) {
|
||||
RemovePlayer(player->GetObjectID());
|
||||
UpdatePlayer(self, player->GetObjectID(), true);
|
||||
} else if (button == 1 && identifier == u"Shooting_Gallery_Exit") {
|
||||
UpdatePlayer(self, player->GetObjectID(), true);
|
||||
RemovePlayer(player->GetObjectID());
|
||||
StopGame(self, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (identifier == u"Scoreboardinfo") {
|
||||
GameMessages::SendDisplayMessageBox(player->GetObjectID(), true,
|
||||
dZoneManager::Instance()->GetZoneControlObject()->GetObjectID(),
|
||||
u"Shooting_Gallery_Retry?", 2, u"Retry?",
|
||||
u"", player->GetSystemAddress());
|
||||
} else {
|
||||
if ((button == 1 && (identifier == u"Shooting_Gallery_Retry" || identifier == u"RePlay"))
|
||||
|| identifier == u"SG1" || button == 0) {
|
||||
|
||||
if (identifier == u"RePlay") {
|
||||
static_cast<Player*>(player)->SendToZone(1300);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
self->SetNetworkVar<bool>(ClearVariable, true);
|
||||
StartGame(self);
|
||||
} else if (button == 1 && identifier == u"Shooting_Gallery_Exit") {
|
||||
UpdatePlayer(self, player->GetObjectID(), true);
|
||||
RemovePlayer(player->GetObjectID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SGCannon::OnActivityTimerDone(Entity* self, const std::string& name) {
|
||||
if (name == SuperChargeTimer && !self->GetVar<bool>(SuperChargePausedVariable)) {
|
||||
if (self->GetVar<bool>(WaveStatusVariable) || self->GetVar<uint32_t>(CurrentSuperChargedTimeVariable) < 1) {
|
||||
self->SetNetworkVar<uint32_t>(ChargeCountingVariable, 99);
|
||||
self->SetNetworkVar<uint32_t>(SuperChargeBarVariable, 0);
|
||||
ToggleSuperCharge(self, false);
|
||||
void SGCannon::SuperChargeTimerFunc(Entity* self) {
|
||||
if (self->GetVar<bool>(WaveStatusVariable) || self->GetVar<uint32_t>(CurrentSuperChargedTimeVariable) < 1) {
|
||||
self->SetNetworkVar<uint32_t>(ChargeCountingVariable, 99);
|
||||
self->SetNetworkVar<uint32_t>(SuperChargeBarVariable, 0);
|
||||
ToggleSuperCharge(self, false);
|
||||
}
|
||||
}
|
||||
|
||||
void SGCannon::SpawnWaveTimerFunc(Entity* self) {
|
||||
if (self->GetVar<bool>(GameStartedVariable)) {
|
||||
self->SetVar<bool>(WaveStatusVariable, true);
|
||||
const auto wave = (int32_t)self->GetVar<uint32_t>(ThisWaveVariable);
|
||||
|
||||
if (wave != 0 && self->GetVar<bool>(SuperChargePausedVariable)) {
|
||||
StartChargedCannon(self, self->GetVar<uint32_t>(CurrentSuperChargedTimeVariable));
|
||||
self->SetVar<uint32_t>(CurrentSuperChargedTimeVariable, 0);
|
||||
}
|
||||
} else if (name == SpawnWaveTimer) {
|
||||
if (self->GetVar<bool>(GameStartedVariable)) {
|
||||
self->SetVar<bool>(WaveStatusVariable, true);
|
||||
const auto wave = (int32_t)self->GetVar<uint32_t>(ThisWaveVariable);
|
||||
|
||||
if (wave != 0 && self->GetVar<bool>(SuperChargePausedVariable)) {
|
||||
StartChargedCannon(self, self->GetVar<uint32_t>(CurrentSuperChargedTimeVariable));
|
||||
self->SetVar<uint32_t>(CurrentSuperChargedTimeVariable, 0);
|
||||
}
|
||||
TimerToggle(self, true);
|
||||
|
||||
TimerToggle(self, true);
|
||||
|
||||
for (const auto& enemyToSpawn : m_Waves.at(self->GetVar<uint32_t>(ThisWaveVariable))) {
|
||||
SpawnObject(self, enemyToSpawn, true);
|
||||
}
|
||||
|
||||
Game::logger->Log("SGCannon", "Current wave spawn: %i/%i", wave, m_Waves.size());
|
||||
|
||||
// All waves completed
|
||||
const auto timeLimit = (float_t)self->GetVar<uint32_t>(TimeLimitVariable);
|
||||
if (wave >= m_Waves.size()) {
|
||||
ActivityTimerStart(self, GameOverTimer, timeLimit, timeLimit);
|
||||
} else {
|
||||
ActivityTimerStart(self, EndWaveTimer, timeLimit, timeLimit);
|
||||
}
|
||||
|
||||
const auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (player != nullptr) {
|
||||
GameMessages::SendPlayFXEffect(player->GetObjectID(), -1, u"SG-start", "");
|
||||
|
||||
GameMessages::SendStartActivityTime(self->GetObjectID(), timeLimit, player->GetSystemAddress());
|
||||
Game::logger->Log("SGCannon", "Sending ActivityPause false");
|
||||
|
||||
GameMessages::SendActivityPause(self->GetObjectID(), false, player->GetSystemAddress());
|
||||
}
|
||||
for (const auto& enemyToSpawn : m_Waves.at(self->GetVar<uint32_t>(ThisWaveVariable))) {
|
||||
SpawnObject(self, enemyToSpawn, true);
|
||||
}
|
||||
} else if (name == EndWaveTimer) {
|
||||
self->SetVar<bool>(WaveStatusVariable, false);
|
||||
|
||||
LOG("Current wave spawn: %i/%i", wave, m_Waves.size());
|
||||
|
||||
// All waves completed
|
||||
const auto timeLimit = (float_t)self->GetVar<uint32_t>(TimeLimitVariable);
|
||||
if (wave >= m_Waves.size()) {
|
||||
ActivityTimerStart(self, GameOverTimer, timeLimit, timeLimit);
|
||||
} else {
|
||||
ActivityTimerStart(self, EndWaveTimer, timeLimit, timeLimit);
|
||||
}
|
||||
|
||||
const auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (player != nullptr) {
|
||||
GameMessages::SendPlayFXEffect(player->GetObjectID(), -1, u"SG-start", "");
|
||||
|
||||
GameMessages::SendStartActivityTime(self->GetObjectID(), timeLimit, player->GetSystemAddress());
|
||||
LOG("Sending ActivityPause false");
|
||||
|
||||
GameMessages::SendActivityPause(self->GetObjectID(), false, player->GetSystemAddress());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SGCannon::EndWaveTimerFunc(Entity* self) {
|
||||
self->SetVar<bool>(WaveStatusVariable, false);
|
||||
TimerToggle(self);
|
||||
RecordPlayerScore(self);
|
||||
|
||||
if (self->GetVar<uint32_t>(ThisWaveVariable) >= 2) {
|
||||
GameMessages::SendActivityPause(self->GetObjectID(), true);
|
||||
ActivityTimerStart(self, GameOverTimer, 0.1, 0.1);
|
||||
return;
|
||||
}
|
||||
|
||||
self->SetVar<uint32_t>(ThisWaveVariable, self->GetVar<uint32_t>(ThisWaveVariable) + 1);
|
||||
PlaySceneAnimation(self, u"wave" + GeneralUtils::to_u16string(self->GetVar<uint32_t>(ThisWaveVariable)), true, true, 1.7f);
|
||||
self->SetNetworkVar<uint32_t>(WaveNumVariable, self->GetVar<uint32_t>(ThisWaveVariable) + 1);
|
||||
self->SetNetworkVar<uint32_t>(WaveStrVariable, self->GetVar<uint32_t>(TimeLimitVariable));
|
||||
|
||||
LOG("Current wave: %i/%i", self->GetVar<uint32_t>(ThisWaveVariable), m_Waves.size());
|
||||
|
||||
if (self->GetVar<uint32_t>(ThisWaveVariable) >= m_Waves.size()) {
|
||||
ActivityTimerStart(self, GameOverTimer, 0.1, 0.1);
|
||||
} else {
|
||||
ActivityTimerStart(self, SpawnWaveTimer, constants.inBetweenWavePause, constants.inBetweenWavePause);
|
||||
}
|
||||
|
||||
LOG("Sending ActivityPause true");
|
||||
|
||||
GameMessages::SendActivityPause(self->GetObjectID(), true);
|
||||
if (self->GetVar<bool>(SuperChargeActiveVariable) && !self->GetVar<bool>(SuperChargePausedVariable)) {
|
||||
PauseChargeCannon(self);
|
||||
}
|
||||
}
|
||||
|
||||
void SGCannon::GameOverTimerFunc(Entity* self) {
|
||||
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (player != nullptr) {
|
||||
LOG_DEBUG("Sending ActivityPause true");
|
||||
|
||||
GameMessages::SendActivityPause(self->GetObjectID(), true, player->GetSystemAddress());
|
||||
|
||||
/*const auto leftoverCannonballs = Game::entityManager->GetEntitiesInGroup("cannonball");
|
||||
if (leftoverCannonballs.empty()) {
|
||||
RecordPlayerScore(self);
|
||||
|
||||
} else {
|
||||
ActivityTimerStart(self, EndGameBufferTimer, 1, leftoverCannonballs.size());
|
||||
}*/
|
||||
|
||||
ActivityTimerStart(self, EndGameBufferTimer, 1, 1);
|
||||
|
||||
TimerToggle(self);
|
||||
RecordPlayerScore(self);
|
||||
}
|
||||
}
|
||||
|
||||
if (self->GetVar<uint32_t>(ThisWaveVariable) >= 2) {
|
||||
GameMessages::SendActivityPause(self->GetObjectID(), true);
|
||||
ActivityTimerStart(self, GameOverTimer, 0.1, 0.1);
|
||||
void SGCannon::DoSpawnTimerFunc(Entity* self, const std::string& name) {
|
||||
if (self->GetVar<bool>(GameStartedVariable)) {
|
||||
LOG_DEBUG("time name %s %s", name.c_str(), name.substr(7).c_str());
|
||||
const auto spawnNumber = (uint32_t)std::stoi(name.substr(7));
|
||||
const auto& activeSpawns = self->GetVar<std::vector<SGEnemy>>(ActiveSpawnsVariable);
|
||||
LOG_DEBUG("size %i, %i", activeSpawns.size(), spawnNumber);
|
||||
if (activeSpawns.size() <= spawnNumber) {
|
||||
LOG_DEBUG("Trying to spawn %i when spawns size is only %i", spawnNumber, activeSpawns.size());
|
||||
return;
|
||||
}
|
||||
|
||||
self->SetVar<uint32_t>(ThisWaveVariable, self->GetVar<uint32_t>(ThisWaveVariable) + 1);
|
||||
PlaySceneAnimation(self, u"wave" + GeneralUtils::to_u16string(self->GetVar<uint32_t>(ThisWaveVariable)), true, true, 1.7f);
|
||||
self->SetNetworkVar<uint32_t>(WaveNumVariable, self->GetVar<uint32_t>(ThisWaveVariable) + 1);
|
||||
self->SetNetworkVar<uint32_t>(WaveStrVariable, self->GetVar<uint32_t>(TimeLimitVariable));
|
||||
|
||||
Game::logger->Log("SGCannon", "Current wave: %i/%i", self->GetVar<uint32_t>(ThisWaveVariable), m_Waves.size());
|
||||
|
||||
if (self->GetVar<uint32_t>(ThisWaveVariable) >= m_Waves.size()) {
|
||||
ActivityTimerStart(self, GameOverTimer, 0.1, 0.1);
|
||||
} else {
|
||||
ActivityTimerStart(self, SpawnWaveTimer, constants.inBetweenWavePause, constants.inBetweenWavePause);
|
||||
const auto& toSpawn = activeSpawns.at(spawnNumber);
|
||||
LOG_DEBUG("toSpawn %i", toSpawn.spawnPaths.size());
|
||||
const auto pathIndex = GeneralUtils::GenerateRandomNumber<float_t>(0, toSpawn.spawnPaths.size() - 1);
|
||||
LOG_DEBUG("index %f", pathIndex);
|
||||
LOG_DEBUG("%s", toSpawn.spawnPaths.at(pathIndex).c_str());
|
||||
const auto* path = Game::zoneManager->GetZone()->GetPath(toSpawn.spawnPaths.at(pathIndex));
|
||||
if (!path) {
|
||||
LOG_DEBUG("Path %s at index %i is null", toSpawn.spawnPaths.at(pathIndex).c_str(), pathIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
Game::logger->Log("SGCannon", "Sending ActivityPause true");
|
||||
LOG_DEBUG("%s", path->pathName.c_str());
|
||||
|
||||
GameMessages::SendActivityPause(self->GetObjectID(), true);
|
||||
if (self->GetVar<bool>(SuperChargeActiveVariable) && !self->GetVar<bool>(SuperChargePausedVariable)) {
|
||||
PauseChargeCannon(self);
|
||||
auto info = EntityInfo{};
|
||||
info.lot = toSpawn.lot;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
info.pos = path->pathWaypoints.at(0).position;
|
||||
|
||||
info.settings = {
|
||||
new LDFData<SGEnemy>(u"SpawnData", toSpawn),
|
||||
new LDFData<std::string>(u"custom_script_server", "scripts/ai/ACT/SG_TARGET.lua"),
|
||||
new LDFData<std::string>(u"custom_script_client", "scripts/client/ai/SG_TARGET_CLIENT.lua"),
|
||||
new LDFData<std::string>(u"attached_path", path->pathName),
|
||||
new LDFData<uint32_t>(u"attached_path_start", 0),
|
||||
new LDFData<std::u16string>(u"groupID", u"SGEnemy")
|
||||
};
|
||||
|
||||
LOG_DEBUG("Spawning enemy %i on path %s", toSpawn.lot, path->pathName.c_str());
|
||||
|
||||
auto* enemy = Game::entityManager->CreateEntity(info, nullptr, self);
|
||||
Game::entityManager->ConstructEntity(enemy);
|
||||
|
||||
auto* movementAI = enemy->AddComponent<MovementAIComponent>(MovementAIInfo{});
|
||||
|
||||
movementAI->SetMaxSpeed(toSpawn.initialSpeed);
|
||||
movementAI->SetCurrentSpeed(toSpawn.initialSpeed);
|
||||
movementAI->SetHaltDistance(0.0f);
|
||||
|
||||
std::vector<NiPoint3> pathWaypoints;
|
||||
|
||||
for (const auto& waypoint : path->pathWaypoints) {
|
||||
pathWaypoints.push_back(waypoint.position);
|
||||
}
|
||||
|
||||
if (GeneralUtils::GenerateRandomNumber<float_t>(0, 1) < 0.5f) {
|
||||
std::reverse(pathWaypoints.begin(), pathWaypoints.end());
|
||||
}
|
||||
|
||||
movementAI->SetPath(pathWaypoints);
|
||||
|
||||
enemy->AddDieCallback([this, self, enemy, name]() {
|
||||
RegisterHit(self, enemy, name);
|
||||
});
|
||||
|
||||
// Save the enemy and tell it to start pathing
|
||||
if (enemy != nullptr) {
|
||||
const_cast<std::vector<LWOOBJID>&>(self->GetVar<std::vector<LWOOBJID>>(SpawnedObjects)).push_back(enemy->GetObjectID());
|
||||
GameMessages::SendPlatformResync(enemy, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SGCannon::EndGameBufferTimerFunc(Entity* self) {
|
||||
RecordPlayerScore(self);
|
||||
StopGame(self, false);
|
||||
}
|
||||
|
||||
void SGCannon::OnActivityTimerDone(Entity* self, const std::string& name) {
|
||||
if (name == SuperChargeTimer && !self->GetVar<bool>(SuperChargePausedVariable)) {
|
||||
SuperChargeTimerFunc(self);
|
||||
} else if (name == SpawnWaveTimer) {
|
||||
SpawnWaveTimerFunc(self);
|
||||
} else if (name == EndWaveTimer) {
|
||||
EndWaveTimerFunc(self);
|
||||
} else if (name == GameOverTimer) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (player != nullptr) {
|
||||
Game::logger->Log("SGCannon", "Sending ActivityPause true");
|
||||
|
||||
GameMessages::SendActivityPause(self->GetObjectID(), true, player->GetSystemAddress());
|
||||
|
||||
/*const auto leftoverCannonballs = EntityManager::Instance()->GetEntitiesInGroup("cannonball");
|
||||
if (leftoverCannonballs.empty()) {
|
||||
RecordPlayerScore(self);
|
||||
|
||||
} else {
|
||||
ActivityTimerStart(self, EndGameBufferTimer, 1, leftoverCannonballs.size());
|
||||
}*/
|
||||
|
||||
ActivityTimerStart(self, EndGameBufferTimer, 1, 1);
|
||||
|
||||
TimerToggle(self);
|
||||
}
|
||||
GameOverTimerFunc(self);
|
||||
} else if (name.rfind(DoSpawnTimer, 0) == 0) {
|
||||
if (self->GetVar<bool>(GameStartedVariable)) {
|
||||
const auto spawnNumber = (uint32_t)std::stoi(name.substr(7));
|
||||
const auto& activeSpawns = self->GetVar<std::vector<SGEnemy>>(ActiveSpawnsVariable);
|
||||
const auto& toSpawn = activeSpawns.at(spawnNumber);
|
||||
|
||||
const auto pathIndex = GeneralUtils::GenerateRandomNumber<float_t>(0, toSpawn.spawnPaths.size() - 1);
|
||||
|
||||
const auto* path = dZoneManager::Instance()->GetZone()->GetPath(
|
||||
toSpawn.spawnPaths.at(pathIndex)
|
||||
);
|
||||
|
||||
auto info = EntityInfo{};
|
||||
info.lot = toSpawn.lot;
|
||||
info.spawnerID = self->GetObjectID();
|
||||
info.pos = path->pathWaypoints.at(0).position;
|
||||
|
||||
info.settings = {
|
||||
new LDFData<SGEnemy>(u"SpawnData", toSpawn),
|
||||
new LDFData<std::string>(u"custom_script_server", "scripts/ai/ACT/SG_TARGET.lua"),
|
||||
new LDFData<std::string>(u"custom_script_client", "scripts/client/ai/SG_TARGET_CLIENT.lua"),
|
||||
new LDFData<std::string>(u"attached_path", path->pathName),
|
||||
new LDFData<uint32_t>(u"attached_path_start", 0),
|
||||
new LDFData<std::u16string>(u"groupID", u"SGEnemy")
|
||||
};
|
||||
|
||||
Game::logger->Log("SGCannon", "Spawning enemy %i on path %s", toSpawn.lot, path->pathName.c_str());
|
||||
|
||||
auto* enemy = EntityManager::Instance()->CreateEntity(info, nullptr, self);
|
||||
EntityManager::Instance()->ConstructEntity(enemy);
|
||||
|
||||
if (true) {
|
||||
auto* movementAI = new MovementAIComponent(enemy, {});
|
||||
|
||||
enemy->AddComponent(COMPONENT_TYPE_MOVEMENT_AI, movementAI);
|
||||
|
||||
movementAI->SetSpeed(toSpawn.initialSpeed);
|
||||
movementAI->SetCurrentSpeed(toSpawn.initialSpeed);
|
||||
movementAI->SetHaltDistance(0.0f);
|
||||
|
||||
std::vector<NiPoint3> pathWaypoints;
|
||||
|
||||
for (const auto& waypoint : path->pathWaypoints) {
|
||||
pathWaypoints.push_back(waypoint.position);
|
||||
}
|
||||
|
||||
if (GeneralUtils::GenerateRandomNumber<float_t>(0, 1) < 0.5f) {
|
||||
std::reverse(pathWaypoints.begin(), pathWaypoints.end());
|
||||
}
|
||||
|
||||
movementAI->SetPath(pathWaypoints);
|
||||
|
||||
enemy->AddDieCallback([this, self, enemy, name]() {
|
||||
RegisterHit(self, enemy, name);
|
||||
});
|
||||
}
|
||||
|
||||
// Save the enemy and tell it to start pathing
|
||||
if (enemy != nullptr) {
|
||||
const_cast<std::vector<LWOOBJID>&>(self->GetVar<std::vector<LWOOBJID>>(SpawnedObjects)).push_back(enemy->GetObjectID());
|
||||
GameMessages::SendPlatformResync(enemy, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
}
|
||||
}
|
||||
DoSpawnTimerFunc(self, name);
|
||||
} else if (name == EndGameBufferTimer) {
|
||||
RecordPlayerScore(self);
|
||||
StopGame(self, false);
|
||||
EndGameBufferTimerFunc(self);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,19 +359,20 @@ SGCannon::OnActivityTimerUpdate(Entity* self, const std::string& name, float_t t
|
||||
}
|
||||
|
||||
void SGCannon::StartGame(Entity* self) {
|
||||
if (self->GetVar<bool>(GameStartedVariable)) return;
|
||||
self->SetNetworkVar<uint32_t>(TimeLimitVariable, self->GetVar<uint32_t>(TimeLimitVariable));
|
||||
self->SetNetworkVar<bool>(AudioStartIntroVariable, true);
|
||||
self->SetVar<LOT>(CurrentRewardVariable, LOT_NULL);
|
||||
|
||||
auto rewardObjects = EntityManager::Instance()->GetEntitiesInGroup(constants.rewardModelGroup);
|
||||
auto rewardObjects = Game::entityManager->GetEntitiesInGroup(constants.rewardModelGroup);
|
||||
for (auto* reward : rewardObjects) {
|
||||
reward->OnFireEventServerSide(self, ModelToBuildEvent);
|
||||
}
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (player != nullptr) {
|
||||
GetLeaderboardData(self, player->GetObjectID(), GetActivityID(self));
|
||||
Game::logger->Log("SGCannon", "Sending ActivityStart");
|
||||
GetLeaderboardData(self, player->GetObjectID(), GetActivityID(self), 1);
|
||||
LOG("Sending ActivityStart");
|
||||
GameMessages::SendActivityStart(self->GetObjectID(), player->GetSystemAddress());
|
||||
|
||||
GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"start", "");
|
||||
@@ -388,9 +414,9 @@ void SGCannon::SpawnNewModel(Entity* self) {
|
||||
self->SetNetworkVar<int32_t>(RewardAddedVariable, currentReward);
|
||||
}
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (player != nullptr) {
|
||||
for (auto* rewardModel : EntityManager::Instance()->GetEntitiesInGroup(constants.rewardModelGroup)) {
|
||||
for (auto* rewardModel : Game::entityManager->GetEntitiesInGroup(constants.rewardModelGroup)) {
|
||||
uint32_t lootMatrix;
|
||||
switch (self->GetVar<uint32_t>(MatrixVariable)) {
|
||||
case 1:
|
||||
@@ -414,7 +440,7 @@ void SGCannon::SpawnNewModel(Entity* self) {
|
||||
|
||||
if (lootMatrix != 0) {
|
||||
std::unordered_map<LOT, int32_t> toDrop = {};
|
||||
toDrop = LootGenerator::Instance().RollLootMatrix(player, lootMatrix);
|
||||
toDrop = Loot::RollLootMatrix(player, lootMatrix);
|
||||
|
||||
for (auto drop : toDrop) {
|
||||
rewardModel->OnFireEventServerSide(self, ModelToBuildEvent, drop.first);
|
||||
@@ -426,7 +452,7 @@ void SGCannon::SpawnNewModel(Entity* self) {
|
||||
}
|
||||
|
||||
void SGCannon::RemovePlayer(LWOOBJID playerID) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
auto* player = Game::entityManager->GetEntity(playerID);
|
||||
if (player == nullptr)
|
||||
return;
|
||||
|
||||
@@ -440,6 +466,14 @@ void SGCannon::RemovePlayer(LWOOBJID playerID) {
|
||||
}
|
||||
}
|
||||
|
||||
void SGCannon::OnRequestActivityExit(Entity* self, LWOOBJID player, bool canceled) {
|
||||
if (canceled) {
|
||||
StopGame(self, canceled);
|
||||
RemovePlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SGCannon::StartChargedCannon(Entity* self, uint32_t optionalTime) {
|
||||
optionalTime = optionalTime == 0 ? constants.chargedTime : optionalTime;
|
||||
self->SetVar<bool>(SuperChargePausedVariable, false);
|
||||
@@ -504,18 +538,18 @@ void SGCannon::RecordPlayerScore(Entity* self) {
|
||||
}
|
||||
|
||||
void SGCannon::PlaySceneAnimation(Entity* self, const std::u16string& animationName, bool onCannon, bool onPlayer, float_t priority) {
|
||||
for (auto* cannon : EntityManager::Instance()->GetEntitiesInGroup("cannongroup")) {
|
||||
GameMessages::SendPlayAnimation(cannon, animationName, priority);
|
||||
for (auto* cannon : Game::entityManager->GetEntitiesInGroup("cannongroup")) {
|
||||
RenderComponent::PlayAnimation(cannon, animationName, priority);
|
||||
}
|
||||
|
||||
if (onCannon) {
|
||||
GameMessages::SendPlayAnimation(self, animationName, priority);
|
||||
RenderComponent::PlayAnimation(self, animationName, priority);
|
||||
}
|
||||
|
||||
if (onPlayer) {
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (player != nullptr) {
|
||||
GameMessages::SendPlayAnimation(player, animationName, priority);
|
||||
RenderComponent::PlayAnimation(player, animationName, priority);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -534,7 +568,7 @@ void SGCannon::StopGame(Entity* self, bool cancel) {
|
||||
self->SetNetworkVar<bool>(ReSetSuperChargeVariable, true);
|
||||
self->SetNetworkVar<bool>(HideSuperChargeVariable, true);
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (player == nullptr)
|
||||
return;
|
||||
|
||||
@@ -542,7 +576,7 @@ void SGCannon::StopGame(Entity* self, bool cancel) {
|
||||
|
||||
// The player won, store all the score and send rewards
|
||||
if (!cancel) {
|
||||
auto percentage = 0;
|
||||
int32_t percentage = 0.0f;
|
||||
auto misses = self->GetVar<uint32_t>(MissesVariable);
|
||||
auto fired = self->GetVar<uint32_t>(ShotsFiredVariable);
|
||||
|
||||
@@ -553,12 +587,15 @@ void SGCannon::StopGame(Entity* self, bool cancel) {
|
||||
auto* missionComponent = player->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent != nullptr) {
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, self->GetVar<uint32_t>(TotalScoreVariable), self->GetObjectID(), "performact_score");
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, self->GetVar<uint32_t>(MaxStreakVariable), self->GetObjectID(), "performact_streak");
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ACTIVITY, m_CannonLot, 0, "", self->GetVar<uint32_t>(TotalScoreVariable));
|
||||
missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, self->GetVar<uint32_t>(TotalScoreVariable), self->GetObjectID(), "performact_score");
|
||||
missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, self->GetVar<uint32_t>(MaxStreakVariable), self->GetObjectID(), "performact_streak");
|
||||
missionComponent->Progress(eMissionTaskType::ACTIVITY, m_CannonLot, 0, "", self->GetVar<uint32_t>(TotalScoreVariable));
|
||||
}
|
||||
|
||||
LootGenerator::Instance().GiveActivityLoot(player, self, GetGameID(self), self->GetVar<uint32_t>(TotalScoreVariable));
|
||||
Loot::GiveActivityLoot(player, self, GetGameID(self), self->GetVar<uint32_t>(TotalScoreVariable));
|
||||
|
||||
SaveScore(self, player->GetObjectID(),
|
||||
static_cast<float>(self->GetVar<uint32_t>(TotalScoreVariable)), static_cast<float>(self->GetVar<uint32_t>(MaxStreakVariable)), percentage);
|
||||
|
||||
StopActivity(self, player->GetObjectID(), self->GetVar<uint32_t>(TotalScoreVariable), self->GetVar<uint32_t>(MaxStreakVariable), percentage);
|
||||
self->SetNetworkVar<bool>(AudioFinalWaveDoneVariable, true);
|
||||
@@ -567,23 +604,12 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
self->SetNetworkVar<std::u16string>(u"UI_Rewards",
|
||||
GeneralUtils::to_u16string(self->GetVar<uint32_t>(TotalScoreVariable)) + u"_0_0_0_0_0_0"
|
||||
);
|
||||
|
||||
GameMessages::SendRequestActivitySummaryLeaderboardData(
|
||||
player->GetObjectID(),
|
||||
self->GetObjectID(),
|
||||
player->GetSystemAddress(),
|
||||
GetGameID(self),
|
||||
1,
|
||||
10,
|
||||
0,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
@@ -592,7 +618,7 @@ void SGCannon::StopGame(Entity* self, bool cancel) {
|
||||
ActivityTimerStopAllTimers(self);
|
||||
|
||||
// Destroy all spawners
|
||||
for (auto* entity : EntityManager::Instance()->GetEntitiesInGroup("SGEnemy")) {
|
||||
for (auto* entity : Game::entityManager->GetEntitiesInGroup("SGEnemy")) {
|
||||
entity->Kill();
|
||||
}
|
||||
|
||||
@@ -628,7 +654,7 @@ void SGCannon::RegisterHit(Entity* self, Entity* target, const std::string& time
|
||||
|
||||
auto scScore = self->GetVar<uint32_t>(TotalScoreVariable) - lastSuperTotal;
|
||||
|
||||
Game::logger->Log("SGCannon", "LastSuperTotal: %i, scScore: %i, constants.chargedPoints: %i",
|
||||
LOG("LastSuperTotal: %i, scScore: %i, constants.chargedPoints: %i",
|
||||
lastSuperTotal, scScore, constants.chargedPoints
|
||||
);
|
||||
|
||||
@@ -659,13 +685,13 @@ void SGCannon::RegisterHit(Entity* self, Entity* target, const std::string& time
|
||||
|
||||
self->SetNetworkVar<std::u16string>(u"beatHighScore", GeneralUtils::to_u16string(newScore));
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
if (player == nullptr) return;
|
||||
|
||||
auto missionComponent = player->GetComponent<MissionComponent>();
|
||||
if (missionComponent == nullptr) return;
|
||||
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SMASH, spawnInfo.lot, self->GetObjectID());
|
||||
missionComponent->Progress(eMissionTaskType::SMASH, spawnInfo.lot, self->GetObjectID());
|
||||
}
|
||||
|
||||
void SGCannon::UpdateStreak(Entity* self) {
|
||||
@@ -709,10 +735,10 @@ void SGCannon::ToggleSuperCharge(Entity* self, bool enable) {
|
||||
if (enable && self->GetVar<bool>(SuperChargeActiveVariable))
|
||||
return;
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
auto* player = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||
|
||||
if (player == nullptr) {
|
||||
Game::logger->Log("SGCannon", "Player not found in toggle super charge");
|
||||
LOG("Player not found in toggle super charge");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -720,7 +746,7 @@ void SGCannon::ToggleSuperCharge(Entity* self, bool enable) {
|
||||
|
||||
auto equippedItems = inventoryComponent->GetEquippedItems();
|
||||
|
||||
Game::logger->Log("SGCannon", "Player has %d equipped items", equippedItems.size());
|
||||
LOG("Player has %d equipped items", equippedItems.size());
|
||||
|
||||
auto skillID = constants.cannonSkill;
|
||||
auto cooldown = constants.cannonRefireRate;
|
||||
@@ -728,12 +754,12 @@ void SGCannon::ToggleSuperCharge(Entity* self, bool enable) {
|
||||
auto* selfInventoryComponent = self->GetComponent<InventoryComponent>();
|
||||
|
||||
if (inventoryComponent == nullptr) {
|
||||
Game::logger->Log("SGCannon", "Inventory component not found");
|
||||
LOG("Inventory component not found");
|
||||
return;
|
||||
}
|
||||
|
||||
if (enable) {
|
||||
Game::logger->Log("SGCannon", "Player is activating super charge");
|
||||
LOG("Player is activating super charge");
|
||||
selfInventoryComponent->UpdateSlot("greeble_r", { ObjectIDManager::GenerateRandomObjectID(), 6505, 1, 0 });
|
||||
selfInventoryComponent->UpdateSlot("greeble_l", { ObjectIDManager::GenerateRandomObjectID(), 6506, 1, 0 });
|
||||
|
||||
@@ -746,19 +772,19 @@ void SGCannon::ToggleSuperCharge(Entity* self, bool enable) {
|
||||
|
||||
self->SetNetworkVar<float>(u"SuperChargeBar", 0);
|
||||
|
||||
Game::logger->Log("SGCannon", "Player disables super charge");
|
||||
LOG("Player disables super charge");
|
||||
|
||||
// TODO: Unequip items
|
||||
for (const auto& equipped : equippedItems) {
|
||||
if (equipped.first == "special_r" || equipped.first == "special_l") {
|
||||
Game::logger->Log("SGCannon", "Trying to unequip a weapon, %i", equipped.second.lot);
|
||||
LOG("Trying to unequip a weapon, %i", equipped.second.lot);
|
||||
|
||||
auto* item = inventoryComponent->FindItemById(equipped.second.id);
|
||||
|
||||
if (item != nullptr) {
|
||||
inventoryComponent->UnEquipItem(item);
|
||||
} else {
|
||||
Game::logger->Log("SGCannon", "Item not found, %i", equipped.second.lot);
|
||||
LOG("Item not found, %i", equipped.second.lot);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -784,8 +810,8 @@ void SGCannon::ToggleSuperCharge(Entity* self, bool enable) {
|
||||
|
||||
shootingGalleryComponent->SetDynamicParams(properties);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
EntityManager::Instance()->SerializeEntity(player);
|
||||
Game::entityManager->SerializeEntity(self);
|
||||
Game::entityManager->SerializeEntity(player);
|
||||
|
||||
self->SetNetworkVar<uint64_t>(CannonBallSkillIDVariable, skillID);
|
||||
self->SetVar<bool>(SuperChargeActiveVariable, enable);
|
||||
|
||||
@@ -63,12 +63,17 @@ public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnPlayerLoaded(Entity* self, Entity* player) override;
|
||||
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) override;
|
||||
void OnActivityStateChangeRequest(Entity* self, LWOOBJID senderID, int32_t value1,
|
||||
int32_t value2, const std::u16string& stringValue) override;
|
||||
void OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier,
|
||||
const std::u16string& userData) override;
|
||||
void OnActivityStateChangeRequest(Entity* self, LWOOBJID senderID, int32_t value1, int32_t value2, const std::u16string& stringValue) override;
|
||||
void OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData) override;
|
||||
void OnActivityTimerDone(Entity* self, const std::string& name) override;
|
||||
void OnActivityTimerUpdate(Entity* self, const std::string& name, float_t timeRemaining, float_t elapsedTime) override;
|
||||
void OnRequestActivityExit(Entity* self, LWOOBJID player, bool canceled) override;
|
||||
void SuperChargeTimerFunc(Entity* self);
|
||||
void SpawnWaveTimerFunc(Entity* self);
|
||||
void EndWaveTimerFunc(Entity* self);
|
||||
void GameOverTimerFunc(Entity* self);
|
||||
void DoSpawnTimerFunc(Entity* self, const std::string& name);
|
||||
void EndGameBufferTimerFunc(Entity* self);
|
||||
private:
|
||||
static std::vector<std::vector<SGEnemy>> GetWaves();
|
||||
static SGConstants GetConstants();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "EntityManager.h"
|
||||
|
||||
void ZoneSGServer::OnStartup(Entity* self) {
|
||||
const auto cannons = EntityManager::Instance()->GetEntitiesByLOT(1864);
|
||||
const auto cannons = Game::entityManager->GetEntitiesByLOT(1864);
|
||||
for (const auto& cannon : cannons)
|
||||
self->SetVar<LWOOBJID>(CannonIDVariable, cannon->GetObjectID());
|
||||
}
|
||||
@@ -10,7 +10,7 @@ void ZoneSGServer::OnStartup(Entity* self) {
|
||||
void ZoneSGServer::OnActivityStateChangeRequest(Entity* self, const LWOOBJID senderID, const int32_t value1,
|
||||
const int32_t value2, const std::u16string& stringValue) {
|
||||
|
||||
auto* cannon = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(CannonIDVariable));
|
||||
auto* cannon = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(CannonIDVariable));
|
||||
if (cannon != nullptr) {
|
||||
cannon->OnActivityStateChangeRequest(senderID, value1, value2, stringValue);
|
||||
}
|
||||
@@ -19,7 +19,7 @@ void ZoneSGServer::OnActivityStateChangeRequest(Entity* self, const LWOOBJID sen
|
||||
void ZoneSGServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
|
||||
int32_t param3) {
|
||||
|
||||
auto* cannon = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(CannonIDVariable));
|
||||
auto* cannon = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(CannonIDVariable));
|
||||
if (cannon != nullptr) {
|
||||
cannon->OnFireEventServerSide(sender, args, param1, param2, param3);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#include "NpcNpSpacemanBob.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "eMissionState.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void NpcNpSpacemanBob::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE && missionID == 173) {
|
||||
DestroyableComponent* destroyable = static_cast<DestroyableComponent*>(target->GetComponent(COMPONENT_TYPE_DESTROYABLE));
|
||||
void NpcNpSpacemanBob::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
||||
if (missionState == eMissionState::READY_TO_COMPLETE && missionID == 173) {
|
||||
DestroyableComponent* destroyable = static_cast<DestroyableComponent*>(target->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||
destroyable->SetImagination(6);
|
||||
MissionComponent* mission = static_cast<MissionComponent*>(target->GetComponent(COMPONENT_TYPE_MISSION));
|
||||
MissionComponent* mission = static_cast<MissionComponent*>(target->GetComponent(eReplicaComponentType::MISSION));
|
||||
|
||||
mission->CompleteMission(664);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
class NpcNpSpacemanBob : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState);
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState);
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "EntityManager.h"
|
||||
|
||||
void PropertyDeathPlane::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
const auto teleportGroup = EntityManager::Instance()->GetEntitiesInGroup("Teleport");
|
||||
const auto teleportGroup = Game::entityManager->GetEntitiesInGroup("Teleport");
|
||||
|
||||
if (teleportGroup.size() == 0) {
|
||||
return;
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
#include "SoundTriggerComponent.h"
|
||||
#include "InventoryComponent.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "eMissionState.h"
|
||||
#include "eMissionTaskType.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
// Constants are at the bottom
|
||||
|
||||
@@ -18,7 +21,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);
|
||||
}
|
||||
}
|
||||
@@ -46,7 +49,7 @@ void NsConcertInstrument::OnFireEventServerSide(Entity* self, Entity* sender, st
|
||||
if (activePlayerID == LWOOBJID_EMPTY)
|
||||
return;
|
||||
|
||||
const auto activePlayer = EntityManager::Instance()->GetEntity(activePlayerID);
|
||||
const auto activePlayer = Game::entityManager->GetEntity(activePlayerID);
|
||||
if (activePlayer == nullptr)
|
||||
return;
|
||||
|
||||
@@ -60,7 +63,7 @@ void NsConcertInstrument::OnTimerDone(Entity* self, std::string name) {
|
||||
return;
|
||||
|
||||
// If for some reason the player becomes null (for example an unexpected leave), we need to clean up
|
||||
const auto activePlayer = EntityManager::Instance()->GetEntity(activePlayerID);
|
||||
const auto activePlayer = Game::entityManager->GetEntity(activePlayerID);
|
||||
if (activePlayer == nullptr && name != "cleanupAfterStop") {
|
||||
StopPlayingInstrument(self, nullptr);
|
||||
return;
|
||||
@@ -94,7 +97,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>();
|
||||
@@ -120,10 +123,10 @@ void NsConcertInstrument::StartPlayingInstrument(Entity* self, Entity* player) {
|
||||
player->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
GameMessages::SendPlayCinematic(player->GetObjectID(), cinematics.at(instrumentLot), UNASSIGNED_SYSTEM_ADDRESS);
|
||||
self->AddCallbackTimer(1.0f, [player, instrumentLot]() {
|
||||
GameMessages::SendPlayAnimation(player, animations.at(instrumentLot), 2.0f);
|
||||
RenderComponent::PlayAnimation(player, animations.at(instrumentLot), 2.0f);
|
||||
});
|
||||
|
||||
for (auto* soundBox : EntityManager::Instance()->GetEntitiesInGroup("Audio-Concert")) {
|
||||
for (auto* soundBox : Game::entityManager->GetEntitiesInGroup("Audio-Concert")) {
|
||||
auto* soundTrigger = soundBox->GetComponent<SoundTriggerComponent>();
|
||||
if (soundTrigger != nullptr) {
|
||||
soundTrigger->ActivateMusicCue(music.at(instrumentLot));
|
||||
@@ -146,19 +149,19 @@ void NsConcertInstrument::StopPlayingInstrument(Entity* self, Entity* player) {
|
||||
// Player might be null if they left
|
||||
if (player != nullptr) {
|
||||
auto* missions = player->GetComponent<MissionComponent>();
|
||||
if (missions != nullptr && missions->GetMissionState(176) == MissionState::MISSION_STATE_ACTIVE) {
|
||||
missions->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
|
||||
if (missions != nullptr && missions->GetMissionState(176) == eMissionState::ACTIVE) {
|
||||
missions->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
|
||||
}
|
||||
|
||||
GameMessages::SendEndCinematic(player->GetObjectID(), cinematics.at(instrumentLot), UNASSIGNED_SYSTEM_ADDRESS, 1.0f);
|
||||
GameMessages::SendPlayAnimation(player, smashAnimations.at(instrumentLot), 2.0f);
|
||||
RenderComponent::PlayAnimation(player, smashAnimations.at(instrumentLot), 2.0f);
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"stopCheckingMovement", 0, 0,
|
||||
player->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
}
|
||||
|
||||
self->SetVar<bool>(u"beingPlayed", false);
|
||||
|
||||
for (auto* soundBox : EntityManager::Instance()->GetEntitiesInGroup("Audio-Concert")) {
|
||||
for (auto* soundBox : Game::entityManager->GetEntitiesInGroup("Audio-Concert")) {
|
||||
auto* soundTrigger = soundBox->GetComponent<SoundTriggerComponent>();
|
||||
if (soundTrigger != nullptr) {
|
||||
soundTrigger->DeactivateMusicCue(music.at(instrumentLot));
|
||||
@@ -197,7 +200,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();
|
||||
}
|
||||
@@ -205,7 +208,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();
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ void NsConcertQuickBuild::OnStartup(Entity* self) {
|
||||
|
||||
// Get the manager of the crate of this quick build
|
||||
const auto groupNumber = std::stoi(splitGroup.at(3));
|
||||
const auto managerObjects = EntityManager::Instance()->GetEntitiesInGroup("CB_" + std::to_string(groupNumber));
|
||||
const auto managerObjects = Game::entityManager->GetEntitiesInGroup("CB_" + std::to_string(groupNumber));
|
||||
if (managerObjects.empty())
|
||||
return;
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ float NsConcertQuickBuild::GetBlinkTime(float time) {
|
||||
}
|
||||
|
||||
void NsConcertQuickBuild::OnDie(Entity* self, Entity* killer) {
|
||||
auto* managerObject = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"managerObject"));
|
||||
auto* managerObject = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"managerObject"));
|
||||
if (managerObject) {
|
||||
managerObject->CancelAllTimers();
|
||||
managerObject->AddCallbackTimer(1.0f, [managerObject]() {
|
||||
@@ -90,7 +90,7 @@ void NsConcertQuickBuild::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
// Find all the quick build objects of the same lot
|
||||
auto finishedQuickBuildObjects = std::vector<Entity*>();
|
||||
for (auto quickBuildID : finishedQuickBuilds) {
|
||||
const auto quickBuildObject = EntityManager::Instance()->GetEntity(quickBuildID);
|
||||
const auto quickBuildObject = Game::entityManager->GetEntity(quickBuildID);
|
||||
if (quickBuildObject && quickBuildObject->GetLOT() == self->GetLOT()) {
|
||||
quickBuildObject->SetVar<LWOOBJID>(u"Player_" + (GeneralUtils::to_u16string(groupNumber)), target->GetObjectID());
|
||||
finishedQuickBuildObjects.push_back(quickBuildObject);
|
||||
@@ -101,7 +101,7 @@ void NsConcertQuickBuild::OnRebuildComplete(Entity* self, Entity* target) {
|
||||
if (finishedQuickBuildObjects.size() >= 4) {
|
||||
|
||||
// Move all the platforms so the user can collect the imagination brick
|
||||
const auto movingPlatforms = EntityManager::Instance()->GetEntitiesInGroup("ConcertPlatforms");
|
||||
const auto movingPlatforms = Game::entityManager->GetEntitiesInGroup("ConcertPlatforms");
|
||||
for (auto* movingPlatform : movingPlatforms) {
|
||||
auto* component = movingPlatform->GetComponent<MovingPlatformComponent>();
|
||||
if (component) {
|
||||
@@ -184,7 +184,7 @@ void NsConcertQuickBuild::ProgressLicensedTechnician(Entity* self) {
|
||||
for (auto i = 1; i < 5; i++) {
|
||||
const auto playerID = self->GetVar<LWOOBJID>(u"Player_" + (GeneralUtils::to_u16string(i)));
|
||||
if (playerID != LWOOBJID_EMPTY) {
|
||||
const auto player = EntityManager::Instance()->GetEntity(playerID);
|
||||
const auto player = Game::entityManager->GetEntity(playerID);
|
||||
if (player) {
|
||||
auto playerMissionComponent = player->GetComponent<MissionComponent>();
|
||||
if (playerMissionComponent)
|
||||
@@ -202,7 +202,7 @@ void NsConcertQuickBuild::UpdateEffects(Entity* self) {
|
||||
return;
|
||||
|
||||
for (const auto& effectName : setIterator->second.effects) {
|
||||
const auto effectObjects = EntityManager::Instance()->GetEntitiesInGroup(quickBuildFX.at(effectName));
|
||||
const auto effectObjects = Game::entityManager->GetEntitiesInGroup(quickBuildFX.at(effectName));
|
||||
for (auto* effectObject : effectObjects) {
|
||||
GameMessages::SendPlayFXEffect(effectObject, 0, GeneralUtils::ASCIIToUTF16(effectName),
|
||||
effectName + "Effect", LWOOBJID_EMPTY, 1, 1, true);
|
||||
@@ -216,7 +216,7 @@ void NsConcertQuickBuild::CancelEffects(Entity* self) {
|
||||
return;
|
||||
|
||||
for (const auto& effectName : setIterator->second.effects) {
|
||||
const auto effectObjects = EntityManager::Instance()->GetEntitiesInGroup(quickBuildFX.at(effectName));
|
||||
const auto effectObjects = Game::entityManager->GetEntitiesInGroup(quickBuildFX.at(effectName));
|
||||
for (auto* effectObject : effectObjects) {
|
||||
GameMessages::SendStopFXEffect(effectObject, true, effectName + "Effect");
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#include "GameMessages.h"
|
||||
#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;
|
||||
@@ -9,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
|
||||
@@ -40,11 +42,11 @@ 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);
|
||||
}
|
||||
|
||||
MissionComponent* mis = static_cast<MissionComponent*>(player->GetComponent(COMPONENT_TYPE_MISSION));
|
||||
MissionComponent* mis = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
|
||||
|
||||
for (int mission : factionMissions) {
|
||||
mis->AcceptMission(mission);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "NsJohnnyMissionServer.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "eMissionState.h"
|
||||
|
||||
void NsJohnnyMissionServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
if (missionID == 773 && missionState <= MissionState::MISSION_STATE_ACTIVE) {
|
||||
void NsJohnnyMissionServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
||||
if (missionID == 773 && missionState <= eMissionState::ACTIVE) {
|
||||
auto* missionComponent = target->GetComponent<MissionComponent>();
|
||||
if (missionComponent != nullptr) {
|
||||
missionComponent->AcceptMission(774);
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
#include "CppScripts.h"
|
||||
|
||||
class NsJohnnyMissionServer : public CppScripts::Script {
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
|
||||
};
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#include "NsModularBuild.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "eMissionState.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void NsModularBuild::OnModularBuildExit(Entity* self, Entity* player, bool bCompleted, std::vector<LOT> modules) {
|
||||
if (bCompleted) {
|
||||
MissionComponent* mission = static_cast<MissionComponent*>(player->GetComponent(COMPONENT_TYPE_MISSION));
|
||||
MissionComponent* mission = static_cast<MissionComponent*>(player->GetComponent(eReplicaComponentType::MISSION));
|
||||
|
||||
if (mission->GetMissionState(m_MissionNum) == MissionState::MISSION_STATE_ACTIVE) {
|
||||
if (mission->GetMissionState(m_MissionNum) == eMissionState::ACTIVE) {
|
||||
for (LOT mod : modules) {
|
||||
if (mod == 9516 || mod == 9517 || mod == 9518) {
|
||||
mission->ForceProgress(m_MissionNum, 1178, 1);
|
||||
|
||||
@@ -31,7 +31,7 @@ void NsQbImaginationStatue::OnTimerDone(Entity* self, std::string timerName) {
|
||||
void NsQbImaginationStatue::SpawnLoot(Entity* self) {
|
||||
const auto playerId = self->GetVar<LWOOBJID>(u"Player");
|
||||
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerId);
|
||||
auto* player = Game::entityManager->GetEntity(playerId);
|
||||
|
||||
if (player == nullptr) return;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ void RockHydrantBroken::OnStartup(Entity* self) {
|
||||
|
||||
const auto hydrant = "hydrant" + self->GetVar<std::string>(u"hydrant");
|
||||
|
||||
const auto bouncers = EntityManager::Instance()->GetEntitiesInGroup(hydrant);
|
||||
const auto bouncers = Game::entityManager->GetEntitiesInGroup(hydrant);
|
||||
|
||||
for (auto* bouncer : bouncers) {
|
||||
self->SetVar<LWOOBJID>(u"bouncer", bouncer->GetObjectID());
|
||||
@@ -23,7 +23,7 @@ void RockHydrantBroken::OnStartup(Entity* self) {
|
||||
|
||||
void RockHydrantBroken::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "KillBroken") {
|
||||
auto* bouncer = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"bouncer"));
|
||||
auto* bouncer = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"bouncer"));
|
||||
|
||||
if (bouncer != nullptr) {
|
||||
GameMessages::SendBouncerActiveStatus(bouncer->GetObjectID(), false, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "RockHydrantSmashable.h"
|
||||
#include "EntityManager.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "GeneralUtils.h"
|
||||
|
||||
void RockHydrantSmashable::OnDie(Entity* self, Entity* killer) {
|
||||
@@ -14,7 +15,7 @@ void RockHydrantSmashable::OnDie(Entity* self, Entity* killer) {
|
||||
info.settings = { data };
|
||||
info.spawnerID = self->GetSpawnerID();
|
||||
|
||||
auto* hydrant = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* hydrant = Game::entityManager->CreateEntity(info);
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(hydrant);
|
||||
Game::entityManager->ConstructEntity(hydrant);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "GameMessages.h"
|
||||
#include "EntityManager.h"
|
||||
#include "PhantomPhysicsComponent.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "Entity.h"
|
||||
|
||||
void WhFans::OnStartup(Entity* self) {
|
||||
self->SetVar<bool>(u"alive", true);
|
||||
@@ -21,7 +23,7 @@ void WhFans::ToggleFX(Entity* self, bool hit) {
|
||||
fanGroup = "";
|
||||
}
|
||||
|
||||
std::vector<Entity*> fanVolumes = EntityManager::Instance()->GetEntitiesInGroup(fanGroup);
|
||||
std::vector<Entity*> fanVolumes = Game::entityManager->GetEntitiesInGroup(fanGroup);
|
||||
|
||||
auto* renderComponent = self->GetComponent<RenderComponent>();
|
||||
|
||||
@@ -30,7 +32,7 @@ void WhFans::ToggleFX(Entity* self, bool hit) {
|
||||
if (fanVolumes.size() == 0 || !self->GetVar<bool>(u"alive")) return;
|
||||
|
||||
if (self->GetVar<bool>(u"on")) {
|
||||
GameMessages::SendPlayAnimation(self, u"fan-off");
|
||||
RenderComponent::PlayAnimation(self, u"fan-off");
|
||||
|
||||
renderComponent->StopEffect("fanOn");
|
||||
self->SetVar<bool>(u"on", false);
|
||||
@@ -39,10 +41,10 @@ void WhFans::ToggleFX(Entity* self, bool hit) {
|
||||
auto volumePhys = volume->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!volumePhys) continue;
|
||||
volumePhys->SetPhysicsEffectActive(false);
|
||||
EntityManager::Instance()->SerializeEntity(volume);
|
||||
Game::entityManager->SerializeEntity(volume);
|
||||
}
|
||||
} else if (!self->GetVar<bool>(u"on") && self->GetVar<bool>(u"alive")) {
|
||||
GameMessages::SendPlayAnimation(self, u"fan-on");
|
||||
RenderComponent::PlayAnimation(self, u"fan-on");
|
||||
|
||||
self->SetVar<bool>(u"on", true);
|
||||
|
||||
@@ -50,7 +52,7 @@ void WhFans::ToggleFX(Entity* self, bool hit) {
|
||||
auto volumePhys = volume->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!volumePhys) continue;
|
||||
volumePhys->SetPhysicsEffectActive(true);
|
||||
EntityManager::Instance()->SerializeEntity(volume);
|
||||
Game::entityManager->SerializeEntity(volume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "HydrantSmashable.h"
|
||||
#include "EntityManager.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "GeneralUtils.h"
|
||||
|
||||
void HydrantSmashable::OnDie(Entity* self, Entity* killer) {
|
||||
@@ -14,7 +15,7 @@ void HydrantSmashable::OnDie(Entity* self, Entity* killer) {
|
||||
info.settings = { data };
|
||||
info.spawnerID = self->GetSpawnerID();
|
||||
|
||||
auto* hydrant = EntityManager::Instance()->CreateEntity(info);
|
||||
auto* hydrant = Game::entityManager->CreateEntity(info);
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(hydrant);
|
||||
Game::entityManager->ConstructEntity(hydrant);
|
||||
}
|
||||
|
||||
@@ -5,18 +5,19 @@
|
||||
#include "InventoryComponent.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "Item.h"
|
||||
#include "eMissionState.h"
|
||||
|
||||
void AgPropGuard::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
void AgPropGuard::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
||||
auto* character = target->GetCharacter();
|
||||
auto* missionComponent = target->GetComponent<MissionComponent>();
|
||||
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
|
||||
|
||||
const auto state = missionComponent->GetMissionState(320);
|
||||
if (missionID == 768 && missionState == MissionState::MISSION_STATE_AVAILABLE) {
|
||||
if (missionID == 768 && missionState == eMissionState::AVAILABLE) {
|
||||
if (!character->GetPlayerFlag(71)) {
|
||||
// TODO: Cinematic "MissionCam"
|
||||
}
|
||||
} else if (missionID == 768 && missionState >= MissionState::MISSION_STATE_READY_TO_COMPLETE) {
|
||||
} else if (missionID == 768 && missionState >= eMissionState::READY_TO_COMPLETE) {
|
||||
//remove the inventory items
|
||||
for (int item : gearSets) {
|
||||
auto* id = inventoryComponent->FindItemByLot(item);
|
||||
@@ -27,13 +28,13 @@ void AgPropGuard::OnMissionDialogueOK(Entity* self, Entity* target, int missionI
|
||||
}
|
||||
}
|
||||
} else if (
|
||||
(missionID == 320 && state == MissionState::MISSION_STATE_AVAILABLE) /*||
|
||||
(state == MissionState::MISSION_STATE_COMPLETE && missionID == 891 && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE)*/
|
||||
(missionID == 320 && state == eMissionState::AVAILABLE) /*||
|
||||
(state == eMissionState::COMPLETE && missionID == 891 && missionState == eMissionState::READY_TO_COMPLETE)*/
|
||||
) {
|
||||
//GameMessages::SendNotifyClientObject(EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(), u"GuardChat", target->GetObjectID(), 0, target->GetObjectID(), "", target->GetSystemAddress());
|
||||
//GameMessages::SendNotifyClientObject(Game::entityManager->GetZoneControlEntity()->GetObjectID(), u"GuardChat", target->GetObjectID(), 0, target->GetObjectID(), "", target->GetSystemAddress());
|
||||
|
||||
target->GetCharacter()->SetPlayerFlag(113, true);
|
||||
|
||||
EntityManager::Instance()->GetZoneControlEntity()->AddTimer("GuardFlyAway", 1.0f);
|
||||
Game::entityManager->GetZoneControlEntity()->AddTimer("GuardFlyAway", 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
class AgPropGuard final : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
|
||||
|
||||
private:
|
||||
std::vector<int> gearSets = { 14359,14321,14353,14315 };
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
#include "GameMessages.h"
|
||||
#include "EntityManager.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "eMissionState.h"
|
||||
|
||||
void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
|
||||
void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
||||
auto* character = target->GetCharacter();
|
||||
if (character == nullptr)
|
||||
return;
|
||||
@@ -13,13 +14,13 @@ void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int mission
|
||||
if (flag == 0)
|
||||
return;
|
||||
|
||||
if ((missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_ACTIVE)
|
||||
if ((missionState == eMissionState::AVAILABLE || missionState == eMissionState::ACTIVE)
|
||||
&& !character->GetPlayerFlag(flag)) {
|
||||
// If the player just started the mission, play a cinematic highlighting the target
|
||||
GameMessages::SendPlayCinematic(target->GetObjectID(), u"MissionCam", target->GetSystemAddress());
|
||||
} else if (missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
|
||||
} else if (missionState == eMissionState::READY_TO_COMPLETE) {
|
||||
// Makes the guard disappear once the mission has been completed
|
||||
const auto zoneControlID = EntityManager::Instance()->GetZoneControlEntity()->GetObjectID();
|
||||
const auto zoneControlID = Game::entityManager->GetZoneControlEntity()->GetObjectID();
|
||||
GameMessages::SendNotifyClientObject(zoneControlID, u"GuardChat", 0, 0, self->GetObjectID(),
|
||||
"", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
@@ -28,7 +29,7 @@ void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int mission
|
||||
if (spawnerName.empty())
|
||||
spawnerName = "Guard";
|
||||
|
||||
auto spawners = dZoneManager::Instance()->GetSpawnersByName(spawnerName);
|
||||
auto spawners = Game::zoneManager->GetSpawnersByName(spawnerName);
|
||||
for (auto* spawner : spawners) {
|
||||
spawner->Deactivate();
|
||||
}
|
||||
@@ -38,7 +39,7 @@ void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int mission
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t AgPropguards::GetFlagForMission(uint32_t missionID) {
|
||||
int32_t AgPropguards::GetFlagForMission(uint32_t missionID) {
|
||||
switch (missionID) {
|
||||
case 872:
|
||||
return 97;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "CppScripts.h"
|
||||
|
||||
class AgPropguards : public CppScripts::Script {
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override;
|
||||
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
|
||||
private:
|
||||
static uint32_t GetFlagForMission(uint32_t missionID);
|
||||
static int32_t GetFlagForMission(uint32_t missionID);
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ void PropertyFXDamage::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
if (skills != nullptr && targetStats != nullptr) {
|
||||
auto targetFactions = targetStats->GetFactionIDs();
|
||||
if (std::find(targetFactions.begin(), targetFactions.end(), 1) != targetFactions.end()) {
|
||||
skills->CalculateBehavior(11386, 692, target->GetObjectID());
|
||||
skills->CalculateBehavior(692, 11386, target->GetObjectID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,22 +3,23 @@
|
||||
#include "DestroyableComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "PossessableComponent.h"
|
||||
#include "RacingTaskParam.h"
|
||||
#include "eRacingTaskParam.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "eMissionTaskType.h"
|
||||
|
||||
void FvRaceSmashEggImagineServer::OnDie(Entity* self, Entity* killer) {
|
||||
if (killer != nullptr) {
|
||||
auto* destroyableComponent = killer->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent != nullptr) {
|
||||
destroyableComponent->SetImagination(destroyableComponent->GetImagination() + 10);
|
||||
EntityManager::Instance()->SerializeEntity(killer);
|
||||
Game::entityManager->SerializeEntity(killer);
|
||||
}
|
||||
|
||||
// get possessor to progress statistics and tasks.
|
||||
auto* possessableComponent = killer->GetComponent<PossessableComponent>();
|
||||
if (possessableComponent != nullptr) {
|
||||
|
||||
auto* possessor = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
|
||||
auto* possessor = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
|
||||
if (possessor != nullptr) {
|
||||
|
||||
auto* missionComponent = possessor->GetComponent<MissionComponent>();
|
||||
@@ -29,8 +30,8 @@ void FvRaceSmashEggImagineServer::OnDie(Entity* self, Entity* killer) {
|
||||
}
|
||||
if (missionComponent == nullptr) return;
|
||||
// Dragon eggs have their own smash server so we handle mission progression for them here.
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, 0, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_SMASHABLES);
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, self->GetLOT(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_SMASH_SPECIFIC_SMASHABLE);
|
||||
missionComponent->Progress(eMissionTaskType::RACING, 0, (LWOOBJID)eRacingTaskParam::SMASHABLES);
|
||||
missionComponent->Progress(eMissionTaskType::RACING, self->GetLOT(), (LWOOBJID)eRacingTaskParam::SMASH_SPECIFIC_SMASHABLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
#include "EntityManager.h"
|
||||
#include "PossessableComponent.h"
|
||||
#include "RaceImagineCrateServer.h"
|
||||
#include "RacingTaskParam.h"
|
||||
#include "eRacingTaskParam.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "eMissionTaskType.h"
|
||||
|
||||
void RaceImagineCrateServer::OnDie(Entity* self, Entity* killer) {
|
||||
if (self->GetVar<bool>(u"bIsDead")) {
|
||||
@@ -29,14 +30,14 @@ void RaceImagineCrateServer::OnDie(Entity* self, Entity* killer) {
|
||||
if (destroyableComponent != nullptr) {
|
||||
destroyableComponent->SetImagination(60);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(killer);
|
||||
Game::entityManager->SerializeEntity(killer);
|
||||
}
|
||||
|
||||
// Find possessor of race car to progress missions and update stats.
|
||||
auto* possessableComponent = killer->GetComponent<PossessableComponent>();
|
||||
if (possessableComponent != nullptr) {
|
||||
|
||||
auto* possessor = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
|
||||
auto* possessor = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
|
||||
if (possessor != nullptr) {
|
||||
|
||||
auto* missionComponent = possessor->GetComponent<MissionComponent>();
|
||||
@@ -49,7 +50,7 @@ void RaceImagineCrateServer::OnDie(Entity* self, Entity* killer) {
|
||||
|
||||
// Progress racing smashable missions
|
||||
if (missionComponent == nullptr) return;
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, 0, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_SMASHABLES);
|
||||
missionComponent->Progress(eMissionTaskType::RACING, 0, (LWOOBJID)eRacingTaskParam::SMASHABLES);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
#include "EntityManager.h"
|
||||
#include "PossessorComponent.h"
|
||||
#include "RaceImaginePowerup.h"
|
||||
#include "RacingTaskParam.h"
|
||||
#include "eRacingTaskParam.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "eMissionTaskType.h"
|
||||
|
||||
void RaceImaginePowerup::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
|
||||
int32_t param2, int32_t param3) {
|
||||
@@ -14,7 +15,7 @@ void RaceImaginePowerup::OnFireEventServerSide(Entity* self, Entity* sender, std
|
||||
return;
|
||||
}
|
||||
|
||||
auto* vehicle = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable());
|
||||
auto* vehicle = Game::entityManager->GetEntity(possessorComponent->GetPossessable());
|
||||
|
||||
if (vehicle == nullptr) {
|
||||
return;
|
||||
@@ -31,6 +32,6 @@ void RaceImaginePowerup::OnFireEventServerSide(Entity* self, Entity* sender, std
|
||||
auto* missionComponent = sender->GetComponent<MissionComponent>();
|
||||
|
||||
if (missionComponent == nullptr) return;
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, self->GetLOT(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_COLLECT_IMAGINATION);
|
||||
missionComponent->Progress(eMissionTaskType::RACING, self->GetLOT(), (LWOOBJID)eRacingTaskParam::COLLECT_IMAGINATION);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,16 @@
|
||||
#include "EntityManager.h"
|
||||
#include "PossessableComponent.h"
|
||||
#include "RaceSmashServer.h"
|
||||
#include "RacingTaskParam.h"
|
||||
#include "eRacingTaskParam.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "eMissionTaskType.h"
|
||||
|
||||
void RaceSmashServer::OnDie(Entity* self, Entity* killer) {
|
||||
// Crate is smashed by the car
|
||||
auto* possessableComponent = killer->GetComponent<PossessableComponent>();
|
||||
if (possessableComponent != nullptr) {
|
||||
|
||||
auto* possessor = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
|
||||
auto* possessor = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
|
||||
if (possessor != nullptr) {
|
||||
|
||||
auto* missionComponent = possessor->GetComponent<MissionComponent>();
|
||||
@@ -22,9 +23,9 @@ void RaceSmashServer::OnDie(Entity* self, Entity* killer) {
|
||||
|
||||
// Progress racing smashable missions
|
||||
if (missionComponent == nullptr) return;
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, 0, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_SMASHABLES);
|
||||
missionComponent->Progress(eMissionTaskType::RACING, 0, (LWOOBJID)eRacingTaskParam::SMASHABLES);
|
||||
// Progress missions that ask us to smash a specific smashable.
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, self->GetLOT(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_SMASH_SPECIFIC_SMASHABLE);
|
||||
missionComponent->Progress(eMissionTaskType::RACING, self->GetLOT(), (LWOOBJID)eRacingTaskParam::SMASH_SPECIFIC_SMASHABLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,47 +0,0 @@
|
||||
#include "SpecialImaginePowerupSpawner.h"
|
||||
|
||||
#include "GameMessages.h"
|
||||
#include "SkillComponent.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "EntityManager.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(COMPONENT_TYPE_SKILL, skillComponent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto source = entering->GetObjectID();
|
||||
|
||||
skillComponent->CalculateBehavior(13, 20, source);
|
||||
|
||||
DestroyableComponent* destroyableComponent;
|
||||
if (!self->TryGetComponent(COMPONENT_TYPE_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);
|
||||
}
|
||||
10
dScripts/ai/SPEC/SpecialSpeedBuffSpawner.h
Normal file
10
dScripts/ai/SPEC/SpecialSpeedBuffSpawner.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
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;
|
||||
};
|
||||
@@ -1,4 +1,11 @@
|
||||
set(DSCRIPTS_SOURCES_AI_WILD
|
||||
set(DSCRIPTS_SOURCES_AI_WILD
|
||||
"AllCrateChicken.cpp"
|
||||
"WildAmbients.cpp"
|
||||
"WildAmbientCrab.cpp"
|
||||
"WildAndScared.cpp"
|
||||
"WildGfGlowbug.cpp"
|
||||
"WildNinjaBricks.cpp"
|
||||
"WildNinjaStudent.cpp"
|
||||
"WildNinjaSensei.cpp"
|
||||
"WildPants.cpp"
|
||||
PARENT_SCOPE)
|
||||
|
||||
27
dScripts/ai/WILD/WildAmbientCrab.cpp
Normal file
27
dScripts/ai/WILD/WildAmbientCrab.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "WildAmbientCrab.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void WildAmbientCrab::OnStartup(Entity* self){
|
||||
self->SetVar(u"flipped", true);
|
||||
GameMessages::SendPlayAnimation(self, u"idle");
|
||||
}
|
||||
|
||||
void WildAmbientCrab::OnUse(Entity* self, Entity* user) {
|
||||
auto flipped = self->GetVar<bool>(u"flipped");
|
||||
if (flipped) {
|
||||
self->AddTimer("Flipping", 0.6f);
|
||||
GameMessages::SendPlayAnimation(self, u"flip-over");
|
||||
self->SetVar(u"flipped", false);
|
||||
} else if (!flipped) {
|
||||
self->AddTimer("Flipback", 0.8f);
|
||||
GameMessages::SendPlayAnimation(self, u"flip-back");
|
||||
self->SetVar(u"flipped", true);
|
||||
}
|
||||
}
|
||||
|
||||
void WildAmbientCrab::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "Flipping") GameMessages::SendPlayAnimation(self, u"over-idle");
|
||||
else if (timerName == "Flipback") GameMessages::SendPlayAnimation(self, u"idle");
|
||||
}
|
||||
|
||||
|
||||
9
dScripts/ai/WILD/WildAmbientCrab.h
Normal file
9
dScripts/ai/WILD/WildAmbientCrab.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class WildAmbientCrab final : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
};
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "WildAmbients.h"
|
||||
#include "GameMessages.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
void WildAmbients::OnUse(Entity* self, Entity* user) {
|
||||
GameMessages::SendPlayAnimation(self, u"interact");
|
||||
RenderComponent::PlayAnimation(self, u"interact");
|
||||
}
|
||||
|
||||
6
dScripts/ai/WILD/WildAndScared.cpp
Normal file
6
dScripts/ai/WILD/WildAndScared.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "WildAndScared.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void WildAndScared::OnUse(Entity* self, Entity* user) {
|
||||
GameMessages::SendPlayAnimation(self, u"scared");
|
||||
}
|
||||
7
dScripts/ai/WILD/WildAndScared.h
Normal file
7
dScripts/ai/WILD/WildAndScared.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class WildAndScared : public CppScripts::Script {
|
||||
public:
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
};
|
||||
28
dScripts/ai/WILD/WildGfGlowbug.cpp
Normal file
28
dScripts/ai/WILD/WildGfGlowbug.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "WildGfGlowbug.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void WildGfGlowbug::OnStartup(Entity* self){
|
||||
self->SetVar(u"switch", false);
|
||||
}
|
||||
|
||||
void WildGfGlowbug::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
|
||||
if (args == "physicsReady") {
|
||||
auto switchState = self->GetVar<bool>(u"switch");
|
||||
if (!switchState) {
|
||||
GameMessages::SendStopFXEffect(self, true, "glowlight");
|
||||
} else if (switchState) {
|
||||
GameMessages::SendPlayFXEffect(self, -1, u"light", "glowlight", LWOOBJID_EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WildGfGlowbug::OnUse(Entity* self, Entity* user) {
|
||||
auto switchState = self->GetVar<bool>(u"switch");
|
||||
if (switchState) {
|
||||
GameMessages::SendStopFXEffect(self, true, "glowlight");
|
||||
self->SetVar(u"switch", false);
|
||||
} else if (!switchState) {
|
||||
GameMessages::SendPlayFXEffect(self, -1, u"light", "glowlight", LWOOBJID_EMPTY);
|
||||
self->SetVar(u"switch", true);
|
||||
}
|
||||
}
|
||||
9
dScripts/ai/WILD/WildGfGlowbug.h
Normal file
9
dScripts/ai/WILD/WildGfGlowbug.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class WildGfGlowbug : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) override;
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
};
|
||||
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 = Game::entityManager->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 = Game::entityManager->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 = Game::entityManager->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 = Game::entityManager->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;
|
||||
};
|
||||
|
||||
10
dScripts/ai/WILD/WildPants.cpp
Normal file
10
dScripts/ai/WILD/WildPants.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include "WildPants.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void WildPants::OnStartup(Entity* self) {
|
||||
self->SetProximityRadius(5, "scardyPants");
|
||||
}
|
||||
|
||||
void WildPants::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
if (status == "ENTER") GameMessages::SendPlayAnimation(self, u"scared");
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "CppScripts.h"
|
||||
|
||||
class SpecialImaginePowerupSpawner final : public CppScripts::Script
|
||||
class WildPants : public CppScripts::Script
|
||||
{
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
Reference in New Issue
Block a user