#W# Change: Mobs are hidden until player has line of site.

This commit is contained in:
WarrentyExpired 2026-08-28 21:29:04 -04:00
parent a90694300e
commit 06ca72b1e3

View file

@ -252,6 +252,8 @@ namespace Server.Mobiles
private bool _summoned; private bool _summoned;
private bool _isLosHidden;
private bool m_bTamable; private bool m_bTamable;
private int m_ColdResistance; private int m_ColdResistance;
@ -3656,6 +3658,45 @@ namespace Server.Mobiles
{ {
var tc = Core.TickCount; var tc = Core.TickCount;
if (!Controlled && !Summoned && Region is Server.Regions.DungeonRegion)
{
if (Combatant == null)
{
bool someoneSeesMe = false;
foreach (Mobile m in Map.GetMobilesInRange(Location, 18))
{
if (m is PlayerMobile { Alive: true, AccessLevel: AccessLevel.Player } player)
{
if (player.InLOS(this))
{
someoneSeesMe = true;
break;
}
}
}
if (!someoneSeesMe && !Hidden)
{
_isLosHidden = true;
Hidden = true;
CantWalk = true;
}
else if (someoneSeesMe && Hidden && _isLosHidden)
{
_isLosHidden = false;
Hidden = false;
CantWalk = false;
}
}
else if (Hidden && _isLosHidden)
{
_isLosHidden = false;
Hidden = false;
CantWalk = false;
}
}
if (EnableRummaging && CanRummageCorpses && !Summoned && !Controlled && tc - m_NextRummageTime >= 0) if (EnableRummaging && CanRummageCorpses && !Summoned && !Controlled && tc - m_NextRummageTime >= 0)
{ {
double min, max; double min, max;