stack cleanup and mild refactoring (#11717)
* stack cleanup * fix tests and ulong * somehow did half a commit * ulong got usmall. (it's ints now) * sussy baka cleanup * mirror's review * make da tests pass again * shadowcommander review * sloth por favor * Update StoreSystem.Ui.cs
This commit is contained in:
@@ -97,7 +97,7 @@ namespace Content.Server.Cloning.Systems
|
||||
|
||||
private void OnDeconstruct(EntityUid uid, CloningPodComponent component, MachineDeconstructedEvent args)
|
||||
{
|
||||
_serverStackSystem.SpawnMultiple(_material.GetMaterialAmount(uid, "Biomass"), 100, "Biomass", Transform(uid).Coordinates);
|
||||
_serverStackSystem.SpawnMultiple(component.MaterialCloningOutput, _material.GetMaterialAmount(uid, component.RequiredMaterial), Transform(uid).Coordinates);
|
||||
}
|
||||
|
||||
internal void TransferMindToClone(Mind.Mind mind)
|
||||
@@ -149,7 +149,7 @@ namespace Content.Server.Cloning.Systems
|
||||
if (!args.IsInDetailsRange || !_powerReceiverSystem.IsPowered(uid))
|
||||
return;
|
||||
|
||||
args.PushMarkup(Loc.GetString("cloning-pod-biomass", ("number", _material.GetMaterialAmount(uid, "Biomass"))));
|
||||
args.PushMarkup(Loc.GetString("cloning-pod-biomass", ("number", _material.GetMaterialAmount(uid, component.RequiredMaterial))));
|
||||
}
|
||||
|
||||
public bool TryCloning(EntityUid uid, EntityUid bodyToClone, Mind.Mind mind, CloningPodComponent? clonePod)
|
||||
@@ -193,7 +193,7 @@ namespace Content.Server.Cloning.Systems
|
||||
cloningCost = (int) Math.Round(cloningCost * EasyModeCloningCost);
|
||||
|
||||
// biomass checks
|
||||
var biomassAmount = _material.GetMaterialAmount(uid, "Biomass");
|
||||
var biomassAmount = _material.GetMaterialAmount(uid, clonePod.RequiredMaterial);
|
||||
|
||||
if (biomassAmount < cloningCost)
|
||||
{
|
||||
@@ -202,7 +202,7 @@ namespace Content.Server.Cloning.Systems
|
||||
return false;
|
||||
}
|
||||
|
||||
_material.TryChangeMaterialAmount(uid, "Biomass", -cloningCost);
|
||||
_material.TryChangeMaterialAmount(uid, clonePod.RequiredMaterial, -cloningCost);
|
||||
clonePod.UsedBiomass = cloningCost;
|
||||
// end of biomass checks
|
||||
|
||||
@@ -319,7 +319,7 @@ namespace Content.Server.Cloning.Systems
|
||||
}
|
||||
_spillableSystem.SpillAt(uid, bloodSolution, "PuddleBlood");
|
||||
|
||||
var biomassStack = Spawn("MaterialBiomass", transform.Coordinates);
|
||||
var biomassStack = Spawn(clonePod.MaterialCloningOutput, transform.Coordinates);
|
||||
_stackSystem.SetCount(biomassStack, _robustRandom.Next(1, (int) (clonePod.UsedBiomass / 2.5)));
|
||||
|
||||
clonePod.UsedBiomass = 0;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Content.Shared.Cloning;
|
||||
using Content.Shared.Construction.Prototypes;
|
||||
using Content.Shared.Materials;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Server.Cloning.Components
|
||||
@@ -25,6 +27,18 @@ namespace Content.Server.Cloning.Components
|
||||
[ViewVariables]
|
||||
public bool FailedClone = false;
|
||||
|
||||
/// <summary>
|
||||
/// The material that is used to clone entities.
|
||||
/// </summary>
|
||||
[DataField("requiredMaterial", customTypeSerializer: typeof(PrototypeIdSerializer<MaterialPrototype>)), ViewVariables(VVAccess.ReadWrite)]
|
||||
public string RequiredMaterial = "Biomass";
|
||||
|
||||
/// <summary>
|
||||
/// The entity that is spawned on machine deconstruct as well as failed cloning.
|
||||
/// </summary>
|
||||
[DataField("materialCloningOutput", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>)), ViewVariables(VVAccess.ReadWrite)]
|
||||
public string MaterialCloningOutput = "MaterialBiomass";
|
||||
|
||||
/// <summary>
|
||||
/// The base amount of time it takes to clone a body
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user