Merge branch 'wbl-generic-and-rc-citizen' into moreMovementAi

This commit is contained in:
Aaron Kimbre 2023-08-15 10:13:38 -05:00
commit e35b95f3c8
5 changed files with 51 additions and 0 deletions

View File

@ -293,6 +293,8 @@
// WBL scripts // WBL scripts
#include "WblGenericZone.h" #include "WblGenericZone.h"
#include "LupGenericInteract.h"
#include "WblRobotCitizen.h"
// Alpha Scripts // Alpha Scripts
#include "TriggerGas.h" #include "TriggerGas.h"
@ -874,6 +876,10 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
// WBL // WBL
else if (scriptName == "scripts\\zone\\LUPs\\WBL_generic_zone.lua") else if (scriptName == "scripts\\zone\\LUPs\\WBL_generic_zone.lua")
script = new WblGenericZone(); script = new WblGenericZone();
else if (scriptName == "scripts\\ai\\WILD\\L_LUP_generic_interact.lua")
script = new LupGenericInteract();
else if (scriptName.rfind("scripts\\zone\\LUPs\\RobotCity Intro\\WBL_RCIntro_RobotCitizen", 0) == 0)
script = new WblRobotCitizen();
// Alpha // Alpha
if (scriptName == "scripts\\ai\\FV\\L_TRIGGER_GAS.lua") if (scriptName == "scripts\\ai\\FV\\L_TRIGGER_GAS.lua")

View File

@ -0,0 +1,7 @@
#include "LupGenericInteract.h"
#include "GameMessages.h"
#include "dLogger.h"
void LupGenericInteract::OnUse(Entity* self, Entity* user) {
GameMessages::SendPlayAnimation(self, u"interact");
}

View File

@ -0,0 +1,7 @@
#pragma once
#include "CppScripts.h"
class LupGenericInteract : public CppScripts::Script {
public:
void OnUse(Entity* self, Entity* user) override;
};

View File

@ -0,0 +1,19 @@
#include "WblRobotCitizen.h"
#include "GameMessages.h"
void WblRobotCitizen::OnStartup(Entity* self) {
// TODO: make it move via controllable physics
}
void WblRobotCitizen::OnUse(Entity* self, Entity* user) {
auto movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
if (movingPlatformComponent) movingPlatformComponent->StopPathing();
auto face = NiQuaternion::LookAt(self->GetPosition(), user->GetPosition());
self->SetRotation(face);
GameMessages::SendPlayAnimation(self, u"wave");
self->AddTimer("animation time", m_AnimationTime);
}
void WblRobotCitizen::OnTimerDone(Entity* self, std::string timerName) {
// TODO: make it move via controllable physics
}

View File

@ -0,0 +1,12 @@
#pragma once
#include "CppScripts.h"
class WblRobotCitizen : public CppScripts::Script {
public:
void OnStartup(Entity* self) override;
void OnUse(Entity* self, Entity* user) override;
void OnTimerDone(Entity* self, std::string timerName) override;
private:
const float m_AnimationTime = 2.5;
};