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) &&
TryComp<InputMoverComponent>(relayMover.RelayEntity, out var relayed))
{
relayed.CanMove = mover.CanMove;
relayed.RelativeEntity = mover.RelativeEntity;
relayed.RelativeRotation = mover.RelativeRotation;
relayed.TargetRelativeRotation = mover.RelativeRotation;

View File

@@ -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!;

View File

@@ -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<CardboardBoxComponent, StorageBeforeCloseEvent>(OnBeforeStorageClosed);
SubscribeLocalEvent<CardboardBoxComponent, StorageAfterOpenEvent>(AfterStorageOpen);
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)
@@ -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);
}
}
}

View File

@@ -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;

View File

@@ -55,4 +55,26 @@ namespace Content.Shared.Interaction
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);
RaiseLocalEvent(user, ev);
var interactedEv = new InteractedNoHandEvent(target.Value, user);
RaiseLocalEvent(target.Value, interactedEv);
DoContactInteraction(user, target.Value, ev);
}
return;

View File

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

View File

@@ -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

View File

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

View File

@@ -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