Generalized material spawning (#12489)

This commit is contained in:
Rane
2023-01-07 13:09:05 -05:00
committed by GitHub
parent f1cb0ca37a
commit fecd60e98a
13 changed files with 177 additions and 60 deletions

View File

@@ -67,7 +67,6 @@ namespace Content.Server.Cloning
SubscribeLocalEvent<CloningPodComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<CloningPodComponent, RefreshPartsEvent>(OnPartsRefreshed);
SubscribeLocalEvent<CloningPodComponent, UpgradeExamineEvent>(OnUpgradeExamine);
SubscribeLocalEvent<CloningPodComponent, MachineDeconstructedEvent>(OnDeconstruct);
SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset);
SubscribeLocalEvent<BeingClonedComponent, MindAddedMessage>(HandleMindAdded);
SubscribeLocalEvent<CloningPodComponent, PortDisconnectedEvent>(OnPortDisconnected);
@@ -96,11 +95,6 @@ namespace Content.Server.Cloning
args.AddPercentageUpgrade("cloning-pod-component-upgrade-biomass-requirement", component.BiomassRequirementMultiplier);
}
private void OnDeconstruct(EntityUid uid, CloningPodComponent component, MachineDeconstructedEvent args)
{
_serverStackSystem.SpawnMultiple(component.MaterialCloningOutput, _material.GetMaterialAmount(uid, component.RequiredMaterial), Transform(uid).Coordinates);
}
internal void TransferMindToClone(Mind.Mind mind)
{
if (!ClonesWaitingForMind.TryGetValue(mind, out var entity) ||
@@ -322,8 +316,7 @@ namespace Content.Server.Cloning
}
_spillableSystem.SpillAt(uid, bloodSolution, "PuddleBlood");
var biomassStack = Spawn(clonePod.MaterialCloningOutput, transform.Coordinates);
_stackSystem.SetCount(biomassStack, _robustRandom.Next(1, (int) (clonePod.UsedBiomass / 2.5)));
_serverStackSystem.SpawnMultipleFromMaterial(_robustRandom.Next(1, (int) (clonePod.UsedBiomass / 2.5)), clonePod.RequiredMaterial, Transform(uid).Coordinates);
clonePod.UsedBiomass = 0;
RemCompDeferred<ActiveCloningPodComponent>(uid);