Implement some scripts for alpha FV (#1049)

* Implement maelstrom fog for alpha FV
add OnOffCollisionPhantom call to cppscripts
Add physics shape for gas blocking volume

* Add Ninja Sensie Script for alpha FV
and migration

* Fix private var casing

* And ninja wild scripts
they keep making me add more things

* address feedback

---------

Co-authored-by: Gie "Max" Vanommeslaeghe <gievanom@hotmail.com>
This commit is contained in:
Aaron Kimbrell
2023-04-12 11:46:31 -05:00
committed by GitHub
parent 9c721abebb
commit ce51438bc8
17 changed files with 287 additions and 1 deletions

View File

@@ -0,0 +1,78 @@
#include "ActNinjaSensei.h"
#include "Entity.h"
#include "EntityManager.h"
#include "GameMessages.h"
void ActNinjaSensei::OnStartup(Entity* self) {
auto students = EntityManager::Instance()->GetEntitiesInGroup(this->m_StudentGroup);
std::vector<Entity*> validStudents = {};
for (auto* student : students) {
if (student && student->GetLOT() == this->m_StudentLOT) validStudents.push_back(student);
}
self->SetVar(u"students", validStudents);
self->AddTimer("crane", 5);
}
void ActNinjaSensei::OnTimerDone(Entity* self, std::string timerName) {
auto students = self->GetVar<std::vector<Entity*>>(u"students");
if (students.empty()) return;
if (timerName == "crane") {
for (auto student : students) {
if (student) GameMessages::SendPlayAnimation(student, u"crane");
}
GameMessages::SendPlayAnimation(self, u"crane");
self->AddTimer("bow", 15.33);
}
if (timerName == "bow") {
GameMessages::SendPlayAnimation(self, u"bow");
for (auto student : students) {
if (student) GameMessages::SendPlayAnimation(student, u"bow");
}
GameMessages::SendPlayAnimation(self, u"bow");
self->AddTimer("tiger", 5);
}
if (timerName == "tiger") {
GameMessages::SendPlayAnimation(self, u"tiger");
for (auto student : students) {
if (student) GameMessages::SendPlayAnimation(student, u"tiger");
}
GameMessages::SendPlayAnimation(self, u"tiger");
self->AddTimer("bow2", 15.33);
}
if (timerName == "bow2") {
GameMessages::SendPlayAnimation(self, u"bow");
for (auto student : students) {
if (student) GameMessages::SendPlayAnimation(student, u"bow");
}
GameMessages::SendPlayAnimation(self, u"bow");
self->AddTimer("mantis", 5);
}
if (timerName == "mantis") {
GameMessages::SendPlayAnimation(self, u"mantis");
for (auto student : students) {
if (student) GameMessages::SendPlayAnimation(student, u"mantis");
}
GameMessages::SendPlayAnimation(self, u"mantis");
self->AddTimer("bow3", 15.3);
}
if (timerName == "bow3") {
GameMessages::SendPlayAnimation(self, u"bow");
for (auto student : students) {
if (student) GameMessages::SendPlayAnimation(student, u"bow");
}
GameMessages::SendPlayAnimation(self, u"bow");
self->AddTimer("repeat", 5);
}
if (timerName == "repeat") {
self->CancelAllTimers();
self->AddTimer("crane", 5);
}
}

View 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;
};

View File

@@ -1,4 +1,5 @@
set(DSCRIPTS_SOURCES_AI_FV
set(DSCRIPTS_SOURCES_AI_FV
"ActNinjaSensei.cpp"
"ActNinjaTurret.cpp"
"FvFlyingCreviceDragon.cpp"
"FvDragonSmashingGolemQb.cpp"
@@ -15,4 +16,5 @@ set(DSCRIPTS_SOURCES_AI_FV
"FvPassThroughWall.cpp"
"FvBounceOverWall.cpp"
"FvMaelstromGeyser.cpp"
"TriggerGas.cpp"
PARENT_SCOPE)

View File

@@ -0,0 +1,49 @@
#include "TriggerGas.h"
#include "InventoryComponent.h"
#include "SkillComponent.h"
#include "Entity.h"
#include "dLogger.h"
void TriggerGas::OnStartup(Entity* self) {
self->AddTimer(this->m_TimerName, this->m_Time);
}
void TriggerGas::OnCollisionPhantom(Entity* self, Entity* target) {
if (!target->IsPlayer()) return;
auto players = self->GetVar<std::vector<Entity*>>(u"players");
players.push_back(target);
self->SetVar(u"players", players);
}
void TriggerGas::OnOffCollisionPhantom(Entity* self, Entity* target) {
auto players = self->GetVar<std::vector<Entity*>>(u"players");
if (!target->IsPlayer() || players.empty()) return;
auto position = std::find(players.begin(), players.end(), target);
if (position != players.end()) players.erase(position);
self->SetVar(u"players", players);
}
void TriggerGas::OnTimerDone(Entity* self, std::string timerName) {
if (timerName != this->m_TimerName) return;
auto players = self->GetVar<std::vector<Entity*>>(u"players");
for (auto player : players) {
if (player->GetIsDead() || !player){
auto position = std::find(players.begin(), players.end(), player);
if (position != players.end()) players.erase(position);
continue;
}
auto inventoryComponent = player->GetComponent<InventoryComponent>();
if (inventoryComponent) {
if (!inventoryComponent->IsEquipped(this->m_MaelstromHelmet)) {
auto* skillComponent = self->GetComponent<SkillComponent>();
if (skillComponent) {
skillComponent->CastSkill(this->m_FogDamageSkill, player->GetObjectID());
}
}
}
}
self->SetVar(u"players", players);
self->AddTimer(this->m_TimerName, this->m_Time);
}

View 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;
};