mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-14 20:28:21 +00:00
waypoint commands wip
This commit is contained in:
parent
5f7a108154
commit
1207d896a8
61
dCommon/dEnums/eWaypointCommandType.h
Normal file
61
dCommon/dEnums/eWaypointCommandType.h
Normal file
@ -0,0 +1,61 @@
|
||||
#ifndef __EWAYPOINTCOMMANDTYPES__H__
|
||||
#define __EWAYPOINTCOMMANDTYPES__H__
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
enum class eWaypointCommandType : uint32_t {
|
||||
INVALID,
|
||||
BOUNCE,
|
||||
STOP,
|
||||
GROUP_EMOTE,
|
||||
SET_VARIABLE,
|
||||
CAST_SKILL,
|
||||
EQUIP_INVENTORY,
|
||||
UNEQUIP_INVENTORY,
|
||||
DELAY,
|
||||
EMOTE,
|
||||
TELEPORT,
|
||||
PATH_SPEED,
|
||||
REMOVE_NPC,
|
||||
CHANGE_WAYPOINT,
|
||||
DELETE_SELF,
|
||||
KILL_SELF,
|
||||
REMOVE_SELF,
|
||||
SPAWN_OBJECT,
|
||||
PLAY_SOUND,
|
||||
};
|
||||
|
||||
|
||||
|
||||
class WaypointCommandType {
|
||||
public:
|
||||
static eWaypointCommandType StringToWaypointCommandType(std::string commandString) {
|
||||
const std::map<std::string, eWaypointCommandType> WaypointCommandTypeMap = {
|
||||
{"bounce", eWaypointCommandType::BOUNCE},
|
||||
{"stop", eWaypointCommandType::STOP},
|
||||
{"groupemote", eWaypointCommandType::GROUP_EMOTE},
|
||||
{"setvar", eWaypointCommandType::SET_VARIABLE},
|
||||
{"castskill", eWaypointCommandType::CAST_SKILL},
|
||||
{"eqInvent", eWaypointCommandType::EQUIP_INVENTORY},
|
||||
{"unInvent", eWaypointCommandType::UNEQUIP_INVENTORY},
|
||||
{"delay", eWaypointCommandType::DELAY},
|
||||
{"femote", eWaypointCommandType::EMOTE},
|
||||
{"emote", eWaypointCommandType::EMOTE},
|
||||
{"teleport", eWaypointCommandType::TELEPORT},
|
||||
{"pathspeed", eWaypointCommandType::PATH_SPEED},
|
||||
{"removeNPC", eWaypointCommandType::REMOVE_NPC},
|
||||
{"changeWP", eWaypointCommandType::CHANGE_WAYPOINT},
|
||||
{"DeleteSelf", eWaypointCommandType::DELETE_SELF},
|
||||
{"killself", eWaypointCommandType::KILL_SELF},
|
||||
{"removeself", eWaypointCommandType::REMOVE_SELF},
|
||||
{"spawnOBJ", eWaypointCommandType::SPAWN_OBJECT},
|
||||
{"playSound", eWaypointCommandType::PLAY_SOUND},
|
||||
};
|
||||
|
||||
auto intermed = WaypointCommandTypeMap.find(commandString);
|
||||
return (intermed != WaypointCommandTypeMap.end()) ? intermed->second : eWaypointCommandType::INVALID;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#endif //!__EWAYPOINTCOMMANDTYPES__H__
|
@ -1,7 +1,50 @@
|
||||
#ifndef MOVEMENTAICOMPONENT_H
|
||||
#include "MovementAIComponent.h"
|
||||
#endif
|
||||
#include "eWaypointCommandType.h"
|
||||
|
||||
void MovementAIComponent::HandleWaypointArrived() {
|
||||
|
||||
if (m_Path->pathWaypoints[m_CurrentPathWaypointIndex].commands.empty()) return;
|
||||
for(auto [command, data] : m_Path->pathWaypoints[m_CurrentPathWaypointIndex].commands){
|
||||
switch(command){
|
||||
case eWaypointCommandType::BOUNCE:
|
||||
break;
|
||||
case eWaypointCommandType::STOP:
|
||||
break;
|
||||
case eWaypointCommandType::GROUP_EMOTE:
|
||||
break;
|
||||
case eWaypointCommandType::SET_VARIABLE:
|
||||
break;
|
||||
case eWaypointCommandType::CAST_SKILL:
|
||||
break;
|
||||
case eWaypointCommandType::EQUIP_INVENTORY:
|
||||
break;
|
||||
case eWaypointCommandType::UNEQUIP_INVENTORY:
|
||||
break;
|
||||
case eWaypointCommandType::DELAY:
|
||||
break;
|
||||
case eWaypointCommandType::EMOTE:
|
||||
break;
|
||||
case eWaypointCommandType::TELEPORT:
|
||||
break;
|
||||
case eWaypointCommandType::PATH_SPEED:
|
||||
break;
|
||||
case eWaypointCommandType::REMOVE_NPC:
|
||||
break;
|
||||
case eWaypointCommandType::CHANGE_WAYPOINT:
|
||||
break;
|
||||
case eWaypointCommandType::DELETE_SELF:
|
||||
break;
|
||||
case eWaypointCommandType::KILL_SELF:
|
||||
break;
|
||||
case eWaypointCommandType::REMOVE_SELF:
|
||||
break;
|
||||
case eWaypointCommandType::SPAWN_OBJECT:
|
||||
break;
|
||||
case eWaypointCommandType::PLAY_SOUND:
|
||||
break;
|
||||
case eWaypointCommandType::INVALID:
|
||||
Game::logger->LogDebug("MovementAIComponentAronwk", "Got invalid waypoint command %i", command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "eTriggerCommandType.h"
|
||||
#include "eTriggerEventType.h"
|
||||
#include "eWaypointCommandType.h"
|
||||
|
||||
Zone::Zone(const LWOMAPID& mapID, const LWOINSTANCEID& instanceID, const LWOCLONEID& cloneID) :
|
||||
m_ZoneID(mapID, instanceID, cloneID) {
|
||||
@ -537,16 +538,16 @@ void Zone::LoadPath(std::istream& file) {
|
||||
|
||||
LDFBaseData* ldfConfig = nullptr;
|
||||
if (path.pathType == PathType::Movement || path.pathType == PathType::Rail) {
|
||||
ldfConfig = LDFBaseData::DataFromString(parameter + "=0:" + value);
|
||||
waypoint.commands.push_back(WaypointCommand(WaypointCommandType::StringToWaypointCommandType(parameter), value));
|
||||
} else {
|
||||
ldfConfig = LDFBaseData::DataFromString(parameter + "=" + value);
|
||||
if (ldfConfig) waypoint.config.push_back(ldfConfig);
|
||||
}
|
||||
if (ldfConfig) waypoint.config.push_back(ldfConfig);
|
||||
}
|
||||
}
|
||||
|
||||
// We verify the waypoint heights against the navmesh because in many movement paths,
|
||||
// the waypoint is located near 0 height,
|
||||
// the waypoint is located near 0 height,
|
||||
if (path.pathType == PathType::Movement) {
|
||||
if (dpWorld::Instance().IsLoaded()) {
|
||||
// 2000 should be large enough for every world.
|
||||
|
@ -13,6 +13,16 @@ namespace LUTriggers {
|
||||
|
||||
class Level;
|
||||
|
||||
enum class eWaypointCommandType : uint32_t;
|
||||
struct WaypointCommand {
|
||||
eWaypointCommandType command;
|
||||
std::string data;
|
||||
WaypointCommand(eWaypointCommandType command, std::string data){
|
||||
this->command = command;
|
||||
this->data = data;
|
||||
}
|
||||
};
|
||||
|
||||
struct SceneRef {
|
||||
std::string filename;
|
||||
uint32_t id;
|
||||
@ -69,6 +79,7 @@ struct PathWaypoint {
|
||||
RacingPathWaypoint racing;
|
||||
RailPathWaypoint rail;
|
||||
std::vector<LDFBaseData*> config;
|
||||
std::vector<WaypointCommand> commands;
|
||||
};
|
||||
|
||||
enum class PathType : uint32_t {
|
||||
|
Loading…
Reference in New Issue
Block a user