#W# Spawn: Tweaked RegionSpawner so it detects the region when you spawn it.

This commit is contained in:
WarrentyExpired 2026-10-08 09:07:58 -04:00
parent 800c0227da
commit e5029166e2
2 changed files with 33 additions and 12 deletions

View file

@ -115,6 +115,30 @@ public partial class RegionSpawner : Spawner
}
}
public override void OnMapChange()
{
base.OnMapChange();
UpdateRegionFromLocation();
}
public override void OnLocationChange(Point3D oldLocation)
{
base.OnLocationChange(oldLocation);
UpdateRegionFromLocation();
}
private void UpdateRegionFromLocation()
{
if (Map != null && Map != Map.Internal)
{
var currentRegion = Region.Find(Location, Map) as BaseRegion;
if (currentRegion != null && currentRegion != _spawnRegion)
{
SpawnRegion = currentRegion;
}
}
}
[AfterDeserialization(false)]
private void AfterDeserialization()
{