#W# Spawn: Tweaked RegionSpawner so it detects the region when you spawn it.
This commit is contained in:
parent
800c0227da
commit
e5029166e2
2 changed files with 33 additions and 12 deletions
|
|
@ -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()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue