Box fixes and Stealth Box in uplink (#12194)

This commit is contained in:
keronshb
2022-11-03 23:16:23 -04:00
committed by GitHub
parent e531db3f7b
commit 84413f2a4c
10 changed files with 86 additions and 8 deletions

View File

@@ -59,6 +59,7 @@ namespace Content.Client.Physics.Controllers
if (TryComp<InputMoverComponent>(player, out var mover) && if (TryComp<InputMoverComponent>(player, out var mover) &&
TryComp<InputMoverComponent>(relayMover.RelayEntity, out var relayed)) TryComp<InputMoverComponent>(relayMover.RelayEntity, out var relayed))
{ {
relayed.CanMove = mover.CanMove;
relayed.RelativeEntity = mover.RelativeEntity; relayed.RelativeEntity = mover.RelativeEntity;
relayed.RelativeRotation = mover.RelativeRotation; relayed.RelativeRotation = mover.RelativeRotation;
relayed.TargetRelativeRotation = mover.RelativeRotation; relayed.TargetRelativeRotation = mover.RelativeRotation;

View File

@@ -1,5 +1,4 @@
using Content.Server.Actions; using Content.Server.Actions;
using Content.Server.MobState;
using Content.Server.Popups; using Content.Server.Popups;
using Content.Server.Sound.Components; using Content.Server.Sound.Components;
using Content.Shared.Actions.ActionTypes; using Content.Shared.Actions.ActionTypes;
@@ -26,7 +25,6 @@ namespace Content.Server.Bed.Sleep
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ActionsSystem _actionsSystem = default!; [Dependency] private readonly ActionsSystem _actionsSystem = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!;

View File

@@ -1,13 +1,18 @@
using System.Linq; using System.Linq;
using Content.Shared.CardboardBox.Components; using Content.Shared.CardboardBox.Components;
using Content.Server.Storage.Components; using Content.Server.Storage.Components;
using Content.Server.Storage.EntitySystems;
using Content.Shared.CardboardBox; using Content.Shared.CardboardBox;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Interaction;
using Content.Shared.Movement.Components; using Content.Shared.Movement.Components;
using Content.Shared.Movement.Systems; using Content.Shared.Movement.Systems;
using Robust.Shared.Player; using Robust.Shared.Player;
using Robust.Shared.Timing; using Robust.Shared.Timing;
using Content.Shared.Stealth.Components; using Content.Shared.Stealth.Components;
using Content.Shared.Stealth; using Content.Shared.Stealth;
using Robust.Shared.Prototypes;
namespace Content.Server.CardboardBox; namespace Content.Server.CardboardBox;
@@ -17,6 +22,9 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
[Dependency] private readonly SharedMoverController _mover = default!; [Dependency] private readonly SharedMoverController _mover = default!;
[Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly SharedStealthSystem _stealth = default!; [Dependency] private readonly SharedStealthSystem _stealth = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly EntityStorageSystem _storage = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -24,6 +32,18 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
SubscribeLocalEvent<CardboardBoxComponent, StorageBeforeCloseEvent>(OnBeforeStorageClosed); SubscribeLocalEvent<CardboardBoxComponent, StorageBeforeCloseEvent>(OnBeforeStorageClosed);
SubscribeLocalEvent<CardboardBoxComponent, StorageAfterOpenEvent>(AfterStorageOpen); SubscribeLocalEvent<CardboardBoxComponent, StorageAfterOpenEvent>(AfterStorageOpen);
SubscribeLocalEvent<CardboardBoxComponent, StorageAfterCloseEvent>(AfterStorageClosed); SubscribeLocalEvent<CardboardBoxComponent, StorageAfterCloseEvent>(AfterStorageClosed);
SubscribeLocalEvent<CardboardBoxComponent, InteractedNoHandEvent>(OnNoHandInteracted);
SubscribeLocalEvent<CardboardBoxComponent, DamageChangedEvent>(OnDamage);
}
private void OnNoHandInteracted(EntityUid uid, CardboardBoxComponent component, InteractedNoHandEvent args)
{
//Free the mice please
if (!TryComp<EntityStorageComponent>(uid, out var box) || box.Open || !box.Contents.Contains(args.User))
return;
_storage.OpenStorage(uid);
} }
private void OnBeforeStorageClosed(EntityUid uid, CardboardBoxComponent component, StorageBeforeCloseEvent args) private void OnBeforeStorageClosed(EntityUid uid, CardboardBoxComponent component, StorageBeforeCloseEvent args)
@@ -75,4 +95,13 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
_stealth.SetEnabled(uid, true, stealth); _stealth.SetEnabled(uid, true, stealth);
} }
} }
//Relay damage to the mover
private void OnDamage(EntityUid uid, CardboardBoxComponent component, DamageChangedEvent args)
{
if (args.DamageDelta != null && args.DamageIncreased)
{
_damageable.TryChangeDamage(component.Mover, args.DamageDelta, origin: args.Origin);
}
}
} }

View File

