Remove broad command

This commit is contained in:
Vladislav Khorev committed 2026-11-06 21:30:17 +06:00
1 parent 1ab9f300b6
commit 3f68a8ba07
11 files changed
+120 -160

No files matched your search

+32 -7
View File
@@ -378,18 +378,47 @@ void InternalGameServer::submit(const GameCommand& command)
state_.globalInts[value.key] = value.value;
} else if constexpr (std::is_same_v<T, SetGlobalFloatCommand>) {
state_.globalFloats[value.key] = value.value;
} else if constexpr (std::is_same_v<T, SetCharacterTransformCommand>) {
} else if constexpr (std::is_same_v<T, SetCharacterPositionCommand>) {
CharacterState* character =
state_.findCharacter(value.locationId, value.characterId);
if (character) {
character->position = value.position;
character->facingAngle = value.facingAngle;
character->targetFacingAngle = value.facingAngle;
if (value.updateHomePosition)
character->homePosition = value.position;
}
} else if constexpr (std::is_same_v<T, SetCharacterFacingAngleCommand>) {
CharacterState* character =
state_.findCharacter(value.locationId, value.characterId);
if (character) {
character->targetFacingAngle = value.angle;
if (value.setCurrentAngle)
character->facingAngle = value.angle;
}
} else if constexpr (std::is_same_v<T, SetCharacterHomePositionCommand>) {
CharacterState* character =
state_.findCharacter(value.locationId, value.characterId);
if (character)
character->homePosition = value.position;
} else if constexpr (std::is_same_v<T, SetCharacterTargetCommand>) {
CharacterState* character =
state_.findCharacter(value.locationId, value.characterId);
if (character) character->attackTargetId = value.targetId;
} else if constexpr (std::is_same_v<T, SetCharacterFaceTargetCommand>) {
CharacterState* character =
state_.findCharacter(value.locationId, value.characterId);
if (character) character->faceTargetId = value.targetId;
} else if constexpr (std::is_same_v<T, SetCharacterEnabledCommand>) {
CharacterState* character =
state_.findCharacter(value.locationId, value.characterId);
if (character) {
character->enabled = value.enabled;
character->attack = 0;
character->attack_cooldown = 0;
character->currentState = AnimationState::STAND;
if (character->canAttack)
character->attackTargetId = "player";
character->battle_state = 0;
}
} else if constexpr (std::is_same_v<T, ClearCharacterAttackTargetCommand>) {
CharacterState* character =
state_.findCharacter(value.locationId, value.characterId);
@@ -445,10 +474,6 @@ void InternalGameServer::submit(const GameCommand& command)
CharacterState* character =
state_.findCharacter(value.locationId, value.characterId);
if (character) character->hp = (std::max)(0.f, character->hp - (std::max)(0.f, value.amount));
} else if constexpr (std::is_same_v<T, CommitCharacterStateCommand>) {
CharacterState* character =
state_.findCharacter(value.locationId, value.characterId);
if (character) *character = value.state;
} else if constexpr (std::is_same_v<T, SetInteractiveObjectActiveCommand>) {
auto location = state_.locations.find(value.locationId);
if (location == state_.locations.end()) return;