feat(NPC): add configuration for creature repositioning during NPC combat (#22973)
Co-authored-by: Andrew <47818697+Nyeriah@users.noreply.github.com>
This commit is contained in:
parent
857559616c
commit
09b79f45f2
4 changed files with 26 additions and 4 deletions
|
|
@ -3000,6 +3000,15 @@ ListenRange.TextEmote = 40
|
|||
|
||||
ListenRange.Yell = 300
|
||||
|
||||
#
|
||||
# Creature.RepositionAgainstNpcs
|
||||
# Description: Enables circling and backwards repositioning during NPC versus NPC combat.
|
||||
# Set to 0 to keep the legacy optimization that disables these moves for NPCs.
|
||||
# Default: 1 - (Enabled, uses more CPU, but looks better)
|
||||
# 0 - (Disabled, uses less CPU)
|
||||
|
||||
Creature.RepositionAgainstNpcs = 1
|
||||
|
||||
#
|
||||
# Creature.MovingStopTimeForPlayer
|
||||
# Description: Time (in milliseconds) during which creature will not move after
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "World.h"
|
||||
#include "Vehicle.h"
|
||||
#include "ZoneScript.h"
|
||||
#include <functional>
|
||||
|
|
@ -364,13 +365,18 @@ void CreatureAI::MoveCircleChecks()
|
|||
if (
|
||||
!victim ||
|
||||
!me->IsFreeToMove() || me->HasUnitMovementFlag(MOVEMENTFLAG_ROOT) ||
|
||||
!me->IsWithinMeleeRange(victim) || me == victim->GetVictim() ||
|
||||
(!victim->IsPlayer() && !victim->IsPet()) // only player & pets to save CPU
|
||||
!me->IsWithinMeleeRange(victim) || me == victim->GetVictim()
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* optimization, disable circling movement for NPC vs NPC combat
|
||||
*/
|
||||
if (!sWorld->getBoolConfig(CONFIG_CREATURE_REPOSITION_AGAINST_NPCS) && !victim->IsPlayer() && !victim->IsPet())
|
||||
return;
|
||||
|
||||
me->GetMotionMaster()->MoveCircleTarget(me->GetVictim());
|
||||
}
|
||||
|
||||
|
|
@ -378,8 +384,13 @@ void CreatureAI::MoveBackwardsChecks()
|
|||
{
|
||||
Unit *victim = me->GetVictim();
|
||||
|
||||
if (!victim || !me->IsFreeToMove() || me->HasUnitMovementFlag(MOVEMENTFLAG_ROOT) ||
|
||||
(!victim->IsPlayer() && !victim->IsPet()))
|
||||
if (!victim || !me->IsFreeToMove() || me->HasUnitMovementFlag(MOVEMENTFLAG_ROOT))
|
||||
return;
|
||||
|
||||
/**
|
||||
* optimization, disable backwards movement for NPC vs NPC combat
|
||||
*/
|
||||
if (!sWorld->getBoolConfig(CONFIG_CREATURE_REPOSITION_AGAINST_NPCS) && !victim->IsPlayer() && !victim->IsPet())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -459,6 +459,7 @@ void WorldConfig::BuildConfigCache()
|
|||
SetConfigValue<uint32>(CONFIG_ARENA_QUEUE_ANNOUNCER_DETAIL, "Arena.QueueAnnouncer.Detail", 3);
|
||||
|
||||
SetConfigValue<bool>(CONFIG_OFFHAND_CHECK_AT_SPELL_UNLEARN, "OffhandCheckAtSpellUnlearn", true);
|
||||
SetConfigValue<bool>(CONFIG_CREATURE_REPOSITION_AGAINST_NPCS, "Creature.RepositionAgainstNpcs", true);
|
||||
SetConfigValue<uint32>(CONFIG_CREATURE_STOP_FOR_PLAYER, "Creature.MovingStopTimeForPlayer", 180000);
|
||||
|
||||
SetConfigValue<uint32>(CONFIG_WATER_BREATH_TIMER, "WaterBreath.Timer", 180000, ConfigValueCache::Reloadable::Yes, [](uint32 const& value) { return value > 0; }, "> 0");
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ enum ServerConfigs
|
|||
CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE,
|
||||
CONFIG_ARENA_QUEUE_ANNOUNCER_PLAYERONLY,
|
||||
CONFIG_OFFHAND_CHECK_AT_SPELL_UNLEARN,
|
||||
CONFIG_CREATURE_REPOSITION_AGAINST_NPCS,
|
||||
CONFIG_VMAP_INDOOR_CHECK,
|
||||
CONFIG_PET_LOS,
|
||||
CONFIG_START_CUSTOM_SPELLS,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue