Biomass (#10313)
* Material * good prototype * Fix material storage * You can insert biomass into the cloner * ok, basic biomass subtraction works * amogus * ok chance works * Alright, the biomass and genetic stuff works * feedback for cloning * more reclaimer polish * ship it * starting biomass + fix lathes * I changed my mind on rat mass and these guys are definitely getting ground up * Doafter * clean up, sync the two * fix naming, fix mass * technology + construction * additional logging, stop unanchoring when active * fix event / logs * dont gib dead salvage * auto eject * fix deconstruction behavior * make warning message better, temporarily disable cancer scanner * fix biomass stacks * add easy mode CVAR * stack cleanup, make biomass 2x as fast * bugfix * new sprite from hyenh * fix tests * hello? :smilethink: * :smilethink: * medical scanner gets antirotting * fix cloner and medical scanner Co-authored-by: Moony <moonheart08@users.noreply.github.com>
This commit is contained in:
@@ -22,7 +22,6 @@ namespace Content.Client.CloningConsole.UI
|
||||
};
|
||||
_window.OnClose += Close;
|
||||
_window.CloneButton.OnPressed += _ => SendMessage(new UiButtonPressedMessage(UiButton.Clone));
|
||||
_window.EjectButton.OnPressed += _ => SendMessage(new UiButtonPressedMessage(UiButton.Eject));
|
||||
_window.OpenCentered();
|
||||
}
|
||||
|
||||
@@ -43,7 +42,6 @@ namespace Content.Client.CloningConsole.UI
|
||||
{
|
||||
_window.OnClose -= Close;
|
||||
_window.CloneButton.OnPressed -= _ => SendMessage(new UiButtonPressedMessage(UiButton.Clone));
|
||||
_window.EjectButton.OnPressed -= _ => SendMessage(new UiButtonPressedMessage(UiButton.Eject));
|
||||
}
|
||||
_window?.Dispose();
|
||||
}
|
||||
|
||||
@@ -46,11 +46,6 @@
|
||||
<RichTextLabel Name="ClonerBrainActivity"
|
||||
Access="Public"
|
||||
HorizontalExpand="True"/>
|
||||
<Button Name="EjectButton"
|
||||
Access="Public"
|
||||
Text="{Loc 'cloning-console-eject-body-button'}"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center" />
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
<BoxContainer Name="CloningPodMissing" Margin="5 5 5 5" Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True">
|
||||
|
||||
@@ -17,7 +17,6 @@ namespace Content.Server.Atmos.Miasma
|
||||
[Dependency] private readonly TransformSystem _transformSystem = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
/// System Variables
|
||||
|
||||
@@ -116,13 +116,13 @@ public sealed class ClimbSystem : SharedClimbSystem
|
||||
if (TryBonk(component, user))
|
||||
return;
|
||||
|
||||
_doAfterSystem.DoAfter(new DoAfterEventArgs(entityToMove, component.ClimbDelay, default, climbable)
|
||||
_doAfterSystem.DoAfter(new DoAfterEventArgs(entityToMove, component.ClimbDelay, default, climbable, user)
|
||||
{
|
||||
BreakOnTargetMove = true,
|
||||
BreakOnUserMove = true,
|
||||
BreakOnDamage = true,
|
||||
BreakOnStun = true,
|
||||
UserFinishedEvent = new ClimbFinishedEvent(user, climbable)
|
||||
UserFinishedEvent = new ClimbFinishedEvent(user, climbable, entityToMove)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -155,10 +155,10 @@ public sealed class ClimbSystem : SharedClimbSystem
|
||||
|
||||
private void OnClimbFinished(EntityUid uid, ClimbingComponent climbing, ClimbFinishedEvent args)
|
||||
{
|
||||
Climb(uid, args.User, args.Climbable, climbing: climbing);
|
||||
Climb(uid, args.User, args.Instigator, args.Climbable, climbing: climbing);
|
||||
}
|
||||
|
||||
private void Climb(EntityUid uid, EntityUid user, EntityUid climbable, bool silent = false, ClimbingComponent? climbing = null,
|
||||
private void Climb(EntityUid uid, EntityUid user, EntityUid instigator, EntityUid climbable, bool silent = false, ClimbingComponent? climbing = null,
|
||||
PhysicsComponent? physics = null, FixturesComponent? fixtures = null)
|
||||
{
|
||||
if (!Resolve(uid, ref climbing, ref physics, ref fixtures, false))
|
||||
@@ -174,7 +174,7 @@ public sealed class ClimbSystem : SharedClimbSystem
|
||||
// there's also the cases where the user might collide with the person they are forcing onto the climbable that i haven't accounted for
|
||||
|
||||
RaiseLocalEvent(uid, new StartClimbEvent(climbable), false);
|
||||
RaiseLocalEvent(climbable, new ClimbedOnEvent(uid), false);
|
||||
RaiseLocalEvent(climbable, new ClimbedOnEvent(uid, user), false);
|
||||
|
||||
if (silent)
|
||||
return;
|
||||
@@ -343,7 +343,7 @@ public sealed class ClimbSystem : SharedClimbSystem
|
||||
|
||||
public void ForciblySetClimbing(EntityUid uid, EntityUid climbable, ClimbingComponent? component = null)
|
||||
{
|
||||
Climb(uid, uid, climbable, true, component);
|
||||
Climb(uid, uid, uid, climbable, true, component);
|
||||
}
|
||||
|
||||
private void OnBuckleChange(EntityUid uid, ClimbingComponent component, BuckleChangeEvent args)
|
||||
@@ -436,14 +436,16 @@ public sealed class ClimbSystem : SharedClimbSystem
|
||||
|
||||
internal sealed class ClimbFinishedEvent : EntityEventArgs
|
||||
{
|
||||
public ClimbFinishedEvent(EntityUid user, EntityUid climbable)
|
||||
public ClimbFinishedEvent(EntityUid user, EntityUid climbable, EntityUid instigator)
|
||||
{
|
||||
User = user;
|
||||
Climbable = climbable;
|
||||
Instigator = instigator;
|
||||
}
|
||||
|
||||
public EntityUid User { get; }
|
||||
public EntityUid Climbable { get; }
|
||||
public EntityUid Instigator { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -452,10 +454,12 @@ internal sealed class ClimbFinishedEvent : EntityEventArgs
|
||||
public sealed class ClimbedOnEvent : EntityEventArgs
|
||||
{
|
||||
public EntityUid Climber;
|
||||
public EntityUid Instigator;
|
||||
|
||||
public ClimbedOnEvent(EntityUid climber)
|
||||
public ClimbedOnEvent(EntityUid climber, EntityUid instigator)
|
||||
{
|
||||
Climber = climber;
|
||||
Instigator = instigator;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ using Content.Server.Mind.Components;
|
||||
using Content.Server.MachineLinking.System;
|
||||
using Content.Server.MachineLinking.Events;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Server.MobState;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
@@ -55,10 +55,6 @@ namespace Content.Server.Cloning.Systems
|
||||
if (consoleComponent.GeneticScanner != null && consoleComponent.CloningPod != null)
|
||||
TryClone(uid, consoleComponent.CloningPod.Value, consoleComponent.GeneticScanner.Value, consoleComponent: consoleComponent);
|
||||
break;
|
||||
case UiButton.Eject:
|
||||
if (consoleComponent.CloningPod != null)
|
||||
TryEject(uid, consoleComponent.CloningPod.Value, consoleComponent: consoleComponent);
|
||||
break;
|
||||
}
|
||||
UpdateUserInterface(consoleComponent);
|
||||
}
|
||||
@@ -123,14 +119,6 @@ namespace Content.Server.Cloning.Systems
|
||||
_uiSystem.GetUiOrNull(consoleComponent.Owner, CloningConsoleUiKey.Key)?.SetState(newState);
|
||||
}
|
||||
|
||||
public void TryEject(EntityUid uid, EntityUid clonePodUid, CloningPodComponent? cloningPod = null, CloningConsoleComponent? consoleComponent = null)
|
||||
{
|
||||
if (!Resolve(uid, ref consoleComponent) || !Resolve(clonePodUid, ref cloningPod))
|
||||
return;
|
||||
|
||||
_cloningSystem.Eject(clonePodUid, cloningPod);
|
||||
}
|
||||
|
||||
public void TryClone(EntityUid uid, EntityUid cloningPodUid, EntityUid scannerUid, CloningPodComponent? cloningPod = null, MedicalScannerComponent? scannerComp = null, CloningConsoleComponent? consoleComponent = null)
|
||||
{
|
||||
if (!Resolve(uid, ref consoleComponent) || !Resolve(cloningPodUid, ref cloningPod) || !Resolve(scannerUid, ref scannerComp))
|
||||
@@ -222,9 +210,10 @@ namespace Content.Server.Cloning.Systems
|
||||
EntityUid? cloneBody = clonePod.BodyContainer.ContainedEntity;
|
||||
|
||||
clonerMindPresent = clonePod.Status == CloningPodStatus.Cloning;
|
||||
if (cloneBody != null)
|
||||
if (HasComp<ActiveCloningPodComponent>(consoleComponent.CloningPod))
|
||||
{
|
||||
cloneBodyInfo = Identity.Name(cloneBody.Value, EntityManager);
|
||||
if (cloneBody != null)
|
||||
cloneBodyInfo = Identity.Name(cloneBody.Value, EntityManager);
|
||||
clonerStatus = ClonerStatus.ClonerOccupied;
|
||||
}
|
||||
}
|
||||
@@ -244,5 +233,6 @@ namespace Content.Server.Cloning.Systems
|
||||
clonerInRange
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,35 @@
|
||||
using Content.Server.Cloning.Components;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.CharacterAppearance.Systems;
|
||||
using Content.Shared.CharacterAppearance.Components;
|
||||
using Content.Shared.Species;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Content.Server.EUI;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Server.Containers;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Stacks;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Cloning;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Server.Cloning.Components;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.EUI;
|
||||
using Content.Server.MachineLinking.System;
|
||||
using Content.Server.MachineLinking.Events;
|
||||
using Content.Server.MobState;
|
||||
using Content.Server.Lathe.Components;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Server.Fluids.EntitySystems;
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Server.Construction.Components;
|
||||
using Content.Server.Stack;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
|
||||
namespace Content.Server.Cloning.Systems
|
||||
{
|
||||
@@ -28,17 +44,29 @@ namespace Content.Server.Cloning.Systems
|
||||
[Dependency] private readonly ContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||
[Dependency] private readonly PowerReceiverSystem _powerReceiverSystem = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||
[Dependency] private readonly TransformSystem _transformSystem = default!;
|
||||
[Dependency] private readonly SharedStackSystem _stackSystem = default!;
|
||||
[Dependency] private readonly StackSystem _serverStackSystem = default!;
|
||||
[Dependency] private readonly SpillableSystem _spillableSystem = default!;
|
||||
[Dependency] private readonly ChatSystem _chatSystem = default!;
|
||||
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
||||
|
||||
public readonly Dictionary<Mind.Mind, EntityUid> ClonesWaitingForMind = new();
|
||||
public const float EasyModeCloningCost = 0.7f;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CloningPodComponent, ComponentInit>(OnComponentInit);
|
||||
SubscribeLocalEvent<CloningPodComponent, MachineDeconstructedEvent>(OnDeconstruct);
|
||||
SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset);
|
||||
SubscribeLocalEvent<BeingClonedComponent, MindAddedMessage>(HandleMindAdded);
|
||||
SubscribeLocalEvent<CloningPodComponent, PortDisconnectedEvent>(OnPortDisconnected);
|
||||
SubscribeLocalEvent<CloningPodComponent, AnchorStateChangedEvent>(OnAnchor);
|
||||
SubscribeLocalEvent<CloningPodComponent, ExaminedEvent>(OnExamined);
|
||||
}
|
||||
|
||||
private void OnComponentInit(EntityUid uid, CloningPodComponent clonePod, ComponentInit args)
|
||||
@@ -47,6 +75,14 @@ namespace Content.Server.Cloning.Systems
|
||||
_signalSystem.EnsureReceiverPorts(uid, CloningPodComponent.PodPort);
|
||||
}
|
||||
|
||||
private void OnDeconstruct(EntityUid uid, CloningPodComponent component, MachineDeconstructedEvent args)
|
||||
{
|
||||
if (!TryComp<MaterialStorageComponent>(uid, out var storage))
|
||||
return;
|
||||
|
||||
_serverStackSystem.SpawnMultiple(storage.GetMaterialAmount("Biomass"), 100, "Biomass", Transform(uid).Coordinates);
|
||||
}
|
||||
|
||||
private void UpdateAppearance(CloningPodComponent clonePod)
|
||||
{
|
||||
if (TryComp<AppearanceComponent>(clonePod.Owner, out var appearance))
|
||||
@@ -97,11 +133,23 @@ namespace Content.Server.Cloning.Systems
|
||||
_cloningConsoleSystem.UpdateUserInterface(console);
|
||||
}
|
||||
|
||||
private void OnExamined(EntityUid uid, CloningPodComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (!args.IsInDetailsRange || !_powerReceiverSystem.IsPowered(uid))
|
||||
return;
|
||||
|
||||
if (TryComp<MaterialStorageComponent>(uid, out var storage))
|
||||
args.PushMarkup(Loc.GetString("cloning-pod-biomass", ("number", storage.GetMaterialAmount("Biomass"))));
|
||||
}
|
||||
|
||||
public bool TryCloning(EntityUid uid, EntityUid bodyToClone, Mind.Mind mind, CloningPodComponent? clonePod)
|
||||
{
|
||||
if (!Resolve(uid, ref clonePod) || bodyToClone == null)
|
||||
return false;
|
||||
|
||||
if (HasComp<ActiveCloningPodComponent>(uid))
|
||||
return false;
|
||||
|
||||
if (ClonesWaitingForMind.TryGetValue(mind, out var clone))
|
||||
{
|
||||
if (EntityManager.EntityExists(clone) &&
|
||||
@@ -120,11 +168,56 @@ namespace Content.Server.Cloning.Systems
|
||||
if (mind.UserId == null || !_playerManager.TryGetSessionById(mind.UserId.Value, out var client))
|
||||
return false; // If we can't track down the client, we can't offer transfer. That'd be quite bad.
|
||||
|
||||
if (!TryComp<MaterialStorageComponent>(clonePod.Owner, out var podStorage))
|
||||
return false;
|
||||
|
||||
if (!TryComp<HumanoidAppearanceComponent>(bodyToClone, out var humanoid))
|
||||
return false; // whatever body was to be cloned, was not a humanoid
|
||||
|
||||
var speciesProto = _prototype.Index<SpeciesPrototype>(humanoid.Species).Prototype;
|
||||
var mob = Spawn(speciesProto, Transform(clonePod.Owner).MapPosition);
|
||||
if (!_prototype.TryIndex<SpeciesPrototype>(humanoid.Species, out var speciesPrototype))
|
||||
return false;
|
||||
|
||||
if (!TryComp<PhysicsComponent>(bodyToClone, out var physics))
|
||||
return false;
|
||||
|
||||
int cloningCost = (int) physics.FixturesMass;
|
||||
|
||||
if (_configManager.GetCVar(CCVars.BiomassEasyMode))
|
||||
cloningCost = (int) Math.Round(cloningCost * EasyModeCloningCost);
|
||||
|
||||
// biomass checks
|
||||
var biomassAmount = podStorage.GetMaterialAmount("Biomass");
|
||||
|
||||
if (biomassAmount < cloningCost)
|
||||
{
|
||||
if (clonePod.ConnectedConsole != null)
|
||||
_chatSystem.TrySendInGameICMessage(clonePod.ConnectedConsole.Value, Loc.GetString("cloning-console-chat-error", ("units", cloningCost)), InGameICChatType.Speak, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
podStorage.RemoveMaterial("Biomass", cloningCost);
|
||||
clonePod.UsedBiomass = cloningCost;
|
||||
// end of biomass checks
|
||||
|
||||
// genetic damage checks
|
||||
if (TryComp<DamageableComponent>(bodyToClone, out var damageable) &&
|
||||
damageable.Damage.DamageDict.TryGetValue("Cellular", out var cellularDmg))
|
||||
{
|
||||
var chance = Math.Clamp((float) (cellularDmg / 100), 0, 1);
|
||||
if (cellularDmg > 0 && clonePod.ConnectedConsole != null)
|
||||
_chatSystem.TrySendInGameICMessage(clonePod.ConnectedConsole.Value, Loc.GetString("cloning-console-cellular-warning", ("percent", Math.Round(100 - (chance * 100)))), InGameICChatType.Speak, false);
|
||||
|
||||
if (_robustRandom.Prob(chance))
|
||||
{
|
||||
UpdateStatus(CloningPodStatus.Gore, clonePod);
|
||||
clonePod.FailedClone = true;
|
||||
AddComp<ActiveCloningPodComponent>(uid);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// end of genetic damage checks
|
||||
|
||||
var mob = Spawn(speciesPrototype.Prototype, Transform(clonePod.Owner).MapPosition);
|
||||
_appearanceSystem.UpdateAppearance(mob, humanoid.Appearance);
|
||||
_appearanceSystem.UpdateSexGender(mob, humanoid.Sex, humanoid.Gender);
|
||||
|
||||
@@ -156,16 +249,17 @@ namespace Content.Server.Cloning.Systems
|
||||
if (!_powerReceiverSystem.IsPowered(cloning.Owner))
|
||||
continue;
|
||||
|
||||
if (cloning.BodyContainer.ContainedEntity != null)
|
||||
{
|
||||
cloning.CloningProgress += frameTime;
|
||||
cloning.CloningProgress = MathHelper.Clamp(cloning.CloningProgress, 0f, cloning.CloningTime);
|
||||
}
|
||||
if (cloning.BodyContainer.ContainedEntity == null && !cloning.FailedClone)
|
||||
continue;
|
||||
|
||||
if (cloning.CapturedMind?.Session?.AttachedEntity == cloning.BodyContainer.ContainedEntity)
|
||||
{
|
||||
cloning.CloningProgress += frameTime;
|
||||
if (cloning.CloningProgress < cloning.CloningTime)
|
||||
continue;
|
||||
|
||||
if (cloning.FailedClone)
|
||||
EndFailedCloning(cloning.Owner, cloning);
|
||||
else
|
||||
Eject(cloning.Owner, cloning);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,10 +275,40 @@ namespace Content.Server.Cloning.Systems
|
||||
clonePod.BodyContainer.Remove(entity);
|
||||
clonePod.CapturedMind = null;
|
||||
clonePod.CloningProgress = 0f;
|
||||
clonePod.UsedBiomass = 0;
|
||||
UpdateStatus(CloningPodStatus.Idle, clonePod);
|
||||
RemCompDeferred<ActiveCloningPodComponent>(uid);
|
||||
}
|
||||
|
||||
private void EndFailedCloning(EntityUid uid, CloningPodComponent clonePod)
|
||||
{
|
||||
clonePod.FailedClone = false;
|
||||
clonePod.CloningProgress = 0f;
|
||||
UpdateStatus(CloningPodStatus.Idle, clonePod);
|
||||
var transform = Transform(uid);
|
||||
var indices = _transformSystem.GetGridOrMapTilePosition(uid);
|
||||
|
||||
var tileMix = _atmosphereSystem.GetTileMixture(transform.GridUid, null, indices, true);
|
||||
|
||||
Solution bloodSolution = new();
|
||||
|
||||
int i = 0;
|
||||
while (i < 1)
|
||||
{
|
||||
tileMix?.AdjustMoles(Gas.Miasma, 6f);
|
||||
bloodSolution.AddReagent("Blood", 50);
|
||||
if (_robustRandom.Prob(0.2f))
|
||||
i++;
|
||||
}
|
||||
_spillableSystem.SpillAt(uid, bloodSolution, "PuddleBlood");
|
||||
|
||||
var biomassStack = Spawn("MaterialBiomass", transform.Coordinates);
|
||||
_stackSystem.SetCount(biomassStack, _robustRandom.Next(1, (int) (clonePod.UsedBiomass / 2.5)));
|
||||
|
||||
clonePod.UsedBiomass = 0;
|
||||
RemCompDeferred<ActiveCloningPodComponent>(uid);
|
||||
}
|
||||
|
||||
public void Reset(RoundRestartCleanupEvent ev)
|
||||
{
|
||||
ClonesWaitingForMind.Clear();
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace Content.Server.Cloning.Components
|
||||
[ViewVariables] public ContainerSlot BodyContainer = default!;
|
||||
[ViewVariables] public Mind.Mind? CapturedMind;
|
||||
[ViewVariables] public float CloningProgress = 0;
|
||||
[ViewVariables] public int UsedBiomass = 70;
|
||||
[ViewVariables] public bool FailedClone = false;
|
||||
[DataField("cloningTime")]
|
||||
[ViewVariables] public float CloningTime = 30f;
|
||||
[ViewVariables] public CloningPodStatus Status;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
using Content.Shared.Lathe;
|
||||
using Content.Shared.Research.Prototypes;
|
||||
using Robust.Server.GameObjects;
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
||||
using Content.Shared.Materials;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Server.Lathe.Components
|
||||
@@ -12,20 +9,6 @@ namespace Content.Server.Lathe.Components
|
||||
[RegisterComponent]
|
||||
public sealed class LatheComponent : SharedLatheComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Whitelist for specifying the kind of materials that can be insert into the lathe
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("whitelist")]
|
||||
public EntityWhitelist? LatheWhitelist;
|
||||
|
||||
/// <summary>
|
||||
/// Whitelist generated on runtime for what items are specifically used for the lathe's recipes.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("materialWhiteList", customTypeSerializer: typeof(PrototypeIdListSerializer<MaterialPrototype>))]
|
||||
public List<string> MaterialWhiteList = new();
|
||||
|
||||
/// <summary>
|
||||
/// The lathe's construction queue
|
||||
/// </summary>
|
||||
@@ -49,12 +32,6 @@ namespace Content.Server.Lathe.Components
|
||||
/// </summary>
|
||||
[DataField("producingSound")]
|
||||
public SoundSpecifier? ProducingSound;
|
||||
|
||||
/// <summary>
|
||||
/// The sound that plays when inserting an item into the lathe, if any
|
||||
/// </summary>
|
||||
[DataField("insertingSound")]
|
||||
public SoundSpecifier? InsertingSound;
|
||||
|
||||
/// <summmary>
|
||||
/// The lathe's UI.
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
using Content.Shared.Lathe;
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
||||
using Content.Shared.Materials;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Server.Lathe.Components
|
||||
{
|
||||
@@ -17,6 +21,26 @@ namespace Content.Server.Lathe.Components
|
||||
[DataField("StorageLimit")]
|
||||
private int _storageLimit = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Whitelist for specifying the kind of items that can be insert into this entity.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("whitelist")]
|
||||
public EntityWhitelist? EntityWhitelist;
|
||||
|
||||
/// <summary>
|
||||
/// Whitelist generated on runtime for what specific materials can be inserted into this entity.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("materialWhiteList", customTypeSerializer: typeof(PrototypeIdListSerializer<MaterialPrototype>))]
|
||||
public List<string> MaterialWhiteList = new();
|
||||
|
||||
/// <summary>
|
||||
/// The sound that plays when inserting an item into the storage
|
||||
/// </summary>
|
||||
[DataField("insertingSound")]
|
||||
public SoundSpecifier? InsertingSound;
|
||||
|
||||
public override ComponentState GetComponentState()
|
||||
{
|
||||
return new MaterialStorageState(Storage);
|
||||
@@ -73,5 +97,14 @@ namespace Content.Server.Lathe.Components
|
||||
{
|
||||
return InsertMaterial(id, -amount);
|
||||
}
|
||||
|
||||
// forgive me I needed to write a crumb of e/c code to not go fucking insane i swear i will ecs this entire shitty fucking system one day
|
||||
public int GetMaterialAmount(string id)
|
||||
{
|
||||
if (!Storage.TryGetValue(id, out var amount))
|
||||
return 0;
|
||||
|
||||
return amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Content.Server.Lathe
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<LatheComponent, InteractUsingEvent>(OnInteractUsing);
|
||||
SubscribeLocalEvent<MaterialStorageComponent, InteractUsingEvent>(OnInteractUsing);
|
||||
SubscribeLocalEvent<LatheComponent, ComponentInit>(OnComponentInit);
|
||||
SubscribeLocalEvent<LatheComponent, LatheQueueRecipeMessage>(OnLatheQueueRecipeMessage);
|
||||
SubscribeLocalEvent<LatheComponent, LatheSyncRequestMessage>(OnLatheSyncRequestMessage);
|
||||
@@ -85,35 +85,34 @@ namespace Content.Server.Lathe
|
||||
if (recipes == null)
|
||||
return;
|
||||
|
||||
if (!TryComp<MaterialStorageComponent>(uid, out var storage))
|
||||
return;
|
||||
|
||||
foreach (var recipe in recipes)
|
||||
{
|
||||
foreach (var mat in recipe.RequiredMaterials)
|
||||
{
|
||||
if (!component.MaterialWhiteList.Contains(mat.Key))
|
||||
component.MaterialWhiteList.Add(mat.Key);
|
||||
if (!storage.MaterialWhiteList.Contains(mat.Key))
|
||||
storage.MaterialWhiteList.Add(mat.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When someone tries to use an item on the lathe,
|
||||
/// insert it if it's a stack and fits inside
|
||||
/// </summary>
|
||||
private void OnInteractUsing(EntityUid uid, LatheComponent component, InteractUsingEvent args)
|
||||
private void OnInteractUsing(EntityUid uid, MaterialStorageComponent component, InteractUsingEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
if (!TryComp<MaterialStorageComponent>(uid, out var storage)
|
||||
|| !TryComp<MaterialComponent>(args.Used, out var material)
|
||||
|| component.LatheWhitelist?.IsValid(args.Used) == false)
|
||||
|| storage.EntityWhitelist?.IsValid(args.Used) == false)
|
||||
return;
|
||||
|
||||
args.Handled = true;
|
||||
|
||||
var matUsed = false;
|
||||
foreach (var mat in material.Materials)
|
||||
if (component.MaterialWhiteList.Contains(mat.ID))
|
||||
if (storage.MaterialWhiteList.Contains(mat.ID))
|
||||
matUsed = true;
|
||||
|
||||
if (!matUsed)
|
||||
@@ -148,16 +147,25 @@ namespace Content.Server.Lathe
|
||||
lastMat = mat;
|
||||
}
|
||||
|
||||
EntityManager.QueueDeleteEntity(args.Used);
|
||||
|
||||
// Play a sound when inserting, if any
|
||||
if (component.InsertingSound != null)
|
||||
_audioSys.PlayPvs(component.InsertingSound, uid);
|
||||
|
||||
_popupSystem.PopupEntity(Loc.GetString("machine-insert-item", ("machine", uid),
|
||||
("item", args.Used)), uid, Filter.Entities(args.User));
|
||||
|
||||
// TODO: You can probably split this part off of lathe component too
|
||||
if (!TryComp<LatheComponent>(uid, out var lathe))
|
||||
return;
|
||||
|
||||
// We need the prototype to get the color
|
||||
_prototypeManager.TryIndex(lastMat, out MaterialPrototype? matProto);
|
||||
|
||||
EntityManager.QueueDeleteEntity(args.Used);
|
||||
|
||||
EnsureComp<LatheInsertingComponent>(uid).TimeRemaining = component.InsertionTime;
|
||||
EnsureComp<LatheInsertingComponent>(uid).TimeRemaining = lathe.InsertionTime;
|
||||
|
||||
_popupSystem.PopupEntity(Loc.GetString("machine-insert-item", ("machine", uid),
|
||||
("item", args.Used)), uid, Filter.Entities(args.User));
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Content.Server.Medical.BiomassReclaimer
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed class ActiveBiomassReclaimerComponent : Component
|
||||
{}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using Content.Shared.Storage;
|
||||
using System.Threading;
|
||||
|
||||
namespace Content.Server.Medical.BiomassReclaimer
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed class BiomassReclaimerComponent : Component
|
||||
{
|
||||
public CancellationTokenSource? CancelToken;
|
||||
|
||||
[DataField("accumulator")]
|
||||
public float Accumulator = 0f;
|
||||
|
||||
[DataField("randomMessAccumulator")]
|
||||
public float RandomMessAccumulator = 0f;
|
||||
public TimeSpan RandomMessInterval = TimeSpan.FromSeconds(5);
|
||||
|
||||
/// <summary>
|
||||
/// This gets set for each mob it processes.
|
||||
/// When accumulator hits this, spit out biomass.
|
||||
/// </summary>
|
||||
public float CurrentProcessingTime = 70f;
|
||||
|
||||
/// <summary>
|
||||
/// This is calculated from the YieldPerUnitMass
|
||||
/// and adjusted for genetic damage too.
|
||||
/// </summary>
|
||||
public float CurrentExpectedYield = 28f;
|
||||
|
||||
public string BloodReagent = "Blood";
|
||||
|
||||
public List<EntitySpawnEntry> SpawnedEntities = new();
|
||||
|
||||
/// <summary>
|
||||
/// How many units of biomass it produces for each unit of mass.
|
||||
/// </summary>
|
||||
[DataField("yieldPerUnitMass")]
|
||||
public float YieldPerUnitMass = 0.4f;
|
||||
|
||||
/// <summary>
|
||||
/// Lower number = faster processing.
|
||||
/// Good for machine upgrading I guess.
|
||||
/// </summmary>
|
||||
public float ProcessingSpeedMultiplier = 0.5f;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Will this refuse to gib a living mob?
|
||||
/// </summary>
|
||||
[DataField("safetyEnabled")]
|
||||
public bool SafetyEnabled = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
using System.Threading;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Jittering;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Throwing;
|
||||
using Content.Shared.Construction.Components;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.CharacterAppearance.Components;
|
||||
using Content.Server.MobState;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Fluids.EntitySystems;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Climbing;
|
||||
using Content.Server.DoAfter;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Stack;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Server.Player;
|
||||
|
||||
namespace Content.Server.Medical.BiomassReclaimer
|
||||
{
|
||||
public sealed class BiomassReclaimerSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
||||
[Dependency] private readonly StackSystem _stackSystem = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||
[Dependency] private readonly SharedJitteringSystem _jitteringSystem = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _sharedAudioSystem = default!;
|
||||
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
|
||||
[Dependency] private readonly SpillableSystem _spillableSystem = default!;
|
||||
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
foreach (var (_, reclaimer) in EntityQuery<ActiveBiomassReclaimerComponent, BiomassReclaimerComponent>())
|
||||
{
|
||||
reclaimer.Accumulator += frameTime;
|
||||
reclaimer.RandomMessAccumulator += frameTime;
|
||||
|
||||
if (reclaimer.RandomMessAccumulator >= reclaimer.RandomMessInterval.TotalSeconds)
|
||||
{
|
||||
if (_robustRandom.Prob(0.3f))
|
||||
{
|
||||
if (_robustRandom.Prob(0.7f))
|
||||
{
|
||||
Solution blood = new();
|
||||
blood.AddReagent(reclaimer.BloodReagent, 50);
|
||||
_spillableSystem.SpillAt(reclaimer.Owner, blood, "PuddleBlood");
|
||||
}
|
||||
if (_robustRandom.Prob(0.1f) && reclaimer.SpawnedEntities.Count > 0)
|
||||
{
|
||||
var thrown = Spawn(_robustRandom.Pick(reclaimer.SpawnedEntities).PrototypeId, Transform(reclaimer.Owner).Coordinates);
|
||||
Vector2 direction = (_robustRandom.Next(-30, 30), _robustRandom.Next(-30, 30));
|
||||
_throwing.TryThrow(thrown, direction, _robustRandom.Next(1, 10));
|
||||
}
|
||||
}
|
||||
reclaimer.RandomMessAccumulator -= (float) reclaimer.RandomMessInterval.TotalSeconds;
|
||||
}
|
||||
|
||||
if (reclaimer.Accumulator < reclaimer.CurrentProcessingTime)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
reclaimer.Accumulator = 0;
|
||||
|
||||
_stackSystem.SpawnMultiple((int) reclaimer.CurrentExpectedYield, 100, "Biomass", Transform(reclaimer.Owner).Coordinates);
|
||||
|
||||
reclaimer.SpawnedEntities.Clear();
|
||||
RemCompDeferred<ActiveBiomassReclaimerComponent>(reclaimer.Owner);
|
||||
}
|
||||
}
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<ActiveBiomassReclaimerComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<ActiveBiomassReclaimerComponent, ComponentShutdown>(OnShutdown);
|
||||
SubscribeLocalEvent<ActiveBiomassReclaimerComponent, UnanchorAttemptEvent>(OnUnanchorAttempt);
|
||||
SubscribeLocalEvent<BiomassReclaimerComponent, AfterInteractUsingEvent>(OnAfterInteractUsing);
|
||||
SubscribeLocalEvent<BiomassReclaimerComponent, ClimbedOnEvent>(OnClimbedOn);
|
||||
SubscribeLocalEvent<ReclaimSuccessfulEvent>(OnReclaimSuccessful);
|
||||
SubscribeLocalEvent<ReclaimCancelledEvent>(OnReclaimCancelled);
|
||||
}
|
||||
|
||||
private void OnInit(EntityUid uid, ActiveBiomassReclaimerComponent component, ComponentInit args)
|
||||
{
|
||||
_jitteringSystem.AddJitter(uid, -10, 100);
|
||||
_sharedAudioSystem.Play("/Audio/Machines/reclaimer_startup.ogg", Filter.Pvs(uid), uid);
|
||||
_ambientSoundSystem.SetAmbience(uid, true);
|
||||
}
|
||||
|
||||
private void OnShutdown(EntityUid uid, ActiveBiomassReclaimerComponent component, ComponentShutdown args)
|
||||
{
|
||||
RemComp<JitteringComponent>(uid);
|
||||
_ambientSoundSystem.SetAmbience(uid, false);
|
||||
}
|
||||
|
||||
private void OnUnanchorAttempt(EntityUid uid, ActiveBiomassReclaimerComponent component, UnanchorAttemptEvent args)
|
||||
{
|
||||
args.Cancel();
|
||||
}
|
||||
private void OnAfterInteractUsing(EntityUid uid, BiomassReclaimerComponent component, AfterInteractUsingEvent args)
|
||||
{
|
||||
if (!args.CanReach)
|
||||
return;
|
||||
|
||||
if (component.CancelToken != null || args.Target == null)
|
||||
return;
|
||||
|
||||
if (HasComp<MobStateComponent>(args.Used) && CanGib(uid, args.Used, component))
|
||||
{
|
||||
component.CancelToken = new CancellationTokenSource();
|
||||
_doAfterSystem.DoAfter(new DoAfterEventArgs(args.User, 7f, component.CancelToken.Token, target: args.Target)
|
||||
{
|
||||
BroadcastFinishedEvent = new ReclaimSuccessfulEvent(args.User, args.Used, uid),
|
||||
BroadcastCancelledEvent = new ReclaimCancelledEvent(uid),
|
||||
BreakOnTargetMove = true,
|
||||
BreakOnUserMove = true,
|
||||
BreakOnStun = true,
|
||||
NeedHand = true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClimbedOn(EntityUid uid, BiomassReclaimerComponent component, ClimbedOnEvent args)
|
||||
{
|
||||
if (!CanGib(uid, args.Climber, component))
|
||||
{
|
||||
Vector2 direction = (_robustRandom.Next(-2, 2), _robustRandom.Next(-2, 2));
|
||||
_throwing.TryThrow(args.Climber, direction, 0.5f);
|
||||
return;
|
||||
}
|
||||
_adminLogger.Add(LogType.Action, LogImpact.Extreme, $"{ToPrettyString(args.Instigator):player} used a biomass reclaimer to gib {ToPrettyString(args.Climber):target} in {ToPrettyString(uid):reclaimer}");
|
||||
|
||||
StartProcessing(args.Climber, component);
|
||||
}
|
||||
|
||||
private void OnReclaimSuccessful(ReclaimSuccessfulEvent args)
|
||||
{
|
||||
if (!TryComp<BiomassReclaimerComponent>(args.Reclaimer, out var reclaimer))
|
||||
return;
|
||||
|
||||
_adminLogger.Add(LogType.Action, LogImpact.Extreme, $"{ToPrettyString(args.User):player} used a biomass reclaimer to gib {ToPrettyString(args.Target):target} in {ToPrettyString(args.Reclaimer):reclaimer}");
|
||||
reclaimer.CancelToken = null;
|
||||
StartProcessing(args.Target, reclaimer);
|
||||
}
|
||||
|
||||
private void OnReclaimCancelled(ReclaimCancelledEvent args)
|
||||
{
|
||||
if (!TryComp<BiomassReclaimerComponent>(args.Reclaimer, out var reclaimer))
|
||||
return;
|
||||
reclaimer.CancelToken = null;
|
||||
}
|
||||
private void StartProcessing(EntityUid toProcess, BiomassReclaimerComponent component)
|
||||
{
|
||||
AddComp<ActiveBiomassReclaimerComponent>(component.Owner);
|
||||
|
||||
if (TryComp<BloodstreamComponent>(toProcess, out var stream))
|
||||
{
|
||||
component.BloodReagent = stream.BloodReagent;
|
||||
}
|
||||
if (TryComp<SharedButcherableComponent>(toProcess, out var butcherableComponent))
|
||||
{
|
||||
component.SpawnedEntities = butcherableComponent.SpawnedEntities;
|
||||
}
|
||||
|
||||
component.CurrentExpectedYield = CalculateYield(toProcess, component);
|
||||
component.CurrentProcessingTime = component.CurrentExpectedYield / component.YieldPerUnitMass * component.ProcessingSpeedMultiplier;
|
||||
EntityManager.QueueDeleteEntity(toProcess);
|
||||
}
|
||||
private float CalculateYield(EntityUid uid, BiomassReclaimerComponent component)
|
||||
{
|
||||
if (!TryComp<PhysicsComponent>(uid, out var physics))
|
||||
{
|
||||
Logger.Error("Somehow tried to extract biomass from " + uid + ", which has no physics component.");
|
||||
return 0f;
|
||||
}
|
||||
|
||||
return (physics.FixturesMass * component.YieldPerUnitMass);
|
||||
}
|
||||
|
||||
private bool CanGib(EntityUid uid, EntityUid dragged, BiomassReclaimerComponent component)
|
||||
{
|
||||
if (HasComp<ActiveBiomassReclaimerComponent>(uid))
|
||||
return false;
|
||||
|
||||
if (!HasComp<MobStateComponent>(dragged))
|
||||
return false;
|
||||
|
||||
if (!Transform(uid).Anchored)
|
||||
return false;
|
||||
|
||||
if (TryComp<ApcPowerReceiverComponent>(uid, out var power) && !power.Powered)
|
||||
return false;
|
||||
|
||||
if (component.SafetyEnabled && !_mobState.IsDead(dragged))
|
||||
return false;
|
||||
|
||||
// Reject souled bodies in easy mode.
|
||||
if (_configManager.GetCVar(CCVars.BiomassEasyMode) && HasComp<HumanoidAppearanceComponent>(dragged) &&
|
||||
TryComp<MindComponent>(dragged, out var mindComp))
|
||||
{
|
||||
if (mindComp.Mind?.UserId != null && _playerManager.TryGetSessionById(mindComp.Mind.UserId.Value, out var client))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private sealed class ReclaimCancelledEvent : EntityEventArgs
|
||||
{
|
||||
public EntityUid Reclaimer;
|
||||
|
||||
public ReclaimCancelledEvent(EntityUid reclaimer)
|
||||
{
|
||||
Reclaimer = reclaimer;
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class ReclaimSuccessfulEvent : EntityEventArgs
|
||||
{
|
||||
public EntityUid User;
|
||||
public EntityUid Target;
|
||||
public EntityUid Reclaimer;
|
||||
public ReclaimSuccessfulEvent(EntityUid user, EntityUid target, EntityUid reclaimer)
|
||||
{
|
||||
User = user;
|
||||
Target = target;
|
||||
Reclaimer = reclaimer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ namespace Content.Server.Medical
|
||||
private void OnComponentInit(EntityUid uid, MedicalScannerComponent scannerComponent, ComponentInit args)
|
||||
{
|
||||
base.Initialize();
|
||||
scannerComponent.BodyContainer = _containerSystem.EnsureContainer<ContainerSlot>(uid, $"{scannerComponent.Name}-bodyContainer");
|
||||
scannerComponent.BodyContainer = _containerSystem.EnsureContainer<ContainerSlot>(uid, $"scanner-bodyContainer");
|
||||
_signalSystem.EnsureReceiverPorts(uid, MedicalScannerComponent.ScannerPort);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
using Content.Shared.Damage;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.MobState;
|
||||
|
||||
namespace Content.Server.Salvage;
|
||||
|
||||
public sealed class SalvageMobRestrictionsSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -49,6 +51,7 @@ public sealed class SalvageMobRestrictionsSystem : EntitySystem
|
||||
foreach (var target in component.MobsToKill)
|
||||
{
|
||||
if (Deleted(target, metaQuery)) continue;
|
||||
if (_mobStateSystem.IsDead(target)) continue; // DONT WASTE BIOMASS
|
||||
if (bodyQuery.TryGetComponent(target, out var body))
|
||||
{
|
||||
// Just because.
|
||||
|
||||
@@ -83,6 +83,44 @@ namespace Content.Server.Stack
|
||||
return entity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Say you want to spawn 97 stacks of something that has a max stack count of 30.
|
||||
/// This would spawn 3 stacks of 30 and 1 stack of 7.
|
||||
/// </summary>
|
||||
public void SpawnMultiple(int amount, int maxCountPerStack, StackPrototype prototype, EntityCoordinates spawnPosition)
|
||||
{
|
||||
while (amount > 0)
|
||||
{
|
||||
if (amount > maxCountPerStack)
|
||||
{
|
||||
var entity = Spawn("MaterialBiomass", spawnPosition);
|
||||
var stack = Comp<StackComponent>(entity);
|
||||
|
||||
SetCount(entity, maxCountPerStack, stack);
|
||||
amount -= maxCountPerStack;
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = Spawn("MaterialBiomass", spawnPosition);
|
||||
var stack = Comp<StackComponent>(entity);
|
||||
|
||||
SetCount(entity, amount, stack);
|
||||
amount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SpawnMultiple(int amount, int maxCountPerStack, string prototype, EntityCoordinates spawnPosition)
|
||||
{
|
||||
if (!_prototypeManager.TryIndex<StackPrototype>(prototype, out var stackType))
|
||||
{
|
||||
Logger.Error("Failed to index stack prototype " + prototype);
|
||||
return;
|
||||
}
|
||||
|
||||
SpawnMultiple(amount, maxCountPerStack, stackType, spawnPosition);
|
||||
}
|
||||
|
||||
private void OnStackAlternativeInteract(EntityUid uid, StackComponent stack, GetVerbsEvent<AlternativeVerb> args)
|
||||
{
|
||||
if (!args.CanAccess || !args.CanInteract || args.Hands == null)
|
||||
|
||||
@@ -1002,6 +1002,17 @@ namespace Content.Shared.CCVar
|
||||
CVarDef.Create("crewmanifest.ordering", "Command,Security,Science,Medical,Engineering,Cargo,Civilian,Unknown",
|
||||
CVar.REPLICATED);
|
||||
|
||||
/*
|
||||
* Biomass
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// Enabled: Cloning has 70% cost and reclaimer will refuse to reclaim corpses with souls. (For LRP).
|
||||
/// Disabled: Cloning has full biomass cost and reclaimer can reclaim corpses with souls. (Playtested and balanced for MRP+).
|
||||
/// </summary>
|
||||
public static readonly CVarDef<bool> BiomassEasyMode =
|
||||
CVarDef.Create("biomass.easy_mode", true, CVar.SERVERONLY);
|
||||
|
||||
/*
|
||||
* VIEWPORT
|
||||
*/
|
||||
|
||||
@@ -73,5 +73,16 @@ namespace Content.Shared.Jittering
|
||||
jittering.Frequency = frequency;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For non mobs.
|
||||
/// </summary>
|
||||
public void AddJitter(EntityUid uid, float amplitude = 10f, float frequency = 4f)
|
||||
{
|
||||
var jitter = EnsureComp<JitteringComponent>(uid);
|
||||
jitter.Amplitude = amplitude;
|
||||
jitter.Frequency = frequency;
|
||||
jitter.Dirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,3 +7,4 @@ server_fans - https://freesound.org/people/DeVern/sounds/610761/ - CC-BY-3.0
|
||||
drain.ogg - https://freesound.org/people/PhreaKsAccount/sounds/46266/ - CC-BY-3.0 (by PhreaKsAccount)
|
||||
portable_scrubber.ogg - https://freesound.org/people/Beethovenboy/sounds/384335/ - CC0 (by Beethovenboy)
|
||||
alarm.ogg - https://github.com/Baystation12/Baystation12/commit/41b11ef289bccfdfa2940480beb9c1e3f50c3b93, fire_alarm.ogg CC-BY-SA-3.0
|
||||
reclaimer_ambience.ogg - https://freesound.org/people/cmorris035/sounds/319152/, Woodchipper Start (heavy machine) 02.wav CC0 (by cmorris035)
|
||||
|
||||
BIN
Resources/Audio/Ambience/Objects/reclaimer_ambience.ogg
Normal file
BIN
Resources/Audio/Ambience/Objects/reclaimer_ambience.ogg
Normal file
Binary file not shown.
@@ -10,4 +10,6 @@ vaccinator_running.ogg taken from https://freesound.org/people/RutgerMuller/soun
|
||||
|
||||
vending_jingle.ogg made by github.com/hubismal licensed under CC-BY-3.0
|
||||
|
||||
lightswitch.ogg taken from https://github.com/Skyrat-SS13/Skyrat-tg/blob/3f6099bbc3c2afdc609bf1991c2f06297a0f13c2/modular_skyrat/modules/aesthetics/lightswitch/sound/lightswitch.ogg under CC-BY-SA 3.0
|
||||
lightswitch.ogg taken from https://github.com/Skyrat-SS13/Skyrat-tg/blob/3f6099bbc3c2afdc609bf1991c2f06297a0f13c2/modular_skyrat/modules/aesthetics/lightswitch/sound/lightswitch.ogg under CC-BY-SA 3.0
|
||||
|
||||
reclaimer_startup.ogg - https://freesound.org/people/cmorris035/sounds/319152/, Woodchipper Start (heavy machine) 02.wav CC0 (by cmorris035)
|
||||
|
||||
BIN
Resources/Audio/Machines/reclaimer_startup.ogg
Normal file
BIN
Resources/Audio/Machines/reclaimer_startup.ogg
Normal file
Binary file not shown.
@@ -1 +1 @@
|
||||
lathe-popup-material-not-used = This material is not used in this lathe.
|
||||
lathe-popup-material-not-used = This material is not used in this machine.
|
||||
|
||||
@@ -24,3 +24,6 @@ cloning-console-component-msg-already-cloning = Not Ready: Pod Network Conflict
|
||||
cloning-console-component-msg-incomplete = Not Ready: Cloning In Progress
|
||||
cloning-console-component-msg-no-cloner = Not Ready: No Cloner Detected
|
||||
cloning-console-component-msg-no-mind = Not Ready: No Soul Activity Detected
|
||||
|
||||
cloning-console-chat-error = ERROR: INSUFFICIENT BIOMASS. CLONING THIS BODY REQUIRES {$units} UNITS OF BIOMASS.
|
||||
cloning-console-cellular-warning = WARNING: GENEFSCK CONFIDENCE SCORE IS {$percent}%. CLONING MAY HAVE UNEXPECTED RESULTS.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
cloning-pod-biomass = It currently has [color=red]{$number}[/color] units of biomass.
|
||||
@@ -132,6 +132,8 @@
|
||||
- id: DoorRemoteMedical
|
||||
- id: RubberStampCMO
|
||||
- id: MedicalTechFabCircuitboard
|
||||
- id: MaterialBiomass
|
||||
amount: 3
|
||||
|
||||
- type: entity
|
||||
id: LockerResearchDirectorFilled
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
- VaccinatorMachineCircuitboard
|
||||
- DiagnoserMachineCircuitboard
|
||||
- HandheldCrewMonitor
|
||||
- CloningConsoleComputerCircuitboard
|
||||
- BiomassReclaimerMachineCircuitboard
|
||||
|
||||
- type: technology
|
||||
name: technologies-advanced-life-support
|
||||
@@ -143,6 +143,7 @@
|
||||
- CloningPodMachineCircuitboard
|
||||
- MedicalScannerMachineCircuitboard
|
||||
- StasisBedMachineCircuitboard
|
||||
- CloningConsoleComputerCircuitboard
|
||||
|
||||
# Security Technology Tree
|
||||
|
||||
|
||||
@@ -554,15 +554,15 @@
|
||||
# categories:
|
||||
# - UplinkMisc
|
||||
|
||||
- type: listing
|
||||
id: UplinkGigacancerScanner
|
||||
name: Ultragigacancer Health Analyzer
|
||||
description: Works like a normal health analyzer, other than giving everyone it scans ultragigacancer.
|
||||
productEntity: HandheldHealthAnalyzerGigacancer
|
||||
cost:
|
||||
Telecrystal: 5
|
||||
categories:
|
||||
- UplinkMisc
|
||||
# - type: listing
|
||||
# id: UplinkGigacancerScanner
|
||||
# name: Ultragigacancer Health Analyzer
|
||||
# description: Works like a normal health analyzer, other than giving everyone it scans ultragigacancer.
|
||||
# productEntity: HandheldHealthAnalyzerGigacancer
|
||||
# cost:
|
||||
# Telecrystal: 5
|
||||
# categories:
|
||||
# - UplinkMisc
|
||||
|
||||
- type: listing
|
||||
id: UplinkNocturineChemistryBottle
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
fixtures:
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.25
|
||||
mass: 120
|
||||
radius: 0.3
|
||||
mass: 65
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -125,7 +125,7 @@
|
||||
scale: 1.2, 1.2
|
||||
layers:
|
||||
- map: ["enum.DamageStateVisualLayers.Base"]
|
||||
state: regalrat
|
||||
state: regalrat
|
||||
- type: MobState
|
||||
thresholds:
|
||||
0: Alive
|
||||
@@ -138,6 +138,16 @@
|
||||
damage:
|
||||
types:
|
||||
Blunt: 50 #oof ouch owie my bones
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.35
|
||||
mass: 150
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
- MobLayer
|
||||
- type: SlowOnDamage
|
||||
speedModifierThresholds:
|
||||
200: 0.7
|
||||
|
||||
@@ -259,6 +259,31 @@
|
||||
materialRequirements:
|
||||
Glass: 1
|
||||
|
||||
- type: entity
|
||||
id: BiomassReclaimerMachineCircuitboard
|
||||
parent: BaseMachineCircuitboard
|
||||
name: biomass reclaimer machine board
|
||||
description: A machine printed circuit board for a biomass reclaimer
|
||||
components:
|
||||
- type: MachineBoard
|
||||
prototype: BiomassReclaimer
|
||||
requirements:
|
||||
Laser: 1
|
||||
Manipulator: 1
|
||||
tagRequirements:
|
||||
Pipe:
|
||||
Amount: 1
|
||||
DefaultPrototype: GasPipeStraight
|
||||
ExamineName: pipe
|
||||
BorgArm:
|
||||
Amount: 3
|
||||
DefaultPrototype: LeftArmBorg
|
||||
ExamineName: borg arm
|
||||
Knife:
|
||||
Amount: 3
|
||||
DefaultPrototype: KitchenKnife
|
||||
ExamineName: knife
|
||||
|
||||
- type: entity
|
||||
id: HydroponicsTrayMachineCircuitboard
|
||||
parent: BaseMachineCircuitboard
|
||||
|
||||
@@ -119,6 +119,32 @@
|
||||
- type: Stack
|
||||
count: 1
|
||||
|
||||
- type: entity
|
||||
parent: MaterialBase
|
||||
id: MaterialBiomass
|
||||
name: biomass
|
||||
suffix: Full
|
||||
components:
|
||||
- type: Material
|
||||
materials:
|
||||
Biomass: 1
|
||||
- type: Stack
|
||||
stackType: Biomass
|
||||
count: 100
|
||||
max: 100
|
||||
- type: Sprite
|
||||
sprite: /Textures/Objects/Misc/monkeycube.rsi
|
||||
state: cube
|
||||
color: "#8A9A5B"
|
||||
|
||||
- type: entity
|
||||
parent: MaterialBiomass
|
||||
id: MaterialBiomass1
|
||||
suffix: Single
|
||||
components:
|
||||
- type: Stack
|
||||
count: 1
|
||||
|
||||
# Following not used currently
|
||||
- type: entity
|
||||
parent: MaterialBase
|
||||
|
||||
@@ -616,6 +616,8 @@
|
||||
interfaces:
|
||||
- key: enum.CloningConsoleUiKey.Key
|
||||
type: CloningConsoleBoundUserInterface
|
||||
- type: Speech
|
||||
speechSounds: Pai
|
||||
|
||||
- type: entity
|
||||
parent: BaseComputer
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
- type: entity
|
||||
id: BiomassReclaimer
|
||||
parent: [ BaseMachinePowered, ConstructibleMachine ]
|
||||
name: biomass reclaimer
|
||||
description: Reclaims biomass from corpses. Gruesome.
|
||||
placement:
|
||||
mode: SnapgridCenter
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Structures/Machines/Medical/biomass_reclaimer.rsi
|
||||
state: icon
|
||||
netsync: false
|
||||
- type: BiomassReclaimer
|
||||
- type: Climbable
|
||||
delay: 7
|
||||
- type: AmbientSound
|
||||
enabled: false
|
||||
volume: -5
|
||||
range: 5
|
||||
sound:
|
||||
path: /Audio/Ambience/Objects/reclaimer_ambience.ogg
|
||||
- type: Machine
|
||||
board: BiomassReclaimerMachineCircuitboard
|
||||
@@ -1,6 +1,6 @@
|
||||
- type: entity
|
||||
id: CloningPod
|
||||
parent: [ BaseMachinePowered, ConstructibleMachine ]
|
||||
parent: BaseMachinePowered
|
||||
name: cloning pod
|
||||
description: A Cloning Pod. 50% reliable.
|
||||
components:
|
||||
@@ -26,6 +26,12 @@
|
||||
- MachineMask
|
||||
layer:
|
||||
- MachineLayer
|
||||
- type: Construction
|
||||
graph: Machine
|
||||
node: machine
|
||||
- type: EmptyOnMachineDeconstruct
|
||||
containers:
|
||||
- clonepod-bodyContainer
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
- trigger:
|
||||
@@ -39,6 +45,8 @@
|
||||
- type: Machine
|
||||
board: CloningPodMachineCircuitboard
|
||||
- type: MaterialStorage
|
||||
materialWhiteList:
|
||||
- Biomass
|
||||
- type: Wires
|
||||
BoardName: "CloningPod"
|
||||
LayoutId: CloningPod
|
||||
|
||||
@@ -48,6 +48,11 @@
|
||||
- type: Machine
|
||||
board: AutolatheMachineCircuitboard
|
||||
- type: MaterialStorage
|
||||
whitelist:
|
||||
tags:
|
||||
- Sheet
|
||||
- RawMaterial
|
||||
- Ingot
|
||||
- type: Wires
|
||||
BoardName: "Autolathe"
|
||||
LayoutId: Autolathe
|
||||
@@ -77,11 +82,6 @@
|
||||
anchored: true
|
||||
- type: Pullable
|
||||
- type: Lathe
|
||||
whitelist:
|
||||
tags:
|
||||
- Sheet
|
||||
- RawMaterial
|
||||
- Ingot
|
||||
|
||||
- type: entity
|
||||
parent: [ BaseMachinePowered, ConstructibleMachine ]
|
||||
@@ -138,6 +138,11 @@
|
||||
LayoutId: Protolathe
|
||||
- type: TechnologyDatabase
|
||||
- type: MaterialStorage
|
||||
whitelist:
|
||||
tags:
|
||||
- Sheet
|
||||
- RawMaterial
|
||||
- Ingot
|
||||
- type: ProtolatheDatabase
|
||||
protolatherecipes:
|
||||
- LightTube
|
||||
@@ -212,11 +217,6 @@
|
||||
anchored: true
|
||||
- type: Pullable
|
||||
- type: Lathe
|
||||
whitelist:
|
||||
tags:
|
||||
- Sheet
|
||||
- RawMaterial
|
||||
- Ingot
|
||||
|
||||
- type: entity
|
||||
parent: Protolathe
|
||||
@@ -248,6 +248,7 @@
|
||||
- DiagnoserMachineCircuitboard
|
||||
- ChemMasterMachineCircuitboard
|
||||
- ChemDispenserMachineCircuitboard
|
||||
- BiomassReclaimerMachineCircuitboard
|
||||
- SurveillanceCameraRouterCircuitboard
|
||||
- SurveillanceCameraMonitorCircuitboard
|
||||
- SurveillanceWirelessCameraMonitorCircuitboard
|
||||
@@ -278,6 +279,7 @@
|
||||
board: CircuitImprinterMachineCircuitboard
|
||||
- type: Lathe
|
||||
producingSound: /Audio/Machines/circuitprinter.ogg
|
||||
- type: MaterialStorage
|
||||
whitelist:
|
||||
tags:
|
||||
- Sheet
|
||||
@@ -329,6 +331,7 @@
|
||||
- type: Machine
|
||||
board: SecurityTechFabCircuitboard
|
||||
- type: Lathe
|
||||
- type: MaterialStorage
|
||||
whitelist:
|
||||
tags:
|
||||
- Sheet
|
||||
@@ -468,10 +471,12 @@
|
||||
board: UniformPrinterMachineCircuitboard
|
||||
- type: Lathe
|
||||
producingSound: /Audio/Machines/uniformprinter.ogg
|
||||
- type: MaterialStorage
|
||||
whitelist:
|
||||
tags:
|
||||
- Sheet
|
||||
- RawMaterial
|
||||
- Ingot
|
||||
|
||||
- type: entity
|
||||
parent: Autolathe
|
||||
@@ -508,7 +513,8 @@
|
||||
- SheetUranium1
|
||||
- IngotGold1
|
||||
- IngotSilver1
|
||||
- type: Lathe
|
||||
- type: MaterialStorage
|
||||
whitelist:
|
||||
tags:
|
||||
- Ore
|
||||
- type: Lathe
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
- type: entity
|
||||
id: MedicalScanner
|
||||
parent: [ BaseMachinePowered, ConstructibleMachine ]
|
||||
parent: BaseMachinePowered
|
||||
name: medical scanner
|
||||
description: A bulky medical scanner.
|
||||
components:
|
||||
@@ -29,6 +29,9 @@
|
||||
- MachineMask
|
||||
layer:
|
||||
- MachineLayer
|
||||
- type: Construction
|
||||
graph: Machine
|
||||
node: machine
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
- trigger:
|
||||
@@ -51,3 +54,6 @@
|
||||
- type: Climbable
|
||||
- type: ApcPowerReceiver
|
||||
powerLoad: 200 #Receives most of its power from the console
|
||||
- type: EmptyOnMachineDeconstruct
|
||||
containers:
|
||||
- scanner-bodyContainer
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
- type: material
|
||||
id: Biomass
|
||||
stack: Biomass
|
||||
name: biomass
|
||||
icon: /Textures/Objects/Misc/monkeycube.rsi/cube.png
|
||||
color: "#8A9A5B"
|
||||
price: 0.05
|
||||
|
||||
- type: material
|
||||
id: Cloth
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
- to: start
|
||||
steps:
|
||||
- tool: Welding
|
||||
doAfter: 5
|
||||
doAfter: 5
|
||||
completed:
|
||||
- !type:SpawnPrototype
|
||||
prototype: SheetSteel1
|
||||
|
||||
@@ -101,6 +101,16 @@
|
||||
Glass: 900
|
||||
Gold: 100
|
||||
|
||||
- type: latheRecipe
|
||||
id: BiomassReclaimerMachineCircuitboard
|
||||
icon: Objects/Misc/module.rsi/id_mod.png
|
||||
result: BiomassReclaimerMachineCircuitboard
|
||||
completetime: 4
|
||||
materials:
|
||||
Steel: 100
|
||||
Glass: 900
|
||||
Gold: 100
|
||||
|
||||
- type: latheRecipe
|
||||
id: HydroponicsTrayMachineCircuitboard
|
||||
icon: Objects/Misc/module.rsi/id_mod.png
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
- type: stack
|
||||
id: Biomass
|
||||
name: biomass
|
||||
icon: /Textures/Objects/Misc/monkeycube.rsi/cube.png
|
||||
spawn: MaterialBiomass1
|
||||
|
||||
- type: stack
|
||||
id: WoodPlank
|
||||
name: wood plank
|
||||
@@ -21,7 +27,7 @@
|
||||
name: diamond
|
||||
icon: /Textures/Objects/Materials/materials.rsi/diamond.png
|
||||
spawn: MaterialDiamond1
|
||||
|
||||
|
||||
- type: stack
|
||||
id: Cotton
|
||||
name: cotton
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"version": 1,
|
||||
"license": "CC-BY-SA-3.0",
|
||||
"copyright": "Created by Discord user Hyenh#6078",
|
||||
"size": {
|
||||
"x": 32,
|
||||
"y": 32
|
||||
},
|
||||
"states": [
|
||||
{
|
||||
"name": "icon"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user