mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-22 13:33:35 +00:00
comments from movementAI branch (#1483)
tests tested that red green and yellow bots waved when interacted with tested that construction robot races when interacted with wandering vendor does nothing before and after, but script is ready for use when npcs are implemented. add scripts for robot city
This commit is contained in:
parent
c9a8be4fb9
commit
366a80ffd2
@ -322,8 +322,8 @@ void GameMessages::SendPlayNDAudioEmitter(Entity* entity, const SystemAddress& s
|
||||
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write(eGameMessageType::PLAY_ND_AUDIO_EMITTER);
|
||||
bitStream.Write0();
|
||||
bitStream.Write0();
|
||||
bitStream.Write0(); // callback message data {lwoobjid}
|
||||
bitStream.Write0(); // audio emitterid {uint32_t}
|
||||
|
||||
uint32_t length = audioGUID.size();
|
||||
bitStream.Write(length);
|
||||
@ -331,9 +331,9 @@ void GameMessages::SendPlayNDAudioEmitter(Entity* entity, const SystemAddress& s
|
||||
bitStream.Write<char>(audioGUID[k]);
|
||||
}
|
||||
|
||||
bitStream.Write<uint32_t>(0);
|
||||
bitStream.Write0();
|
||||
bitStream.Write0();
|
||||
bitStream.Write<uint32_t>(0); // size of NDAudioMetaEventName (then print the string like the guid)
|
||||
bitStream.Write0(); // result {bool}
|
||||
bitStream.Write0(); // m_TargetObjectIDForNDAudioCallbackMessages {lwoobjid}
|
||||
|
||||
SEND_PACKET_BROADCAST;
|
||||
}
|
||||
|
@ -15,7 +15,9 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_AM
|
||||
"AmSkullkinDrillStand.cpp"
|
||||
"AmSkullkinTower.cpp"
|
||||
"AmBlueX.cpp"
|
||||
"AmTeapotServer.cpp")
|
||||
"AmTeapotServer.cpp"
|
||||
"WanderingVendor.cpp"
|
||||
)
|
||||
|
||||
add_library(dScriptsServerMapAM ${DSCRIPTS_SOURCES_02_SERVER_MAP_AM})
|
||||
target_include_directories(dScriptsServerMapAM PUBLIC ".")
|
||||
|
33
dScripts/02_server/Map/AM/WanderingVendor.cpp
Normal file
33
dScripts/02_server/Map/AM/WanderingVendor.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include "WanderingVendor.h"
|
||||
#include "MovementAIComponent.h"
|
||||
#include "ProximityMonitorComponent.h"
|
||||
|
||||
void WanderingVendor::OnStartup(Entity* self) {
|
||||
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
|
||||
if (!movementAIComponent) return;
|
||||
// movementAIComponent->Resume();
|
||||
self->SetProximityRadius(10, "playermonitor");
|
||||
}
|
||||
|
||||
void WanderingVendor::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
||||
if (status == "ENTER" && entering->IsPlayer()) {
|
||||
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
|
||||
if (!movementAIComponent) return;
|
||||
// movementAIComponent->Pause();
|
||||
self->CancelTimer("startWalking");
|
||||
} else if (status == "LEAVE") {
|
||||
auto* proximityMonitorComponent = self->GetComponent<ProximityMonitorComponent>();
|
||||
if (!proximityMonitorComponent) self->AddComponent<ProximityMonitorComponent>();
|
||||
|
||||
const auto proxObjs = proximityMonitorComponent->GetProximityObjects("playermonitor");
|
||||
if (proxObjs.empty()) self->AddTimer("startWalking", 1.5);
|
||||
}
|
||||
}
|
||||
|
||||
void WanderingVendor::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (timerName == "startWalking") {
|
||||
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
|
||||
if (!movementAIComponent) return;
|
||||
// movementAIComponent->Resume();
|
||||
}
|
||||
}
|
13
dScripts/02_server/Map/AM/WanderingVendor.h
Normal file
13
dScripts/02_server/Map/AM/WanderingVendor.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef __WANDERINGVENDOR__H__
|
||||
#define __WANDERINGVENDOR__H__
|
||||
|
||||
#include "CppScripts.h"
|
||||
|
||||
class WanderingVendor : public CppScripts::Script {
|
||||
public:
|
||||
void OnStartup(Entity* self) override;
|
||||
void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override;
|
||||
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||
};
|
||||
|
||||
#endif //!__WANDERINGVENDOR__H__
|
@ -240,6 +240,7 @@
|
||||
#include "AmDarklingDragon.h"
|
||||
#include "AmBlueX.h"
|
||||
#include "AmTeapotServer.h"
|
||||
#include "WanderingVendor.h"
|
||||
|
||||
// NJ Scripts
|
||||
#include "NjGarmadonCelebration.h"
|
||||
@ -317,6 +318,8 @@
|
||||
#include "WildNinjaSensei.h"
|
||||
#include "WildNinjaBricks.h"
|
||||
#include "VisToggleNotifierServer.h"
|
||||
#include "LupGenericInteract.h"
|
||||
#include "WblRobotCitizen.h"
|
||||
|
||||
namespace {
|
||||
InvalidScript* invalidToReturn = new InvalidScript();
|
||||
@ -547,7 +550,7 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
|
||||
//PR:
|
||||
else if (scriptName == "scripts\\client\\ai\\PR\\L_PR_WHISTLE.lua")
|
||||
script = new PrWhistle();
|
||||
else if (scriptName == "scripts\\02_server\\Map\\PR\\L_PR_SEAGULL_FLY.lua")
|
||||
if (scriptName == "scripts\\02_server\\Map\\PR\\L_PR_SEAGULL_FLY.lua")
|
||||
script = new PrSeagullFly();
|
||||
else if (scriptName == "scripts\\ai\\PETS\\L_HYDRANT_SMASHABLE.lua")
|
||||
script = new HydrantSmashable();
|
||||
@ -642,6 +645,8 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
|
||||
script = new MailBoxServer();
|
||||
else if (scriptName == "scripts\\ai\\ACT\\L_ACT_MINE.lua")
|
||||
script = new ActMine();
|
||||
else if (scriptName == "scripts\\02_server\\Map\\AM\\L_WANDERING_VENDOR.lua")
|
||||
script = new WanderingVendor();
|
||||
|
||||
//Racing:
|
||||
else if (scriptName == "scripts\\ai\\RACING\\OBJECTS\\RACE_IMAGINE_CRATE_SERVER.lua")
|
||||
@ -726,7 +731,7 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
|
||||
script = new NTNaomiDirtServer();
|
||||
|
||||
//AM:
|
||||
else if (scriptName == "scripts\\02_server\\Map\\AM\\L_AM_CONSOLE_TELEPORT_SERVER.lua")
|
||||
if (scriptName == "scripts\\02_server\\Map\\AM\\L_AM_CONSOLE_TELEPORT_SERVER.lua")
|
||||
script = new AmConsoleTeleportServer();
|
||||
else if (scriptName == "scripts\\02_server\\Map\\AM\\L_RANDOM_SPAWNER_FIN.lua")
|
||||
script = new RandomSpawnerFin();
|
||||
@ -806,7 +811,7 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
|
||||
script = new Lieutenant();
|
||||
else if (scriptName == "scripts\\02_server\\Map\\njhub\\L_RAIN_OF_ARROWS.lua")
|
||||
script = new RainOfArrows();
|
||||
else if (scriptName == "scripts\\02_server\\Map\\njhub\\L_CAVE_PRISON_CAGE.lua")
|
||||
if (scriptName == "scripts\\02_server\\Map\\njhub\\L_CAVE_PRISON_CAGE.lua")
|
||||
script = new CavePrisonCage();
|
||||
else if (scriptName == "scripts\\02_server\\Map\\njhub\\boss_instance\\L_MONASTERY_BOSS_INSTANCE_SERVER.lua")
|
||||
script = new NjMonastryBossInstance();
|
||||
@ -938,6 +943,10 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
|
||||
script = new WildNinjaStudent();
|
||||
else if (scriptName == "scripts\\ai\\WILD\\L_WILD_NINJA_SENSEI.lua")
|
||||
script = new WildNinjaSensei();
|
||||
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();
|
||||
|
||||
// handle invalid script reporting if the path is greater than zero and it's not an ignored script
|
||||
// information not really needed for sys admins but is for developers
|
||||
|
@ -1,5 +1,6 @@
|
||||
set(DSCRIPTS_SOURCES_AI_WILD
|
||||
"AllCrateChicken.cpp"
|
||||
"LupGenericInteract.cpp"
|
||||
"WildAmbients.cpp"
|
||||
"WildAmbientCrab.cpp"
|
||||
"WildAndScared.cpp"
|
||||
|
6
dScripts/ai/WILD/LupGenericInteract.cpp
Normal file
6
dScripts/ai/WILD/LupGenericInteract.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include "LupGenericInteract.h"
|
||||
#include "GameMessages.h"
|
||||
|
||||
void LupGenericInteract::OnUse(Entity* self, Entity* user) {
|
||||
GameMessages::SendPlayAnimation(self, u"interact");
|
||||
}
|
12
dScripts/ai/WILD/LupGenericInteract.h
Normal file
12
dScripts/ai/WILD/LupGenericInteract.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef __LUCGENERICINTERACT__H__
|
||||
#define __LUCGENERICINTERACT__H__
|
||||
|
||||
#include "CppScripts.h"
|
||||
|
||||
class LupGenericInteract : public CppScripts::Script {
|
||||
public:
|
||||
void OnUse(Entity* self, Entity* user) override;
|
||||
};
|
||||
|
||||
#endif //!__LUCGENERICINTERACT__H__
|
||||
|
@ -22,6 +22,7 @@ add_library(dScriptsZone STATIC ${DSCRIPTS_SOURCES_ZONE})
|
||||
target_include_directories(dScriptsZone PUBLIC "."
|
||||
"AG"
|
||||
"LUPs"
|
||||
"LUPs/RobotCity_Intro"
|
||||
"PROPERTY"
|
||||
"PROPERTY/FV"
|
||||
"PROPERTY/GF"
|
||||
|
@ -1,3 +1,11 @@
|
||||
set(DSCRIPTS_SOURCES_ZONE_LUPS
|
||||
set(DSCRIPTS_SOURCES_ZONE_LUPS
|
||||
"WblGenericZone.cpp"
|
||||
PARENT_SCOPE)
|
||||
)
|
||||
|
||||
add_subdirectory(RobotCity_Intro)
|
||||
|
||||
foreach(file ${DSCRIPTS_SOURCES_ZONE_LUPS_ROBOTCITYINTRO})
|
||||
set(DSCRIPTS_SOURCES_ZONE_LUPS ${DSCRIPTS_SOURCES_ZONE_LUPS} "RobotCity_Intro/${file}")
|
||||
endforeach()
|
||||
|
||||
set(DSCRIPTS_SOURCES_ZONE_LUPS ${DSCRIPTS_SOURCES_ZONE_LUPS} PARENT_SCOPE)
|
||||
|
3
dScripts/zone/LUPs/RobotCity_Intro/CMakeLists.txt
Normal file
3
dScripts/zone/LUPs/RobotCity_Intro/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
set(DSCRIPTS_SOURCES_ZONE_LUPS_ROBOTCITYINTRO
|
||||
"WblRobotCitizen.cpp"
|
||||
PARENT_SCOPE)
|
24
dScripts/zone/LUPs/RobotCity_Intro/WblRobotCitizen.cpp
Normal file
24
dScripts/zone/LUPs/RobotCity_Intro/WblRobotCitizen.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include "WblRobotCitizen.h"
|
||||
#include "MovementAIComponent.h"
|
||||
#include "RenderComponent.h"
|
||||
|
||||
void WblRobotCitizen::OnStartup(Entity* self) {
|
||||
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
|
||||
if (!movementAIComponent) return;
|
||||
// movementAIComponent->Resume();
|
||||
}
|
||||
|
||||
void WblRobotCitizen::OnUse(Entity* self, Entity* user) {
|
||||
// auto movementAIComponent = self->GetComponent<MovementAIComponent>();
|
||||
// if (!movementAIComponent) movementAIComponent->Pause();
|
||||
auto face = NiQuaternion::LookAt(self->GetPosition(), user->GetPosition());
|
||||
self->SetRotation(face);
|
||||
auto timer = RenderComponent::PlayAnimation(self, "wave");
|
||||
self->AddTimer("animation time", timer);
|
||||
}
|
||||
|
||||
void WblRobotCitizen::OnTimerDone(Entity* self, std::string timerName) {
|
||||
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
|
||||
if (!movementAIComponent) return;
|
||||
// movementAIComponent->Resume();
|
||||
}
|
13
dScripts/zone/LUPs/RobotCity_Intro/WblRobotCitizen.h
Normal file
13
dScripts/zone/LUPs/RobotCity_Intro/WblRobotCitizen.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef __WBLROBOTCITIZEN__H__
|
||||
#define __WBLROBOTCITIZEN__H__
|
||||
|
||||
#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;
|
||||
};
|
||||
|
||||
#endif //!__WBLROBOTCITIZEN__H__
|
Loading…
Reference in New Issue
Block a user