mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-14 20:28:21 +00:00
Add LupGenericInteraction and Robot Citizen script
This commit is contained in:
parent
14d4bf3cc5
commit
67ec10ac0d
@ -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"
|
||||
|
@ -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;
|
||||
|
7
dScripts/LupGenericInteract.cpp
Normal file
7
dScripts/LupGenericInteract.cpp
Normal 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");
|
||||
}
|
9
dScripts/LupGenericInteract.h
Normal file
9
dScripts/LupGenericInteract.h
Normal 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;
|
||||
};
|
24
dScripts/WblRobotCitizen.cpp
Normal file
24
dScripts/WblRobotCitizen.cpp
Normal 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();
|
||||
}
|
12
dScripts/WblRobotCitizen.h
Normal file
12
dScripts/WblRobotCitizen.h
Normal 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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user