Merge branch 'main' into moreMovementAi

This commit is contained in:
David Markowitz
2024-03-07 00:40:26 -08:00
143 changed files with 1769 additions and 1288 deletions

View File

@@ -30,15 +30,28 @@ endforeach()
add_subdirectory(Pets)
add_library(dScriptsServer STATIC ${DSCRIPTS_SOURCES_02_SERVER})
target_include_directories(dScriptsServer PUBLIC "."
add_library(dScriptsServerBase OBJECT ${DSCRIPTS_SOURCES_02_SERVER})
target_include_directories(dScriptsServerBase PUBLIC "."
"DLU"
"Equipment"
"Minigame"
"Minigame/General"
"Objects"
"Pets")
)
target_precompile_headers(dScriptsServerBase REUSE_FROM dScriptsBase)
add_library(dScriptsServer INTERFACE)
target_sources(dScriptsServer INTERFACE
$<TARGET_OBJECTS:dScriptsServerBase>
$<TARGET_OBJECTS:dScriptsServerEnemy>
$<TARGET_OBJECTS:dScriptsServerPets>
)
target_link_libraries(dScriptsServer INTERFACE
dScriptsServerEnemy
dScriptsServerMap)
target_precompile_headers(dScriptsServer REUSE_FROM dScriptsBase)
dScriptsServerMap
)
target_include_directories(dScriptsServer INTERFACE
$<TARGET_PROPERTY:dScriptsServerBase,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsServerEnemy,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsServerMap,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsServerPets,INTERFACE_INCLUDE_DIRECTORIES>
)

View File

@@ -5,20 +5,17 @@
#include "RenderComponent.h"
void DLUVanityTeleportingObject::OnStartup(Entity* self) {
if (!self->HasVar(u"npcName") || !self->HasVar(u"teleport")) return;
m_Object = VanityUtilities::GetObject(self->GetVarAsString(u"npcName"));
if (!self->HasVar(u"npcName")) return;
m_Object = VanityUtilities::GetObject(self->GetVarAsString(u"npcName"));
if (!m_Object) return;
if (self->HasVar(u"teleportInterval")) m_TeleportInterval = self->GetVar<float>(u"teleportInterval");
if (self->GetVar<bool>(u"teleport")) {
self->AddTimer("setupTeleport", m_TeleportInterval);
}
self->AddTimer("setupTeleport", m_TeleportInterval);
}
void DLUVanityTeleportingObject::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "setupTeleport") {
RenderComponent::PlayAnimation(self, u"interact");
GameMessages::SendPlayFXEffect(self->GetObjectID(), 6478, u"teleportBeam", "teleportBeam");
GameMessages::SendPlayFXEffect(self->GetObjectID(), 6478, u"teleportRings", "teleportRings");
@@ -40,7 +37,6 @@ void DLUVanityTeleportingObject::OnTimerDone(Entity* self, std::string timerName
self->SetPosition(newLocation.m_Position);
self->SetRotation(newLocation.m_Rotation);
self->SetScale(newLocation.m_Scale);
GameMessages::SendPlayFXEffect(self->GetObjectID(), 6478, u"teleportBeam", "teleportBeam");
GameMessages::SendPlayFXEffect(self->GetObjectID(), 6478, u"teleportRings", "teleportRings");
self->AddTimer("stopFX", 2.0f);

View File

@@ -42,7 +42,7 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_ENEMY_WAVES})
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY ${DSCRIPTS_SOURCES_02_SERVER_ENEMY} "Waves/${file}")
endforeach()
add_library(dScriptsServerEnemy STATIC ${DSCRIPTS_SOURCES_02_SERVER_ENEMY})
add_library(dScriptsServerEnemy OBJECT ${DSCRIPTS_SOURCES_02_SERVER_ENEMY})
target_link_libraries(dScriptsServerEnemy dScriptsBase)
target_include_directories(dScriptsServerEnemy PUBLIC "."
"AG"

View File

@@ -14,6 +14,6 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_AG
"NpcCowboyServer.cpp"
"NpcPirateServer.cpp")
add_library(dScriptsServerMapAG ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG})
add_library(dScriptsServerMapAG OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG})
target_include_directories(dScriptsServerMapAG PUBLIC ".")
target_precompile_headers(dScriptsServerMapAG REUSE_FROM dScriptsBase)

View File

@@ -2,7 +2,7 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_AG_SPIDER_QUEEN
"ZoneAgSpiderQueen.cpp"
"SpiderBossTreasureChestServer.cpp")
add_library(dScriptsServerMapAGSpiderQueen ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG_SPIDER_QUEEN})
add_library(dScriptsServerMapAGSpiderQueen OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_AG_SPIDER_QUEEN})
target_include_directories(dScriptsServerMapAGSpiderQueen PUBLIC ".")
target_link_libraries(dScriptsServerMapAGSpiderQueen dScriptsServerMapProperty)
target_precompile_headers(dScriptsServerMapAGSpiderQueen REUSE_FROM dScriptsBase)

View File

