### 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.
81 lines
1.7 KiB
C#
81 lines
1.7 KiB
C#
using System;
|
|
|
|
namespace Server;
|
|
|
|
public interface IPoint2D
|
|
{
|
|
int X { get; }
|
|
int Y { get; }
|
|
}
|
|
|
|
public interface IPoint3D : IPoint2D
|
|
{
|
|
int Z { get; }
|
|
}
|
|
|
|
public interface ICarvable
|
|
{
|
|
void Carve(Mobile from, Item item);
|
|
}
|
|
|
|
public interface IWeapon
|
|
{
|
|
int MaxRange { get; }
|
|
void OnBeforeSwing(Mobile attacker, Mobile defender);
|
|
TimeSpan OnSwing(Mobile attacker, Mobile defender, double damageBonus = 1.0);
|
|
void GetStatusDamage(Mobile from, out int min, out int max);
|
|
}
|
|
|
|
public interface IHued
|
|
{
|
|
int HuedItemID { get; }
|
|
}
|
|
|
|
public interface ISpell
|
|
{
|
|
bool BlocksMovement { get; }
|
|
bool IsCasting { get; }
|
|
void OnCasterHurt();
|
|
void OnCasterKilled();
|
|
void OnConnectionChanged();
|
|
bool OnCasterMoving(Direction d);
|
|
bool OnCasterEquipping(Item item);
|
|
bool OnCasterUsingObject(IEntity entity);
|
|
bool OnCastInTown(Region r);
|
|
void FinishSequence();
|
|
}
|
|
|
|
public interface IParty
|
|
{
|
|
void OnStamChanged(Mobile m);
|
|
void OnManaChanged(Mobile m);
|
|
void OnStatsQuery(Mobile beholder, Mobile beheld);
|
|
}
|
|
|
|
// TODO: Add SpawnMap and change Spawner.Map to use it
|
|
public interface ISpawner : IEntity
|
|
{
|
|
Guid Guid { get; }
|
|
bool UnlinkOnTaming { get; }
|
|
int WalkingRange { get; }
|
|
Rectangle3D SpawnBounds { get; }
|
|
Region Region { get; }
|
|
bool ReturnOnDeactivate { get; }
|
|
bool Running { get; }
|
|
|
|
void Remove(ISpawnable spawn);
|
|
Point3D GetSpawnPosition(ISpawnable spawned, Map map);
|
|
void Respawn();
|
|
|
|
/// <summary>
|
|
/// Checks if the given location is within the spawn bounds.
|
|
/// </summary>
|
|
bool IsInSpawnBounds(IPoint3D location);
|
|
}
|
|
|
|
public interface ISpawnable : IEntity
|
|
{
|
|
ISpawner Spawner { get; set; }
|
|
void OnBeforeSpawn(Point3D location, Map map);
|
|
void OnAfterSpawn();
|
|
}
|