@@ -70,6 +70,7 @@ namespace Content.Server.Physics.Controllers
{ {
if (moverQuery.TryGetComponent(relayed.RelayEntity, out var relayMover)) if (moverQuery.TryGetComponent(relayed.RelayEntity, out var relayMover))
{ {
relayMover.CanMove = mover.CanMove;
relayMover.RelativeEntity = mover.RelativeEntity; relayMover.RelativeEntity = mover.RelativeEntity;
relayMover.RelativeRotation = mover.RelativeRotation; relayMover.RelativeRotation = mover.RelativeRotation;
relayMover.TargetRelativeRotation = mover.TargetRelativeRotation; relayMover.TargetRelativeRotation = mover.TargetRelativeRotation;

View File

@@ -55,4 +55,26 @@ namespace Content.Shared.Interaction
Target = target; Target = target;
} }
} }
/// <summary>
/// Reverse of the InteractNoHandEvent - raised on what was interacted on, rather than the other way around.
/// </summary>
public sealed class InteractedNoHandEvent : HandledEntityEventArgs, ITargetedInteractEventArgs
{
/// <summary>
/// Entity that was interacted on
/// </summary>
public EntityUid Target { get; }
/// <summary>
/// Entity that triggered this interaction
/// </summary>
public EntityUid User { get; }
public InteractedNoHandEvent(EntityUid target, EntityUid user)
{
Target = target;
User = user;
}
}
} }

View File

@@ -262,6 +262,9 @@ namespace Content.Shared.Interaction
{ {
var ev = new InteractNoHandEvent(user, target.Value); var ev = new InteractNoHandEvent(user, target.Value);
RaiseLocalEvent(user, ev); RaiseLocalEvent(user, ev);
var interactedEv = new InteractedNoHandEvent(target.Value, user);
RaiseLocalEvent(target.Value, interactedEv);
DoContactInteraction(user, target.Value, ev); DoContactInteraction(user, target.Value, ev);
} }
return; return;

View File

@@ -169,7 +169,7 @@ public abstract class SharedStealthSystem : EntitySystem
/// <summary> /// <summary>
private sealed class GetVisibilityModifiersEvent : EntityEventArgs private sealed class GetVisibilityModifiersEvent : EntityEventArgs
{ {
public readonly StealthComponent Stealth = default!; public readonly StealthComponent Stealth;
public readonly float SecondsSinceUpdate; public readonly float SecondsSinceUpdate;
/// <summary> /// <summary>

View File

@@ -239,6 +239,16 @@
categories: categories:
- UplinkUtility - UplinkUtility
- type: listing
id: UplinkStealthBox
name: Stealth Box
description: A box outfitted with stealth technology, sneak around with this and don't move too fast now!
productEntity: StealthBox
cost:
Telecrystal: 10
categories:
- UplinkUtility
#TODO: Increase the price of this to 4-5/remove it when we get encrpytion keys #TODO: Increase the price of this to 4-5/remove it when we get encrpytion keys
- type: listing - type: listing
id: UplinkHeadset id: UplinkHeadset

View File

@@ -23,4 +23,11 @@
supportedTypes: supportedTypes:
- Heat - Heat
- type: damageContainer
id: Box
supportedGroups:
- Brute
- Burn
- Toxin
supportedTypes:
- Shock

View File

@@ -16,7 +16,7 @@
mask: mask:
- MobMask - MobMask
layer: layer:
- SlipLayer - MobLayer
hard: true hard: true
- type: Pullable - type: Pullable
- type: CardboardBox - type: CardboardBox
@@ -25,11 +25,13 @@
- type: EntityStorage - type: EntityStorage
isCollidableWhenOpen: false isCollidableWhenOpen: false
openOnMove: false openOnMove: false
airtight: false airtight: true #true for now until it doesn't make a vacuum
capacity: 4 #4 Entities seems like a nice comfy fit for a cardboard box. capacity: 4 #4 Entities seems like a nice comfy fit for a cardboard box.
- type: ContainerContainer - type: ContainerContainer
containers: containers:
entity_storage: !type:Container entity_storage: !type:Container
- type: Damageable
damageContainer: Box
- type: Sprite - type: Sprite
noRot: true noRot: true
netsync: false netsync: false
@@ -54,6 +56,11 @@
name: cardboard box #it's still just a box name: cardboard box #it's still just a box
description: Kept ya waiting, huh? description: Kept ya waiting, huh?
components: components:
- type: CardboardBox
effectSound: /Audio/Effects/chime.ogg
- type: Damageable
damageContainer: Box
damageModifierSet: FlimsyMetallic #Syndicate boxes should have a bit of protection
- type: Sprite - type: Sprite
noRot: true noRot: true
netsync: false netsync: false
@@ -69,8 +76,8 @@
state_open: cardboard_open state_open: cardboard_open
- type: Stealth - type: Stealth
- type: StealthOnMove - type: StealthOnMove
passiveVisibilityRate: -0.24 passiveVisibilityRate: -0.37
movementVisibilityRate: 0.10 movementVisibilityRate: 0.20
#For admin spawning only #For admin spawning only
- type: entity - type: entity