@@ -19,6 +19,6 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_AM
"WanderingVendor.cpp"
)
add_library(dScriptsServerMapAM ${DSCRIPTS_SOURCES_02_SERVER_MAP_AM})
add_library(dScriptsServerMapAM OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_AM})
target_include_directories(dScriptsServerMapAM PUBLIC ".")
target_precompile_headers(dScriptsServerMapAM REUSE_FROM dScriptsBase)

View File

@@ -5,7 +5,7 @@
void WanderingVendor::OnStartup(Entity* self) {
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
if (!movementAIComponent) return;
movementAIComponent->Resume();
// movementAIComponent->Resume();
self->SetProximityRadius(10, "playermonitor");
}
@@ -13,14 +13,12 @@ void WanderingVendor::OnProximityUpdate(Entity* self, Entity* entering, std::str
if (status == "ENTER" && entering->IsPlayer()) {
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
if (!movementAIComponent) return;
movementAIComponent->Pause();
// movementAIComponent->Pause();
self->CancelTimer("startWalking");
} else if (status == "LEAVE") {
auto* proximityMonitorComponent = self->GetComponent<ProximityMonitorComponent>();
if (!proximityMonitorComponent) {
LOG("Proximity monitor component not found!");
return;
}
if (!proximityMonitorComponent) self->AddComponent<ProximityMonitorComponent>();
const auto proxObjs = proximityMonitorComponent->GetProximityObjects("playermonitor");
if (proxObjs.empty()) self->AddTimer("startWalking", 1.5);
}
@@ -30,6 +28,6 @@ void WanderingVendor::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "startWalking") {
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
if (!movementAIComponent) return;
movementAIComponent->Resume();
// movementAIComponent->Resume();
}
}

View File

@@ -1,4 +1,6 @@
#pragma once
#ifndef __WANDERINGVENDOR__H__
#define __WANDERINGVENDOR__H__
#include "CppScripts.h"
class WanderingVendor : public CppScripts::Script {
@@ -8,3 +10,4 @@ public:
void OnTimerDone(Entity* self, std::string timerName) override;
};
#endif //!__WANDERINGVENDOR__H__

View File

@@ -13,17 +13,33 @@ add_subdirectory(SS)
add_subdirectory(VE)
add_library(dScriptsServerMap INTERFACE)
target_link_libraries(dScriptsServerMap INTERFACE
dScriptsServerMapAG
dScriptsServerMapAGSpiderQueen
dScriptsServerMapAM
dScriptsServerMapFV
dScriptsServerMapGeneral
dScriptsServerMapGF
dScriptsServerMapNJHub
dScriptsServerMapNS
dScriptsServerMapNT
dScriptsServerMapPR
dScriptsServerMapProperty
dScriptsServerMapSS
dScriptsServerMapVE)
target_sources(dScriptsServerMap INTERFACE
$<TARGET_OBJECTS:dScriptsServerMapAG>
$<TARGET_OBJECTS:dScriptsServerMapAGSpiderQueen>
$<TARGET_OBJECTS:dScriptsServerMapAM>
$<TARGET_OBJECTS:dScriptsServerMapFV>
$<TARGET_OBJECTS:dScriptsServerMapGeneral>
$<TARGET_OBJECTS:dScriptsServerMapGF>
$<TARGET_OBJECTS:dScriptsServerMapNJHub>
$<TARGET_OBJECTS:dScriptsServerMapNS>
$<TARGET_OBJECTS:dScriptsServerMapNT>
$<TARGET_OBJECTS:dScriptsServerMapPR>
$<TARGET_OBJECTS:dScriptsServerMapProperty>
$<TARGET_OBJECTS:dScriptsServerMapSS>
$<TARGET_OBJECTS:dScriptsServerMapVE>
)
target_include_directories(dScriptsServerMap INTERFACE
$<TARGET_PROPERTY:dScriptsServerMapAG,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsServerMapAGSpiderQueen,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsServerMapAM,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsServerMapFV,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsServerMapGeneral,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsServerMapGF,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsServerMapNJHub,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsServerMapNS,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsServerMapNT,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsServerMapPR,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsServerMapProperty,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsServerMapSS,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsServerMapVE,INTERFACE_INCLUDE_DIRECTORIES>
)

View File

@@ -11,6 +11,6 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV_RACING})
set(DSCRIPTS_SOURCES_02_SERVER_MAP_FV ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV} "Racing/${file}")
endforeach()
add_library(dScriptsServerMapFV ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV})
add_library(dScriptsServerMapFV OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_FV})
target_include_directories(dScriptsServerMapFV PUBLIC "." "Racing")
target_precompile_headers(dScriptsServerMapFV REUSE_FROM dScriptsBase)

View File

@@ -4,6 +4,6 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_GF
"MastTeleport.cpp"
"SpawnLionServer.cpp")
add_library(dScriptsServerMapGF ${DSCRIPTS_SOURCES_02_SERVER_MAP_GF})
add_library(dScriptsServerMapGF OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_GF})
target_include_directories(dScriptsServerMapGF PUBLIC ".")
target_precompile_headers(dScriptsServerMapGF REUSE_FROM dScriptsBase)

View File

