Add verbs to Two Way Levers, make some odds and ends recyclable. (#12660)
This commit is contained in:
@@ -17,6 +17,7 @@ using Robust.Server.GameObjects;
|
|||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
using Content.Server.Recycling.Components;
|
||||||
|
|
||||||
namespace Content.Server.Cuffs.Components
|
namespace Content.Server.Cuffs.Components
|
||||||
{
|
{
|
||||||
@@ -270,6 +271,8 @@ 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.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
CanStillInteract = _entMan.TryGetComponent(Owner, out HandsComponent? handsComponent) && handsComponent.SortedHands.Count() > CuffedHandCount;
|
CanStillInteract = _entMan.TryGetComponent(Owner, out HandsComponent? handsComponent) && handsComponent.SortedHands.Count() > CuffedHandCount;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.MachineLinking.Components;
|
using Content.Server.MachineLinking.Components;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.MachineLinking;
|
using Content.Shared.MachineLinking;
|
||||||
|
using Content.Shared.Verbs;
|
||||||
|
|
||||||
namespace Content.Server.MachineLinking.System
|
namespace Content.Server.MachineLinking.System
|
||||||
{
|
{
|
||||||
@@ -8,11 +9,15 @@ namespace Content.Server.MachineLinking.System
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly SignalLinkerSystem _signalSystem = default!;
|
[Dependency] private readonly SignalLinkerSystem _signalSystem = default!;
|
||||||
|
|
||||||
|
const string _leftToggleImage = "rotate_ccw.svg.192dpi.png";
|
||||||
|
const string _rightToggleImage = "rotate_cw.svg.192dpi.png";
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeLocalEvent<TwoWayLeverComponent, ComponentInit>(OnInit);
|
SubscribeLocalEvent<TwoWayLeverComponent, ComponentInit>(OnInit);
|
||||||
SubscribeLocalEvent<TwoWayLeverComponent, ActivateInWorldEvent>(OnActivated);
|
SubscribeLocalEvent<TwoWayLeverComponent, ActivateInWorldEvent>(OnActivated);
|
||||||
|
SubscribeLocalEvent<TwoWayLeverComponent, GetVerbsEvent<InteractionVerb>>(OnGetInteractionVerbs);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInit(EntityUid uid, TwoWayLeverComponent component, ComponentInit args)
|
private void OnInit(EntityUid uid, TwoWayLeverComponent component, ComponentInit args)
|
||||||
@@ -33,6 +38,56 @@ namespace Content.Server.MachineLinking.System
|
|||||||
_ => throw new ArgumentOutOfRangeException()
|
_ => throw new ArgumentOutOfRangeException()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
StateChanged(uid, component);
|
||||||
|
|
||||||
|
args.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGetInteractionVerbs(EntityUid uid, TwoWayLeverComponent component, GetVerbsEvent<InteractionVerb> args)
|
||||||
|
{
|
||||||
|
InteractionVerb verbLeft = new()
|
||||||
|
{
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
component.State = component.State switch
|
||||||
|
{
|
||||||
|
TwoWayLeverState.Middle => TwoWayLeverState.Left,
|
||||||
|
TwoWayLeverState.Right => TwoWayLeverState.Middle,
|
||||||
|
_ => throw new ArgumentOutOfRangeException()
|
||||||
|
};
|
||||||
|
StateChanged(uid, component);
|
||||||
|
},
|
||||||
|
Message = Loc.GetString("two-way-lever-cant"),
|
||||||
|
Disabled = component.State == TwoWayLeverState.Left,
|
||||||
|
IconTexture = $"/Textures/Interface/VerbIcons/{_leftToggleImage}",
|
||||||
|
Text = Loc.GetString("two-way-lever-left"),
|
||||||
|
};
|
||||||
|
|
||||||
|
args.Verbs.Add(verbLeft);
|
||||||
|
|
||||||
|
InteractionVerb verbRight = new()
|
||||||
|
{
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
component.State = component.State switch
|
||||||
|
{
|
||||||
|
TwoWayLeverState.Left => TwoWayLeverState.Middle,
|
||||||
|
TwoWayLeverState.Middle => TwoWayLeverState.Right,
|
||||||
|
_ => throw new ArgumentOutOfRangeException()
|
||||||
|
};
|
||||||
|
StateChanged(uid, component);
|
||||||
|
},
|
||||||
|
Message = Loc.GetString("two-way-lever-cant"),
|
||||||
|
Disabled = component.State == TwoWayLeverState.Right,
|
||||||
|
IconTexture = $"/Textures/Interface/VerbIcons/{_rightToggleImage}",
|
||||||
|
Text = Loc.GetString("two-way-lever-right"),
|
||||||
|
};
|
||||||
|
|
||||||
|
args.Verbs.Add(verbRight);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StateChanged(EntityUid uid, TwoWayLeverComponent component)
|
||||||
|
{
|
||||||
if (component.State == TwoWayLeverState.Middle)
|
if (component.State == TwoWayLeverState.Middle)
|
||||||
component.NextSignalLeft = !component.NextSignalLeft;
|
component.NextSignalLeft = !component.NextSignalLeft;
|
||||||
|
|
||||||
@@ -48,7 +103,6 @@ namespace Content.Server.MachineLinking.System
|
|||||||
};
|
};
|
||||||
|
|
||||||
_signalSystem.InvokePort(uid, port);
|
_signalSystem.InvokePort(uid, port);
|
||||||
args.Handled = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,5 +43,7 @@ namespace Content.Server.Recycling.Components
|
|||||||
|
|
||||||
// Ratelimit sounds to avoid spam
|
// Ratelimit sounds to avoid spam
|
||||||
public TimeSpan LastSound;
|
public TimeSpan LastSound;
|
||||||
|
|
||||||
|
public int ItemsProcessed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Server.Recycling.Components;
|
|||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
using Content.Shared.Body.Components;
|
using Content.Shared.Body.Components;
|
||||||
using Content.Shared.Emag.Systems;
|
using Content.Shared.Emag.Systems;
|
||||||
|
using Content.Shared.Examine;
|
||||||
using Content.Shared.IdentityManagement;
|
using Content.Shared.IdentityManagement;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Recycling;
|
using Content.Shared.Recycling;
|
||||||
@@ -33,11 +34,17 @@ namespace Content.Server.Recycling
|
|||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
SubscribeLocalEvent<RecyclerComponent, ExaminedEvent>(OnExamined);
|
||||||
SubscribeLocalEvent<RecyclerComponent, StartCollideEvent>(OnCollide);
|
SubscribeLocalEvent<RecyclerComponent, StartCollideEvent>(OnCollide);
|
||||||
SubscribeLocalEvent<RecyclerComponent, GotEmaggedEvent>(OnEmagged);
|
SubscribeLocalEvent<RecyclerComponent, GotEmaggedEvent>(OnEmagged);
|
||||||
SubscribeLocalEvent<RecyclerComponent, SuicideEvent>(OnSuicide);
|
SubscribeLocalEvent<RecyclerComponent, SuicideEvent>(OnSuicide);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnExamined(EntityUid uid, RecyclerComponent component, ExaminedEvent args)
|
||||||
|
{
|
||||||
|
args.PushMarkup(Loc.GetString("recycler-count-items", ("items", component.ItemsProcessed)));
|
||||||
|
}
|
||||||
|
|
||||||
private void OnSuicide(EntityUid uid, RecyclerComponent component, SuicideEvent args)
|
private void OnSuicide(EntityUid uid, RecyclerComponent component, SuicideEvent args)
|
||||||
{
|
{
|
||||||
if (args.Handled) return;
|
if (args.Handled) return;
|
||||||
@@ -119,6 +126,8 @@ namespace Content.Server.Recycling
|
|||||||
SoundSystem.Play(component.Sound.GetSound(), Filter.Pvs(component.Owner, entityManager: EntityManager), component.Owner, AudioHelpers.WithVariation(0.01f).WithVolume(-3));
|
SoundSystem.Play(component.Sound.GetSound(), Filter.Pvs(component.Owner, entityManager: EntityManager), component.Owner, AudioHelpers.WithVariation(0.01f).WithVolume(-3));
|
||||||
component.LastSound = _timing.CurTime;
|
component.LastSound = _timing.CurTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
component.ItemsProcessed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanGib(RecyclerComponent component, EntityUid entity)
|
private bool CanGib(RecyclerComponent component, EntityUid entity)
|
||||||
|
|||||||
@@ -11,3 +11,9 @@ machine-upgrade-not-upgraded = [color=yellow]{CAPITALIZE($upgraded)}[/color] not
|
|||||||
upgrade-power-draw = power draw
|
upgrade-power-draw = power draw
|
||||||
upgrade-max-charge = max charge
|
upgrade-max-charge = max charge
|
||||||
upgrade-power-supply = power supply
|
upgrade-power-supply = power supply
|
||||||
|
|
||||||
|
two-way-lever-left = push left
|
||||||
|
two-way-lever-right = push right
|
||||||
|
two-way-lever-cant = can't push the lever that way!
|
||||||
|
|
||||||
|
recycler-count-items = Recycled {$items} objects.
|
||||||
@@ -146,6 +146,7 @@
|
|||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- PetWearable
|
- PetWearable
|
||||||
|
- type: Recyclable
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: ClothingMaskBase
|
parent: ClothingMaskBase
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
reagents:
|
reagents:
|
||||||
- ReagentId: Water
|
- ReagentId: Water
|
||||||
Quantity: 50
|
Quantity: 50
|
||||||
|
- type: TrashOnEmpty
|
||||||
|
solution: drink
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: DrinkBase
|
parent: DrinkBase
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
- Document
|
- Document
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
- type: PaperVisuals
|
- type: PaperVisuals
|
||||||
|
- type: Recyclable
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: Paper
|
parent: Paper
|
||||||
@@ -76,6 +77,7 @@
|
|||||||
sprite: Objects/Misc/bureaucracy.rsi
|
sprite: Objects/Misc/bureaucracy.rsi
|
||||||
heldPrefix: pen
|
heldPrefix: pen
|
||||||
size: 2
|
size: 2
|
||||||
|
- type: Recyclable
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: Cybersun pen
|
name: Cybersun pen
|
||||||
|
|||||||
@@ -12,3 +12,4 @@
|
|||||||
sprite: Objects/Fun/toys.rsi
|
sprite: Objects/Fun/toys.rsi
|
||||||
layers:
|
layers:
|
||||||
- state: foamdart
|
- state: foamdart
|
||||||
|
- type: Recyclable
|
||||||
Reference in New Issue
Block a user