Exosuit: Ripley (#12668)
* mechs * interaction relay * atmos handling * fuck around with interaction events SPAGHETTI CODE OH MY GOD * more sprites and whatever the hell * more mech shit * more shit for equipment * starting equipment (for nukie mechs and such) * equipment cycling * starting with some of the ui * a fat chunk of ui prototyping * done tinkering with ui * a bunch of ui stuff and what have yous * cleaning up grabber and state handling * make the ui actually functional + watch me port a million icons I swear i'll prune the sprites later blease * start on construction * construction yo mamma * remove some unused files * fix a silly * make the graph sane * make it actually constructible. * print the boards as well, bozo * rebalance part prices * eject action also i appease the russians by remembering to localize * Punch Shit * make mech integrity and repairs work * Make the UI more based STOMP STOMP STOMP STOMP * make equipment even more based * batteries and other such delights * make the ui look pimpin af * make the construction mega based * UI but so epic * equipment * some sweat tweaks * damage rebalancing * restructure tech * fix some shit * mechs inherit access * make icons actually use sprite specifiers * TRAILING COMMAA!!!!! * fix a mild indentation sin * undo this change because it isn't needed * actually fix this * secret webeditting shhhh * place this tech here * comments * foo
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Interaction.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Relays an entities interactions to another entity.
|
||||
/// This doesn't raise the same events, but just relays
|
||||
/// the clicks of the mouse.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[Access(typeof(SharedInteractionSystem))]
|
||||
public sealed class InteractionRelayComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The entity the interactions are being relayed to.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public EntityUid? RelayEntity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Contains network state for <see cref="InteractionRelayComponent"/>
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class InteractionRelayComponentState : ComponentState
|
||||
{
|
||||
public EntityUid? RelayEntity;
|
||||
|
||||
public InteractionRelayComponentState(EntityUid? relayEntity)
|
||||
{
|
||||
RelayEntity = relayEntity;
|
||||
}
|
||||
}
|
||||
@@ -18,4 +18,20 @@ namespace Content.Shared.Interaction.Events
|
||||
Target = target;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raised directed at an entity to check if they can attack while inside of a container.
|
||||
/// </summary>
|
||||
public sealed class CanAttackFromContainerEvent : EntityEventArgs
|
||||
{
|
||||
public EntityUid Uid;
|
||||
public EntityUid? Target;
|
||||
public bool CanAttack = false;
|
||||
|
||||
public CanAttackFromContainerEvent(EntityUid uid, EntityUid? target = null)
|
||||
{
|
||||
Uid = uid;
|
||||
Target = target;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Shared.Interaction
|
||||
{
|
||||
@@ -37,44 +38,57 @@ namespace Content.Shared.Interaction
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class InteractNoHandEvent : HandledEntityEventArgs, ITargetedInteractEventArgs
|
||||
/// <summary>
|
||||
/// Low-level interaction event used for entities without hands.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// SHIT IS CURSED.
|
||||
/// </remarks>
|
||||
//TODO: KILLLLLLL
|
||||
public sealed class InteractNoHandEvent : HandledEntityEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Entity that triggered the interaction.
|
||||
/// </summary>
|
||||
public EntityUid User { get; }
|
||||
public EntityUid User;
|
||||
|
||||
/// <summary>
|
||||
/// Entity that was interacted on.
|
||||
/// </summary>
|
||||
public EntityUid Target { get; }
|
||||
public EntityUid? Target;
|
||||
|
||||
public InteractNoHandEvent(EntityUid user, EntityUid target)
|
||||
public EntityCoordinates ClickLocation;
|
||||
|
||||
public InteractNoHandEvent(EntityUid user, EntityUid? target, EntityCoordinates clickLocation)
|
||||
{
|
||||
User = user;
|
||||
Target = target;
|
||||
ClickLocation = clickLocation;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reverse of the InteractNoHandEvent - raised on what was interacted on, rather than the other way around.
|
||||
/// </summary>
|
||||
public sealed class InteractedNoHandEvent : HandledEntityEventArgs, ITargetedInteractEventArgs
|
||||
public sealed class InteractedNoHandEvent : HandledEntityEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Entity that was interacted on
|
||||
/// </summary>
|
||||
public EntityUid Target { get; }
|
||||
public EntityUid Target;
|
||||
|
||||
/// <summary>
|
||||
/// Entity that triggered this interaction
|
||||
/// </summary>
|
||||
public EntityUid User { get; }
|
||||
public EntityUid User;
|
||||
|
||||
public InteractedNoHandEvent(EntityUid target, EntityUid user)
|
||||
public EntityCoordinates ClickLocation;
|
||||
|
||||
public InteractedNoHandEvent(EntityUid target, EntityUid user, EntityCoordinates clickLocation)
|
||||
{
|
||||
Target = target;
|
||||
User = user;
|
||||
ClickLocation = clickLocation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
35
Content.Shared/Interaction/SharedInteractionSystem.Relay.cs
Normal file
35
Content.Shared/Interaction/SharedInteractionSystem.Relay.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Content.Shared.Interaction.Components;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Interaction;
|
||||
|
||||
public abstract partial class SharedInteractionSystem
|
||||
{
|
||||
public void InitializeRelay()
|
||||
{
|
||||
SubscribeLocalEvent<InteractionRelayComponent, ComponentGetState>(OnGetState);
|
||||
SubscribeLocalEvent<InteractionRelayComponent, ComponentHandleState>(OnHandleState);
|
||||
}
|
||||
|
||||
private void OnGetState(EntityUid uid, InteractionRelayComponent component, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new InteractionRelayComponentState(component.RelayEntity);
|
||||
}
|
||||
|
||||
private void OnHandleState(EntityUid uid, InteractionRelayComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not InteractionRelayComponentState state)
|
||||
return;
|
||||
|
||||
component.RelayEntity = state.RelayEntity;
|
||||
}
|
||||
|
||||
public void SetRelay(EntityUid uid, EntityUid? relayEntity, InteractionRelayComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
return;
|
||||
|
||||
component.RelayEntity = relayEntity;
|
||||
Dirty(component);
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ namespace Content.Shared.Interaction
|
||||
/// Governs interactions during clicking on entities
|
||||
/// </summary>
|
||||
[UsedImplicitly]
|
||||
public abstract class SharedInteractionSystem : EntitySystem
|
||||
public abstract partial class SharedInteractionSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
@@ -81,6 +81,8 @@ namespace Content.Shared.Interaction
|
||||
.Bind(ContentKeyFunctions.TryPullObject,
|
||||
new PointerInputCmdHandler(HandleTryPullObject))
|
||||
.Register<SharedInteractionSystem>();
|
||||
|
||||
InitializeRelay();
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
@@ -224,6 +226,11 @@ namespace Content.Shared.Interaction
|
||||
bool checkAccess = true,
|
||||
bool checkCanUse = true)
|
||||
{
|
||||
if (TryComp<InteractionRelayComponent>(user, out var relay) && relay.RelayEntity is not null)
|
||||
{
|
||||
UserInteraction(relay.RelayEntity.Value, coordinates, target, altInteract, checkCanInteract, checkAccess, checkCanUse);
|
||||
}
|
||||
|
||||
if (target != null && Deleted(target.Value))
|
||||
return;
|
||||
|
||||
@@ -255,25 +262,25 @@ namespace Content.Shared.Interaction
|
||||
&& !CanAccessViaStorage(user, target.Value))
|
||||
return;
|
||||
|
||||
var inRangeUnobstructed = target == null
|
||||
? !checkAccess || InRangeUnobstructed(user, coordinates)
|
||||
: !checkAccess || InRangeUnobstructed(user, target.Value); // permits interactions with wall mounted entities
|
||||
|
||||
// Does the user have hands?
|
||||
if (!TryComp(user, out SharedHandsComponent? hands) || hands.ActiveHand == null)
|
||||
{
|
||||
var ev = new InteractNoHandEvent(user, target, coordinates);
|
||||
RaiseLocalEvent(user, ev);
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
var ev = new InteractNoHandEvent(user, target.Value);
|
||||
RaiseLocalEvent(user, ev);
|
||||
|
||||
var interactedEv = new InteractedNoHandEvent(target.Value, user);
|
||||
var interactedEv = new InteractedNoHandEvent(target.Value, user, coordinates);
|
||||
RaiseLocalEvent(target.Value, interactedEv);
|
||||
DoContactInteraction(user, target.Value, ev);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var inRangeUnobstructed = target == null
|
||||
? !checkAccess || InRangeUnobstructed(user, coordinates)
|
||||
: !checkAccess || InRangeUnobstructed(user, target.Value); // permits interactions with wall mounted entities
|
||||
|
||||
// empty-hand interactions
|
||||
if (hands.ActiveHandEntity is not { } held)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user