mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-18 14:07:53 +03:00
* Meteors that leave behind asteroid ore * bigger offset * Bit more generic * Better defaults * hrm? * I HATE CUSTOM SERIALIZERS * More comments * renamed a variable --------- Co-authored-by: plykiya <plykiya@protonmail.com> (cherry picked from commit 1d2b7131ab6c39222423f336c2ec364dea31ab10)
38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
using Content.Server.Spawners.Components;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Spawners;
|
|
|
|
namespace Content.Server.Spawners.EntitySystems;
|
|
|
|
public sealed class SpawnOnDespawnSystem : EntitySystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<SpawnOnDespawnComponent, TimedDespawnEvent>(OnDespawn);
|
|
}
|
|
|
|
private void OnDespawn(EntityUid uid, SpawnOnDespawnComponent comp, ref TimedDespawnEvent args)
|
|
{
|
|
if (!TryComp(uid, out TransformComponent? xform))
|
|
return;
|
|
|
|
// Lavaland Change start
|
|
if (comp.Prototype != null)
|
|
Spawn(comp.Prototype, xform.Coordinates);
|
|
// Lavaland Change end
|
|
|
|
// Lavaland Change start
|
|
// make it spawn more (without intrusion)
|
|
foreach (var prot in comp.Prototypes)
|
|
Spawn(prot, xform.Coordinates);
|
|
// Lavaland Change end
|
|
}
|
|
|
|
public void SetPrototype(Entity<SpawnOnDespawnComponent> entity, EntProtoId prototype)
|
|
{
|
|
entity.Comp.Prototype = prototype;
|
|
}
|
|
}
|