mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-04-15 04:06:57 +00:00
fix: adding custom behaviors (#1969)
This commit is contained in:
@@ -189,8 +189,7 @@ void ModelComponent::AddBehavior(AddMessage& msg) {
|
|||||||
// Check if this behavior is able to be found via lot (if so, its a loot behavior).
|
// Check if this behavior is able to be found via lot (if so, its a loot behavior).
|
||||||
insertedBehavior.SetIsLoot(inventoryComponent->FindItemByLot(msg.GetBehaviorId(), eInventoryType::BEHAVIORS));
|
insertedBehavior.SetIsLoot(inventoryComponent->FindItemByLot(msg.GetBehaviorId(), eInventoryType::BEHAVIORS));
|
||||||
}
|
}
|
||||||
auto* const missionComponent = playerEntity->GetComponent<MissionComponent>();
|
ProgressAddBehaviorMission(*playerEntity);
|
||||||
if (missionComponent) missionComponent->Progress(eMissionTaskType::ADD_BEHAVIOR, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* const simplePhysComponent = m_Parent->GetComponent<SimplePhysicsComponent>();
|
auto* const simplePhysComponent = m_Parent->GetComponent<SimplePhysicsComponent>();
|
||||||
@@ -200,6 +199,11 @@ void ModelComponent::AddBehavior(AddMessage& msg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModelComponent::ProgressAddBehaviorMission(Entity& playerEntity) {
|
||||||
|
auto* const missionComponent = playerEntity.GetComponent<MissionComponent>();
|
||||||
|
if (missionComponent) missionComponent->Progress(eMissionTaskType::ADD_BEHAVIOR, 0);
|
||||||
|
}
|
||||||
|
|
||||||
std::string ModelComponent::SaveBehavior(const PropertyBehavior& behavior) const {
|
std::string ModelComponent::SaveBehavior(const PropertyBehavior& behavior) const {
|
||||||
tinyxml2::XMLDocument doc;
|
tinyxml2::XMLDocument doc;
|
||||||
auto* root = doc.NewElement("Behavior");
|
auto* root = doc.NewElement("Behavior");
|
||||||
|
|||||||
@@ -98,6 +98,8 @@ public:
|
|||||||
return msg.GetNeedsNewBehaviorID();
|
return msg.GetNeedsNewBehaviorID();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void ProgressAddBehaviorMission(Entity& playerEntity);
|
||||||
|
|
||||||
void AddBehavior(AddMessage& msg);
|
void AddBehavior(AddMessage& msg);
|
||||||
|
|
||||||
void RemoveBehavior(MoveToInventoryMessage& msg, const bool keepItem);
|
void RemoveBehavior(MoveToInventoryMessage& msg, const bool keepItem);
|
||||||
|
|||||||
@@ -164,7 +164,12 @@ void ControlBehaviors::ProcessCommand(Entity* const modelEntity, const AMFArrayV
|
|||||||
LOG("Unknown behavior command (%s)", command.data());
|
LOG("Unknown behavior command (%s)", command.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needsNewBehaviorID) RequestUpdatedID(context);
|
// If we need a new behaviorID, request it and progress the mission for adding a behavior.
|
||||||
|
// "add" takes care of this in the ModelComponent directly so we do not need to do it here for that command.
|
||||||
|
if (needsNewBehaviorID) {
|
||||||
|
RequestUpdatedID(context);
|
||||||
|
context.modelComponent->ProgressAddBehaviorMission(*context.modelOwner);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlBehaviors::ControlBehaviors() {
|
ControlBehaviors::ControlBehaviors() {
|
||||||
|
|||||||
Reference in New Issue
Block a user