picnicbot

This commit is contained in:
David Markowitz
2025-07-13 21:27:48 -07:00
parent 2ed79541d8
commit 8ea8900540
7 changed files with 38 additions and 1 deletions

View File

@@ -23,6 +23,7 @@ enum class eWaypointCommandType : uint32_t {
KILL_SELF,
SPAWN_OBJECT,
PLAY_SOUND,
PICNICBOT,
};
class WaypointCommandType {
@@ -48,6 +49,7 @@ public:
{"removeself", eWaypointCommandType::DELETE_SELF},
{"spawnOBJ", eWaypointCommandType::SPAWN_OBJECT},
{"playSound", eWaypointCommandType::PLAY_SOUND},
{"picnicbot", eWaypointCommandType::PICNICBOT},
};
auto intermed = WaypointCommandTypeMap.find(commandString);

View File

@@ -437,6 +437,7 @@ void MovementAIComponent::SetMaxSpeed(const float value) {
void MovementAIComponent::RunWaypointCommands(uint32_t waypointNum) {
m_Parent->GetScript()->OnWaypointReached(m_Parent, waypointNum);
m_Parent->GetScript()->OnArrived(*m_Parent, "", waypointNum, m_Path);
if (!m_Path || waypointNum >= m_Path->pathWaypoints.size()) return;

View File

@@ -375,6 +375,7 @@
#include "NpRotatingPlatform.h"
#include "NpMime.h"
#include "NpPicnicBot.h"
#include "PicnicBotPicnicBot.h"
namespace {
// This is in the translation unit instead of the header to prevent weird linker errors
@@ -782,6 +783,7 @@ namespace {
{R"(scripts\newcontent\server\np_felix.lua)", []() {return new NpFelix();}},
{R"(scripts\newcontent\server\np_mime.lua)", []() {return new NpMime();}},
{R"(scripts\newcontent\server\np_picnicbot.lua)", []() {return new NpPicnicBot();}},
{R"(scripts\newcontent\server\picnicbot\picnicbot\picnicbot\picnicbot_picnicbot.lua)", []() {return new PicnicBotPicnicBot();}}, // gotta stay organized :strong muscle emoji:
{R"(scripts\ai\NP\L_NP_ROTATING_PLATFORM.lua)", []() {return new NpRotatingPlatform();}},
};

View File

@@ -7,6 +7,7 @@
class User;
class Entity;
class NiPoint3;
struct Path;
enum class eMissionState : int32_t;
enum class ePetTamingNotifyType : uint32_t;
enum class eQuickBuildState : uint32_t;
@@ -367,7 +368,7 @@ namespace CppScripts {
* @param pathType the type of path the object was following
* @param waypoint index of the waypoint in the path
*/
virtual void OnArrived(Entity* self, const std::string& pathType, const uint32_t waypoint) {};
virtual void OnArrived(Entity& self, const std::string& pathType, const uint32_t waypoint, const Path* const levelPath) {};
/**
* @brief Handles when an object has loaded on the server

View File

@@ -12,4 +12,5 @@ set(DSCRIPTS_SOURCES_NEWCONTENT_SERVER
"NpFelix.cpp"
"NpMime.cpp"
"NpPicnicBot.cpp"
"PicnicBotPicnicBot.cpp"
PARENT_SCOPE)

View File

@@ -0,0 +1,16 @@
#include "PicnicBotPicnicBot.h"
#include "RenderComponent.h"
#include "Zone.h"
void PicnicBotPicnicBot::OnArrived(Entity& self, const std::string& pathType, const uint32_t waypoint, const Path* const levelPath) {
if (!levelPath || waypoint >= levelPath->pathWaypoints.size() || levelPath->pathWaypoints[waypoint].commands.empty()) return;
if (levelPath->pathWaypoints[waypoint].commands[0].data == "picnicbot") {
for (auto* const entity : Game::entityManager->GetEntitiesInGroup("picnicbot")) {
if (entity) {
RenderComponent::PlayAnimation(entity, "attack");
}
}
self.Smash();
}
}

View File

@@ -0,0 +1,14 @@
// Darkflame Universe
// Copyright 2025
#ifndef PICNICBOTPICNICBOT_H
#define PICNICBOTPICNICBOT_H
#include "CppScripts.h"
class PicnicBotPicnicBot : public CppScripts::Script {
public:
void OnArrived(Entity& self, const std::string& pathType, const uint32_t waypoint, const Path* const levelPath) override;
};
#endif //!PICNICBOTPICNICBOT_H