fix: Fixes respawn command when spawner is off (#1891)

This commit is contained in:
Kamron Batman 2024-07-28 14:34:23 -07:00 committed by GitHub
parent 4a83b651f4
commit 4610712205
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 4 deletions

View file

@ -61,6 +61,7 @@ public interface ISpawner : IEntity
int HomeRange { get; }
Region Region { get; }
bool ReturnOnDeactivate { get; }
bool Running { get; }
void Remove(ISpawnable spawn);
Point3D GetSpawnPosition(ISpawnable spawned, Map map);

View file

@ -575,9 +575,9 @@ public class AdvancedSearchGump : Gump
{
var entry = SearchResults[i];
if (entry.Selected)
if (entry.Selected && entry.Entity is ISpawner { Running: true } spawner)
{
(entry.Entity as Spawner)?.Respawn();
spawner.Respawn();
}
}
}

View file

@ -51,7 +51,7 @@ public class RespawnCommand : BaseCommand
foreach (var obj in list)
{
if (obj is ISpawner spawner)
if (obj is ISpawner { Running: true } spawner)
{
spawner.Respawn();
}

View file

@ -95,7 +95,7 @@ public partial class ProximitySpawner : Spawner
public override string DefaultName => "Proximity Spawner";
public override bool HandlesOnMovement => true;
public override bool HandlesOnMovement => Running;
public override void ToJson(DynamicJson json, JsonSerializerOptions options)
{