@@ -27,6 +27,6 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL_NINJAGO})
set(DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL} "Ninjago/${file}")
endforeach()
add_library(dScriptsServerMapGeneral ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL})
add_library(dScriptsServerMapGeneral OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_GENERAL})
target_include_directories(dScriptsServerMapGeneral PUBLIC "." "Ninjago")
target_precompile_headers(dScriptsServerMapGeneral REUSE_FROM dScriptsBase)

View File

@@ -6,7 +6,7 @@
#include "Entity.h"
void StoryBoxInteractServer::OnUse(Entity* self, Entity* user) {
if (self->GetVar<bool>(u"hasCustomText")) {
if (self->HasVar(u"customText")) {
const auto& customText = self->GetVar<std::string>(u"customText");
{
@@ -29,15 +29,19 @@ void StoryBoxInteractServer::OnUse(Entity* self, Entity* user) {
return;
}
if (!self->HasVar(u"storyText") || !self->HasVar(u"altFlagID")) return;
const auto storyText = self->GetVarAsString(u"storyText");
if (storyText.length() > 2) {
auto storyValue = GeneralUtils::TryParse<uint32_t>(storyText.substr(storyText.length() - 2));
if(!storyValue) return;
int32_t boxFlag = self->GetVar<int32_t>(u"altFlagID");
if (boxFlag <= 0) {
boxFlag = (10000 + Game::server->GetZoneID() + storyValue.value());
}
int32_t boxFlag = self->GetVar<int32_t>(u"altFlagID");
if (boxFlag <= 0) {
boxFlag = (10000 + Game::server->GetZoneID() + std::stoi(storyText.substr(storyText.length() - 2)));
}
if (user->GetCharacter()->GetPlayerFlag(boxFlag) == false) {
user->GetCharacter()->SetPlayerFlag(boxFlag, true);
GameMessages::SendFireEventClientSide(self->GetObjectID(), user->GetSystemAddress(), u"achieve", LWOOBJID_EMPTY, 0, -1, LWOOBJID_EMPTY);
if (user->GetCharacter()->GetPlayerFlag(boxFlag) == false) {
user->GetCharacter()->SetPlayerFlag(boxFlag, true);
GameMessages::SendFireEventClientSide(self->GetObjectID(), user->GetSystemAddress(), u"achieve", LWOOBJID_EMPTY, 0, -1, LWOOBJID_EMPTY);
}
}
}

View File

@@ -10,6 +10,6 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS_WAVES})
set(DSCRIPTS_SOURCES_02_SERVER_MAP_NS ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS} "Waves/${file}")
endforeach()
add_library(dScriptsServerMapNS ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS})
add_library(dScriptsServerMapNS OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_NS})
target_include_directories(dScriptsServerMapNS PUBLIC "." "Waves")
target_precompile_headers(dScriptsServerMapNS REUSE_FROM dScriptsBase)

View File

@@ -27,6 +27,6 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_NT
"NtBcSubmitServer.cpp"
"NtNaomiBreadcrumbServer.cpp")
add_library(dScriptsServerMapNT ${DSCRIPTS_SOURCES_02_SERVER_MAP_NT})
add_library(dScriptsServerMapNT OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_NT})
target_include_directories(dScriptsServerMapNT PUBLIC ".")
target_precompile_headers(dScriptsServerMapNT REUSE_FROM dScriptsBase)

View File

@@ -1,5 +1,6 @@
#include "NtCombatChallengeDummy.h"
#include "EntityManager.h"
#include "Entity.h"
void NtCombatChallengeDummy::OnDie(Entity* self, Entity* killer) {
const auto challengeObjectID = self->GetVar<LWOOBJID>(u"challengeObjectID");
@@ -7,9 +8,7 @@ void NtCombatChallengeDummy::OnDie(Entity* self, Entity* killer) {
auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID);
if (challengeObject != nullptr) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
script->OnDie(challengeObject, killer);
}
challengeObject->GetScript()->OnDie(challengeObject, killer);
}
}
@@ -19,8 +18,6 @@ void NtCombatChallengeDummy::OnHitOrHealResult(Entity* self, Entity* attacker, i
auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID);
if (challengeObject != nullptr) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
script->OnHitOrHealResult(challengeObject, attacker, damage);
}
challengeObject->GetScript()->OnHitOrHealResult(challengeObject, attacker, damage);
}
}

View File

@@ -9,9 +9,7 @@ void NtCombatChallengeExplodingDummy::OnDie(Entity* self, Entity* killer) {
auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID);
if (challengeObject != nullptr) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
script->OnDie(challengeObject, killer);
}
challengeObject->GetScript()->OnDie(challengeObject, killer);
}
}
@@ -32,9 +30,7 @@ void NtCombatChallengeExplodingDummy::OnHitOrHealResult(Entity* self, Entity* at
auto* challengeObject = Game::entityManager->GetEntity(challengeObjectID);
if (challengeObject != nullptr) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(challengeObject)) {
script->OnHitOrHealResult(challengeObject, attacker, damage);
}
challengeObject->GetScript()->OnHitOrHealResult(challengeObject, attacker, damage);
}
auto skillComponent = self->GetComponent<SkillComponent>();
if (skillComponent != nullptr) {

View File

@@ -3,6 +3,6 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_PR
"PrSeagullFly.cpp"
"SpawnGryphonServer.cpp")
add_library(dScriptsServerMapPR ${DSCRIPTS_SOURCES_02_SERVER_MAP_PR})
add_library(dScriptsServerMapPR OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_PR})
target_include_directories(dScriptsServerMapPR PUBLIC ".")
target_precompile_headers(dScriptsServerMapPR REUSE_FROM dScriptsBase)

