From 84413f2a4c3be4fa38d04aa48705057984fdb591 Mon Sep 17 00:00:00 2001 From: keronshb <54602815+keronshb@users.noreply.github.com> Date: Thu, 3 Nov 2022 23:16:23 -0400 Subject: [PATCH] Box fixes and Stealth Box in uplink (#12194) --- .../Physics/Controllers/MoverController.cs | 1 + Content.Server/Bed/Sleep/SleepingSystem.cs | 2 -- .../CardboardBox/CardboardBoxSystem.cs | 29 +++++++++++++++++++ .../Physics/Controllers/MoverController.cs | 1 + Content.Shared/Interaction/InteractHand.cs | 22 ++++++++++++++ .../Interaction/SharedInteractionSystem.cs | 3 ++ Content.Shared/Stealth/SharedStealthSystem.cs | 2 +- .../Prototypes/Catalog/uplink_catalog.yml | 10 +++++++ Resources/Prototypes/Damage/containers.yml | 9 +++++- .../Structures/Storage/Closets/big_boxes.yml | 15 +++++++--- 10 files changed, 86 insertions(+), 8 deletions(-) diff --git a/Content.Client/Physics/Controllers/MoverController.cs b/Content.Client/Physics/Controllers/MoverController.cs index 88e6a335c1..7cf1e72255 100644 --- a/Content.Client/Physics/Controllers/MoverController.cs +++ b/Content.Client/Physics/Controllers/MoverController.cs @@ -59,6 +59,7 @@ namespace Content.Client.Physics.Controllers if (TryComp(player, out var mover) && TryComp(relayMover.RelayEntity, out var relayed)) { + relayed.CanMove = mover.CanMove; relayed.RelativeEntity = mover.RelativeEntity; relayed.RelativeRotation = mover.RelativeRotation; relayed.TargetRelativeRotation = mover.RelativeRotation; diff --git a/Content.Server/Bed/Sleep/SleepingSystem.cs b/Content.Server/Bed/Sleep/SleepingSystem.cs index c7f7e4f036..209b135df0 100644 --- a/Content.Server/Bed/Sleep/SleepingSystem.cs +++ b/Content.Server/Bed/Sleep/SleepingSystem.cs @@ -1,5 +1,4 @@ using Content.Server.Actions; -using Content.Server.MobState; using Content.Server.Popups; using Content.Server.Sound.Components; using Content.Shared.Actions.ActionTypes; @@ -26,7 +25,6 @@ namespace Content.Server.Bed.Sleep [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly ActionsSystem _actionsSystem = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; - [Dependency] private readonly MobStateSystem _mobStateSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; diff --git a/Content.Server/CardboardBox/CardboardBoxSystem.cs b/Content.Server/CardboardBox/CardboardBoxSystem.cs index 50ee49a24e..4b49dc902c 100644 --- a/Content.Server/CardboardBox/CardboardBoxSystem.cs +++ b/Content.Server/CardboardBox/CardboardBoxSystem.cs @@ -1,13 +1,18 @@ using System.Linq; using Content.Shared.CardboardBox.Components; using Content.Server.Storage.Components; +using Content.Server.Storage.EntitySystems; 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.Systems; using Robust.Shared.Player; using Robust.Shared.Timing; using Content.Shared.Stealth.Components; using Content.Shared.Stealth; +using Robust.Shared.Prototypes; namespace Content.Server.CardboardBox; @@ -17,6 +22,9 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem [Dependency] private readonly SharedMoverController _mover = default!; [Dependency] private readonly IGameTiming _timing = 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() { @@ -24,6 +32,18 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem SubscribeLocalEvent(OnBeforeStorageClosed); SubscribeLocalEvent(AfterStorageOpen); SubscribeLocalEvent(AfterStorageClosed); + SubscribeLocalEvent(OnNoHandInteracted); + + SubscribeLocalEvent(OnDamage); + } + + private void OnNoHandInteracted(EntityUid uid, CardboardBoxComponent component, InteractedNoHandEvent args) + { + //Free the mice please + if (!TryComp(uid, out var box) || box.Open || !box.Contents.Contains(args.User)) + return; + + _storage.OpenStorage(uid); } private void OnBeforeStorageClosed(EntityUid uid, CardboardBoxComponent component, StorageBeforeCloseEvent args) @@ -75,4 +95,13 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem _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); + } + } } diff --git a/Content.Server/Physics/Controllers/MoverController.cs b/Content.Server/Physics/Controllers/MoverController.cs index 93eda974a2..0793b07e77 100644 --- a/Content.Server/Physics/Controllers/MoverController.cs +++ b/Content.Server/Physics/Controllers/MoverController.cs @@ -70,6 +70,7 @@ namespace Content.Server.Physics.Controllers { if (moverQuery.TryGetComponent(relayed.RelayEntity, out var relayMover)) { + relayMover.CanMove = mover.CanMove; relayMover.RelativeEntity = mover.RelativeEntity; relayMover.RelativeRotation = mover.RelativeRotation; relayMover.TargetRelativeRotation = mover.TargetRelativeRotation; diff --git a/Content.Shared/Interaction/InteractHand.cs b/Content.Shared/Interaction/InteractHand.cs index 8fc4053d35..00a16e2398 100644 --- a/Content.Shared/Interaction/InteractHand.cs +++ b/Content.Shared/Interaction/InteractHand.cs @@ -55,4 +55,26 @@ namespace Content.Shared.Interaction Target = target; } } + + /// + /// Reverse of the InteractNoHandEvent - raised on what was interacted on, rather than the other way around. + /// + public sealed class InteractedNoHandEvent : HandledEntityEventArgs, ITargetedInteractEventArgs + { + /// + /// Entity that was interacted on + /// + public EntityUid Target { get; } + + /// + /// Entity that triggered this interaction + /// + public EntityUid User { get; } + + public InteractedNoHandEvent(EntityUid target, EntityUid user) + { + Target = target; + User = user; + } + } } diff --git a/Content.Shared/Interaction/SharedInteractionSystem.cs b/Content.Shared/Interaction/SharedInteractionSystem.cs index 45b8e9c204..86d721cb43 100644 --- a/Content.Shared/Interaction/SharedInteractionSystem.cs +++ b/Content.Shared/Interaction/SharedInteractionSystem.cs @@ -262,6 +262,9 @@ namespace Content.Shared.Interaction { var ev = new InteractNoHandEvent(user, target.Value); RaiseLocalEvent(user, ev); + + var interactedEv = new InteractedNoHandEvent(target.Value, user); + RaiseLocalEvent(target.Value, interactedEv); DoContactInteraction(user, target.Value, ev); } return; diff --git a/Content.Shared/Stealth/SharedStealthSystem.cs b/Content.Shared/Stealth/SharedStealthSystem.cs index b46344b609..46d04beaff 100644 --- a/Content.Shared/Stealth/SharedStealthSystem.cs +++ b/Content.Shared/Stealth/SharedStealthSystem.cs @@ -169,7 +169,7 @@ public abstract class SharedStealthSystem : EntitySystem /// private sealed class GetVisibilityModifiersEvent : EntityEventArgs { - public readonly StealthComponent Stealth = default!; + public readonly StealthComponent Stealth; public readonly float SecondsSinceUpdate; /// diff --git a/Resources/Prototypes/Catalog/uplink_catalog.yml b/Resources/Prototypes/Catalog/uplink_catalog.yml index bfa36edccd..933f792e62 100644 --- a/Resources/Prototypes/Catalog/uplink_catalog.yml +++ b/Resources/Prototypes/Catalog/uplink_catalog.yml @@ -239,6 +239,16 @@ categories: - 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 - type: listing id: UplinkHeadset diff --git a/Resources/Prototypes/Damage/containers.yml b/Resources/Prototypes/Damage/containers.yml index 523edd88ff..8b70bc2e5b 100644 --- a/Resources/Prototypes/Damage/containers.yml +++ b/Resources/Prototypes/Damage/containers.yml @@ -23,4 +23,11 @@ supportedTypes: - Heat - +- type: damageContainer + id: Box + supportedGroups: + - Brute + - Burn + - Toxin + supportedTypes: + - Shock diff --git a/Resources/Prototypes/Entities/Structures/Storage/Closets/big_boxes.yml b/Resources/Prototypes/Entities/Structures/Storage/Closets/big_boxes.yml index aca016f6e4..d7ff23fbef 100644 --- a/Resources/Prototypes/Entities/Structures/Storage/Closets/big_boxes.yml +++ b/Resources/Prototypes/Entities/Structures/Storage/Closets/big_boxes.yml @@ -16,7 +16,7 @@ mask: - MobMask layer: - - SlipLayer + - MobLayer hard: true - type: Pullable - type: CardboardBox @@ -25,11 +25,13 @@ - type: EntityStorage isCollidableWhenOpen: 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. - type: ContainerContainer containers: entity_storage: !type:Container + - type: Damageable + damageContainer: Box - type: Sprite noRot: true netsync: false @@ -54,6 +56,11 @@ name: cardboard box #it's still just a box description: Kept ya waiting, huh? components: + - type: CardboardBox + effectSound: /Audio/Effects/chime.ogg + - type: Damageable + damageContainer: Box + damageModifierSet: FlimsyMetallic #Syndicate boxes should have a bit of protection - type: Sprite noRot: true netsync: false @@ -69,8 +76,8 @@ state_open: cardboard_open - type: Stealth - type: StealthOnMove - passiveVisibilityRate: -0.24 - movementVisibilityRate: 0.10 + passiveVisibilityRate: -0.37 + movementVisibilityRate: 0.20 #For admin spawning only - type: entity