Merge ebb8e7c6cb into c3c6a6abd9
This commit is contained in:
commit
5e441cd6f5
|
|
@ -257,4 +257,9 @@ public record struct IsWeightlessEvent(bool IsWeightless = false, bool Handled =
|
|||
/// Raised on an entity when their weightless status changes.
|
||||
/// </summary>
|
||||
[ByRefEvent]
|
||||
public readonly record struct WeightlessnessChangedEvent(bool Weightless);
|
||||
// Start DeltaV - Made WeightlessnessChangedEvent relay to inventory.
|
||||
public readonly record struct WeightlessnessChangedEvent(bool Weightless) : IInventoryRelayEvent
|
||||
{
|
||||
SlotFlags IInventoryRelayEvent.TargetSlots => ~SlotFlags.POCKET;
|
||||
}
|
||||
// End DeltaV - Made WeightlessnessChangedEvent relay to inventory.
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ public partial class InventorySystem
|
|||
SubscribeLocalEvent<InventoryComponent, PsionicPowerUseAttemptEvent>(RefRelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, TargetedByPsionicPowerEvent>(RefRelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, NoosphericFryEvent>(RefRelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, WeightlessnessChangedEvent>(RefRelayInventoryEvent); // Heavy Clothing
|
||||
// DeltaV End - Psionic Events
|
||||
|
||||
// Eye/vision events
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ public sealed class SlipAttemptEvent : EntityEventArgs, IInventoryRelayEvent
|
|||
|
||||
public EntityUid? SlipCausingEntity;
|
||||
|
||||
public SlotFlags TargetSlots { get; } = SlotFlags.FEET;
|
||||
public SlotFlags TargetSlots { get; } = SlotFlags.FEET | SlotFlags.OUTERCLOTHING; // DeltaV - Added Heavy Clothing
|
||||
|
||||
public SlipAttemptEvent(EntityUid? slipCausingEntity)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
using Content.Shared.Alert;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared._DV.Clothing.Components;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class HeavyClothingComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The alert shown when wearing heavy clothing.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public ProtoId<AlertPrototype> AlertPrototype = "HeavyClothing";
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
using Content.Shared._DV.Clothing.Components;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Atmos.Components;
|
||||
using Content.Shared.Clothing;
|
||||
using Content.Shared.Gravity;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Slippery;
|
||||
|
||||
namespace Content.Shared._DV.Clothing.Systems;
|
||||
|
||||
public sealed class HeavyClothingSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly AlertsSystem _alerts = default!;
|
||||
[Dependency] private readonly SharedGravitySystem _gravity = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<HeavyClothingComponent, ClothingGotEquippedEvent>(OnGotEquipped);
|
||||
SubscribeLocalEvent<HeavyClothingComponent, ClothingGotUnequippedEvent>(OnGotUnequipped);
|
||||
SubscribeLocalEvent<HeavyClothingComponent, WeightlessnessChangedEvent>(OnIsWeightless);
|
||||
SubscribeLocalEvent<HeavyClothingComponent, InventoryRelayedEvent<WeightlessnessChangedEvent>>(OnIsWeightless);
|
||||
SubscribeLocalEvent<HeavyClothingComponent, SlipAttemptEvent>(OnSlipAttempt);
|
||||
SubscribeLocalEvent<HeavyClothingComponent, InventoryRelayedEvent<SlipAttemptEvent>>(OnSlipAttempt);
|
||||
|
||||
}
|
||||
|
||||
private void OnGotUnequipped(Entity<HeavyClothingComponent> clothing, ref ClothingGotUnequippedEvent args)
|
||||
{
|
||||
UpdateWindResistance(args.Wearer, clothing, false);
|
||||
}
|
||||
|
||||
private void OnGotEquipped(Entity<HeavyClothingComponent> clothing, ref ClothingGotEquippedEvent args)
|
||||
{
|
||||
UpdateWindResistance(args.Wearer, clothing, !_gravity.IsWeightless(args.Wearer));
|
||||
}
|
||||
|
||||
public void UpdateWindResistance(EntityUid user, Entity<HeavyClothingComponent> clothing, bool state)
|
||||
{
|
||||
// TODO: public api for this and add access
|
||||
if (TryComp<MovedByPressureComponent>(user, out var moved))
|
||||
moved.Enabled = !state;
|
||||
|
||||
if (state)
|
||||
_alerts.ShowAlert(user, clothing.Comp.AlertPrototype);
|
||||
else
|
||||
_alerts.ClearAlert(user, clothing.Comp.AlertPrototype);
|
||||
}
|
||||
|
||||
private void OnIsWeightless(Entity<HeavyClothingComponent> clothing, ref WeightlessnessChangedEvent args)
|
||||
{
|
||||
UpdateWindResistance(clothing, clothing, !args.Weightless);
|
||||
}
|
||||
|
||||
private void OnIsWeightless(Entity<HeavyClothingComponent> clothing, ref InventoryRelayedEvent<WeightlessnessChangedEvent> args)
|
||||
{
|
||||
OnIsWeightless(clothing, ref args.Args);
|
||||
UpdateWindResistance(args.Owner, clothing, !args.Args.Weightless);
|
||||
}
|
||||
|
||||
private void OnSlipAttempt(Entity<HeavyClothingComponent> clothing, ref SlipAttemptEvent args)
|
||||
{
|
||||
args.NoSlip = !_gravity.IsWeightless(clothing.Owner);
|
||||
}
|
||||
|
||||
private void OnSlipAttempt(Entity<HeavyClothingComponent> clothing, ref InventoryRelayedEvent<SlipAttemptEvent> args)
|
||||
{
|
||||
args.Args.NoSlip = !_gravity.IsWeightless(args.Owner);
|
||||
}
|
||||
}
|
||||
|
|
@ -14,3 +14,6 @@ alerts-light-level-bright-desc = You are in an area with bright light.
|
|||
|
||||
alerts-resurrecting-name = Resurrecting
|
||||
alerts-resurrecting-desc = You are currently dead, but will resurrect soon.
|
||||
|
||||
alert-heavy-clothing-name = You're [color=yellow]heavy[/color]
|
||||
alert-heavy-clothing-desc = Heavy gear is weighing you down, rendering you [color=yellow]immune[/color] to space wind and slippery surfaces!
|
||||
|
|
|
|||
|
|
@ -4,3 +4,11 @@
|
|||
icons: [ /Textures/_DV/Interface/Alerts/Grappled/grappled.png ]
|
||||
name: alerts-grappled-name
|
||||
description: alerts-grappled-desc
|
||||
|
||||
- type: alert
|
||||
id: HeavyClothing
|
||||
icons:
|
||||
- sprite: /Textures/_DV/Interface/Alerts/heavy_clothing.rsi
|
||||
state: enabled
|
||||
name: alert-heavy-clothing-name
|
||||
description: alert-heavy-clothing-desc
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@
|
|||
sprintModifier: 0.60
|
||||
- type: ToggleableClothing
|
||||
clothingPrototype: ClothingHeadHelmetHardsuitCombatRiot
|
||||
- type: HeavyClothing
|
||||
|
||||
- type: entity
|
||||
parent: ClothingOuterHardsuitCombatRiot
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 430 B |
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"version": 1,
|
||||
"license": "CC-BY-SA-4.0",
|
||||
"copyright": "Enabled Sprite sprited by SirWarock on Github for DeltaV.",
|
||||
"size": {
|
||||
"x": 32,
|
||||
"y": 32
|
||||
},
|
||||
"states": [
|
||||
{
|
||||
"name": "enabled"
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in New Issue