Add LupGenericInteraction and Robot Citizen script

This commit is contained in:
Aaron Kimbre 2022-09-02 21:52:57 -05:00
parent 14d4bf3cc5
commit 67ec10ac0d
6 changed files with 61 additions and 1 deletions

View File

@ -130,6 +130,7 @@ set(DSCRIPT_SOURCES "ActivityManager.cpp"
"InvalidScript.cpp"
"LegoDieRoll.cpp"
"Lieutenant.cpp"
"LupGenericInteract.cpp"
"MaestromExtracticatorServer.cpp"
"MailBoxServer.cpp"
"MastTeleport.cpp"
@ -248,6 +249,7 @@ set(DSCRIPT_SOURCES "ActivityManager.cpp"
"WaveBossHorsemen.cpp"
"WaveBossSpiderling.cpp"
"WblGenericZone.cpp"
"WblRobotCitizen.cpp"
"WhFans.cpp"
"WildAmbients.cpp"
"WishingWellServer.cpp"

View File

@ -290,6 +290,8 @@
// WBL scripts
#include "WblGenericZone.h"
#include "LupGenericInteract.h"
#include "WblRobotCitizen.h"
//Big bad global bc this is a namespace and not a class:
InvalidScript* invalidToReturn = new InvalidScript();
@ -847,6 +849,10 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
// WBL
else if (scriptName == "scripts\\zone\\LUPs\\WBL_generic_zone.lua")
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();
//Ignore these scripts:
else if (scriptName == "scripts\\02_server\\Enemy\\General\\L_SUSPEND_LUA_AI.lua")
@ -855,7 +861,7 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
script = invalidToReturn;
else if (script == invalidToReturn) {
if (scriptName.length() > 0)
Game::logger->LogDebug("CppScripts", "Attempted to load CppScript for '%s', but returned InvalidScript.", scriptName.c_str());
Game::logger->Log("CppScripts", "Lot %i attempted to load CppScript for '%s', but returned InvalidScript.", parent->GetLOT(), scriptName.c_str());
// information not really needed for sys admins but is for developers
script = invalidToReturn;

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,9 @@
#pragma once
#include "CppScripts.h"
class LupGenericInteract : public CppScripts::Script {
public:
void OnUse(Entity* self, Entity* user) override;
private:
const uint32_t frakjawChestId = 16486;
};

View File

@ -0,0 +1,24 @@
#include "WblRobotCitizen.h"
#include "GameMessages.h"
#include "MovingPlatformComponent.h"
#include "dLogger.h"
void WblRobotCitizen::OnStartup(Entity* self) {
auto movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
if (movingPlatformComponent) movingPlatformComponent->StartPathing();
}
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) {
auto movingPlatformComponent = self->GetComponent<MovingPlatformComponent>();
if (movingPlatformComponent) movingPlatformComponent->ContinuePathing();
}

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