View File

@@ -19,7 +19,7 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY_NS_MED})
set(DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY} "NS_Med/${file}")
endforeach()
add_library(dScriptsServerMapProperty ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY})
add_library(dScriptsServerMapProperty OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_PROPERTY})
target_precompile_headers(dScriptsServerMapProperty REUSE_FROM dScriptsBase)
target_include_directories(dScriptsServerMapProperty PUBLIC "."
"AG_Med"

View File

@@ -1,6 +1,6 @@
set(DSCRIPTS_SOURCES_02_SERVER_MAP_SS
"SsModularBuildServer.cpp")
add_library(dScriptsServerMapSS ${DSCRIPTS_SOURCES_02_SERVER_MAP_SS})
add_library(dScriptsServerMapSS OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_SS})
target_include_directories(dScriptsServerMapSS PUBLIC ".")
target_precompile_headers(dScriptsServerMapSS REUSE_FROM dScriptsBase)

View File

@@ -3,6 +3,6 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_VE
"VeEpsilonServer.cpp"
"VeBricksampleServer.cpp")
add_library(dScriptsServerMapVE ${DSCRIPTS_SOURCES_02_SERVER_MAP_VE})
add_library(dScriptsServerMapVE OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_VE})
target_include_directories(dScriptsServerMapVE PUBLIC ".")
target_precompile_headers(dScriptsServerMapVE REUSE_FROM dScriptsBase)

View File

