diff --git a/dGame/dComponents/PetComponent.cpp b/dGame/dComponents/PetComponent.cpp index 7d896316..1ab06833 100644 --- a/dGame/dComponents/PetComponent.cpp +++ b/dGame/dComponents/PetComponent.cpp @@ -381,7 +381,7 @@ void PetComponent::Update(float deltaTime) { return; } - if (m_TresureTime > 0.0f) { //TODO: Find better trigger + if (m_TresureTime > 0.0f) { //TODO: Find better trigger? InteractDig(deltaTime); return; } @@ -1037,6 +1037,12 @@ void PetComponent::Command(NiPoint3 position, LWOOBJID source, int32_t commandTy if (owner->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { ChatPackets::SendSystemMessage(owner->GetSystemAddress(), u"Commmand Type: " + (GeneralUtils::to_u16string(commandType)) + u" - Type Id: " + (GeneralUtils::to_u16string(typeId))); } + + // Add movement functionality + if (position != NiPoint3::ZERO) { + m_MovementAI->SetDestination(position); + m_Timer = 9; //Is this setting how long until the next update tick? + } } LWOOBJID PetComponent::GetOwnerId() const { diff --git a/dGame/dUtilities/SlashCommandHandler.cpp b/dGame/dUtilities/SlashCommandHandler.cpp index fbda3b67..21f45cd2 100644 --- a/dGame/dUtilities/SlashCommandHandler.cpp +++ b/dGame/dUtilities/SlashCommandHandler.cpp @@ -736,19 +736,19 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit //Pet command utility if (chatCommand == "petcommand" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { - if (args.size() < 2) { + if (args.size() < 5) { ChatPackets::SendSystemMessage(sysAddr, u"Too few arguments!"); return; } int32_t commandType; - if (!GeneralUtils::TryParse(args[0], commandType)) { + if (!GeneralUtils::TryParse(args[0+3], commandType)) { ChatPackets::SendSystemMessage(sysAddr, u"Invalid command type!"); return; } int32_t typeId; - if (!GeneralUtils::TryParse(args[1], typeId)) { + if (!GeneralUtils::TryParse(args[1+3], typeId)) { ChatPackets::SendSystemMessage(sysAddr, u"Invalid command type id!"); return; } @@ -760,7 +760,30 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit return; } - petComponent->Command(NiPoint3::ZERO, LWOOBJID_EMPTY, commandType, typeId, true); + //Determine the positional coordinates + NiPoint3 commandPos{}; + float x, y, z; + if (!GeneralUtils::TryParse(args[0], x)) { + ChatPackets::SendSystemMessage(sysAddr, u"Invalid x."); + return; + } + + if (!GeneralUtils::TryParse(args[1], y)) { + ChatPackets::SendSystemMessage(sysAddr, u"Invalid y."); + return; + } + + if (!GeneralUtils::TryParse(args[2], z)) { + ChatPackets::SendSystemMessage(sysAddr, u"Invalid z."); + return; + } + + // Set command position + commandPos.SetX(x); + commandPos.SetY(y); + commandPos.SetZ(z); + + petComponent->Command(commandPos, entity->GetObjectID(), commandType, typeId, true); }