27
Content.Client/Materials/RecyclerVisualizerSystem.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using Content.Shared.Conveyor;
|
||||||
|
using Content.Shared.Materials;
|
||||||
|
using Robust.Client.GameObjects;
|
||||||
|
|
||||||
|
namespace Content.Client.Materials;
|
||||||
|
|
||||||
|
public sealed class RecyclerVisualizerSystem : VisualizerSystem<RecyclerVisualsComponent>
|
||||||
|
{
|
||||||
|
protected override void OnAppearanceChange(EntityUid uid, RecyclerVisualsComponent component, ref AppearanceChangeEvent args)
|
||||||
|
{
|
||||||
|
if (args.Sprite == null || !args.Sprite.LayerMapTryGet(RecyclerVisualLayers.Main, out var layer))
|
||||||
|
return;
|
||||||
|
|
||||||
|
AppearanceSystem.TryGetData<ConveyorState>(uid, ConveyorVisuals.State, out var running);
|
||||||
|
AppearanceSystem.TryGetData<bool>(uid, RecyclerVisuals.Bloody, out var bloody);
|
||||||
|
AppearanceSystem.TryGetData<bool>(uid, RecyclerVisuals.Broken, out var broken);
|
||||||
|
|
||||||
|
var activityState = running == ConveyorState.Off ? 0 : 1;
|
||||||
|
if (broken) //breakage overrides activity
|
||||||
|
activityState = 2;
|
||||||
|
|
||||||
|
var bloodyKey = bloody ? component.BloodyKey : string.Empty;
|
||||||
|
|
||||||
|
var state = $"{component.BaseKey}{activityState}{bloodyKey}";
|
||||||
|
args.Sprite.LayerSetState(layer, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
17
Content.Client/Materials/RecyclerVisualsComponent.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
namespace Content.Client.Materials;
|
||||||
|
|
||||||
|
[RegisterComponent]
|
||||||
|
public sealed partial class RecyclerVisualsComponent : Component
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Key appended to state string if bloody.
|
||||||
|
/// </summary>
|
||||||
|
[DataField]
|
||||||
|
public string BloodyKey = "bld";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Base key for the visual state.
|
||||||
|
/// </summary>
|
||||||
|
[DataField]
|
||||||
|
public string BaseKey = "grinder-o";
|
||||||
|
}
|
||||||
@@ -20,19 +20,24 @@ using Robust.Shared.Player;
|
|||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Administration.Logs;
|
using Content.Server.Administration.Logs;
|
||||||
|
using Content.Server.Repairable;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
|
using Content.Shared.Destructible;
|
||||||
|
using Content.Shared.Emag.Components;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Server.Materials;
|
namespace Content.Server.Materials;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
|
public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||||
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
||||||
[Dependency] private readonly GameTicker _ticker = default!;
|
[Dependency] private readonly GameTicker _ticker = default!;
|
||||||
[Dependency] private readonly MaterialStorageSystem _materialStorage = default!;
|
[Dependency] private readonly MaterialStorageSystem _materialStorage = default!;
|
||||||
[Dependency] private readonly OpenableSystem _openable = default!;
|
[Dependency] private readonly OpenableSystem _openable = default!;
|
||||||
[Dependency] private readonly PopupSystem _popup = default!;
|
[Dependency] private readonly PopupSystem _popup = default!;
|
||||||
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
|
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;
|
||||||
[Dependency] private readonly SharedBodySystem _body = default!; //bobby
|
[Dependency] private readonly SharedBodySystem _body = default!; //bobby
|
||||||
[Dependency] private readonly PuddleSystem _puddle = default!;
|
[Dependency] private readonly PuddleSystem _puddle = default!;
|
||||||
[Dependency] private readonly StackSystem _stack = default!;
|
[Dependency] private readonly StackSystem _stack = default!;
|
||||||
@@ -44,16 +49,14 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<MaterialReclaimerComponent, ComponentStartup>(OnStartup);
|
|
||||||
SubscribeLocalEvent<MaterialReclaimerComponent, PowerChangedEvent>(OnPowerChanged);
|
SubscribeLocalEvent<MaterialReclaimerComponent, PowerChangedEvent>(OnPowerChanged);
|
||||||
SubscribeLocalEvent<MaterialReclaimerComponent, InteractUsingEvent>(OnInteractUsing,
|
SubscribeLocalEvent<MaterialReclaimerComponent, InteractUsingEvent>(OnInteractUsing,
|
||||||
before: new []{typeof(WiresSystem), typeof(SolutionTransferSystem)});
|
before: [typeof(WiresSystem), typeof(SolutionTransferSystem)]);
|
||||||
SubscribeLocalEvent<MaterialReclaimerComponent, SuicideByEnvironmentEvent>(OnSuicideByEnvironment);
|
SubscribeLocalEvent<MaterialReclaimerComponent, SuicideByEnvironmentEvent>(OnSuicideByEnvironment);
|
||||||
SubscribeLocalEvent<ActiveMaterialReclaimerComponent, PowerChangedEvent>(OnActivePowerChanged);
|
SubscribeLocalEvent<ActiveMaterialReclaimerComponent, PowerChangedEvent>(OnActivePowerChanged);
|
||||||
}
|
|
||||||
private void OnStartup(Entity<MaterialReclaimerComponent> entity, ref ComponentStartup args)
|
SubscribeLocalEvent<MaterialReclaimerComponent, BreakageEventArgs>(OnBreakage);
|
||||||
{
|
SubscribeLocalEvent<MaterialReclaimerComponent, RepairedEvent>(OnRepaired);
|
||||||
_solutionContainer.EnsureSolution(entity.Owner, entity.Comp.SolutionContainerId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPowerChanged(Entity<MaterialReclaimerComponent> entity, ref PowerChangedEvent args)
|
private void OnPowerChanged(Entity<MaterialReclaimerComponent> entity, ref PowerChangedEvent args)
|
||||||
@@ -119,6 +122,30 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
|
|||||||
TryFinishProcessItem(entity, null, entity.Comp);
|
TryFinishProcessItem(entity, null, entity.Comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnBreakage(Entity<MaterialReclaimerComponent> ent, ref BreakageEventArgs args)
|
||||||
|
{
|
||||||
|
//un-emags itself when it breaks
|
||||||
|
RemComp<EmaggedComponent>(ent);
|
||||||
|
SetBroken(ent, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnRepaired(Entity<MaterialReclaimerComponent> ent, ref RepairedEvent args)
|
||||||
|
{
|
||||||
|
SetBroken(ent, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetBroken(Entity<MaterialReclaimerComponent> ent, bool val)
|
||||||
|
{
|
||||||
|
if (ent.Comp.Broken == val)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_appearance.SetData(ent, RecyclerVisuals.Broken, val);
|
||||||
|
SetReclaimerEnabled(ent, false);
|
||||||
|
|
||||||
|
ent.Comp.Broken = val;
|
||||||
|
Dirty(ent);
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override bool TryFinishProcessItem(EntityUid uid, MaterialReclaimerComponent? component = null, ActiveMaterialReclaimerComponent? active = null)
|
public override bool TryFinishProcessItem(EntityUid uid, MaterialReclaimerComponent? component = null, ActiveMaterialReclaimerComponent? active = null)
|
||||||
{
|
{
|
||||||
@@ -136,7 +163,8 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
|
|||||||
|
|
||||||
// scales the output if the process was interrupted.
|
// scales the output if the process was interrupted.
|
||||||
var completion = 1f - Math.Clamp((float) Math.Round((active.EndTime - Timing.CurTime) / active.Duration),
|
var completion = 1f - Math.Clamp((float) Math.Round((active.EndTime - Timing.CurTime) / active.Duration),
|
||||||
0f, 1f);
|
0f,
|
||||||
|
1f);
|
||||||
Reclaim(uid, item, completion, component);
|
Reclaim(uid, item, completion, component);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -193,7 +221,8 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
|
|||||||
|
|
||||||
foreach (var (storedMaterial, storedAmount) in storage.Storage)
|
foreach (var (storedMaterial, storedAmount) in storage.Storage)
|
||||||
{
|
{
|
||||||
var stacks = _materialStorage.SpawnMultipleFromMaterial(storedAmount, storedMaterial,
|
var stacks = _materialStorage.SpawnMultipleFromMaterial(storedAmount,
|
||||||
|
storedMaterial,
|
||||||
xform.Coordinates,
|
xform.Coordinates,
|
||||||
out var materialOverflow);
|
out var materialOverflow);
|
||||||
var amountConsumed = storedAmount - materialOverflow;
|
var amountConsumed = storedAmount - materialOverflow;
|
||||||
@@ -215,8 +244,6 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
|
|||||||
{
|
{
|
||||||
if (!Resolve(reclaimer, ref reclaimerComponent, ref xform))
|
if (!Resolve(reclaimer, ref reclaimerComponent, ref xform))
|
||||||
return;
|
return;
|
||||||
if (!_solutionContainer.TryGetSolution(reclaimer, reclaimerComponent.SolutionContainerId, out var outputSolution))
|
|
||||||
return;
|
|
||||||
|
|
||||||
efficiency *= reclaimerComponent.Efficiency;
|
efficiency *= reclaimerComponent.Efficiency;
|
||||||
|
|
||||||
@@ -232,20 +259,14 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if the item we inserted has reagents, add it in.
|
// if the item we inserted has reagents, add it in.
|
||||||
if (TryComp<SolutionContainerManagerComponent>(item, out var solutionContainer))
|
if (_solutionContainer.TryGetDrainableSolution(item, out _, out var drainableSolution))
|
||||||
{
|
{
|
||||||
foreach (var (_, soln) in _solutionContainer.EnumerateSolutions((item, solutionContainer)))
|
totalChemicals.AddSolution(drainableSolution, _prototype);
|
||||||
{
|
|
||||||
var solution = soln.Comp.Solution;
|
|
||||||
foreach (var quantity in solution.Contents)
|
|
||||||
{
|
|
||||||
totalChemicals.AddReagent(quantity.Reagent.Prototype, quantity.Quantity * efficiency, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_solutionContainer.TryTransferSolution(outputSolution.Value, totalChemicals, totalChemicals.Volume);
|
if (!_solutionContainer.TryGetSolution(reclaimer, reclaimerComponent.SolutionContainerId, out var outputSolution) ||
|
||||||
if (totalChemicals.Volume > 0)
|
!_solutionContainer.TryTransferSolution(outputSolution.Value, totalChemicals, totalChemicals.Volume) ||
|
||||||
|
totalChemicals.Volume > 0)
|
||||||
{
|
{
|
||||||
_puddle.TrySpillAt(reclaimer, totalChemicals, out _, sound, transformComponent: xform);
|
_puddle.TrySpillAt(reclaimer, totalChemicals, out _, sound, transformComponent: xform);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.DeviceLinking.Systems;
|
|||||||
using Content.Server.Materials;
|
using Content.Server.Materials;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Shared.Conveyor;
|
using Content.Shared.Conveyor;
|
||||||
|
using Content.Shared.Destructible;
|
||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using Content.Shared.Physics.Controllers;
|
using Content.Shared.Physics.Controllers;
|
||||||
@@ -26,7 +27,7 @@ public sealed class ConveyorController : SharedConveyorController
|
|||||||
UpdatesAfter.Add(typeof(MoverController));
|
UpdatesAfter.Add(typeof(MoverController));
|
||||||
SubscribeLocalEvent<ConveyorComponent, ComponentInit>(OnInit);
|
SubscribeLocalEvent<ConveyorComponent, ComponentInit>(OnInit);
|
||||||
SubscribeLocalEvent<ConveyorComponent, ComponentShutdown>(OnConveyorShutdown);
|
SubscribeLocalEvent<ConveyorComponent, ComponentShutdown>(OnConveyorShutdown);
|
||||||
|
SubscribeLocalEvent<ConveyorComponent, BreakageEventArgs>(OnBreakage);
|
||||||
|
|
||||||
SubscribeLocalEvent<ConveyorComponent, SignalReceivedEvent>(OnSignalReceived);
|
SubscribeLocalEvent<ConveyorComponent, SignalReceivedEvent>(OnSignalReceived);
|
||||||
SubscribeLocalEvent<ConveyorComponent, PowerChangedEvent>(OnPowerChanged);
|
SubscribeLocalEvent<ConveyorComponent, PowerChangedEvent>(OnPowerChanged);
|
||||||
@@ -61,6 +62,11 @@ public sealed class ConveyorController : SharedConveyorController
|
|||||||
_fixtures.DestroyFixture(uid, ConveyorFixture, body: physics);
|
_fixtures.DestroyFixture(uid, ConveyorFixture, body: physics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnBreakage(Entity<ConveyorComponent> ent, ref BreakageEventArgs args)
|
||||||
|
{
|
||||||
|
SetState(ent, ConveyorState.Off, ent);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnPowerChanged(EntityUid uid, ConveyorComponent component, ref PowerChangedEvent args)
|
private void OnPowerChanged(EntityUid uid, ConveyorComponent component, ref PowerChangedEvent args)
|
||||||
{
|
{
|
||||||
component.Powered = args.Powered;
|
component.Powered = args.Powered;
|
||||||
@@ -96,13 +102,14 @@ public sealed class ConveyorController : SharedConveyorController
|
|||||||
if (!Resolve(uid, ref component))
|
if (!Resolve(uid, ref component))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!_materialReclaimer.SetReclaimerEnabled(uid, state != ConveyorState.Off))
|
||||||
|
return;
|
||||||
|
|
||||||
component.State = state;
|
component.State = state;
|
||||||
|
|
||||||
if (TryComp<PhysicsComponent>(uid, out var physics))
|
if (TryComp<PhysicsComponent>(uid, out var physics))
|
||||||
_broadphase.RegenerateContacts(uid, physics);
|
_broadphase.RegenerateContacts(uid, physics);
|
||||||
|
|
||||||
_materialReclaimer.SetReclaimerEnabled(uid, component.State != ConveyorState.Off);
|
|
||||||
|
|
||||||
UpdateAppearance(uid, component);
|
UpdateAppearance(uid, component);
|
||||||
Dirty(uid, component);
|
Dirty(uid, component);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ namespace Content.Server.Repairable
|
|||||||
("target", uid),
|
("target", uid),
|
||||||
("tool", args.Used!));
|
("tool", args.Used!));
|
||||||
_popup.PopupEntity(str, uid, args.User);
|
_popup.PopupEntity(str, uid, args.User);
|
||||||
|
|
||||||
|
var ev = new RepairedEvent((uid, component), args.User);
|
||||||
|
RaiseLocalEvent(uid, ref ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Repair(EntityUid uid, RepairableComponent component, InteractUsingEvent args)
|
public async void Repair(EntityUid uid, RepairableComponent component, InteractUsingEvent args)
|
||||||
@@ -72,4 +75,13 @@ namespace Content.Server.Repairable
|
|||||||
args.Handled = _toolSystem.UseTool(args.Used, args.User, uid, delay, component.QualityNeeded, new RepairFinishedEvent(), component.FuelCost);
|
args.Handled = _toolSystem.UseTool(args.Used, args.User, uid, delay, component.QualityNeeded, new RepairFinishedEvent(), component.FuelCost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event raised on an entity when its successfully repaired.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Ent"></param>
|
||||||
|
/// <param name="User"></param>
|
||||||
|
[ByRefEvent]
|
||||||
|
public readonly record struct RepairedEvent(Entity<RepairableComponent> Ent, EntityUid User);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Shared.Whitelist;
|
using Content.Shared.Whitelist;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -27,6 +28,12 @@ public sealed partial class MaterialReclaimerComponent : Component
|
|||||||
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
public bool Enabled = true;
|
public bool Enabled = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A master control for whether or not the recycler is broken and can function.
|
||||||
|
/// </summary>
|
||||||
|
[DataField, AutoNetworkedField]
|
||||||
|
public bool Broken;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How efficiently the materials are reclaimed.
|
/// How efficiently the materials are reclaimed.
|
||||||
/// In practice, a multiplier per material when calculating the output of the reclaimer.
|
/// In practice, a multiplier per material when calculating the output of the reclaimer.
|
||||||
@@ -59,8 +66,8 @@ public sealed partial class MaterialReclaimerComponent : Component
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The id of our output solution
|
/// The id of our output solution
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField]
|
||||||
public string SolutionContainerId = "output";
|
public string? SolutionContainerId;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// a whitelist for what entities can be inserted into this reclaimer
|
/// a whitelist for what entities can be inserted into this reclaimer
|
||||||
@@ -114,11 +121,12 @@ public sealed partial class MaterialReclaimerComponent : Component
|
|||||||
[NetSerializable, Serializable]
|
[NetSerializable, Serializable]
|
||||||
public enum RecyclerVisuals
|
public enum RecyclerVisuals
|
||||||
{
|
{
|
||||||
Bloody
|
Bloody,
|
||||||
|
Broken
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[UsedImplicitly]
|
||||||
public enum RecyclerVisualLayers : byte
|
public enum RecyclerVisualLayers : byte
|
||||||
{
|
{
|
||||||
Main,
|
Main
|
||||||
Bloody
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ using System.Linq;
|
|||||||
using Content.Shared.Administration.Logs;
|
using Content.Shared.Administration.Logs;
|
||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
using Content.Shared.Body.Components;
|
using Content.Shared.Body.Components;
|
||||||
using Content.Shared.Coordinates;
|
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Emag.Components;
|
using Content.Shared.Emag.Components;
|
||||||
using Content.Shared.Emag.Systems;
|
using Content.Shared.Emag.Systems;
|
||||||
@@ -10,7 +9,6 @@ using Content.Shared.Examine;
|
|||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Stacks;
|
using Content.Shared.Stacks;
|
||||||
using Content.Shared.Whitelist;
|
using Content.Shared.Whitelist;
|
||||||
using Robust.Shared.Audio;
|
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
@@ -102,7 +100,8 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
|
|||||||
|
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
_adminLog.Add(LogType.Action, LogImpact.High,
|
_adminLog.Add(LogType.Action,
|
||||||
|
LogImpact.High,
|
||||||
$"{ToPrettyString(user.Value):player} destroyed {ToPrettyString(item)} in the material reclaimer, {ToPrettyString(uid)}");
|
$"{ToPrettyString(user.Value):player} destroyed {ToPrettyString(item)} in the material reclaimer, {ToPrettyString(uid)}");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,13 +170,19 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the Enabled field on the reclaimer.
|
/// Sets the Enabled field on the reclaimer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetReclaimerEnabled(EntityUid uid, bool enabled, MaterialReclaimerComponent? component = null)
|
public bool SetReclaimerEnabled(EntityUid uid, bool enabled, MaterialReclaimerComponent? component = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref component, false))
|
if (!Resolve(uid, ref component, false))
|
||||||
return;
|
return true;
|
||||||
|
|
||||||
|
if (component.Broken && enabled)
|
||||||
|
return false;
|
||||||
|
|
||||||
component.Enabled = enabled;
|
component.Enabled = enabled;
|
||||||
AmbientSound.SetAmbience(uid, enabled && component.Powered);
|
AmbientSound.SetAmbience(uid, enabled && component.Powered);
|
||||||
Dirty(uid, component);
|
Dirty(uid, component);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -189,7 +194,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
|
|||||||
if (HasComp<ActiveMaterialReclaimerComponent>(uid))
|
if (HasComp<ActiveMaterialReclaimerComponent>(uid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return component.Powered && component.Enabled;
|
return component.Powered && component.Enabled && !component.Broken;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -200,6 +205,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
return component.Powered &&
|
return component.Powered &&
|
||||||
component.Enabled &&
|
component.Enabled &&
|
||||||
|
!component.Broken &&
|
||||||
HasComp<BodyComponent>(victim) &&
|
HasComp<BodyComponent>(victim) &&
|
||||||
HasComp<EmaggedComponent>(uid);
|
HasComp<EmaggedComponent>(uid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -951,20 +951,6 @@
|
|||||||
Manipulator: 1
|
Manipulator: 1
|
||||||
Steel: 1
|
Steel: 1
|
||||||
|
|
||||||
- type: entity
|
|
||||||
id: MaterialReclaimerMachineCircuitboard
|
|
||||||
parent: BaseMachineCircuitboard
|
|
||||||
name: material reclaimer machine board
|
|
||||||
components:
|
|
||||||
- type: Sprite
|
|
||||||
state: supply
|
|
||||||
- type: MachineBoard
|
|
||||||
prototype: MaterialReclaimer
|
|
||||||
stackRequirements:
|
|
||||||
Manipulator: 2
|
|
||||||
Steel: 5
|
|
||||||
Plastic: 5
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: OreProcessorMachineCircuitboard
|
id: OreProcessorMachineCircuitboard
|
||||||
parent: BaseMachineCircuitboard
|
parent: BaseMachineCircuitboard
|
||||||
|
|||||||
@@ -419,7 +419,6 @@
|
|||||||
- AutolatheMachineCircuitboard
|
- AutolatheMachineCircuitboard
|
||||||
- CircuitImprinterMachineCircuitboard
|
- CircuitImprinterMachineCircuitboard
|
||||||
- OreProcessorMachineCircuitboard
|
- OreProcessorMachineCircuitboard
|
||||||
- MaterialReclaimerMachineCircuitboard
|
|
||||||
- ElectrolysisUnitMachineCircuitboard
|
- ElectrolysisUnitMachineCircuitboard
|
||||||
- CentrifugeMachineCircuitboard
|
- CentrifugeMachineCircuitboard
|
||||||
- ChemDispenserMachineCircuitboard
|
- ChemDispenserMachineCircuitboard
|
||||||
|
|||||||
@@ -1,103 +0,0 @@
|
|||||||
- type: entity
|
|
||||||
parent: [ BaseMachinePowered, ConstructibleMachine ]
|
|
||||||
id: MaterialReclaimer
|
|
||||||
name: material reclaimer
|
|
||||||
description: Cannot reclaim immaterial things, like motivation.
|
|
||||||
components:
|
|
||||||
- type: Sprite
|
|
||||||
sprite: Structures/Machines/material_reclaimer.rsi
|
|
||||||
snapCardinals: true
|
|
||||||
layers:
|
|
||||||
- state: icon
|
|
||||||
map: ["enum.LatheVisualLayers.IsRunning"]
|
|
||||||
- state: gear-active
|
|
||||||
map: ["enum.DamageStateVisualLayers.Base"]
|
|
||||||
- state: unlit
|
|
||||||
shader: unshaded
|
|
||||||
map: ["enum.PowerDeviceVisualLayers.Powered"]
|
|
||||||
- state: fill-6
|
|
||||||
map: ["enum.SolutionContainerLayers.Fill"]
|
|
||||||
visible: false
|
|
||||||
- state: panel
|
|
||||||
map: ["enum.WiresVisualLayers.MaintenancePanel"]
|
|
||||||
- type: Appearance
|
|
||||||
- type: SolutionContainerVisuals
|
|
||||||
maxFillLevels: 6
|
|
||||||
fillBaseName: fill-
|
|
||||||
- type: WiresVisuals
|
|
||||||
- type: GenericVisualizer
|
|
||||||
visuals:
|
|
||||||
enum.PowerDeviceVisuals.Powered:
|
|
||||||
enum.DamageStateVisualLayers.Base:
|
|
||||||
True: { state: gear-active}
|
|
||||||
False: { state: gear-idle }
|
|
||||||
enum.PowerDeviceVisualLayers.Powered:
|
|
||||||
True: { visible: true }
|
|
||||||
False: { visible: false }
|
|
||||||
- type: LitOnPowered
|
|
||||||
- type: PointLight
|
|
||||||
radius: 1.5
|
|
||||||
energy: 1.6
|
|
||||||
enabled: false
|
|
||||||
color: "#da824d"
|
|
||||||
mask: /Textures/Effects/LightMasks/cone.png
|
|
||||||
autoRot: true
|
|
||||||
offset: "0, 0.4"
|
|
||||||
castShadows: false
|
|
||||||
- type: PowerSwitch
|
|
||||||
- type: Destructible
|
|
||||||
thresholds:
|
|
||||||
- trigger:
|
|
||||||
!type:DamageTrigger
|
|
||||||
damage: 100
|
|
||||||
behaviors:
|
|
||||||
- !type:PlaySoundBehavior
|
|
||||||
sound:
|
|
||||||
collection: MetalGlassBreak
|
|
||||||
- !type:ChangeConstructionNodeBehavior
|
|
||||||
node: machineFrame
|
|
||||||
- !type:DoActsBehavior
|
|
||||||
acts: ["Destruction"]
|
|
||||||
- type: Machine
|
|
||||||
board: MaterialReclaimerMachineCircuitboard
|
|
||||||
- type: WiresPanel
|
|
||||||
- type: MaterialReclaimer
|
|
||||||
whitelist:
|
|
||||||
components:
|
|
||||||
- PhysicalComposition
|
|
||||||
- SpaceGarbage
|
|
||||||
tags:
|
|
||||||
- Trash
|
|
||||||
- Recyclable
|
|
||||||
blacklist:
|
|
||||||
components:
|
|
||||||
- Material
|
|
||||||
- Pda
|
|
||||||
- IdCard
|
|
||||||
- Brain
|
|
||||||
tags:
|
|
||||||
- HighRiskItem
|
|
||||||
soundCooldown: 0
|
|
||||||
sound:
|
|
||||||
path: /Audio/Ambience/Objects/crushing.ogg
|
|
||||||
params:
|
|
||||||
volume: 5
|
|
||||||
maxDistance: 5
|
|
||||||
loop: true
|
|
||||||
- type: MaterialStorage
|
|
||||||
insertOnInteract: false
|
|
||||||
- type: ContainerContainer
|
|
||||||
containers:
|
|
||||||
active-material-reclaimer-container: !type:Container
|
|
||||||
machine_board: !type:Container
|
|
||||||
machine_parts: !type:Container
|
|
||||||
- type: SolutionContainerManager
|
|
||||||
solutions:
|
|
||||||
output:
|
|
||||||
maxVol: 100
|
|
||||||
- type: DrainableSolution
|
|
||||||
solution: output
|
|
||||||
- type: ExaminableSolution
|
|
||||||
solution: output
|
|
||||||
- type: StaticPrice
|
|
||||||
price: 500
|
|
||||||
@@ -56,32 +56,12 @@
|
|||||||
layers:
|
layers:
|
||||||
- state: grinder-o0
|
- state: grinder-o0
|
||||||
map: ["enum.RecyclerVisualLayers.Main"]
|
map: ["enum.RecyclerVisualLayers.Main"]
|
||||||
- state: grinder-o0bld
|
|
||||||
map: ["enum.RecyclerVisualLayers.Bloody"]
|
|
||||||
visible: false
|
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
- type: GenericVisualizer
|
- type: RecyclerVisuals
|
||||||
visuals:
|
|
||||||
enum.RecyclerVisuals.Bloody:
|
|
||||||
enum.RecyclerVisualLayers.Main:
|
|
||||||
True: { visible: false }
|
|
||||||
False: { visible: true }
|
|
||||||
enum.RecyclerVisualLayers.Bloody:
|
|
||||||
True: { visible: true }
|
|
||||||
False: { visible: false }
|
|
||||||
enum.ConveyorVisuals.State:
|
|
||||||
enum.RecyclerVisualLayers.Main:
|
|
||||||
Forward: { state: grinder-o1 }
|
|
||||||
Reverse: { state: grinder-o1 }
|
|
||||||
Off: { state: grinder-o0 }
|
|
||||||
enum.RecyclerVisualLayers.Bloody:
|
|
||||||
Forward: { state: grinder-o1bld }
|
|
||||||
Reverse: { state: grinder-o1bld }
|
|
||||||
Off: { state: grinder-o0bld }
|
|
||||||
- type: CollideMaterialReclaimer
|
- type: CollideMaterialReclaimer
|
||||||
- type: MaterialReclaimer
|
- type: MaterialReclaimer
|
||||||
enabled: false
|
enabled: false
|
||||||
efficiency: 0.25
|
|
||||||
scaleProcessSpeed: false #instant!
|
scaleProcessSpeed: false #instant!
|
||||||
minimumProcessDuration: 0
|
minimumProcessDuration: 0
|
||||||
whitelist:
|
whitelist:
|
||||||
@@ -104,13 +84,23 @@
|
|||||||
params:
|
params:
|
||||||
volume: -3
|
volume: -3
|
||||||
cutOffSound: false
|
cutOffSound: false
|
||||||
- type: SolutionContainerManager
|
|
||||||
solutions:
|
|
||||||
output:
|
|
||||||
maxVol: 0 #exists only for the overflow stuff on material reclaimer
|
|
||||||
- type: MaterialStorage
|
- type: MaterialStorage
|
||||||
- type: Conveyor
|
- type: Conveyor
|
||||||
- type: Rotatable
|
- type: Rotatable
|
||||||
|
- type: Repairable
|
||||||
|
doAfterDelay: 5
|
||||||
|
fuelCost: 25
|
||||||
|
- type: Destructible
|
||||||
|
thresholds:
|
||||||
|
- trigger:
|
||||||
|
!type:DamageTrigger
|
||||||
|
damage: 300
|
||||||
|
behaviors:
|
||||||
|
- !type:DoActsBehavior
|
||||||
|
acts: ["Breakage"]
|
||||||
|
- !type:PlaySoundBehavior
|
||||||
|
sound:
|
||||||
|
collection: MetalBreak
|
||||||
- type: InteractionPopup
|
- type: InteractionPopup
|
||||||
successChance: 1.0
|
successChance: 1.0
|
||||||
interactSuccessString: petting-success-recycler
|
interactSuccessString: petting-success-recycler
|
||||||
|
|||||||
@@ -481,15 +481,6 @@
|
|||||||
Steel: 100
|
Steel: 100
|
||||||
Glass: 500
|
Glass: 500
|
||||||
|
|
||||||
- type: latheRecipe
|
|
||||||
id: MaterialReclaimerMachineCircuitboard
|
|
||||||
result: MaterialReclaimerMachineCircuitboard
|
|
||||||
category: Circuitry
|
|
||||||
completetime: 4
|
|
||||||
materials:
|
|
||||||
Steel: 100
|
|
||||||
Glass: 500
|
|
||||||
|
|
||||||
- type: latheRecipe
|
- type: latheRecipe
|
||||||
id: OreProcessorMachineCircuitboard
|
id: OreProcessorMachineCircuitboard
|
||||||
result: OreProcessorMachineCircuitboard
|
result: OreProcessorMachineCircuitboard
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 112 B |
|
Before Width: | Height: | Size: 117 B |
|
Before Width: | Height: | Size: 121 B |
|
Before Width: | Height: | Size: 119 B |
|
Before Width: | Height: | Size: 122 B |
|
Before Width: | Height: | Size: 120 B |
|
Before Width: | Height: | Size: 379 B |
|
Before Width: | Height: | Size: 202 B |
|
Before Width: | Height: | Size: 709 B |
@@ -1,57 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 1,
|
|
||||||
"license": "CC0-1.0",
|
|
||||||
"copyright": "Created by EmoGarbage404 (github) for Space Station 14",
|
|
||||||
"size": {
|
|
||||||
"x": 32,
|
|
||||||
"y": 32
|
|
||||||
},
|
|
||||||
"states": [
|
|
||||||
{
|
|
||||||
"name": "fill-1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "fill-2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "fill-3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "fill-4"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "fill-5"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "fill-6"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "gear-active",
|
|
||||||
"delays": [
|
|
||||||
[
|
|
||||||
0.25,
|
|
||||||
0.25,
|
|
||||||
0.25
|
|
||||||
]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "gear-idle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "icon"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "panel"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "unlit",
|
|
||||||
"delays": [
|
|
||||||
[
|
|
||||||
0.1,
|
|
||||||
1.0
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 204 B |
|
Before Width: | Height: | Size: 223 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
@@ -40,16 +40,35 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "grinder-o0"
|
"name": "grinder-o0",
|
||||||
|
"directions": 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "grinder-o0bld"
|
"name": "grinder-o0bld",
|
||||||
|
"directions": 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "grinder-o1",
|
"name": "grinder-o1",
|
||||||
|
"directions": 4,
|
||||||
"delays": [
|
"delays": [
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
],
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
],
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
],
|
||||||
[
|
[
|
||||||
0.1,
|
0.1,
|
||||||
0.1,
|
0.1,
|
||||||
@@ -60,7 +79,26 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "grinder-o1bld",
|
"name": "grinder-o1bld",
|
||||||
|
"directions": 4,
|
||||||
"delays": [
|
"delays": [
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
],
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
],
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
],
|
||||||
[
|
[
|
||||||
0.1,
|
0.1,
|
||||||
0.1,
|
0.1,
|
||||||
@@ -69,6 +107,14 @@
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "grinder-o2",
|
||||||
|
"directions": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "grinder-o2bld",
|
||||||
|
"directions": 4
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "separator-"
|
"name": "separator-"
|
||||||
|
|
||||||
|
|||||||
@@ -383,6 +383,10 @@ SignHydro3: SignHydro1
|
|||||||
# 2024-07-27
|
# 2024-07-27
|
||||||
LogicGate: LogicGateOr
|
LogicGate: LogicGateOr
|
||||||
|
|
||||||
|
# 2024-08-08
|
||||||
|
MaterialReclaimer: null
|
||||||
|
MaterialReclaimerMachineCircuitboard: null
|
||||||
|
|
||||||
# 2024-08-11
|
# 2024-08-11
|
||||||
FoodTacoBeef: FoodTacoShell
|
FoodTacoBeef: FoodTacoShell
|
||||||
FoodTacoChicken: FoodTacoShell
|
FoodTacoChicken: FoodTacoShell
|
||||||
|
|||||||