mirror of
https://github.com/modernuo/ModernUO
synced 2026-08-11 22:23:06 -04:00
### Summary - Adds CanSpawnMobile(x, y, minZ, maxZ, canSwim, cantWalk, out spawnZ) overload for finding spawn surfaces within a Z range - Adds CanSpawnItem(x, y, minZ, maxZ, out spawnZ) for item spawning with Surface+Impassable support (tables, furniture) - Uses bitmask optimization inspired by Item.DropToWorld's m_OpenSlots pattern for O(1) surface/blocker checks - HomeRange spawners now use surface detection to set proper Z bounds ### Key Changes Map.cs: - CanSpawnMobile with Z-range finds lowest valid surface for mobiles - CanSpawnItem with Z-range finds lowest valid surface for items (including tables) - CanFitItem for point-check item placement on Surface+Impassable tiles - Bitmask approach eliminates nested loops and stackalloc arrays Spawners: - Simplified GetSpawnPosition using new Z-range methods - HomeRange setter detects surface below spawner for proper Z bounds - Consistent handling for mobiles and items ### Bug Fixes - Water tiles (Impassable | Wet) no longer block swimming mobs - Items can now spawn on tables/furniture (Surface+Impassable) ### Test Plan - Run dotnet test - 631 tests pass - Manual testing: multi-story spawning, water mobs, item spawning on tables - Verify HomeRange spawner movement shifts bounds correctly
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(Point3D location);
|
|
}
|
|
|
|
public interface ISpawnable : IEntity
|
|
{
|
|
ISpawner Spawner { get; set; }
|
|
void OnBeforeSpawn(Point3D location, Map map);
|
|
void OnAfterSpawn();
|
|
}
|