refactor(spawners): expose BaseSpawner DTO helpers to out-of-assembly subclasses (#2619)

## Summary

`BaseSpawner.Dto.cs` exposes `DtoName`, `DtoWalkingRange`, `DtoSpawnPositionMode`, `DtoMaxSpawnAttempts`, `DtoHomeRange` and `BoundsFromHomeRange` as `private protected`, which limits them to subclasses in this assembly. A spawner subclass in another assembly that overrides `ToDto()` to produce its own `SpawnerDto` subtype cannot build the DTO without duplicating that logic.

This widens them to `protected`. No behaviour change; nothing else in UOContent is affected.

## Tests

- `dotnet build` clean.
- An external spawner assembly builds and its test suite (419 tests) passes against this commit.
This commit is contained in:
Kamron Batman 2026-09-08 19:52:43 -07:00 committed by GitHub
parent 114dbba6e2
commit 4bad0cc9e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -53,7 +53,7 @@ public abstract partial class BaseSpawner
} }
/// <summary>The square spawn bounds a homeRange radius represents (centered on the location).</summary> /// <summary>The square spawn bounds a homeRange radius represents (centered on the location).</summary>
private protected static Rectangle3D BoundsFromHomeRange(Point3D location, int homeRange) protected static Rectangle3D BoundsFromHomeRange(Point3D location, int homeRange)
{ {
int z; int z;
int depth; int depth;
@ -78,7 +78,7 @@ public abstract partial class BaseSpawner
); );
} }
private protected string DtoName protected string DtoName
{ {
get get
{ {
@ -91,17 +91,17 @@ public abstract partial class BaseSpawner
// MaxDelay/Team/SpawnLocationIsHome match their property and are referenced directly in ToDto.) // MaxDelay/Team/SpawnLocationIsHome match their property and are referenced directly in ToDto.)
// Raw field; the public WalkingRange is computed (falls back to HomeRange). // Raw field; the public WalkingRange is computed (falls back to HomeRange).
private protected int DtoWalkingRange => _walkingRange; protected int DtoWalkingRange => _walkingRange;
// Abandoned is a transient runtime state, not persisted -> map to Automatic (omitted). // Abandoned is a transient runtime state, not persisted -> map to Automatic (omitted).
private protected SpawnPositionMode DtoSpawnPositionMode => protected SpawnPositionMode DtoSpawnPositionMode =>
_spawnPositionMode == SpawnPositionMode.Abandoned ? SpawnPositionMode.Automatic : _spawnPositionMode; _spawnPositionMode == SpawnPositionMode.Abandoned ? SpawnPositionMode.Automatic : _spawnPositionMode;
// Runtime treats 0 as DefaultMaxSpawnAttempts -> map the default to 0 (omitted). // Runtime treats 0 as DefaultMaxSpawnAttempts -> map the default to 0 (omitted).
private protected int DtoMaxSpawnAttempts => _maxSpawnAttempts == DefaultMaxSpawnAttempts ? 0 : _maxSpawnAttempts; protected int DtoMaxSpawnAttempts => _maxSpawnAttempts == DefaultMaxSpawnAttempts ? 0 : _maxSpawnAttempts;
// The radius if SpawnBounds is exactly what it reconstructs (lossless square); otherwise -1. // The radius if SpawnBounds is exactly what it reconstructs (lossless square); otherwise -1.
private protected int DtoHomeRange protected int DtoHomeRange
{ {
get get
{ {