@@ -28,7 +28,7 @@ foreach(file ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB_BOSS_INSTANCE})
set(DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB} "boss_instance/${file}")
endforeach()
add_library(dScriptsServerMapNJHub ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB})
add_library(dScriptsServerMapNJHub OBJECT ${DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB})
target_include_directories(dScriptsServerMapNJHub PUBLIC "." "boss_instance")
target_link_libraries(dScriptsServerMapNJHub
dScriptsServerPets

View File

@@ -3,7 +3,7 @@ set(DSCRIPTS_SOURCES_02_SERVER_PETS
"PetFromObjectServer.cpp"
"DamagingPets.cpp")
add_library(dScriptsServerPets STATIC ${DSCRIPTS_SOURCES_02_SERVER_PETS})
add_library(dScriptsServerPets OBJECT ${DSCRIPTS_SOURCES_02_SERVER_PETS})
target_include_directories(dScriptsServerPets PUBLIC ".")
target_precompile_headers(dScriptsServerPets REUSE_FROM dScriptsBase)

View File

@@ -11,24 +11,27 @@ set(DSCRIPTS_SOURCES
"InvalidScript.cpp"
"NPCAddRemoveItem.cpp"
"NtFactionSpyServer.cpp"
"ScriptComponent.cpp"
"ScriptedPowerupSpawner.cpp"
"SpawnPetBaseServer.cpp")
link_libraries(dDatabase dPhysics)
add_library(dScriptsBase STATIC ${DSCRIPTS_SOURCES})
target_include_directories(dScriptsBase PUBLIC .)
target_link_libraries(dScriptsBase
INTERFACE dGameBase)
add_library(dScriptsBase OBJECT ${DSCRIPTS_SOURCES})
target_link_libraries(dScriptsBase INTERFACE dGameBase dComponents)
target_precompile_headers(dScriptsBase PRIVATE ${HEADERS_DGAME})
include_directories(
${PROJECT_SOURCE_DIR}/dScripts
${PROJECT_SOURCE_DIR}/dGame
"${PROJECT_SOURCE_DIR}/dScripts"
"${PROJECT_SOURCE_DIR}/dGame"
"${PROJECT_SOURCE_DIR}/dGame/dComponents" # e.g. ScriptedActivityComponent.h
"${PROJECT_SOURCE_DIR}/dGame/dGameMessages" # e.g. direct ActivityManager
"${PROJECT_SOURCE_DIR}/dGame/dUtilities" # e.g. direct ActivityManager
"${PROJECT_SOURCE_DIR}/dGame/dEntity" # via dZoneManager.h
"${PROJECT_SOURCE_DIR}/dGame/dMission" # via MissionComponent.h
"${PROJECT_SOURCE_DIR}/dGame/dBehaviors" # viaInventoryComponent.h
"${PROJECT_SOURCE_DIR}/dGame/dInventory" # via InventoryComponent.h
"${PROJECT_SOURCE_DIR}/dZoneManager"
)
link_libraries(dScriptsBase)
# dComponents
add_subdirectory(02_server)
add_subdirectory(ai)
@@ -37,14 +40,22 @@ add_subdirectory(EquipmentScripts)
add_subdirectory(EquipmentTriggers)
add_subdirectory(zone)
add_library(dScripts STATIC "CppScripts.cpp")
add_library(dScripts STATIC
$<TARGET_OBJECTS:dScriptsBase>
$<TARGET_OBJECTS:dScriptsClient>
$<TARGET_OBJECTS:dScriptsEquipmentScripts>
$<TARGET_OBJECTS:dScriptsEquipmentTriggers>
$<TARGET_OBJECTS:dScriptsZone>
"CppScripts.cpp"
)
target_link_libraries(dScripts PRIVATE dScriptsAI dScriptsServer)
target_include_directories(dScripts PRIVATE
$<TARGET_PROPERTY:dScriptsBase,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsServer,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsAI,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsClient,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsEquipmentScripts,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsEquipmentTriggers,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsZone,INTERFACE_INCLUDE_DIRECTORIES>
)
target_precompile_headers(dScripts REUSE_FROM dScriptsBase)
target_include_directories(dScripts PUBLIC ".")
target_link_libraries(dScripts
dScriptsBase
dScriptsServer
dScriptsAI
dScriptsClient
dScriptsEquipmentScripts
dScriptsEquipmentTriggers
dScriptsZone)

View File

@@ -320,18 +320,22 @@
#include "WildNinjaSensei.h"
#include "WildNinjaBricks.h"
#include "VisToggleNotifierServer.h"
#include "LupGenericInteract.h"
#include "WblRobotCitizen.h"
namespace {
InvalidScript* invalidToReturn = new InvalidScript();
// This is in the translation unit instead of the header to prevent wierd linker errors
InvalidScript* const InvalidToReturn = new InvalidScript();
std::map<std::string, CppScripts::Script*> m_Scripts;
};
CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scriptName) {
if (m_Scripts.find(scriptName) != m_Scripts.end()) {
return m_Scripts[scriptName];
CppScripts::Script* const CppScripts::GetScript(Entity* parent, const std::string& scriptName) {
auto itr = m_Scripts.find(scriptName);
if (itr != m_Scripts.end()) {
return itr->second;
}
Script* script = invalidToReturn;
Script* script = InvalidToReturn;
//VE / AG:
if (scriptName == "scripts\\ai\\AG\\L_AG_SHIP_PLAYER_DEATH_TRIGGER.lua")
@@ -550,7 +554,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();
@@ -645,6 +649,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")
@@ -729,7 +735,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();
@@ -811,7 +817,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();
@@ -947,10 +953,14 @@ 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
else if (script == invalidToReturn) {
else if (script == InvalidToReturn) {
if ((scriptName.length() > 0) && !((scriptName == "scripts\\02_server\\Enemy\\General\\L_SUSPEND_LUA_AI.lua") ||
(scriptName == "scripts\\02_server\\Enemy\\General\\L_BASE_ENEMY_SPIDERLING.lua") ||
(scriptName =="scripts\\ai\\FV\\L_ACT_NINJA_STUDENT.lua") ||
@@ -963,13 +973,6 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
return script;
}
std::vector<CppScripts::Script*> CppScripts::GetEntityScripts(Entity* entity) {
std::vector<CppScripts::Script*> scripts;
std::vector<ScriptComponent*> comps = entity->GetScriptComponents();
for (ScriptComponent* scriptComp : comps) {
if (scriptComp != nullptr) {
scripts.push_back(scriptComp->GetScript());
}
}
return scripts;
CppScripts::Script* const CppScripts::GetInvalidScript() {
return InvalidToReturn;
}

View File

@@ -357,6 +357,10 @@ namespace CppScripts {
virtual void OnRequestActivityExit(Entity* sender, LWOOBJID player, bool canceled){};
};
Script* GetScript(Entity* parent, const std::string& scriptName);
std::vector<Script*> GetEntityScripts(Entity* entity);
Script* const GetScript(Entity* parent, const std::string& scriptName);
// Get the invalid script. Would be a static variable of the namespace, but that would be
// more cluttery to use. Also this allows us to control where this invalid script is defined and initialized
// since we dont want anyone externally modifying it.
Script* const GetInvalidScript();
};

View File

@@ -8,6 +8,6 @@ set(DSCRIPTS_SOURCES_EQUIPMENTSCRIPTS
"FireFirstSkillonStartup.cpp"
"StunImmunity.cpp")
add_library(dScriptsEquipmentScripts STATIC ${DSCRIPTS_SOURCES_EQUIPMENTSCRIPTS})
add_library(dScriptsEquipmentScripts OBJECT ${DSCRIPTS_SOURCES_EQUIPMENTSCRIPTS})
target_include_directories(dScriptsEquipmentScripts PUBLIC ".")
target_precompile_headers(dScriptsEquipmentScripts REUSE_FROM dScriptsBase)

View File

@@ -1,6 +1,6 @@
set(DSCRIPTS_SOURCES_EQUIPMENTTRIGGERSSCRIPTS
"CoilBackpackBase.cpp")
add_library(dScriptsEquipmentTriggers STATIC ${DSCRIPTS_SOURCES_EQUIPMENTTRIGGERSSCRIPTS})
add_library(dScriptsEquipmentTriggers OBJECT ${DSCRIPTS_SOURCES_EQUIPMENTTRIGGERSSCRIPTS})
target_include_directories(dScriptsEquipmentTriggers PUBLIC ".")
target_precompile_headers(dScriptsEquipmentTriggers REUSE_FROM dScriptsBase)

View File

@@ -1,52 +0,0 @@
/*
* Darkflame Universe
* Copyright 2018
*/
#include "Entity.h"
#include "ScriptComponent.h"
ScriptComponent::ScriptComponent(Entity* parent, std::string scriptName, bool serialized, bool client) : Component(parent) {
m_Serialized = serialized;
m_Client = client;
SetScript(scriptName);
}
ScriptComponent::~ScriptComponent() {
}
void ScriptComponent::Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) {
if (bIsInitialUpdate) {
const auto& networkSettings = m_Parent->GetNetworkSettings();
auto hasNetworkSettings = !networkSettings.empty();
outBitStream.Write(hasNetworkSettings);
if (hasNetworkSettings) {
// First write the most inner LDF data
RakNet::BitStream ldfData;
ldfData.Write<uint8_t>(0);
ldfData.Write<uint32_t>(networkSettings.size());
for (auto* networkSetting : networkSettings) {
networkSetting->WriteToPacket(ldfData);
}
// Finally write everything to the stream
outBitStream.Write<uint32_t>(ldfData.GetNumberOfBytesUsed());
outBitStream.Write(ldfData);
}
}
}
CppScripts::Script* ScriptComponent::GetScript() {
return m_Script;
}
void ScriptComponent::SetScript(const std::string& scriptName) {
// Scripts are managed by the CppScripts class and are effecitvely singletons
// and they may also be used by other script components so DON'T delete them.
m_Script = CppScripts::GetScript(m_Parent, scriptName);
}

View File

@@ -1,65 +0,0 @@
/*
* Darkflame Universe
* Copyright 2018
*/
#ifndef SCRIPTCOMPONENT_H
#define SCRIPTCOMPONENT_H
#include "CppScripts.h"
#include "Component.h"
#include <string>
#include "eReplicaComponentType.h"
class Entity;
/**
* Handles the loading and execution of server side scripts on entities, scripts were originally written in Lua,
* here they're written in C++
*/
class ScriptComponent final : public Component {
public:
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::SCRIPT;
ScriptComponent(Entity* parent, std::string scriptName, bool serialized, bool client = false);
~ScriptComponent() override;
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
/**
* Returns the script that's attached to this entity
* @return the script that's attached to this entity
*/
CppScripts::Script* GetScript();
/**
* Sets whether the entity should be serialized, unused
* @param var whether the entity should be serialized
*/
void SetSerialized(const bool var) { m_Serialized = var; }
/**
* Sets the script using a path by looking through dScripts for a script that matches
* @param scriptName the name of the script to find
*/
void SetScript(const std::string& scriptName);
private:
/**
* The script attached to this entity
*/
CppScripts::Script* m_Script;
/**
* Whether or not the comp should be serialized, unused
*/
bool m_Serialized;
/**
* Whether or not this script is a client script
*/
bool m_Client;
};
#endif // SCRIPTCOMPONENT_H

View File

@@ -9,6 +9,6 @@ foreach(file ${DSCRIPTS_SOURCES_AI_ACT_FOOTRACE})
set(DSCRIPTS_SOURCES_AI_ACT ${DSCRIPTS_SOURCES_AI_ACT} "FootRace/${file}")
endforeach()
add_library(dScriptsAiAct STATIC ${DSCRIPTS_SOURCES_AI_ACT})
add_library(dScriptsAiAct OBJECT ${DSCRIPTS_SOURCES_AI_ACT})
target_include_directories(dScriptsAiAct PUBLIC "." "FootRace")
target_precompile_headers(dScriptsAiAct REUSE_FROM dScriptsBase)

View File

@@ -16,6 +16,6 @@ set(DSCRIPTS_SOURCES_AI_AG
"AgStagePlatforms.cpp"
"AgQbWall.cpp")
add_library(dScriptsAiAG STATIC ${DSCRIPTS_SOURCES_AI_AG})
add_library(dScriptsAiAG OBJECT ${DSCRIPTS_SOURCES_AI_AG})
target_include_directories(dScriptsAiAG PUBLIC ".")
target_precompile_headers(dScriptsAiAG REUSE_FROM dScriptsBase)

View File

@@ -15,18 +15,34 @@ add_subdirectory(SPEC)
add_subdirectory(WILD)
add_library(dScriptsAI INTERFACE)
target_link_libraries(dScriptsAI INTERFACE
dScriptsAiAct
dScriptsAiAG
dScriptsAiFV
dScriptsAiGeneral
dScriptsAiGF
dScriptsAiMinigame
dScriptsAiNP
dScriptsAiNS
dScriptsAiPets
dScriptsAiProperty
dScriptsAiRacing
dScriptsAiSpec
dScriptsAiWild
target_sources(dScriptsAI INTERFACE
$<TARGET_OBJECTS:dScriptsAiAct>
$<TARGET_OBJECTS:dScriptsAiAG>
$<TARGET_OBJECTS:dScriptsAiFV>
$<TARGET_OBJECTS:dScriptsAiGeneral>
$<TARGET_OBJECTS:dScriptsAiGF>
$<TARGET_OBJECTS:dScriptsAiMinigame>
$<TARGET_OBJECTS:dScriptsAiNP>
$<TARGET_OBJECTS:dScriptsAiNS>
$<TARGET_OBJECTS:dScriptsAiPets>
$<TARGET_OBJECTS:dScriptsAiProperty>
$<TARGET_OBJECTS:dScriptsAiRacing>
$<TARGET_OBJECTS:dScriptsAiSpec>
$<TARGET_OBJECTS:dScriptsAiWild>
)
target_include_directories(dScriptsAI INTERFACE
$<TARGET_PROPERTY:dScriptsAiAct,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsAiAG,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsAiFV,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsAiGeneral,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsAiGF,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsAiMinigame,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsAiNP,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsAiNS,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsAiPets,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsAiProperty,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsAiRacing,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsAiSpec,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:dScriptsAiWild,INTERFACE_INCLUDE_DIRECTORIES>
)

View File

@@ -18,7 +18,7 @@ set(DSCRIPTS_SOURCES_AI_FV
"FvMaelstromGeyser.cpp"
"TriggerGas.cpp")
add_library(dScriptsAiFV STATIC ${DSCRIPTS_SOURCES_AI_FV})
add_library(dScriptsAiFV OBJECT ${DSCRIPTS_SOURCES_AI_FV})
target_include_directories(dScriptsAiFV PUBLIC ".")
target_precompile_headers(dScriptsAiFV REUSE_FROM dScriptsBase)

View File

@@ -2,7 +2,7 @@ set(DSCRIPTS_SOURCES_AI_GENERAL
"InstanceExitTransferPlayerToLastNonInstance.cpp"
"LegoDieRoll.cpp")
add_library(dScriptsAiGeneral STATIC ${DSCRIPTS_SOURCES_AI_GENERAL})
add_library(dScriptsAiGeneral OBJECT ${DSCRIPTS_SOURCES_AI_GENERAL})
target_include_directories(dScriptsAiGeneral PUBLIC ".")
target_precompile_headers(dScriptsAiGeneral REUSE_FROM dScriptsBase)

View File

@@ -12,6 +12,6 @@ set(DSCRIPTS_SOURCES_AI_GF
"PirateRep.cpp"
"GfParrotCrash.cpp")
add_library(dScriptsAiGF STATIC ${DSCRIPTS_SOURCES_AI_GF})
add_library(dScriptsAiGF OBJECT ${DSCRIPTS_SOURCES_AI_GF})
target_include_directories(dScriptsAiGF PUBLIC ".")
target_precompile_headers(dScriptsAiGF REUSE_FROM dScriptsBase)

View File

@@ -12,6 +12,6 @@ foreach(file ${DSCRIPTS_SOURCES_AI_MINIGAME_OBJECTS})
set(DSCRIPTS_SOURCES_AI_MINIGAME ${DSCRIPTS_SOURCES_AI_MINIGAME} "Objects/${file}")
endforeach()
add_library(dScriptsAiMinigame STATIC ${DSCRIPTS_SOURCES_AI_MINIGAME})
add_library(dScriptsAiMinigame OBJECT ${DSCRIPTS_SOURCES_AI_MINIGAME})
target_include_directories(dScriptsAiMinigame PUBLIC "." "Objects" "SG_GF" "SG_GF/SERVER")
target_precompile_headers(dScriptsAiMinigame REUSE_FROM dScriptsBase)

View File

@@ -1,6 +1,6 @@
set(DSCRIPTS_SOURCES_AI_NP
"NpcNpSpacemanBob.cpp")
add_library(dScriptsAiNP STATIC ${DSCRIPTS_SOURCES_AI_NP})
add_library(dScriptsAiNP OBJECT ${DSCRIPTS_SOURCES_AI_NP})
target_include_directories(dScriptsAiNP PUBLIC ".")
target_precompile_headers(dScriptsAiNP REUSE_FROM dScriptsBase)

View File

@@ -21,7 +21,7 @@ foreach(file ${DSCRIPTS_SOURCES_AI_NS_WH})
set(DSCRIPTS_SOURCES_AI_NS ${DSCRIPTS_SOURCES_AI_NS} "WH/${file}")
endforeach()
add_library(dScriptsAiNS STATIC ${DSCRIPTS_SOURCES_AI_NS})
add_library(dScriptsAiNS OBJECT ${DSCRIPTS_SOURCES_AI_NS})
target_include_directories(dScriptsAiNS PUBLIC "." "NS_PP_01" "WH"
PRIVATE
${PROJECT_SOURCE_DIR}/dScripts/02_server/Map/NS) # NsConcertChoiceBuildManager.h

View File

@@ -1,6 +1,6 @@
set(DSCRIPTS_SOURCES_AI_PETS
"HydrantSmashable.cpp")
add_library(dScriptsAiPets STATIC ${DSCRIPTS_SOURCES_AI_PETS})
add_library(dScriptsAiPets OBJECT ${DSCRIPTS_SOURCES_AI_PETS})
target_include_directories(dScriptsAiPets PUBLIC "." "NS_PP_01" "WH")
target_precompile_headers(dScriptsAiPets REUSE_FROM dScriptsBase)

View File

@@ -8,6 +8,6 @@ foreach(file ${DSCRIPTS_SOURCES_AI_PROPERTY_AG})
set(DSCRIPTS_SOURCES_AI_PROPERTY ${DSCRIPTS_SOURCES_AI_PROPERTY} "AG/${file}")
endforeach()
add_library(dScriptsAiProperty STATIC ${DSCRIPTS_SOURCES_AI_PROPERTY})
add_library(dScriptsAiProperty OBJECT ${DSCRIPTS_SOURCES_AI_PROPERTY})
target_include_directories(dScriptsAiProperty PUBLIC "." "AG")
target_precompile_headers(dScriptsAiProperty REUSE_FROM dScriptsBase)

View File

@@ -6,6 +6,6 @@ foreach(file ${DSCRIPTS_SOURCES_AI_RACING_OBJECTS})
set(DSCRIPTS_SOURCES_AI_RACING ${DSCRIPTS_SOURCES_AI_RACING} "OBJECTS/${file}")
endforeach()
add_library(dScriptsAiRacing STATIC ${DSCRIPTS_SOURCES_AI_RACING})
add_library(dScriptsAiRacing OBJECT ${DSCRIPTS_SOURCES_AI_RACING})
target_include_directories(dScriptsAiRacing PUBLIC "." "OBJECTS")
target_precompile_headers(dScriptsAiRacing REUSE_FROM dScriptsBase)

View File

@@ -3,6 +3,6 @@ set(DSCRIPTS_SOURCES_AI_SPEC
"SpecialPowerupSpawner.cpp"
"SpecialSpeedBuffSpawner.cpp")
add_library(dScriptsAiSpec STATIC ${DSCRIPTS_SOURCES_AI_SPEC})
add_library(dScriptsAiSpec OBJECT ${DSCRIPTS_SOURCES_AI_SPEC})
target_include_directories(dScriptsAiSpec PUBLIC ".")
target_precompile_headers(dScriptsAiSpec REUSE_FROM dScriptsBase)

View File

@@ -10,6 +10,6 @@ set(DSCRIPTS_SOURCES_AI_WILD
"WildNinjaSensei.cpp"
"WildPants.cpp")
add_library(dScriptsAiWild STATIC ${DSCRIPTS_SOURCES_AI_WILD})
add_library(dScriptsAiWild OBJECT ${DSCRIPTS_SOURCES_AI_WILD})
target_include_directories(dScriptsAiWild PUBLIC ".")
target_precompile_headers(dScriptsAiWild REUSE_FROM dScriptsBase)

View File

@@ -1,7 +1,12 @@
#pragma once
#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__

View File

@@ -6,6 +6,6 @@ foreach(file ${DSCRIPTS_SOURCES_CLIENT_AI})
set(DSCRIPTS_SOURCES_CLIENT ${DSCRIPTS_SOURCES_CLIENT} "ai/${file}")
endforeach()
add_library(dScriptsClient STATIC ${DSCRIPTS_SOURCES_CLIENT})
add_library(dScriptsClient OBJECT ${DSCRIPTS_SOURCES_CLIENT})
target_include_directories(dScriptsClient PUBLIC "." "ai" "ai/PR")
target_precompile_headers(dScriptsClient REUSE_FROM dScriptsBase)

View File

@@ -18,7 +18,7 @@ foreach(file ${DSCRIPTS_SOURCES_ZONE_PROPERTY})
set(DSCRIPTS_SOURCES_ZONE ${DSCRIPTS_SOURCES_ZONE} "PROPERTY/${file}")
endforeach()
add_library(dScriptsZone STATIC ${DSCRIPTS_SOURCES_ZONE})
add_library(dScriptsZone OBJECT ${DSCRIPTS_SOURCES_ZONE})
target_include_directories(dScriptsZone PUBLIC "."
"AG"
"LUPs"

View File

@@ -1,4 +1,3 @@
set(DSCRIPTS_SOURCES_ZONE_LUPS
"WblGenericZone.cpp"
)

View File

@@ -5,13 +5,12 @@
void WblRobotCitizen::OnStartup(Entity* self) {
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
if (!movementAIComponent) return;
movementAIComponent->Resume();
// movementAIComponent->Resume();
}
void WblRobotCitizen::OnUse(Entity* self, Entity* user) {
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
if (!movementAIComponent) return;
movementAIComponent->Pause();
// 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");
@@ -21,5 +20,5 @@ void WblRobotCitizen::OnUse(Entity* self, Entity* user) {
void WblRobotCitizen::OnTimerDone(Entity* self, std::string timerName) {
auto movementAIComponent = self->GetComponent<MovementAIComponent>();
if (!movementAIComponent) return;
movementAIComponent->Resume();
// movementAIComponent->Resume();
}

View File

@@ -1,4 +1,6 @@
#pragma once
#ifndef __WBLROBOTCITIZEN__H__
#define __WBLROBOTCITIZEN__H__
#include "CppScripts.h"
class WblRobotCitizen : public CppScripts::Script {
@@ -8,3 +10,4 @@ public:
void OnTimerDone(Entity* self, std::string timerName) override;
};
#endif //!__WBLROBOTCITIZEN__H__