rename and shorted BehaviorTemplate enum (#1512)

just a renaming of the enum and the value names and deletion of the empty cpp file.  Code compiles still.
This commit is contained in:
David Markowitz 2024-03-26 04:35:35 -07:00 committed by GitHub
parent 1e09ec92e3
commit 39b81b6263
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 158 additions and 160 deletions

View File

@ -222,7 +222,7 @@ void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet
if (healthDamageDealt >= 1) { if (healthDamageDealt >= 1) {
successState = eBasicAttackSuccessTypes::SUCCESS; successState = eBasicAttackSuccessTypes::SUCCESS;
} else if (armorDamageDealt >= 1) { } else if (armorDamageDealt >= 1) {
successState = this->m_OnFailArmor->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY ? eBasicAttackSuccessTypes::FAILIMMUNE : eBasicAttackSuccessTypes::FAILARMOR; successState = this->m_OnFailArmor->m_templateId == BehaviorTemplate::EMPTY ? eBasicAttackSuccessTypes::FAILIMMUNE : eBasicAttackSuccessTypes::FAILARMOR;
} }
bitStream.Write(armorDamageDealt); bitStream.Write(armorDamageDealt);

View File

@ -5,7 +5,7 @@
#include "CDActivitiesTable.h" #include "CDActivitiesTable.h"
#include "Game.h" #include "Game.h"
#include "Logger.h" #include "Logger.h"
#include "BehaviorTemplates.h" #include "BehaviorTemplate.h"
#include "BehaviorBranchContext.h" #include "BehaviorBranchContext.h"
#include <unordered_map> #include <unordered_map>
@ -110,176 +110,176 @@ Behavior* Behavior::CreateBehavior(const uint32_t behaviorId) {
Behavior* behavior = nullptr; Behavior* behavior = nullptr;
switch (templateId) { switch (templateId) {
case BehaviorTemplates::BEHAVIOR_EMPTY: break; case BehaviorTemplate::EMPTY: break;
case BehaviorTemplates::BEHAVIOR_BASIC_ATTACK: case BehaviorTemplate::BASIC_ATTACK:
behavior = new BasicAttackBehavior(behaviorId); behavior = new BasicAttackBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_TAC_ARC: case BehaviorTemplate::TAC_ARC:
behavior = new TacArcBehavior(behaviorId); behavior = new TacArcBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_AND: case BehaviorTemplate::AND:
behavior = new AndBehavior(behaviorId); behavior = new AndBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_PROJECTILE_ATTACK: case BehaviorTemplate::PROJECTILE_ATTACK:
behavior = new ProjectileAttackBehavior(behaviorId); behavior = new ProjectileAttackBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_HEAL: case BehaviorTemplate::HEAL:
behavior = new HealBehavior(behaviorId); behavior = new HealBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_MOVEMENT_SWITCH: case BehaviorTemplate::MOVEMENT_SWITCH:
behavior = new MovementSwitchBehavior(behaviorId); behavior = new MovementSwitchBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_AREA_OF_EFFECT: case BehaviorTemplate::AREA_OF_EFFECT:
behavior = new AreaOfEffectBehavior(behaviorId); behavior = new AreaOfEffectBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_PLAY_EFFECT: case BehaviorTemplate::PLAY_EFFECT:
behavior = new PlayEffectBehavior(behaviorId); behavior = new PlayEffectBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_IMMUNITY: case BehaviorTemplate::IMMUNITY:
behavior = new ImmunityBehavior(behaviorId); behavior = new ImmunityBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_DAMAGE_BUFF: break; case BehaviorTemplate::DAMAGE_BUFF: break;
case BehaviorTemplates::BEHAVIOR_DAMAGE_ABSORBTION: case BehaviorTemplate::DAMAGE_ABSORBTION:
behavior = new DamageAbsorptionBehavior(behaviorId); behavior = new DamageAbsorptionBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_OVER_TIME: case BehaviorTemplate::OVER_TIME:
behavior = new OverTimeBehavior(behaviorId); behavior = new OverTimeBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_IMAGINATION: case BehaviorTemplate::IMAGINATION:
behavior = new ImaginationBehavior(behaviorId); behavior = new ImaginationBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_TARGET_CASTER: case BehaviorTemplate::TARGET_CASTER:
behavior = new TargetCasterBehavior(behaviorId); behavior = new TargetCasterBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_STUN: case BehaviorTemplate::STUN:
behavior = new StunBehavior(behaviorId); behavior = new StunBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_DURATION: case BehaviorTemplate::DURATION:
behavior = new DurationBehavior(behaviorId); behavior = new DurationBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_KNOCKBACK: case BehaviorTemplate::KNOCKBACK:
behavior = new KnockbackBehavior(behaviorId); behavior = new KnockbackBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_ATTACK_DELAY: case BehaviorTemplate::ATTACK_DELAY:
behavior = new AttackDelayBehavior(behaviorId); behavior = new AttackDelayBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_CAR_BOOST: case BehaviorTemplate::CAR_BOOST:
behavior = new CarBoostBehavior(behaviorId); behavior = new CarBoostBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_FALL_SPEED: case BehaviorTemplate::FALL_SPEED:
behavior = new FallSpeedBehavior(behaviorId); behavior = new FallSpeedBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_SHIELD: break; case BehaviorTemplate::SHIELD: break;
case BehaviorTemplates::BEHAVIOR_REPAIR_ARMOR: case BehaviorTemplate::REPAIR_ARMOR:
behavior = new RepairBehavior(behaviorId); behavior = new RepairBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_SPEED: case BehaviorTemplate::SPEED:
behavior = new SpeedBehavior(behaviorId); behavior = new SpeedBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_DARK_INSPIRATION: case BehaviorTemplate::DARK_INSPIRATION:
behavior = new DarkInspirationBehavior(behaviorId); behavior = new DarkInspirationBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_LOOT_BUFF: case BehaviorTemplate::LOOT_BUFF:
behavior = new LootBuffBehavior(behaviorId); behavior = new LootBuffBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_VENTURE_VISION: case BehaviorTemplate::VENTURE_VISION:
behavior = new VentureVisionBehavior(behaviorId); behavior = new VentureVisionBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_SPAWN_OBJECT: case BehaviorTemplate::SPAWN_OBJECT:
behavior = new SpawnBehavior(behaviorId); behavior = new SpawnBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_LAY_BRICK: break; case BehaviorTemplate::LAY_BRICK: break;
case BehaviorTemplates::BEHAVIOR_SWITCH: case BehaviorTemplate::SWITCH:
behavior = new SwitchBehavior(behaviorId); behavior = new SwitchBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_BUFF: case BehaviorTemplate::BUFF:
behavior = new BuffBehavior(behaviorId); behavior = new BuffBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_JETPACK: case BehaviorTemplate::JETPACK:
behavior = new JetPackBehavior(behaviorId); behavior = new JetPackBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_SKILL_EVENT: case BehaviorTemplate::SKILL_EVENT:
behavior = new SkillEventBehavior(behaviorId); behavior = new SkillEventBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_CONSUME_ITEM: case BehaviorTemplate::CONSUME_ITEM:
behavior = new ConsumeItemBehavior(behaviorId); behavior = new ConsumeItemBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_SKILL_CAST_FAILED: case BehaviorTemplate::SKILL_CAST_FAILED:
behavior = new SkillCastFailedBehavior(behaviorId); behavior = new SkillCastFailedBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_IMITATION_SKUNK_STINK: break; case BehaviorTemplate::IMITATION_SKUNK_STINK: break;
case BehaviorTemplates::BEHAVIOR_CHANGE_IDLE_FLAGS: case BehaviorTemplate::CHANGE_IDLE_FLAGS:
behavior = new ChangeIdleFlagsBehavior(behaviorId); behavior = new ChangeIdleFlagsBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_APPLY_BUFF: case BehaviorTemplate::APPLY_BUFF:
behavior = new ApplyBuffBehavior(behaviorId); behavior = new ApplyBuffBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_CHAIN: case BehaviorTemplate::CHAIN:
behavior = new ChainBehavior(behaviorId); behavior = new ChainBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_CHANGE_ORIENTATION: case BehaviorTemplate::CHANGE_ORIENTATION:
behavior = new ChangeOrientationBehavior(behaviorId); behavior = new ChangeOrientationBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_FORCE_MOVEMENT: case BehaviorTemplate::FORCE_MOVEMENT:
behavior = new ForceMovementBehavior(behaviorId); behavior = new ForceMovementBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_INTERRUPT: case BehaviorTemplate::INTERRUPT:
behavior = new InterruptBehavior(behaviorId); behavior = new InterruptBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_ALTER_COOLDOWN: break; case BehaviorTemplate::ALTER_COOLDOWN: break;
case BehaviorTemplates::BEHAVIOR_CHARGE_UP: case BehaviorTemplate::CHARGE_UP:
behavior = new ChargeUpBehavior(behaviorId); behavior = new ChargeUpBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_SWITCH_MULTIPLE: case BehaviorTemplate::SWITCH_MULTIPLE:
behavior = new SwitchMultipleBehavior(behaviorId); behavior = new SwitchMultipleBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_START: case BehaviorTemplate::START:
behavior = new StartBehavior(behaviorId); behavior = new StartBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_END: case BehaviorTemplate::END:
behavior = new EndBehavior(behaviorId); behavior = new EndBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_ALTER_CHAIN_DELAY: break; case BehaviorTemplate::ALTER_CHAIN_DELAY: break;
case BehaviorTemplates::BEHAVIOR_CAMERA: break; case BehaviorTemplate::CAMERA: break;
case BehaviorTemplates::BEHAVIOR_REMOVE_BUFF: case BehaviorTemplate::REMOVE_BUFF:
behavior = new RemoveBuffBehavior(behaviorId); behavior = new RemoveBuffBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_GRAB: break; case BehaviorTemplate::GRAB: break;
case BehaviorTemplates::BEHAVIOR_MODULAR_BUILD: break; case BehaviorTemplate::MODULAR_BUILD: break;
case BehaviorTemplates::BEHAVIOR_NPC_COMBAT_SKILL: case BehaviorTemplate::NPC_COMBAT_SKILL:
behavior = new NpcCombatSkillBehavior(behaviorId); behavior = new NpcCombatSkillBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_BLOCK: case BehaviorTemplate::BLOCK:
behavior = new BlockBehavior(behaviorId); behavior = new BlockBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_VERIFY: case BehaviorTemplate::VERIFY:
behavior = new VerifyBehavior(behaviorId); behavior = new VerifyBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_TAUNT: case BehaviorTemplate::TAUNT:
behavior = new TauntBehavior(behaviorId); behavior = new TauntBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_AIR_MOVEMENT: case BehaviorTemplate::AIR_MOVEMENT:
behavior = new AirMovementBehavior(behaviorId); behavior = new AirMovementBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_SPAWN_QUICKBUILD: case BehaviorTemplate::SPAWN_QUICKBUILD:
behavior = new SpawnBehavior(behaviorId); behavior = new SpawnBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_PULL_TO_POINT: case BehaviorTemplate::PULL_TO_POINT:
behavior = new PullToPointBehavior(behaviorId); behavior = new PullToPointBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_PROPERTY_ROTATE: break; case BehaviorTemplate::PROPERTY_ROTATE: break;
case BehaviorTemplates::BEHAVIOR_DAMAGE_REDUCTION: case BehaviorTemplate::DAMAGE_REDUCTION:
behavior = new DamageReductionBehavior(behaviorId); behavior = new DamageReductionBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_PROPERTY_TELEPORT: case BehaviorTemplate::PROPERTY_TELEPORT:
behavior = new PropertyTeleportBehavior(behaviorId); behavior = new PropertyTeleportBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_PROPERTY_CLEAR_TARGET: case BehaviorTemplate::PROPERTY_CLEAR_TARGET:
behavior = new ClearTargetBehavior(behaviorId); behavior = new ClearTargetBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_TAKE_PICTURE: break; case BehaviorTemplate::TAKE_PICTURE: break;
case BehaviorTemplates::BEHAVIOR_MOUNT: break; case BehaviorTemplate::MOUNT: break;
case BehaviorTemplates::BEHAVIOR_SKILL_SET: break; case BehaviorTemplate::SKILL_SET: break;
default: default:
//LOG("Failed to load behavior with invalid template id (%i)!", templateId); //LOG("Failed to load behavior with invalid template id (%i)!", templateId);
break; break;
@ -296,19 +296,19 @@ Behavior* Behavior::CreateBehavior(const uint32_t behaviorId) {
return behavior; return behavior;
} }
BehaviorTemplates Behavior::GetBehaviorTemplate(const uint32_t behaviorId) { BehaviorTemplate Behavior::GetBehaviorTemplate(const uint32_t behaviorId) {
auto behaviorTemplateTable = CDClientManager::GetTable<CDBehaviorTemplateTable>(); auto behaviorTemplateTable = CDClientManager::GetTable<CDBehaviorTemplateTable>();
BehaviorTemplates templateID = BehaviorTemplates::BEHAVIOR_EMPTY; BehaviorTemplate templateID = BehaviorTemplate::EMPTY;
// Find behavior template by its behavior id. Default to 0. // Find behavior template by its behavior id. Default to 0.
if (behaviorTemplateTable) { if (behaviorTemplateTable) {
auto templateEntry = behaviorTemplateTable->GetByBehaviorID(behaviorId); auto templateEntry = behaviorTemplateTable->GetByBehaviorID(behaviorId);
if (templateEntry.behaviorID == behaviorId) { if (templateEntry.behaviorID == behaviorId) {
templateID = static_cast<BehaviorTemplates>(templateEntry.templateID); templateID = static_cast<BehaviorTemplate>(templateEntry.templateID);
} }
} }
if (templateID == BehaviorTemplates::BEHAVIOR_EMPTY && behaviorId != 0) { if (templateID == BehaviorTemplate::EMPTY && behaviorId != 0) {
LOG("Failed to load behavior template with id (%i)!", behaviorId); LOG("Failed to load behavior template with id (%i)!", behaviorId);
} }
@ -419,7 +419,7 @@ Behavior::Behavior(const uint32_t behaviorId) {
if (behaviorId == 0) { if (behaviorId == 0) {
this->m_effectId = 0; this->m_effectId = 0;
this->m_templateId = BehaviorTemplates::BEHAVIOR_EMPTY; this->m_templateId = BehaviorTemplate::EMPTY;
} }
// Make sure we do not proceed if we are trying to load an invalid behavior // Make sure we do not proceed if we are trying to load an invalid behavior
@ -427,12 +427,12 @@ Behavior::Behavior(const uint32_t behaviorId) {
LOG("Failed to load behavior with id (%i)!", behaviorId); LOG("Failed to load behavior with id (%i)!", behaviorId);
this->m_effectId = 0; this->m_effectId = 0;
this->m_templateId = BehaviorTemplates::BEHAVIOR_EMPTY; this->m_templateId = BehaviorTemplate::EMPTY;
return; return;
} }
this->m_templateId = static_cast<BehaviorTemplates>(templateInDatabase.templateID); this->m_templateId = static_cast<BehaviorTemplate>(templateInDatabase.templateID);
this->m_effectId = templateInDatabase.effectID; this->m_effectId = templateInDatabase.effectID;

View File

@ -6,7 +6,7 @@
#include <unordered_map> #include <unordered_map>
#include "BitStream.h" #include "BitStream.h"
#include "BehaviorTemplates.h" #include "BehaviorTemplate.h"
#include "dCommonVars.h" #include "dCommonVars.h"
struct BehaviorContext; struct BehaviorContext;
@ -26,7 +26,7 @@ public:
static Behavior* CreateBehavior(uint32_t behaviorId); static Behavior* CreateBehavior(uint32_t behaviorId);
static BehaviorTemplates GetBehaviorTemplate(uint32_t behaviorId); static BehaviorTemplate GetBehaviorTemplate(uint32_t behaviorId);
/* /*
* Utilities * Utilities
@ -39,7 +39,7 @@ public:
*/ */
uint32_t m_behaviorId; uint32_t m_behaviorId;
BehaviorTemplates m_templateId; BehaviorTemplate m_templateId;
uint32_t m_effectId; uint32_t m_effectId;
std::string m_effectHandle; std::string m_effectHandle;
std::unordered_map<std::string, std::string> m_effectNames; std::unordered_map<std::string, std::string> m_effectNames;

View File

@ -0,0 +1,70 @@
#pragma once
enum class BehaviorTemplate : unsigned int {
EMPTY, // Not a real behavior, indicates invalid behaviors
BASIC_ATTACK,
TAC_ARC,
AND,
PROJECTILE_ATTACK,
HEAL,
MOVEMENT_SWITCH,
AREA_OF_EFFECT,
PLAY_EFFECT,
IMMUNITY,
DAMAGE_BUFF,
DAMAGE_ABSORBTION,
OVER_TIME,
IMAGINATION,
TARGET_CASTER,
STUN,
DURATION,
KNOCKBACK,
ATTACK_DELAY,
CAR_BOOST,
FALL_SPEED,
SHIELD,
REPAIR_ARMOR,
SPEED,
DARK_INSPIRATION,
LOOT_BUFF,
VENTURE_VISION,
SPAWN_OBJECT,
LAY_BRICK,
SWITCH,
BUFF,
JETPACK,
SKILL_EVENT,
CONSUME_ITEM,
SKILL_CAST_FAILED,
IMITATION_SKUNK_STINK,
CHANGE_IDLE_FLAGS,
APPLY_BUFF,
CHAIN,
CHANGE_ORIENTATION,
FORCE_MOVEMENT,
INTERRUPT,
ALTER_COOLDOWN,
CHARGE_UP,
SWITCH_MULTIPLE,
START,
END,
ALTER_CHAIN_DELAY,
CAMERA,
REMOVE_BUFF,
GRAB,
MODULAR_BUILD,
NPC_COMBAT_SKILL,
BLOCK,
VERIFY,
TAUNT,
AIR_MOVEMENT,
SPAWN_QUICKBUILD,
PULL_TO_POINT,
PROPERTY_ROTATE,
DAMAGE_REDUCTION,
PROPERTY_TELEPORT,
PROPERTY_CLEAR_TARGET,
TAKE_PICTURE,
MOUNT,
SKILL_SET
};

View File

@ -1 +0,0 @@
#include "BehaviorTemplates.h"

View File

@ -1,70 +0,0 @@
#pragma once
enum class BehaviorTemplates : unsigned int {
BEHAVIOR_EMPTY, // Not a real behavior, indicates invalid behaviors
BEHAVIOR_BASIC_ATTACK,
BEHAVIOR_TAC_ARC,
BEHAVIOR_AND,
BEHAVIOR_PROJECTILE_ATTACK,
BEHAVIOR_HEAL,
BEHAVIOR_MOVEMENT_SWITCH,
BEHAVIOR_AREA_OF_EFFECT,
BEHAVIOR_PLAY_EFFECT,
BEHAVIOR_IMMUNITY,
BEHAVIOR_DAMAGE_BUFF,
BEHAVIOR_DAMAGE_ABSORBTION,
BEHAVIOR_OVER_TIME,
BEHAVIOR_IMAGINATION,
BEHAVIOR_TARGET_CASTER,
BEHAVIOR_STUN,
BEHAVIOR_DURATION,
BEHAVIOR_KNOCKBACK,
BEHAVIOR_ATTACK_DELAY,
BEHAVIOR_CAR_BOOST,
BEHAVIOR_FALL_SPEED,
BEHAVIOR_SHIELD,
BEHAVIOR_REPAIR_ARMOR,
BEHAVIOR_SPEED,
BEHAVIOR_DARK_INSPIRATION,
BEHAVIOR_LOOT_BUFF,
BEHAVIOR_VENTURE_VISION,
BEHAVIOR_SPAWN_OBJECT,
BEHAVIOR_LAY_BRICK,
BEHAVIOR_SWITCH,
BEHAVIOR_BUFF,
BEHAVIOR_JETPACK,
BEHAVIOR_SKILL_EVENT,
BEHAVIOR_CONSUME_ITEM,
BEHAVIOR_SKILL_CAST_FAILED,
BEHAVIOR_IMITATION_SKUNK_STINK,
BEHAVIOR_CHANGE_IDLE_FLAGS,
BEHAVIOR_APPLY_BUFF,
BEHAVIOR_CHAIN,
BEHAVIOR_CHANGE_ORIENTATION,
BEHAVIOR_FORCE_MOVEMENT,
BEHAVIOR_INTERRUPT,
BEHAVIOR_ALTER_COOLDOWN,
BEHAVIOR_CHARGE_UP,
BEHAVIOR_SWITCH_MULTIPLE,
BEHAVIOR_START,
BEHAVIOR_END,
BEHAVIOR_ALTER_CHAIN_DELAY,
BEHAVIOR_CAMERA,
BEHAVIOR_REMOVE_BUFF,
BEHAVIOR_GRAB,
BEHAVIOR_MODULAR_BUILD,
BEHAVIOR_NPC_COMBAT_SKILL,
BEHAVIOR_BLOCK,
BEHAVIOR_VERIFY,
BEHAVIOR_TAUNT,
BEHAVIOR_AIR_MOVEMENT,
BEHAVIOR_SPAWN_QUICKBUILD,
BEHAVIOR_PULL_TO_POINT,
BEHAVIOR_PROPERTY_ROTATE,
BEHAVIOR_DAMAGE_REDUCTION,
BEHAVIOR_PROPERTY_TELEPORT,
BEHAVIOR_PROPERTY_CLEAR_TARGET,
BEHAVIOR_TAKE_PICTURE,
BEHAVIOR_MOUNT,
BEHAVIOR_SKILL_SET
};

View File

@ -7,7 +7,6 @@ set(DGAME_DBEHAVIORS_SOURCES "AirMovementBehavior.cpp"
"Behavior.cpp" "Behavior.cpp"
"BehaviorBranchContext.cpp" "BehaviorBranchContext.cpp"
"BehaviorContext.cpp" "BehaviorContext.cpp"
"BehaviorTemplates.cpp"
"BlockBehavior.cpp" "BlockBehavior.cpp"
"BuffBehavior.cpp" "BuffBehavior.cpp"
"CarBoostBehavior.cpp" "CarBoostBehavior.cpp"

View File

@ -7,7 +7,7 @@
#include "Logger.h" #include "Logger.h"
void ForceMovementBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) { void ForceMovementBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
if (this->m_hitAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && this->m_hitEnemyAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && this->m_hitFactionAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY) { if (this->m_hitAction->m_templateId == BehaviorTemplate::EMPTY && this->m_hitEnemyAction->m_templateId == BehaviorTemplate::EMPTY && this->m_hitFactionAction->m_templateId == BehaviorTemplate::EMPTY) {
return; return;
} }
@ -38,7 +38,7 @@ void ForceMovementBehavior::Sync(BehaviorContext* context, RakNet::BitStream& bi
} }
void ForceMovementBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) { void ForceMovementBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {
if (this->m_hitAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && this->m_hitEnemyAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && this->m_hitFactionAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY) { if (this->m_hitAction->m_templateId == BehaviorTemplate::EMPTY && this->m_hitEnemyAction->m_templateId == BehaviorTemplate::EMPTY && this->m_hitFactionAction->m_templateId == BehaviorTemplate::EMPTY) {
return; return;
} }

View File

@ -6,13 +6,13 @@
void MovementSwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) { void MovementSwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream& bitStream, const BehaviorBranchContext branch) {
uint32_t movementType{}; uint32_t movementType{};
if (!bitStream.Read(movementType)) { if (!bitStream.Read(movementType)) {
if (this->m_groundAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && if (this->m_groundAction->m_templateId == BehaviorTemplate::EMPTY &&
this->m_jumpAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && this->m_jumpAction->m_templateId == BehaviorTemplate::EMPTY &&
this->m_fallingAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && this->m_fallingAction->m_templateId == BehaviorTemplate::EMPTY &&
this->m_doubleJumpAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && this->m_doubleJumpAction->m_templateId == BehaviorTemplate::EMPTY &&
this->m_airAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && this->m_airAction->m_templateId == BehaviorTemplate::EMPTY &&
this->m_jetpackAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY && this->m_jetpackAction->m_templateId == BehaviorTemplate::EMPTY &&
this->m_movingAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY) { this->m_movingAction->m_templateId == BehaviorTemplate::EMPTY) {
return; return;
} }
LOG("Unable to read movementType from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits()); LOG("Unable to read movementType from bitStream, aborting Handle! %i", bitStream.GetNumberOfUnreadBits());
@ -47,7 +47,7 @@ void MovementSwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream&
Behavior* MovementSwitchBehavior::LoadMovementType(std::string movementType) { Behavior* MovementSwitchBehavior::LoadMovementType(std::string movementType) {
float actionValue = GetFloat(movementType, -1.0f); float actionValue = GetFloat(movementType, -1.0f);
auto loadedBehavior = GetAction(actionValue != -1.0f ? actionValue : 0.0f); auto loadedBehavior = GetAction(actionValue != -1.0f ? actionValue : 0.0f);
if (actionValue == -1.0f && loadedBehavior->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY) { if (actionValue == -1.0f && loadedBehavior->m_templateId == BehaviorTemplate::EMPTY) {
loadedBehavior = this->m_groundAction; loadedBehavior = this->m_groundAction;
} }
return loadedBehavior; return loadedBehavior;