feat: Changes Spawner HomeRange to SpawnBounds (#2290)
### Summary This PR transitions the spawner system from a simple radius-based model to a flexible 3D boundary system. ### Core Changes * **Replaced `HomeRange` with `SpawnBounds`**: Spawners now use a `Rectangle3D` to define spawn areas instead of a circular integer range. * **Backward Compatibility**: * The `HomeRange` property remains as a helper that generates square `SpawnBounds` centered on the spawner. * Included a migration path (v10 to v11) that automatically converts old range data into new bounds during deserialization. * **Dynamic Bounds Shifting**: If a spawner is moved, its `SpawnBounds` will automatically shift with it, provided the bounds are currently configured as a centered square. * **New Spawn Logic**: Added `SpawnLocationIsHome` toggle. If enabled, spawned mobiles treat their exact spawn coordinates as their "Home" rather than the spawner's location. ### Implementation Details * **Interface Updates**: Updated `ISpawner` to include `WalkingRange`, `SpawnBounds`, and `IsInSpawnBounds()`. * **UI Enhancements**: The Spawner Controller Gump now displays "Custom" for complex bounds and allows copying of the new boundary properties between spawners. * **Refactored Constructors**: Streamlined `BaseSpawner`, `ProximitySpawner`, and `RegionSpawner` constructors to support the new data types.
This commit is contained in:
parent
bde072f81c
commit
0b34cc4417
16 changed files with 502 additions and 196 deletions
|
|
@ -158,7 +158,7 @@ public static class ImportSpawnersCommand
|
|||
Point3D location = Point3D.Parse(Utility.GetText(node["location"], "Error"));
|
||||
Map map = Map.Parse(Utility.GetText(node["map"], "Error"));
|
||||
|
||||
Spawner spawner = new Spawner(count, minDelay, maxDelay, team, homeRange, creatureNames.ToArray());
|
||||
Spawner spawner = new Spawner(count, minDelay, maxDelay, team, spawnedNames: creatureNames.ToArray());
|
||||
if (walkingRange >= 0)
|
||||
{
|
||||
spawner.WalkingRange = walkingRange;
|
||||
|
|
@ -166,6 +166,7 @@ public static class ImportSpawnersCommand
|
|||
|
||||
spawner.Name = name;
|
||||
spawner.MoveToWorld(location, map);
|
||||
spawner.HomeRange = homeRange;
|
||||
if (spawner.Map == Map.Internal)
|
||||
{
|
||||
spawner.Delete();
|
||||
|
|
@ -347,7 +348,7 @@ public static class ImportSpawnersCommand
|
|||
var maxDelay = GetTimeSpan(maxTimeOverride, parts[12]);
|
||||
var homeRange = int.Parse(parts[14]);
|
||||
|
||||
var spawner = new Spawner(totalCount, minDelay, maxDelay, 0, homeRange)
|
||||
var spawner = new Spawner(totalCount, minDelay, maxDelay)
|
||||
{
|
||||
WalkingRange = int.Parse(parts[13]),
|
||||
Name = $"Spawner ({spawnerIdOverride ?? parts[15]})"
|
||||
|
|
@ -362,6 +363,7 @@ public static class ImportSpawnersCommand
|
|||
new Point3D(int.Parse(parts[7]), int.Parse(parts[8]), int.Parse(parts[9])),
|
||||
map
|
||||
);
|
||||
spawner.HomeRange = homeRange;
|
||||
|
||||
spawner.Respawn();
|
||||
allSpawners.Add(spawner.Guid, spawner);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue