Rename some variables in Component

And add more virtuals
This commit is contained in:
David Markowitz
2023-06-06 18:59:53 -07:00
parent b589755655
commit 716a5fcf37
54 changed files with 602 additions and 580 deletions

View File

@@ -16,7 +16,7 @@
TriggerComponent::TriggerComponent(Entity* parent, const std::string triggerInfo): Component(parent) {
m_Parent = parent;
m_OwningEntity = parent;
m_Trigger = nullptr;
std::vector<std::string> tokens = GeneralUtils::SplitString(triggerInfo, ':');
@@ -116,7 +116,7 @@ void TriggerComponent::HandleTriggerCommand(LUTriggers::Command* command, Entity
HandleCastSkill(targetEntity, command->args);
break;
case eTriggerCommandType::DISPLAY_ZONE_SUMMARY:
GameMessages::SendDisplayZoneSummary(targetEntity->GetObjectID(), targetEntity->GetSystemAddress(), false, command->args == "1", m_Parent->GetObjectID());
GameMessages::SendDisplayZoneSummary(targetEntity->GetObjectID(), targetEntity->GetSystemAddress(), false, command->args == "1", m_OwningEntity->GetObjectID());
break;
case eTriggerCommandType::SET_PHYSICS_VOLUME_EFFECT:
HandleSetPhysicsVolumeEffect(targetEntity, argArray);
@@ -164,7 +164,7 @@ void TriggerComponent::HandleTriggerCommand(LUTriggers::Command* command, Entity
std::vector<Entity*> TriggerComponent::GatherTargets(LUTriggers::Command* command, Entity* optionalTarget) {
std::vector<Entity*> entities = {};
if (command->target == "self") entities.push_back(m_Parent);
if (command->target == "self") entities.push_back(m_OwningEntity);
else if (command->target == "zone") { /*TODO*/ }
else if (command->target == "target" && optionalTarget) entities.push_back(optionalTarget);
else if (command->target == "targetTeam" && optionalTarget) {
@@ -185,14 +185,14 @@ std::vector<Entity*> TriggerComponent::GatherTargets(LUTriggers::Command* comman
void TriggerComponent::HandleFireEvent(Entity* targetEntity, std::string args) {
for (CppScripts::Script* script : CppScripts::GetEntityScripts(targetEntity)) {
script->OnFireEventServerSide(targetEntity, m_Parent, args, 0, 0, 0);
script->OnFireEventServerSide(targetEntity, m_OwningEntity, args, 0, 0, 0);
}
}
void TriggerComponent::HandleDestroyObject(Entity* targetEntity, std::string args){
uint32_t killType;
GeneralUtils::TryParse<uint32_t>(args, killType);
targetEntity->Smash(m_Parent->GetObjectID(), static_cast<eKillType>(killType));
targetEntity->Smash(m_OwningEntity->GetObjectID(), static_cast<eKillType>(killType));
}
void TriggerComponent::HandleToggleTrigger(Entity* targetEntity, std::string args){
@@ -237,7 +237,7 @@ void TriggerComponent::HandleRotateObject(Entity* targetEntity, std::vector<std:
void TriggerComponent::HandlePushObject(Entity* targetEntity, std::vector<std::string> argArray){
if (argArray.size() < 3) return;
auto* phantomPhysicsComponent = m_Parent->GetComponent<PhantomPhysicsComponent>();
auto* phantomPhysicsComponent = m_OwningEntity->GetComponent<PhantomPhysicsComponent>();
if (!phantomPhysicsComponent) {
Game::logger->LogDebug("TriggerComponent::HandlePushObject", "Phantom Physics component not found!");
return;
@@ -249,12 +249,12 @@ void TriggerComponent::HandlePushObject(Entity* targetEntity, std::vector<std::s
GeneralUtils::TryParse(argArray.at(0), argArray.at(1), argArray.at(2), direction);
phantomPhysicsComponent->SetDirection(direction);
EntityManager::Instance()->SerializeEntity(m_Parent);
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
}
void TriggerComponent::HandleRepelObject(Entity* targetEntity, std::string args){
auto* phantomPhysicsComponent = m_Parent->GetComponent<PhantomPhysicsComponent>();
auto* phantomPhysicsComponent = m_OwningEntity->GetComponent<PhantomPhysicsComponent>();
if (!phantomPhysicsComponent) {
Game::logger->LogDebug("TriggerComponent::HandleRepelObject", "Phantom Physics component not found!");
return;
@@ -265,7 +265,7 @@ void TriggerComponent::HandleRepelObject(Entity* targetEntity, std::string args)
phantomPhysicsComponent->SetEffectType(ePhysicsEffectType::REPULSE);
phantomPhysicsComponent->SetDirectionalMultiplier(forceMultiplier);
auto triggerPos = m_Parent->GetPosition();
auto triggerPos = m_OwningEntity->GetPosition();
auto targetPos = targetEntity->GetPosition();
// normalize the vectors to get the direction
@@ -274,7 +274,7 @@ void TriggerComponent::HandleRepelObject(Entity* targetEntity, std::string args)
NiPoint3 direction = delta / length;
phantomPhysicsComponent->SetDirection(direction);
EntityManager::Instance()->SerializeEntity(m_Parent);
EntityManager::Instance()->SerializeEntity(m_OwningEntity);
}
void TriggerComponent::HandleSetTimer(Entity* targetEntity, std::vector<std::string> argArray){
@@ -284,11 +284,11 @@ void TriggerComponent::HandleSetTimer(Entity* targetEntity, std::vector<std::str
}
float time = 0.0;
GeneralUtils::TryParse<float>(argArray.at(1), time);
m_Parent->AddTimer(argArray.at(0), time);
m_OwningEntity->AddTimer(argArray.at(0), time);
}
void TriggerComponent::HandleCancelTimer(Entity* targetEntity, std::string args){
m_Parent->CancelTimer(args);
m_OwningEntity->CancelTimer(args);
}
void TriggerComponent::HandlePlayCinematic(Entity* targetEntity, std::vector<std::string> argArray) {