Add round reset cleanup for PlantSystem
It now repopulates the entire seed database.
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Server.Botany;
|
using Content.Server.Botany;
|
||||||
using Content.Server.GameObjects.Components.Botany;
|
using Content.Server.GameObjects.Components.Botany;
|
||||||
|
using Content.Shared.GameTicking;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
@@ -12,7 +13,7 @@ using Robust.Shared.Prototypes;
|
|||||||
namespace Content.Server.GameObjects.EntitySystems
|
namespace Content.Server.GameObjects.EntitySystems
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class PlantSystem : EntitySystem
|
public class PlantSystem : EntitySystem, IResettingEntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IComponentManager _componentManager = default!;
|
[Dependency] private readonly IComponentManager _componentManager = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
@@ -29,6 +30,15 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
|
PopulateDatabase();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PopulateDatabase()
|
||||||
|
{
|
||||||
|
_nextUid = 0;
|
||||||
|
|
||||||
|
_seeds.Clear();
|
||||||
|
|
||||||
foreach (var seed in _prototypeManager.EnumeratePrototypes<Seed>())
|
foreach (var seed in _prototypeManager.EnumeratePrototypes<Seed>())
|
||||||
{
|
{
|
||||||
AddSeedToDatabase(seed);
|
AddSeedToDatabase(seed);
|
||||||
@@ -66,5 +76,10 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
plantHolder.Update();
|
plantHolder.Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
PopulateDatabase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user