mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-15 04:38:21 +00:00
Merge branch 'moreMovementAi' of https://github.com/DarkflameUniverse/DarkflameServer into moreMovementAi
This commit is contained in:
commit
4f447eb441
@ -73,7 +73,7 @@ void MovementAIComponent::HandleWaypointArrived(uint32_t commandIndex) {
|
||||
GameMessages::SendPlayNDAudioEmitter(m_Parent, UNASSIGNED_SYSTEM_ADDRESS, data);
|
||||
break;
|
||||
case eWaypointCommandType::BOUNCE:
|
||||
Game::logger->LogDebug("MovementAIComponent", "Unable to process bounce waypoint command server side");
|
||||
Game::logger->LogDebug("MovementAIComponent", "Unable to process bounce waypoint command server side!");
|
||||
break;
|
||||
case eWaypointCommandType::INVALID:
|
||||
default:
|
||||
@ -111,7 +111,7 @@ void MovementAIComponent::HandleWaypointCommandCastSkill(const std::string& data
|
||||
return;
|
||||
}
|
||||
uint32_t skillId = 0;
|
||||
GeneralUtils::TryParse<uint32_t>(data, skillId);
|
||||
if (!GeneralUtils::TryParse<uint32_t>(data, skillId)) return;
|
||||
if (skillId != 0) skillComponent->CastSkill(skillId);
|
||||
return;
|
||||
}
|
||||
@ -149,8 +149,9 @@ void MovementAIComponent::HandleWaypointCommandUnequipInventory(const std::strin
|
||||
float MovementAIComponent::HandleWaypointCommandDelay(const std::string& data) {
|
||||
float delay = 0.0f;
|
||||
std::string delayString = data;
|
||||
delayString.erase(std::remove_if(delayString.begin(), delayString.end(), isspace), delayString.end());
|
||||
GeneralUtils::TryParse<float>(delayString, delay);
|
||||
if (!GeneralUtils::TryParse<float>(delayString, delay)){
|
||||
Game::logger->LogDebug("MovementAIComponentAronwk", "Failed to parse delay %s", data.c_str());
|
||||
}
|
||||
return delay;
|
||||
}
|
||||
|
||||
@ -166,7 +167,7 @@ void MovementAIComponent::HandleWaypointCommandTeleport(const std::string& data)
|
||||
|
||||
void MovementAIComponent::HandleWaypointCommandPathSpeed(const std::string& data) {
|
||||
float speed = 0.0;
|
||||
GeneralUtils::TryParse<float>(data, speed);
|
||||
if (!GeneralUtils::TryParse<float>(data, speed)) return;
|
||||
SetCurrentSpeed(speed);
|
||||
}
|
||||
|
||||
@ -187,7 +188,7 @@ void MovementAIComponent::HandleWaypointCommandRemoveNPC(const std::string& data
|
||||
return;
|
||||
}
|
||||
uint32_t factionID = -1;
|
||||
GeneralUtils::TryParse<uint32_t>(data, factionID);
|
||||
if (!GeneralUtils::TryParse<uint32_t>(data, factionID)) return;
|
||||
if (destroyableComponent->BelongsToFaction(factionID)) m_Parent->Kill();
|
||||
}
|
||||
}
|
||||
@ -199,7 +200,7 @@ void MovementAIComponent::HandleWaypointCommandChangeWaypoint(const std::string&
|
||||
if (data.find(",") != std::string::npos){
|
||||
auto datas = GeneralUtils::SplitString(data, ',');
|
||||
path_string = datas.at(0);
|
||||
GeneralUtils::TryParse(datas.at(1), index);
|
||||
if (!GeneralUtils::TryParse(datas.at(1), index)) return;
|
||||
} else path_string = data;
|
||||
|
||||
if (path_string != "") {
|
||||
@ -210,7 +211,7 @@ void MovementAIComponent::HandleWaypointCommandChangeWaypoint(const std::string&
|
||||
|
||||
void MovementAIComponent::HandleWaypointCommandSpawnObject(const std::string& data) {
|
||||
LOT newObjectLOT = 0;
|
||||
GeneralUtils::TryParse(data, newObjectLOT);
|
||||
if (!GeneralUtils::TryParse(data, newObjectLOT)) return;
|
||||
EntityInfo info{};
|
||||
info.lot = newObjectLOT;
|
||||
info.pos = m_Parent->GetPosition();
|
||||
|
@ -550,8 +550,9 @@ void Zone::LoadPath(std::istream& file) {
|
||||
LDFBaseData* ldfConfig = nullptr;
|
||||
if (path.pathType == PathType::Movement || path.pathType == PathType::Rail) {
|
||||
// cause NetDevil puts spaces in things that don't need spaces
|
||||
parameter.erase(std::remove_if(parameter.begin(), parameter.end(), isspace), parameter.end());
|
||||
parameter.erase(std::remove_if(parameter.begin(), parameter.end(), ::isspace), parameter.end());
|
||||
auto waypointCommand = WaypointCommandType::StringToWaypointCommandType(parameter);
|
||||
if (waypointCommand == eWaypointCommandType::DELAY) value.erase(std::remove_if(value.begin(), value.end(), ::isspace), value.end());
|
||||
if (waypointCommand != eWaypointCommandType::INVALID) waypoint.commands.push_back(WaypointCommand(waypointCommand, value));
|
||||
else Game::logger->Log("Zone", "Tried to load invalid waypoint command '%s'", parameter.c_str());
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user