Fixes for the recycler and related things (#12703)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -286,7 +286,7 @@ namespace Content.Server.Cuffs.Components
|
|||||||
sprite.LayerSetState(0, cuff.BrokenState); // TODO: safety check to see if RSI contains the state?
|
sprite.LayerSetState(0, cuff.BrokenState); // TODO: safety check to see if RSI contains the state?
|
||||||
}
|
}
|
||||||
|
|
||||||
_entMan.AddComponent<RecyclableComponent>(cuffsToRemove);
|
_entMan.EnsureComponent<RecyclableComponent>(cuffsToRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
CanStillInteract = _entMan.TryGetComponent(Owner, out HandsComponent? handsComponent) && handsComponent.SortedHands.Count() > CuffedHandCount;
|
CanStillInteract = _entMan.TryGetComponent(Owner, out HandsComponent? handsComponent) && handsComponent.SortedHands.Count() > CuffedHandCount;
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ namespace Content.Server.MachineLinking.System
|
|||||||
|
|
||||||
private void OnGetInteractionVerbs(EntityUid uid, TwoWayLeverComponent component, GetVerbsEvent<InteractionVerb> args)
|
private void OnGetInteractionVerbs(EntityUid uid, TwoWayLeverComponent component, GetVerbsEvent<InteractionVerb> args)
|
||||||
{
|
{
|
||||||
|
if (!args.CanAccess || !args.CanInteract || (args.Hands == null))
|
||||||
|
return;
|
||||||
|
|
||||||
InteractionVerb verbLeft = new()
|
InteractionVerb verbLeft = new()
|
||||||
{
|
{
|
||||||
Act = () =>
|
Act = () =>
|
||||||
@@ -57,6 +60,7 @@ namespace Content.Server.MachineLinking.System
|
|||||||
};
|
};
|
||||||
StateChanged(uid, component);
|
StateChanged(uid, component);
|
||||||
},
|
},
|
||||||
|
Category = VerbCategory.Lever,
|
||||||
Message = Loc.GetString("two-way-lever-cant"),
|
Message = Loc.GetString("two-way-lever-cant"),
|
||||||
Disabled = component.State == TwoWayLeverState.Left,
|
Disabled = component.State == TwoWayLeverState.Left,
|
||||||
IconTexture = $"/Textures/Interface/VerbIcons/{_leftToggleImage}",
|
IconTexture = $"/Textures/Interface/VerbIcons/{_leftToggleImage}",
|
||||||
@@ -77,6 +81,7 @@ namespace Content.Server.MachineLinking.System
|
|||||||
};
|
};
|
||||||
StateChanged(uid, component);
|
StateChanged(uid, component);
|
||||||
},
|
},
|
||||||
|
Category = VerbCategory.Lever,
|
||||||
Message = Loc.GetString("two-way-lever-cant"),
|
Message = Loc.GetString("two-way-lever-cant"),
|
||||||
Disabled = component.State == TwoWayLeverState.Right,
|
Disabled = component.State == TwoWayLeverState.Right,
|
||||||
IconTexture = $"/Textures/Interface/VerbIcons/{_rightToggleImage}",
|
IconTexture = $"/Textures/Interface/VerbIcons/{_rightToggleImage}",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace Content.Server.Recycling.Components
|
|||||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
[DataField("enabled")]
|
[DataField("enabled")]
|
||||||
public bool Enabled = true;
|
public bool Enabled;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether or not sentient beings will be recycled
|
/// Whether or not sentient beings will be recycled
|
||||||
@@ -27,14 +27,6 @@ namespace Content.Server.Recycling.Components
|
|||||||
[DataField("efficiency")]
|
[DataField("efficiency")]
|
||||||
internal float Efficiency = 0.25f;
|
internal float Efficiency = 0.25f;
|
||||||
|
|
||||||
private void Clean()
|
|
||||||
{
|
|
||||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
|
||||||
{
|
|
||||||
appearance.SetData(RecyclerVisuals.Bloody, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default sound to play when recycling
|
/// Default sound to play when recycling
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.Body.Systems;
|
|||||||
using Content.Server.GameTicking;
|
using Content.Server.GameTicking;
|
||||||
using Content.Server.Players;
|
using Content.Server.Players;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.Power.EntitySystems;
|
using Content.Server.Power.EntitySystems;
|
||||||
using Content.Server.Recycling.Components;
|
using Content.Server.Recycling.Components;
|
||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
@@ -29,6 +30,10 @@ namespace Content.Server.Recycling
|
|||||||
[Dependency] private readonly GameTicker _ticker = default!;
|
[Dependency] private readonly GameTicker _ticker = default!;
|
||||||
[Dependency] private readonly PopupSystem _popup = default!;
|
[Dependency] private readonly PopupSystem _popup = default!;
|
||||||
[Dependency] private readonly TagSystem _tags = default!;
|
[Dependency] private readonly TagSystem _tags = default!;
|
||||||
|
[Dependency] private readonly AudioSystem _soundSystem = default!;
|
||||||
|
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
|
||||||
|
|
||||||
|
private const string RecyclerColliderName = "brrt";
|
||||||
|
|
||||||
private const float RecyclerSoundCooldown = 0.8f;
|
private const float RecyclerSoundCooldown = 0.8f;
|
||||||
|
|
||||||
@@ -38,6 +43,7 @@ namespace Content.Server.Recycling
|
|||||||
SubscribeLocalEvent<RecyclerComponent, StartCollideEvent>(OnCollide);
|
SubscribeLocalEvent<RecyclerComponent, StartCollideEvent>(OnCollide);
|
||||||
SubscribeLocalEvent<RecyclerComponent, GotEmaggedEvent>(OnEmagged);
|
SubscribeLocalEvent<RecyclerComponent, GotEmaggedEvent>(OnEmagged);
|
||||||
SubscribeLocalEvent<RecyclerComponent, SuicideEvent>(OnSuicide);
|
SubscribeLocalEvent<RecyclerComponent, SuicideEvent>(OnSuicide);
|
||||||
|
SubscribeLocalEvent<RecyclerComponent, PowerChangedEvent>(OnPowerChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnExamined(EntityUid uid, RecyclerComponent component, ExaminedEvent args)
|
private void OnExamined(EntityUid uid, RecyclerComponent component, ExaminedEvent args)
|
||||||
@@ -77,9 +83,18 @@ namespace Content.Server.Recycling
|
|||||||
if (component.Enabled) return;
|
if (component.Enabled) return;
|
||||||
|
|
||||||
component.Enabled = true;
|
component.Enabled = true;
|
||||||
|
|
||||||
|
if (TryComp(component.Owner, out ApcPowerReceiverComponent? apcPower))
|
||||||
|
{
|
||||||
|
_ambience.SetAmbience(component.Owner, apcPower.Powered);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
_ambience.SetAmbience(component.Owner, true);
|
_ambience.SetAmbience(component.Owner, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void DisableRecycler(RecyclerComponent component)
|
public void DisableRecycler(RecyclerComponent component)
|
||||||
{
|
{
|
||||||
if (!component.Enabled) return;
|
if (!component.Enabled) return;
|
||||||
@@ -88,9 +103,24 @@ namespace Content.Server.Recycling
|
|||||||
_ambience.SetAmbience(component.Owner, false);
|
_ambience.SetAmbience(component.Owner, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPowerChanged(EntityUid uid, RecyclerComponent component, ref PowerChangedEvent args)
|
||||||
|
{
|
||||||
|
if (component.Enabled)
|
||||||
|
{
|
||||||
|
_ambience.SetAmbience(uid, args.Powered);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnCollide(EntityUid uid, RecyclerComponent component, ref StartCollideEvent args)
|
private void OnCollide(EntityUid uid, RecyclerComponent component, ref StartCollideEvent args)
|
||||||
{
|
{
|
||||||
if (component.Enabled && args.OurFixture.ID != "brrt") return;
|
if (component.Enabled && args.OurFixture.ID != RecyclerColliderName)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (TryComp(uid, out ApcPowerReceiverComponent? apcPower))
|
||||||
|
{
|
||||||
|
if (!apcPower.Powered)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Recycle(component, args.OtherFixture.Body.Owner);
|
Recycle(component, args.OtherFixture.Body.Owner);
|
||||||
}
|
}
|
||||||
@@ -123,7 +153,7 @@ namespace Content.Server.Recycling
|
|||||||
|
|
||||||
if (component.Sound != null && (_timing.CurTime - component.LastSound).TotalSeconds > RecyclerSoundCooldown)
|
if (component.Sound != null && (_timing.CurTime - component.LastSound).TotalSeconds > RecyclerSoundCooldown)
|
||||||
{
|
{
|
||||||
SoundSystem.Play(component.Sound.GetSound(), Filter.Pvs(component.Owner, entityManager: EntityManager), component.Owner, AudioHelpers.WithVariation(0.01f).WithVolume(-3));
|
_soundSystem.PlayPvs(component.Sound, component.Owner, AudioHelpers.WithVariation(0.01f).WithVolume(-3));
|
||||||
component.LastSound = _timing.CurTime;
|
component.LastSound = _timing.CurTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +170,7 @@ namespace Content.Server.Recycling
|
|||||||
{
|
{
|
||||||
if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearance))
|
if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearance))
|
||||||
{
|
{
|
||||||
appearance.SetData(RecyclerVisuals.Bloody, true);
|
_appearanceSystem.SetData(component.Owner, RecyclerVisuals.Bloody, true, appearance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,5 +77,7 @@ namespace Content.Shared.Verbs
|
|||||||
new("verb-categories-instrument-style", null);
|
new("verb-categories-instrument-style", null);
|
||||||
|
|
||||||
public static readonly VerbCategory SetSensor = new("verb-categories-set-sensor", null);
|
public static readonly VerbCategory SetSensor = new("verb-categories-set-sensor", null);
|
||||||
|
|
||||||
|
public static readonly VerbCategory Lever = new("verb-categories-lever", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ verb-categories-split = Split
|
|||||||
verb-categories-instrument-style = Instrument Style
|
verb-categories-instrument-style = Instrument Style
|
||||||
verb-categories-set-sensor = Sensor
|
verb-categories-set-sensor = Sensor
|
||||||
verb-categories-timer = Set Delay
|
verb-categories-timer = Set Delay
|
||||||
|
verb-categories-lever = Lever
|
||||||
|
|
||||||
verb-common-toggle-light = Toggle light
|
verb-common-toggle-light = Toggle light
|
||||||
verb-common-close = Close
|
verb-common-close = Close
|
||||||
|
|||||||
@@ -65,3 +65,4 @@
|
|||||||
state_off: grinder-o0
|
state_off: grinder-o0
|
||||||
- type: Recycler
|
- type: Recycler
|
||||||
- type: Conveyor
|
- type: Conveyor
|
||||||
|
- type: Rotatable
|
||||||
@@ -29,3 +29,6 @@
|
|||||||
steps:
|
steps:
|
||||||
- tool: Prying
|
- tool: Prying
|
||||||
doAfter: 3
|
doAfter: 3
|
||||||
|
completed:
|
||||||
|
- !type:SetAnchor
|
||||||
|
value: false
|
||||||
Reference in New Issue
Block a user