Convert almost all IActivate instances that open UIs to ActivatableUI (#7028)
* Chem master * Drone support for handhelds * Vending machines, scanners * Cloners, R&D computers * make research a little less sussy * Unfuck wires * PA control computer * Unfuck merge * Clean up git gore for good * Disposals * Microwaves * paper * Magic mirror * More vendors for drones * Solar computer whitelist * EFR review updates
This commit is contained in:
@@ -14,19 +14,13 @@ using Content.Shared.Sound;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
|
|
||||||
namespace Content.Server.AME.Components
|
namespace Content.Server.AME.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
|
||||||
[ComponentReference(typeof(IInteractUsing))]
|
[ComponentReference(typeof(IInteractUsing))]
|
||||||
public sealed class AMEControllerComponent : SharedAMEControllerComponent, IActivate, IInteractUsing
|
public sealed class AMEControllerComponent : SharedAMEControllerComponent, IInteractUsing
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entities = default!;
|
[Dependency] private readonly IEntityManager _entities = default!;
|
||||||
|
|
||||||
@@ -115,30 +109,6 @@ namespace Content.Server.AME.Components
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when you click the owner entity with an empty hand. Opens the UI client-side if possible.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="args">Data relevant to the event such as the actor which triggered it.</param>
|
|
||||||
void IActivate.Activate(ActivateEventArgs args)
|
|
||||||
{
|
|
||||||
if (!_entities.TryGetComponent(args.User, out ActorComponent? actor))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_entities.TryGetComponent(args.User, out HandsComponent? hands))
|
|
||||||
{
|
|
||||||
Owner.PopupMessage(args.User, Loc.GetString("ame-controller-component-interact-no-hands-text"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var activeHandEntity = hands.GetActiveHandItem?.Owner;
|
|
||||||
if (activeHandEntity == null)
|
|
||||||
{
|
|
||||||
UserInterface?.Open(actor.PlayerSession);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnPowerChanged(PowerChangedMessage e)
|
private void OnPowerChanged(PowerChangedMessage e)
|
||||||
{
|
{
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
|
|||||||
@@ -1,18 +1,40 @@
|
|||||||
using System.Collections.Generic;
|
using System.Linq;
|
||||||
using System.Linq;
|
|
||||||
using Content.Server.Arcade.Components;
|
using Content.Server.Arcade.Components;
|
||||||
|
using Content.Server.UserInterface;
|
||||||
using Content.Shared.Arcade;
|
using Content.Shared.Arcade;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
using Robust.Server.GameObjects;
|
||||||
|
|
||||||
|
|
||||||
namespace Content.Server.Arcade
|
namespace Content.Server.Arcade
|
||||||
{
|
{
|
||||||
// ReSharper disable once ClassNeverInstantiated.Global
|
// ReSharper disable once ClassNeverInstantiated.Global
|
||||||
public sealed class BlockGameSystem : EntitySystem
|
public sealed class ArcadeSystem : EntitySystem
|
||||||
{
|
{
|
||||||
private readonly List<BlockGameMessages.HighScoreEntry> _roundHighscores = new();
|
private readonly List<BlockGameMessages.HighScoreEntry> _roundHighscores = new();
|
||||||
private readonly List<BlockGameMessages.HighScoreEntry> _globalHighscores = new();
|
private readonly List<BlockGameMessages.HighScoreEntry> _globalHighscores = new();
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
SubscribeLocalEvent<BlockGameArcadeComponent, AfterActivatableUIOpenEvent>(OnAfterUIOpen);
|
||||||
|
SubscribeLocalEvent<SpaceVillainArcadeComponent, AfterActivatableUIOpenEvent>(OnAfterUIOpenSV);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnAfterUIOpen(EntityUid uid, BlockGameArcadeComponent component, AfterActivatableUIOpenEvent args)
|
||||||
|
{
|
||||||
|
var actor = Comp<ActorComponent>(args.User);
|
||||||
|
if (component.UserInterface?.SessionHasOpen(actor.PlayerSession) == true)
|
||||||
|
{
|
||||||
|
component.RegisterPlayerSession(actor.PlayerSession);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnAfterUIOpenSV(EntityUid uid, SpaceVillainArcadeComponent component, AfterActivatableUIOpenEvent args)
|
||||||
|
{
|
||||||
|
component.Game ??= new SpaceVillainArcadeComponent.SpaceVillainGame(component);
|
||||||
|
}
|
||||||
|
|
||||||
public HighScorePlacement RegisterHighScore(string name, int score)
|
public HighScorePlacement RegisterHighScore(string name, int score)
|
||||||
{
|
{
|
||||||
var entry = new BlockGameMessages.HighScoreEntry(name, score);
|
var entry = new BlockGameMessages.HighScoreEntry(name, score);
|
||||||
@@ -1,29 +1,22 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
using Content.Shared.ActionBlocker;
|
|
||||||
using Content.Shared.Arcade;
|
using Content.Shared.Arcade;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.Arcade.Components
|
namespace Content.Server.Arcade.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
public sealed class BlockGameArcadeComponent : Component
|
||||||
public sealed class BlockGameArcadeComponent : Component, IActivate
|
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
|
|
||||||
private bool Powered => _entityManager.TryGetComponent<ApcPowerReceiverComponent>(Owner, out var powerReceiverComponent) && powerReceiverComponent.Powered;
|
public bool Powered => _entityManager.TryGetComponent<ApcPowerReceiverComponent>(Owner, out var powerReceiverComponent) && powerReceiverComponent.Powered;
|
||||||
private BoundUserInterface? UserInterface => Owner.GetUIOrNull(BlockGameUiKey.Key);
|
public BoundUserInterface? UserInterface => Owner.GetUIOrNull(BlockGameUiKey.Key);
|
||||||
|
|
||||||
private BlockGame? _game;
|
private BlockGame? _game;
|
||||||
|
|
||||||
@@ -44,19 +37,7 @@ namespace Content.Server.Arcade.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
public void RegisterPlayerSession(IPlayerSession session)
|
||||||
{
|
|
||||||
if(!Powered || !IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
|
||||||
return;
|
|
||||||
|
|
||||||
UserInterface?.Toggle(actor.PlayerSession);
|
|
||||||
if (UserInterface?.SessionHasOpen(actor.PlayerSession) == true)
|
|
||||||
{
|
|
||||||
RegisterPlayerSession(actor.PlayerSession);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RegisterPlayerSession(IPlayerSession session)
|
|
||||||
{
|
{
|
||||||
if (_player == null) _player = session;
|
if (_player == null) _player = session;
|
||||||
else _spectators.Add(session);
|
else _spectators.Add(session);
|
||||||
@@ -233,7 +214,7 @@ namespace Content.Server.Arcade.Components
|
|||||||
}
|
}
|
||||||
private int _internalPoints;
|
private int _internalPoints;
|
||||||
|
|
||||||
private BlockGameSystem.HighScorePlacement? _highScorePlacement = null;
|
private ArcadeSystem.HighScorePlacement? _highScorePlacement = null;
|
||||||
|
|
||||||
private void SendPointsUpdate()
|
private void SendPointsUpdate()
|
||||||
{
|
{
|
||||||
@@ -292,13 +273,13 @@ namespace Content.Server.Arcade.Components
|
|||||||
|
|
||||||
private void SendHighscoreUpdate()
|
private void SendHighscoreUpdate()
|
||||||
{
|
{
|
||||||
var entitySystem = EntitySystem.Get<BlockGameSystem>();
|
var entitySystem = EntitySystem.Get<ArcadeSystem>();
|
||||||
_component.UserInterface?.SendMessage(new BlockGameMessages.BlockGameHighScoreUpdateMessage(entitySystem.GetLocalHighscores(), entitySystem.GetGlobalHighscores()));
|
_component.UserInterface?.SendMessage(new BlockGameMessages.BlockGameHighScoreUpdateMessage(entitySystem.GetLocalHighscores(), entitySystem.GetGlobalHighscores()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendHighscoreUpdate(IPlayerSession session)
|
private void SendHighscoreUpdate(IPlayerSession session)
|
||||||
{
|
{
|
||||||
var entitySystem = EntitySystem.Get<BlockGameSystem>();
|
var entitySystem = EntitySystem.Get<ArcadeSystem>();
|
||||||
_component.UserInterface?.SendMessage(new BlockGameMessages.BlockGameHighScoreUpdateMessage(entitySystem.GetLocalHighscores(), entitySystem.GetGlobalHighscores()), session);
|
_component.UserInterface?.SendMessage(new BlockGameMessages.BlockGameHighScoreUpdateMessage(entitySystem.GetLocalHighscores(), entitySystem.GetGlobalHighscores()), session);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -656,7 +637,7 @@ namespace Content.Server.Arcade.Components
|
|||||||
|
|
||||||
if (_component._player?.AttachedEntity is {Valid: true} playerEntity)
|
if (_component._player?.AttachedEntity is {Valid: true} playerEntity)
|
||||||
{
|
{
|
||||||
var blockGameSystem = EntitySystem.Get<BlockGameSystem>();
|
var blockGameSystem = EntitySystem.Get<ArcadeSystem>();
|
||||||
|
|
||||||
_highScorePlacement = blockGameSystem.RegisterHighScore(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(playerEntity).EntityName, Points);
|
_highScorePlacement = blockGameSystem.RegisterHighScore(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(playerEntity).EntityName, Points);
|
||||||
SendHighscoreUpdate();
|
SendHighscoreUpdate();
|
||||||
|
|||||||
@@ -1,32 +1,22 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
using Content.Server.VendingMachines;
|
using Content.Server.VendingMachines;
|
||||||
using Content.Server.WireHacking;
|
using Content.Server.WireHacking;
|
||||||
using Content.Shared.ActionBlocker;
|
|
||||||
using Content.Shared.Arcade;
|
using Content.Shared.Arcade;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Sound;
|
using Content.Shared.Sound;
|
||||||
using Content.Shared.Wires;
|
using Content.Shared.Wires;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
|
|
||||||
namespace Content.Server.Arcade.Components
|
namespace Content.Server.Arcade.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
public sealed class SpaceVillainArcadeComponent : SharedSpaceVillainArcadeComponent, IWires
|
||||||
public sealed class SpaceVillainArcadeComponent : SharedSpaceVillainArcadeComponent, IActivate, IWires
|
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IRobustRandom _random = null!;
|
[Dependency] private readonly IRobustRandom _random = null!;
|
||||||
|
|
||||||
@@ -37,7 +27,7 @@ namespace Content.Server.Arcade.Components
|
|||||||
[ViewVariables] private bool _overflowFlag;
|
[ViewVariables] private bool _overflowFlag;
|
||||||
[ViewVariables] private bool _playerInvincibilityFlag;
|
[ViewVariables] private bool _playerInvincibilityFlag;
|
||||||
[ViewVariables] private bool _enemyInvincibilityFlag;
|
[ViewVariables] private bool _enemyInvincibilityFlag;
|
||||||
[ViewVariables] private SpaceVillainGame _game = null!;
|
[ViewVariables] public SpaceVillainGame Game = null!;
|
||||||
|
|
||||||
[DataField("newGameSound")] private SoundSpecifier _newGameSound = new SoundPathSpecifier("/Audio/Effects/Arcade/newgame.ogg");
|
[DataField("newGameSound")] private SoundSpecifier _newGameSound = new SoundPathSpecifier("/Audio/Effects/Arcade/newgame.ogg");
|
||||||
[DataField("playerAttackSound")] private SoundSpecifier _playerAttackSound = new SoundPathSpecifier("/Audio/Effects/Arcade/player_attack.ogg");
|
[DataField("playerAttackSound")] private SoundSpecifier _playerAttackSound = new SoundPathSpecifier("/Audio/Effects/Arcade/player_attack.ogg");
|
||||||
@@ -72,22 +62,6 @@ namespace Content.Server.Arcade.Components
|
|||||||
"ToyPhazon", "ToyFireRipley", "ToyReticence", "ToyRipley", "ToySeraph", "ToyDurand", "ToySkeleton"
|
"ToyPhazon", "ToyFireRipley", "ToyReticence", "ToyRipley", "ToySeraph", "ToyDurand", "ToySkeleton"
|
||||||
};
|
};
|
||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
|
||||||
{
|
|
||||||
if (!Powered || !IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
|
||||||
return;
|
|
||||||
|
|
||||||
_game ??= new SpaceVillainGame(this);
|
|
||||||
|
|
||||||
if (_entityManager.TryGetComponent<WiresComponent>(Owner, out var wiresComponent) && wiresComponent.IsPanelOpen)
|
|
||||||
{
|
|
||||||
wiresComponent.OpenInterface(actor.PlayerSession);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UserInterface?.Toggle(actor.PlayerSession);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Initialize()
|
protected override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -131,22 +105,22 @@ namespace Content.Server.Arcade.Components
|
|||||||
switch (msg.PlayerAction)
|
switch (msg.PlayerAction)
|
||||||
{
|
{
|
||||||
case PlayerAction.Attack:
|
case PlayerAction.Attack:
|
||||||
_game?.ExecutePlayerAction(msg.PlayerAction);
|
Game?.ExecutePlayerAction(msg.PlayerAction);
|
||||||
break;
|
break;
|
||||||
case PlayerAction.Heal:
|
case PlayerAction.Heal:
|
||||||
_game?.ExecutePlayerAction(msg.PlayerAction);
|
Game?.ExecutePlayerAction(msg.PlayerAction);
|
||||||
break;
|
break;
|
||||||
case PlayerAction.Recharge:
|
case PlayerAction.Recharge:
|
||||||
_game?.ExecutePlayerAction(msg.PlayerAction);
|
Game?.ExecutePlayerAction(msg.PlayerAction);
|
||||||
break;
|
break;
|
||||||
case PlayerAction.NewGame:
|
case PlayerAction.NewGame:
|
||||||
SoundSystem.Play(Filter.Pvs(Owner), _newGameSound.GetSound(), Owner, AudioParams.Default.WithVolume(-4f));
|
SoundSystem.Play(Filter.Pvs(Owner), _newGameSound.GetSound(), Owner, AudioParams.Default.WithVolume(-4f));
|
||||||
|
|
||||||
_game = new SpaceVillainGame(this);
|
Game = new SpaceVillainGame(this);
|
||||||
UserInterface?.SendMessage(_game.GenerateMetaDataMessage());
|
UserInterface?.SendMessage(Game.GenerateMetaDataMessage());
|
||||||
break;
|
break;
|
||||||
case PlayerAction.RequestData:
|
case PlayerAction.RequestData:
|
||||||
UserInterface?.SendMessage(_game.GenerateMetaDataMessage());
|
UserInterface?.SendMessage(Game.GenerateMetaDataMessage());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.Atmos.EntitySystems;
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Hands.Components;
|
using Content.Server.Hands.Components;
|
||||||
@@ -9,18 +8,13 @@ using Content.Shared.Interaction;
|
|||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Components
|
namespace Content.Server.Atmos.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
|
||||||
[ComponentReference(typeof(SharedGasAnalyzerComponent))]
|
[ComponentReference(typeof(SharedGasAnalyzerComponent))]
|
||||||
public sealed class GasAnalyzerComponent : SharedGasAnalyzerComponent, IAfterInteract, IDropped, IActivate
|
public sealed class GasAnalyzerComponent : SharedGasAnalyzerComponent, IAfterInteract, IDropped
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entities = default!;
|
[Dependency] private readonly IEntityManager _entities = default!;
|
||||||
|
|
||||||
@@ -263,8 +257,6 @@ namespace Content.Server.Atmos.Components
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void IDropped.Dropped(DroppedEventArgs eventArgs)
|
void IDropped.Dropped(DroppedEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (_entities.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
if (_entities.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||||
@@ -272,15 +264,5 @@ namespace Content.Server.Atmos.Components
|
|||||||
CloseInterface(actor.PlayerSession);
|
CloseInterface(actor.PlayerSession);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
|
||||||
{
|
|
||||||
if (_entities.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
|
||||||
{
|
|
||||||
ToggleInterface(actor.PlayerSession);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,8 @@ using Robust.Shared.Utility;
|
|||||||
namespace Content.Server.Atmos.Components
|
namespace Content.Server.Atmos.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
|
||||||
#pragma warning disable 618
|
#pragma warning disable 618
|
||||||
public sealed class GasTankComponent : Component, IExamine, IGasMixtureHolder, IDropped, IActivate
|
public sealed class GasTankComponent : Component, IExamine, IGasMixtureHolder, IDropped
|
||||||
#pragma warning restore 618
|
#pragma warning restore 618
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
@@ -147,12 +146,6 @@ namespace Content.Server.Atmos.Components
|
|||||||
return air;
|
return air;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
|
||||||
{
|
|
||||||
if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor)) return;
|
|
||||||
OpenInterface(actor.PlayerSession);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ConnectToInternals()
|
public void ConnectToInternals()
|
||||||
{
|
{
|
||||||
if (IsConnected || !IsFunctional) return;
|
if (IsConnected || !IsFunctional) return;
|
||||||
|
|||||||
@@ -1,45 +1,16 @@
|
|||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
using Content.Shared.Body.Components;
|
using Content.Shared.Body.Components;
|
||||||
using Content.Shared.Interaction;
|
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
|
|
||||||
namespace Content.Server.Body.Components
|
namespace Content.Server.Body.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
|
||||||
[ComponentReference(typeof(SharedBodyScannerComponent))]
|
[ComponentReference(typeof(SharedBodyScannerComponent))]
|
||||||
public sealed class BodyScannerComponent : SharedBodyScannerComponent, IActivate
|
public sealed class BodyScannerComponent : SharedBodyScannerComponent
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(BodyScannerUiKey.Key);
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(BodyScannerUiKey.Key);
|
||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
|
||||||
{
|
|
||||||
if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var session = actor.PlayerSession;
|
|
||||||
|
|
||||||
if (session.AttachedEntity == default)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_entMan.TryGetComponent(session.AttachedEntity, out SharedBodyComponent? body))
|
|
||||||
{
|
|
||||||
var state = InterfaceState(body);
|
|
||||||
UserInterface?.SetState(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
UserInterface?.Open(session);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Initialize()
|
protected override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|||||||
@@ -2,25 +2,17 @@ using Content.Server.CharacterAppearance.Systems;
|
|||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
using Content.Shared.CharacterAppearance;
|
using Content.Shared.CharacterAppearance;
|
||||||
using Content.Shared.CharacterAppearance.Components;
|
using Content.Shared.CharacterAppearance.Components;
|
||||||
using Content.Shared.Interaction;
|
|
||||||
using Content.Shared.Popups;
|
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
|
|
||||||
namespace Content.Server.CharacterAppearance.Components
|
namespace Content.Server.CharacterAppearance.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
public sealed class MagicMirrorComponent : SharedMagicMirrorComponent
|
||||||
public sealed class MagicMirrorComponent : SharedMagicMirrorComponent, IActivate
|
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entities = default!;
|
[Dependency] private readonly IEntityManager _entities = default!;
|
||||||
[Dependency] private readonly SpriteAccessoryManager _spriteAccessoryManager = default!;
|
[Dependency] private readonly SpriteAccessoryManager _spriteAccessoryManager = default!;
|
||||||
|
|
||||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(MagicMirrorUiKey.Key);
|
[ViewVariables] public BoundUserInterface? UserInterface => Owner.GetUIOrNull(MagicMirrorUiKey.Key);
|
||||||
|
|
||||||
protected override void Initialize()
|
protected override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -94,36 +86,5 @@ namespace Content.Server.CharacterAppearance.Components
|
|||||||
|
|
||||||
EntitySystem.Get<HumanoidAppearanceSystem>().ForceAppearanceUpdate(player);
|
EntitySystem.Get<HumanoidAppearanceSystem>().ForceAppearanceUpdate(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
|
||||||
{
|
|
||||||
if (!_entities.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_entities.TryGetComponent(eventArgs.User, out HumanoidAppearanceComponent? looks))
|
|
||||||
{
|
|
||||||
Owner.PopupMessage(eventArgs.User, Loc.GetString("magic-mirror-component-activate-user-has-no-hair"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserInterface?.Toggle(actor.PlayerSession);
|
|
||||||
|
|
||||||
var appearance = looks.Appearance;
|
|
||||||
|
|
||||||
var msg = new MagicMirrorInitialDataMessage(
|
|
||||||
appearance.HairColor,
|
|
||||||
appearance.FacialHairColor,
|
|
||||||
appearance.HairStyleId,
|
|
||||||
appearance.FacialHairStyleId,
|
|
||||||
appearance.EyeColor,
|
|
||||||
looks.CategoriesHair,
|
|
||||||
looks.CategoriesFacialHair,
|
|
||||||
looks.CanColorHair,
|
|
||||||
looks.CanColorFacialHair);
|
|
||||||
|
|
||||||
UserInterface?.SendMessage(msg, actor.PlayerSession);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ using Content.Shared.Body.Components;
|
|||||||
using Content.Shared.CharacterAppearance.Components;
|
using Content.Shared.CharacterAppearance.Components;
|
||||||
using Content.Shared.CharacterAppearance.Systems;
|
using Content.Shared.CharacterAppearance.Systems;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
|
|
||||||
namespace Content.Server.CharacterAppearance.Systems
|
namespace Content.Server.CharacterAppearance.Systems
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
using Content.Server.CharacterAppearance.Components;
|
||||||
|
using Content.Server.UserInterface;
|
||||||
|
using Content.Shared.CharacterAppearance.Components;
|
||||||
|
using Robust.Server.GameObjects;
|
||||||
|
|
||||||
|
namespace Content.Server.CharacterAppearance.Systems
|
||||||
|
{
|
||||||
|
public sealed class MagicMirrorSystem : EntitySystem
|
||||||
|
{
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
SubscribeLocalEvent<MagicMirrorComponent, ActivatableUIOpenAttemptEvent>(OnOpenUIAttempt);
|
||||||
|
SubscribeLocalEvent<MagicMirrorComponent, AfterActivatableUIOpenEvent>(AfterUIOpen);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnOpenUIAttempt(EntityUid uid, MagicMirrorComponent mirror, ActivatableUIOpenAttemptEvent args)
|
||||||
|
{
|
||||||
|
if (!HasComp<HumanoidAppearanceComponent>(args.User))
|
||||||
|
args.Cancel();
|
||||||
|
}
|
||||||
|
private void AfterUIOpen(EntityUid uid, MagicMirrorComponent component, AfterActivatableUIOpenEvent args)
|
||||||
|
{
|
||||||
|
var looks = Comp<HumanoidAppearanceComponent>(args.User);
|
||||||
|
var actor = Comp<ActorComponent>(args.User);
|
||||||
|
var appearance = looks.Appearance;
|
||||||
|
|
||||||
|
var msg = new MagicMirrorComponent.MagicMirrorInitialDataMessage(
|
||||||
|
appearance.HairColor,
|
||||||
|
appearance.FacialHairColor,
|
||||||
|
appearance.HairStyleId,
|
||||||
|
appearance.FacialHairStyleId,
|
||||||
|
appearance.EyeColor,
|
||||||
|
looks.CategoriesHair,
|
||||||
|
looks.CategoriesFacialHair,
|
||||||
|
looks.CanColorHair,
|
||||||
|
looks.CanColorFacialHair);
|
||||||
|
|
||||||
|
component.UserInterface?.SendMessage(msg, actor.PlayerSession);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,28 +1,19 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Content.Server.Chemistry.Components.SolutionManager;
|
|
||||||
using Content.Server.Chemistry.EntitySystems;
|
using Content.Server.Chemistry.EntitySystems;
|
||||||
using Content.Server.Hands.Components;
|
using Content.Server.Hands.Components;
|
||||||
using Content.Server.Labels.Components;
|
using Content.Server.Labels.Components;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
using Content.Shared.ActionBlocker;
|
|
||||||
using Content.Shared.Chemistry.Components;
|
using Content.Shared.Chemistry.Components;
|
||||||
using Content.Shared.Containers.ItemSlots;
|
using Content.Shared.Containers.ItemSlots;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Content.Shared.Interaction;
|
|
||||||
using Content.Shared.Item;
|
using Content.Shared.Item;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Content.Shared.Random.Helpers;
|
using Content.Shared.Random.Helpers;
|
||||||
using Content.Shared.Sound;
|
using Content.Shared.Sound;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.Components
|
namespace Content.Server.Chemistry.Components
|
||||||
{
|
{
|
||||||
@@ -33,9 +24,8 @@ namespace Content.Server.Chemistry.Components
|
|||||||
/// Messages sent from the client are used to handle ui button presses.
|
/// Messages sent from the client are used to handle ui button presses.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
|
||||||
[ComponentReference(typeof(SharedChemMasterComponent))]
|
[ComponentReference(typeof(SharedChemMasterComponent))]
|
||||||
public sealed class ChemMasterComponent : SharedChemMasterComponent, IActivate
|
public sealed class ChemMasterComponent : SharedChemMasterComponent
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entities = default!;
|
[Dependency] private readonly IEntityManager _entities = default!;
|
||||||
|
|
||||||
@@ -385,30 +375,6 @@ namespace Content.Server.Chemistry.Components
|
|||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when you click the owner entity with an empty hand. Opens the UI client-side if possible.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="args">Data relevant to the event such as the actor which triggered it.</param>
|
|
||||||
void IActivate.Activate(ActivateEventArgs args)
|
|
||||||
{
|
|
||||||
if (!_entities.TryGetComponent(args.User, out ActorComponent? actor))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_entities.TryGetComponent(args.User, out HandsComponent? hands))
|
|
||||||
{
|
|
||||||
Owner.PopupMessage(args.User, Loc.GetString("chem-master-component-activate-no-hands"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var activeHandEntity = hands.GetActiveHandItem?.Owner;
|
|
||||||
if (activeHandEntity == null)
|
|
||||||
{
|
|
||||||
UserInterface?.Open(actor.PlayerSession);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ClickSound()
|
private void ClickSound()
|
||||||
{
|
{
|
||||||
SoundSystem.Play(Filter.Pvs(Owner), _clickSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
|
SoundSystem.Play(Filter.Pvs(Owner), _clickSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
|
||||||
|
|||||||
@@ -1,30 +1,17 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Chemistry.Components.SolutionManager;
|
|
||||||
using Content.Server.Chemistry.EntitySystems;
|
using Content.Server.Chemistry.EntitySystems;
|
||||||
using Content.Server.Hands.Components;
|
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
using Content.Shared.ActionBlocker;
|
|
||||||
using Content.Shared.Chemistry.Components;
|
using Content.Shared.Chemistry.Components;
|
||||||
using Content.Shared.Chemistry.Dispenser;
|
using Content.Shared.Chemistry.Dispenser;
|
||||||
using Content.Shared.Containers.ItemSlots;
|
using Content.Shared.Containers.ItemSlots;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Content.Shared.Interaction;
|
|
||||||
using Content.Shared.Popups;
|
|
||||||
using Content.Shared.Sound;
|
using Content.Shared.Sound;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Log;
|
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.Components
|
namespace Content.Server.Chemistry.Components
|
||||||
@@ -36,9 +23,8 @@ namespace Content.Server.Chemistry.Components
|
|||||||
/// Messages sent from the client are used to handle ui button presses.
|
/// Messages sent from the client are used to handle ui button presses.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
|
||||||
[ComponentReference(typeof(SharedReagentDispenserComponent))]
|
[ComponentReference(typeof(SharedReagentDispenserComponent))]
|
||||||
public sealed class ReagentDispenserComponent : SharedReagentDispenserComponent, IActivate
|
public sealed class ReagentDispenserComponent : SharedReagentDispenserComponent
|
||||||
{
|
{
|
||||||
private static ReagentInventoryComparer _comparer = new();
|
private static ReagentInventoryComparer _comparer = new();
|
||||||
public static string SolutionName = "reagent";
|
public static string SolutionName = "reagent";
|
||||||
@@ -296,30 +282,6 @@ namespace Content.Server.Chemistry.Components
|
|||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when you click the owner entity with an empty hand. Opens the UI client-side if possible.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="args">Data relevant to the event such as the actor which triggered it.</param>
|
|
||||||
void IActivate.Activate(ActivateEventArgs args)
|
|
||||||
{
|
|
||||||
if (!_entities.TryGetComponent(args.User, out ActorComponent? actor))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_entities.TryGetComponent(args.User, out HandsComponent? hands))
|
|
||||||
{
|
|
||||||
Owner.PopupMessage(args.User, Loc.GetString("reagent-dispenser-component-activate-no-hands"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var activeHandEntity = hands.GetActiveHandItem?.Owner;
|
|
||||||
if (activeHandEntity == null)
|
|
||||||
{
|
|
||||||
UserInterface?.Open(actor.PlayerSession);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ClickSound()
|
private void ClickSound()
|
||||||
{
|
{
|
||||||
SoundSystem.Play(Filter.Pvs(Owner), _clickSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
|
SoundSystem.Play(Filter.Pvs(Owner), _clickSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Cloning.Components;
|
using Content.Server.Cloning.Components;
|
||||||
using Content.Server.Mind.Components;
|
using Content.Server.Mind.Components;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Shared.GameTicking;
|
using Content.Shared.GameTicking;
|
||||||
using Content.Shared.Interaction;
|
|
||||||
using Content.Shared.Preferences;
|
using Content.Shared.Preferences;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using static Content.Shared.Cloning.SharedCloningPodComponent;
|
using static Content.Shared.Cloning.SharedCloningPodComponent;
|
||||||
|
|
||||||
@@ -28,7 +22,6 @@ namespace Content.Server.Cloning
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset);
|
SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset);
|
||||||
SubscribeLocalEvent<CloningPodComponent, ActivateInWorldEvent>(HandleActivate);
|
|
||||||
SubscribeLocalEvent<BeingClonedComponent, MindAddedMessage>(HandleMindAdded);
|
SubscribeLocalEvent<BeingClonedComponent, MindAddedMessage>(HandleMindAdded);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,17 +38,6 @@ namespace Content.Server.Cloning
|
|||||||
ClonesWaitingForMind.Remove(mind);
|
ClonesWaitingForMind.Remove(mind);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleActivate(EntityUid uid, CloningPodComponent component, ActivateInWorldEvent args)
|
|
||||||
{
|
|
||||||
if (!component.Powered ||
|
|
||||||
!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
component.UserInterface?.Open(actor.PlayerSession);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void HandleMindAdded(EntityUid uid, BeingClonedComponent component, MindAddedMessage message)
|
private void HandleMindAdded(EntityUid uid, BeingClonedComponent component, MindAddedMessage message)
|
||||||
{
|
{
|
||||||
if (component.Parent == EntityUid.Invalid ||
|
if (component.Parent == EntityUid.Invalid ||
|
||||||
|
|||||||
@@ -1,33 +1,18 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Content.Server.Disposal.Unit.Components;
|
using Content.Server.Disposal.Unit.Components;
|
||||||
using Content.Server.Hands.Components;
|
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
using Content.Shared.ActionBlocker;
|
|
||||||
using Content.Shared.Interaction;
|
|
||||||
using Content.Shared.Popups;
|
|
||||||
using Content.Shared.Sound;
|
using Content.Shared.Sound;
|
||||||
using Robust.Server.Console;
|
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
using static Content.Shared.Disposal.Components.SharedDisposalRouterComponent;
|
using static Content.Shared.Disposal.Components.SharedDisposalRouterComponent;
|
||||||
|
|
||||||
namespace Content.Server.Disposal.Tube.Components
|
namespace Content.Server.Disposal.Tube.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
|
||||||
[ComponentReference(typeof(IDisposalTubeComponent))]
|
[ComponentReference(typeof(IDisposalTubeComponent))]
|
||||||
public sealed class DisposalRouterComponent : DisposalJunctionComponent, IActivate
|
public sealed class DisposalRouterComponent : DisposalJunctionComponent
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
@@ -131,30 +116,6 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
SoundSystem.Play(Filter.Pvs(Owner), _clickSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
|
SoundSystem.Play(Filter.Pvs(Owner), _clickSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when you click the owner entity with an empty hand. Opens the UI client-side if possible.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="args">Data relevant to the event such as the actor which triggered it.</param>
|
|
||||||
void IActivate.Activate(ActivateEventArgs args)
|
|
||||||
{
|
|
||||||
if (!_entMan.TryGetComponent(args.User, out ActorComponent? actor))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_entMan.TryGetComponent(args.User, out HandsComponent? hands))
|
|
||||||
{
|
|
||||||
Owner.PopupMessage(args.User, Loc.GetString("disposal-router-window-tag-input-activate-no-hands"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var activeHandEntity = hands.GetActiveHandItem?.Owner;
|
|
||||||
if (activeHandEntity == null)
|
|
||||||
{
|
|
||||||
OpenUserInterface(actor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnRemove()
|
protected override void OnRemove()
|
||||||
{
|
{
|
||||||
UserInterface?.CloseAll();
|
UserInterface?.CloseAll();
|
||||||
|
|||||||
@@ -1,30 +1,17 @@
|
|||||||
using Content.Server.Disposal.Unit.Components;
|
using Content.Server.Disposal.Unit.Components;
|
||||||
using Content.Server.Hands.Components;
|
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
using Content.Shared.ActionBlocker;
|
|
||||||
using Content.Shared.Interaction;
|
|
||||||
using Content.Shared.Popups;
|
|
||||||
using Content.Shared.Sound;
|
using Content.Shared.Sound;
|
||||||
using Robust.Server.Console;
|
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
using static Content.Shared.Disposal.Components.SharedDisposalTaggerComponent;
|
using static Content.Shared.Disposal.Components.SharedDisposalTaggerComponent;
|
||||||
|
|
||||||
namespace Content.Server.Disposal.Tube.Components
|
namespace Content.Server.Disposal.Tube.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
|
||||||
[ComponentReference(typeof(IDisposalTubeComponent))]
|
[ComponentReference(typeof(IDisposalTubeComponent))]
|
||||||
public sealed class DisposalTaggerComponent : DisposalTransitComponent, IActivate
|
public sealed class DisposalTaggerComponent : DisposalTransitComponent
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
@@ -97,31 +84,6 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
{
|
{
|
||||||
SoundSystem.Play(Filter.Pvs(Owner), _clickSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
|
SoundSystem.Play(Filter.Pvs(Owner), _clickSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when you click the owner entity with an empty hand. Opens the UI client-side if possible.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="args">Data relevant to the event such as the actor which triggered it.</param>
|
|
||||||
void IActivate.Activate(ActivateEventArgs args)
|
|
||||||
{
|
|
||||||
if (!_entMan.TryGetComponent(args.User, out ActorComponent? actor))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_entMan.TryGetComponent(args.User, out HandsComponent? hands))
|
|
||||||
{
|
|
||||||
Owner.PopupMessage(args.User, Loc.GetString("disposal-tagger-window-activate-no-hands"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var activeHandEntity = hands.GetActiveHandItem?.Owner;
|
|
||||||
if (activeHandEntity == null)
|
|
||||||
{
|
|
||||||
OpenUserInterface(actor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnRemove()
|
protected override void OnRemove()
|
||||||
{
|
{
|
||||||
base.OnRemove();
|
base.OnRemove();
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
using Content.Server.Disposal.Tube.Components;
|
using Content.Server.Disposal.Tube.Components;
|
||||||
|
using Content.Server.UserInterface;
|
||||||
|
using Content.Server.Hands.Components;
|
||||||
using Content.Shared.Movement;
|
using Content.Shared.Movement;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
|
using Content.Shared.Popups;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
@@ -23,10 +22,12 @@ namespace Content.Server.Disposal.Tube
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<DisposalTubeComponent, PhysicsBodyTypeChangedEvent>(BodyTypeChanged);
|
SubscribeLocalEvent<DisposalTubeComponent, PhysicsBodyTypeChangedEvent>(BodyTypeChanged);
|
||||||
|
|
||||||
SubscribeLocalEvent<DisposalTubeComponent, RelayMovementEntityEvent>(OnRelayMovement);
|
SubscribeLocalEvent<DisposalTubeComponent, RelayMovementEntityEvent>(OnRelayMovement);
|
||||||
SubscribeLocalEvent<DisposalTaggerComponent, GetVerbsEvent<InteractionVerb>>(AddOpenUIVerbs);
|
SubscribeLocalEvent<DisposalTaggerComponent, GetVerbsEvent<InteractionVerb>>(AddOpenUIVerbs);
|
||||||
SubscribeLocalEvent<DisposalRouterComponent, GetVerbsEvent<InteractionVerb>>(AddOpenUIVerbs);
|
SubscribeLocalEvent<DisposalRouterComponent, GetVerbsEvent<InteractionVerb>>(AddOpenUIVerbs);
|
||||||
|
SubscribeLocalEvent<DisposalRouterComponent, ActivatableUIOpenAttemptEvent>(OnOpenRouterUIAttempt);
|
||||||
|
SubscribeLocalEvent<DisposalTaggerComponent, ActivatableUIOpenAttemptEvent>(OnOpenTaggerUIAttempt);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddOpenUIVerbs(EntityUid uid, DisposalTaggerComponent component, GetVerbsEvent<InteractionVerb> args)
|
private void AddOpenUIVerbs(EntityUid uid, DisposalTaggerComponent component, GetVerbsEvent<InteractionVerb> args)
|
||||||
@@ -72,6 +73,37 @@ namespace Content.Server.Disposal.Tube
|
|||||||
SoundSystem.Play(Filter.Pvs(uid), component.ClangSound.GetSound(), uid);
|
SoundSystem.Play(Filter.Pvs(uid), component.ClangSound.GetSound(), uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnOpenRouterUIAttempt(EntityUid uid, DisposalRouterComponent router, ActivatableUIOpenAttemptEvent args)
|
||||||
|
{
|
||||||
|
if (!TryComp<HandsComponent>(args.User, out var hands))
|
||||||
|
{
|
||||||
|
uid.PopupMessage(args.User, Loc.GetString("disposal-router-window-tag-input-activate-no-hands"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var activeHandEntity = hands.GetActiveHandItem?.Owner;
|
||||||
|
if (activeHandEntity != null)
|
||||||
|
{
|
||||||
|
args.Cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnOpenTaggerUIAttempt(EntityUid uid, DisposalTaggerComponent router, ActivatableUIOpenAttemptEvent args)
|
||||||
|
{
|
||||||
|
if (!TryComp<HandsComponent>(args.User, out var hands))
|
||||||
|
{
|
||||||
|
uid.PopupMessage(args.User, Loc.GetString("disposal-tagger-window-activate-no-hands"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var activeHandEntity = hands.GetActiveHandItem?.Owner;
|
||||||
|
if (activeHandEntity != null)
|
||||||
|
{
|
||||||
|
args.Cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void BodyTypeChanged(
|
private static void BodyTypeChanged(
|
||||||
EntityUid uid,
|
EntityUid uid,
|
||||||
DisposalTubeComponent component,
|
DisposalTubeComponent component,
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Content.Server.Storage;
|
using Content.Server.Storage;
|
||||||
using Robust.Shared.Analyzers;
|
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Content.Server.Drone.Components
|
namespace Content.Server.Drone.Components
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,7 +51,10 @@ namespace Content.Server.Drone
|
|||||||
|
|
||||||
private void OnActivateUIAttempt(EntityUid uid, DroneComponent component, UserOpenActivatableUIAttemptEvent args)
|
private void OnActivateUIAttempt(EntityUid uid, DroneComponent component, UserOpenActivatableUIAttemptEvent args)
|
||||||
{
|
{
|
||||||
args.Cancel();
|
if (!_tagSystem.HasTag(args.Target, "DroneUsable"))
|
||||||
|
{
|
||||||
|
args.Cancel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnExamined(EntityUid uid, DroneComponent component, ExaminedEvent args)
|
private void OnExamined(EntityUid uid, DroneComponent component, ExaminedEvent args)
|
||||||
|
|||||||
@@ -30,8 +30,7 @@ using Robust.Shared.Player;
|
|||||||
namespace Content.Server.Kitchen.Components
|
namespace Content.Server.Kitchen.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
public sealed class MicrowaveComponent : SharedMicrowaveComponent, IInteractUsing, ISuicideAct, IBreakAct
|
||||||
public sealed class MicrowaveComponent : SharedMicrowaveComponent, IActivate, IInteractUsing, ISuicideAct, IBreakAct
|
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entities = default!;
|
[Dependency] private readonly IEntityManager _entities = default!;
|
||||||
|
|
||||||
@@ -76,13 +75,13 @@ namespace Content.Server.Kitchen.Components
|
|||||||
|
|
||||||
private bool HasContents => _storage.ContainedEntities.Count > 0;
|
private bool HasContents => _storage.ContainedEntities.Count > 0;
|
||||||
|
|
||||||
private bool _uiDirty = true;
|
public bool UIDirty = true;
|
||||||
private bool _lostPower;
|
private bool _lostPower;
|
||||||
private int _currentCookTimeButtonIndex;
|
private int _currentCookTimeButtonIndex;
|
||||||
|
|
||||||
public void DirtyUi()
|
public void DirtyUi()
|
||||||
{
|
{
|
||||||
_uiDirty = true;
|
UIDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Container _storage = default!;
|
private Container _storage = default!;
|
||||||
@@ -121,7 +120,7 @@ namespace Content.Server.Kitchen.Components
|
|||||||
{
|
{
|
||||||
EjectSolids();
|
EjectSolids();
|
||||||
ClickSound();
|
ClickSound();
|
||||||
_uiDirty = true;
|
UIDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -130,7 +129,7 @@ namespace Content.Server.Kitchen.Components
|
|||||||
{
|
{
|
||||||
EjectSolid(msg.EntityID);
|
EjectSolid(msg.EntityID);
|
||||||
ClickSound();
|
ClickSound();
|
||||||
_uiDirty = true;
|
UIDirty = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -138,7 +137,7 @@ namespace Content.Server.Kitchen.Components
|
|||||||
_currentCookTimeButtonIndex = msg.ButtonIndex;
|
_currentCookTimeButtonIndex = msg.ButtonIndex;
|
||||||
_currentCookTimerTime = msg.NewCookTime;
|
_currentCookTimerTime = msg.NewCookTime;
|
||||||
ClickSound();
|
ClickSound();
|
||||||
_uiDirty = true;
|
UIDirty = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,7 +156,7 @@ namespace Content.Server.Kitchen.Components
|
|||||||
_lostPower = true;
|
_lostPower = true;
|
||||||
EjectSolids();
|
EjectSolids();
|
||||||
_busy = false;
|
_busy = false;
|
||||||
_uiDirty = true;
|
UIDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_busy && _broken)
|
if (_busy && _broken)
|
||||||
@@ -167,10 +166,10 @@ namespace Content.Server.Kitchen.Components
|
|||||||
_lostPower = true;
|
_lostPower = true;
|
||||||
EjectSolids();
|
EjectSolids();
|
||||||
_busy = false;
|
_busy = false;
|
||||||
_uiDirty = true;
|
UIDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_uiDirty)
|
if (UIDirty)
|
||||||
{
|
{
|
||||||
UserInterface?.SetState(new MicrowaveUpdateUserInterfaceState
|
UserInterface?.SetState(new MicrowaveUpdateUserInterfaceState
|
||||||
(
|
(
|
||||||
@@ -179,7 +178,7 @@ namespace Content.Server.Kitchen.Components
|
|||||||
_currentCookTimeButtonIndex,
|
_currentCookTimeButtonIndex,
|
||||||
_currentCookTimerTime
|
_currentCookTimerTime
|
||||||
));
|
));
|
||||||
_uiDirty = false;
|
UIDirty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,17 +202,6 @@ namespace Content.Server.Kitchen.Components
|
|||||||
SetAppearance(MicrowaveVisualState.Broken);
|
SetAppearance(MicrowaveVisualState.Broken);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
|
||||||
{
|
|
||||||
if (!_entities.TryGetComponent(eventArgs.User, out ActorComponent? actor) || !Powered)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_uiDirty = true;
|
|
||||||
UserInterface?.Toggle(actor.PlayerSession);
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (!Powered)
|
if (!Powered)
|
||||||
@@ -242,7 +230,7 @@ namespace Content.Server.Kitchen.Components
|
|||||||
|
|
||||||
var ent = food.Owner; //Get the entity of the ItemComponent.
|
var ent = food.Owner; //Get the entity of the ItemComponent.
|
||||||
_storage.Insert(ent);
|
_storage.Insert(ent);
|
||||||
_uiDirty = true;
|
UIDirty = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,10 +341,10 @@ namespace Content.Server.Kitchen.Components
|
|||||||
SetAppearance(MicrowaveVisualState.Idle);
|
SetAppearance(MicrowaveVisualState.Idle);
|
||||||
_busy = false;
|
_busy = false;
|
||||||
|
|
||||||
_uiDirty = true;
|
UIDirty = true;
|
||||||
});
|
});
|
||||||
_lostPower = false;
|
_lostPower = false;
|
||||||
_uiDirty = true;
|
UIDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -544,7 +532,7 @@ namespace Content.Server.Kitchen.Components
|
|||||||
|
|
||||||
_currentCookTimerTime = 10;
|
_currentCookTimerTime = 10;
|
||||||
ClickSound();
|
ClickSound();
|
||||||
_uiDirty = true;
|
UIDirty = true;
|
||||||
Wzhzhzh();
|
Wzhzhzh();
|
||||||
return SuicideKind.Heat;
|
return SuicideKind.Heat;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Content.Server.Chemistry.EntitySystems;
|
using Content.Server.Chemistry.EntitySystems;
|
||||||
using Content.Server.Kitchen.Components;
|
using Content.Server.Kitchen.Components;
|
||||||
|
using Content.Server.UserInterface;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Server.Kitchen.EntitySystems
|
namespace Content.Server.Kitchen.EntitySystems
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.Materials;
|
using Content.Server.Materials;
|
||||||
@@ -13,15 +11,11 @@ using Content.Shared.Power;
|
|||||||
using Content.Shared.Research.Prototypes;
|
using Content.Shared.Research.Prototypes;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
|
|
||||||
namespace Content.Server.Lathe.Components
|
namespace Content.Server.Lathe.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
public sealed class LatheComponent : SharedLatheComponent, IInteractUsing
|
||||||
public sealed class LatheComponent : SharedLatheComponent, IInteractUsing, IActivate
|
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
@@ -138,19 +132,6 @@ namespace Content.Server.Lathe.Components
|
|||||||
{
|
{
|
||||||
UserInterface?.Open(session);
|
UserInterface?.Open(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
|
||||||
{
|
|
||||||
if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
|
||||||
return;
|
|
||||||
if (!Powered)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
OpenUserInterface(actor.PlayerSession);
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (!_entMan.TryGetComponent(Owner, out MaterialStorageComponent? storage)
|
if (!_entMan.TryGetComponent(Owner, out MaterialStorageComponent? storage)
|
||||||
|
|||||||
@@ -5,25 +5,20 @@ using Content.Shared.Interaction;
|
|||||||
using Content.Shared.Paper;
|
using Content.Shared.Paper;
|
||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
|
|
||||||
namespace Content.Server.Paper
|
namespace Content.Server.Paper
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
#pragma warning disable 618
|
#pragma warning disable 618
|
||||||
[ComponentReference(typeof(SharedPaperComponent))]
|
[ComponentReference(typeof(SharedPaperComponent))]
|
||||||
[ComponentReference(typeof(IActivate))]
|
public sealed class PaperComponent : SharedPaperComponent, IExamine, IInteractUsing
|
||||||
public sealed class PaperComponent : SharedPaperComponent, IExamine, IInteractUsing, IActivate
|
|
||||||
#pragma warning restore 618
|
#pragma warning restore 618
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
private PaperAction _mode;
|
public PaperAction Mode;
|
||||||
[DataField("content")]
|
[DataField("content")]
|
||||||
public string Content { get; set; } = "";
|
public string Content { get; set; } = "";
|
||||||
|
|
||||||
@@ -42,7 +37,7 @@ namespace Content.Server.Paper
|
|||||||
UserInterface.OnReceiveMessage += OnUiReceiveMessage;
|
UserInterface.OnReceiveMessage += OnUiReceiveMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
_mode = PaperAction.Read;
|
Mode = PaperAction.Read;
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,9 +57,9 @@ namespace Content.Server.Paper
|
|||||||
appearance.SetData(PaperVisuals.Status, status);
|
appearance.SetData(PaperVisuals.Status, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateUserInterface()
|
public void UpdateUserInterface()
|
||||||
{
|
{
|
||||||
UserInterface?.SetState(new PaperBoundUserInterfaceState(Content, _mode));
|
UserInterface?.SetState(new PaperBoundUserInterfaceState(Content, Mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||||
@@ -81,17 +76,6 @@ namespace Content.Server.Paper
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
|
||||||
{
|
|
||||||
if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
|
||||||
return;
|
|
||||||
|
|
||||||
_mode = PaperAction.Read;
|
|
||||||
UpdateUserInterface();
|
|
||||||
UserInterface?.Toggle(actor.PlayerSession);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
|
private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
|
||||||
{
|
{
|
||||||
var msg = (PaperInputText) obj.Message;
|
var msg = (PaperInputText) obj.Message;
|
||||||
@@ -118,7 +102,7 @@ namespace Content.Server.Paper
|
|||||||
if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
_mode = PaperAction.Write;
|
Mode = PaperAction.Write;
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
UserInterface?.Open(actor.PlayerSession);
|
UserInterface?.Open(actor.PlayerSession);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
20
Content.Server/Paper/PaperSystem.cs
Normal file
20
Content.Server/Paper/PaperSystem.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using Content.Server.UserInterface;
|
||||||
|
using Content.Shared.Paper;
|
||||||
|
|
||||||
|
namespace Content.Server.Paper
|
||||||
|
{
|
||||||
|
public sealed class PaperSystem : EntitySystem
|
||||||
|
{
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
SubscribeLocalEvent<PaperComponent, BeforeActivatableUIOpenEvent>(AfterUIOpen);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AfterUIOpen(EntityUid uid, PaperComponent component, BeforeActivatableUIOpenEvent args)
|
||||||
|
{
|
||||||
|
component.Mode = SharedPaperComponent.PaperAction.Read;
|
||||||
|
component.UpdateUserInterface();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -9,18 +7,10 @@ using Content.Server.Power.EntitySystems;
|
|||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
using Content.Server.VendingMachines;
|
using Content.Server.VendingMachines;
|
||||||
using Content.Server.WireHacking;
|
using Content.Server.WireHacking;
|
||||||
using Content.Shared.ActionBlocker;
|
|
||||||
using Content.Shared.Interaction;
|
|
||||||
using Content.Shared.Singularity.Components;
|
using Content.Shared.Singularity.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
using static Content.Shared.Wires.SharedWiresComponent;
|
using static Content.Shared.Wires.SharedWiresComponent;
|
||||||
using Timer = Robust.Shared.Timing.Timer;
|
using Timer = Robust.Shared.Timing.Timer;
|
||||||
|
|
||||||
@@ -32,9 +22,8 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
/// Is the computer thing people interact with to control the PA.
|
/// Is the computer thing people interact with to control the PA.
|
||||||
/// Also contains primary logic for actual PA behavior, part scanning, etc...
|
/// Also contains primary logic for actual PA behavior, part scanning, etc...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ComponentReference(typeof(IActivate))]
|
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed class ParticleAcceleratorControlBoxComponent : ParticleAcceleratorPartComponent, IActivate, IWires
|
public sealed class ParticleAcceleratorControlBoxComponent : ParticleAcceleratorPartComponent, IWires
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
@@ -210,30 +199,6 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
|
|
||||||
UserInterface?.SetState(state);
|
UserInterface?.SetState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
|
||||||
{
|
|
||||||
if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_entMan.TryGetComponent<WiresComponent?>(Owner, out var wires) && wires.IsPanelOpen)
|
|
||||||
{
|
|
||||||
wires.OpenInterface(actor.PlayerSession);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!ConsolePowered)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserInterface?.Toggle(actor.PlayerSession);
|
|
||||||
UpdateUI();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnRemove()
|
protected override void OnRemove()
|
||||||
{
|
{
|
||||||
UserInterface?.CloseAll();
|
UserInterface?.CloseAll();
|
||||||
|
|||||||
@@ -1,24 +1,8 @@
|
|||||||
using System.Linq;
|
|
||||||
using Content.Shared;
|
|
||||||
using Content.Shared.CCVar;
|
|
||||||
using Content.Shared.ActionBlocker;
|
|
||||||
using Content.Shared.Hands;
|
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Content.Shared.Standing;
|
|
||||||
using Content.Shared.Stunnable;
|
|
||||||
using Content.Shared.Throwing;
|
|
||||||
using Content.Shared.Interaction;
|
|
||||||
using Content.Shared.Interaction.Helpers;
|
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
|
using Content.Server.WireHacking;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Server.Player;
|
|
||||||
using Robust.Shared.Configuration;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.Network;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
|
|
||||||
namespace Content.Server.Power.EntitySystems
|
namespace Content.Server.Power.EntitySystems
|
||||||
{
|
{
|
||||||
@@ -39,7 +23,9 @@ namespace Content.Server.Power.EntitySystems
|
|||||||
if (args.Cancelled) return;
|
if (args.Cancelled) return;
|
||||||
if (EntityManager.TryGetComponent<ApcPowerReceiverComponent>(uid, out var power) && !power.Powered)
|
if (EntityManager.TryGetComponent<ApcPowerReceiverComponent>(uid, out var power) && !power.Powered)
|
||||||
{
|
{
|
||||||
args.User.PopupMessageCursor(Loc.GetString("base-computer-ui-component-not-powered"));
|
if (TryComp<WiresComponent>(uid, out var wires) && wires.IsPanelOpen)
|
||||||
|
return;
|
||||||
|
args.User.PopupMessageCursor(Loc.GetString("base-computer-ui-component-not-powered", ("machine", uid)));
|
||||||
args.Cancel();
|
args.Cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,15 +3,12 @@ using Content.Shared.Interaction;
|
|||||||
using Content.Shared.Research.Components;
|
using Content.Shared.Research.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
|
|
||||||
namespace Content.Server.Research.Components
|
namespace Content.Server.Research.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[Virtual]
|
[Virtual]
|
||||||
public class ResearchClientComponent : SharedResearchClientComponent, IActivate
|
public class ResearchClientComponent : SharedResearchClientComponent
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
||||||
|
|
||||||
@@ -55,15 +52,6 @@ namespace Content.Server.Research.Components
|
|||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
UserInterface?.Open(session);
|
UserInterface?.Open(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
|
||||||
{
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
|
||||||
return;
|
|
||||||
|
|
||||||
OpenUserInterface(actor.PlayerSession);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateUserInterface()
|
public void UpdateUserInterface()
|
||||||
{
|
{
|
||||||
UserInterface?.SetState(GetNewUiState());
|
UserInterface?.SetState(GetNewUiState());
|
||||||
|
|||||||
@@ -1,26 +1,18 @@
|
|||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
using Content.Shared.Audio;
|
|
||||||
using Content.Shared.Interaction;
|
|
||||||
using Content.Shared.Research.Components;
|
using Content.Shared.Research.Components;
|
||||||
using Content.Shared.Research.Prototypes;
|
using Content.Shared.Research.Prototypes;
|
||||||
using Content.Shared.Sound;
|
using Content.Shared.Sound;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
|
|
||||||
namespace Content.Server.Research.Components
|
namespace Content.Server.Research.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
public sealed class ResearchConsoleComponent : SharedResearchConsoleComponent
|
||||||
public sealed class ResearchConsoleComponent : SharedResearchConsoleComponent, IActivate
|
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
@@ -110,20 +102,7 @@ namespace Content.Server.Research.Components
|
|||||||
UserInterface?.Open(session);
|
UserInterface?.Open(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
public void PlayKeyboardSound()
|
||||||
{
|
|
||||||
if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
|
||||||
return;
|
|
||||||
if (!Powered)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
OpenUserInterface(actor.PlayerSession);
|
|
||||||
PlayKeyboardSound();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PlayKeyboardSound()
|
|
||||||
{
|
{
|
||||||
SoundSystem.Play(Filter.Pvs(Owner), _soundCollectionName.GetSound(), Owner, AudioParams.Default);
|
SoundSystem.Play(Filter.Pvs(Owner), _soundCollectionName.GetSound(), Owner, AudioParams.Default);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,9 @@
|
|||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
|
|
||||||
namespace Content.Server.Research.Components
|
namespace Content.Server.Research.Components
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
|
||||||
public sealed class ResearchPointSourceComponent : ResearchClientComponent
|
public sealed class ResearchPointSourceComponent : ResearchClientComponent
|
||||||
{
|
{
|
||||||
[DataField("pointspersecond")]
|
[DataField("pointspersecond")]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using Content.Server.UserInterface;
|
||||||
using Content.Server.Research.Components;
|
using Content.Server.Research.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Server.Research
|
namespace Content.Server.Research
|
||||||
{
|
{
|
||||||
@@ -14,6 +14,17 @@ namespace Content.Server.Research
|
|||||||
private readonly List<ResearchServerComponent> _servers = new();
|
private readonly List<ResearchServerComponent> _servers = new();
|
||||||
public IReadOnlyList<ResearchServerComponent> Servers => _servers;
|
public IReadOnlyList<ResearchServerComponent> Servers => _servers;
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
SubscribeLocalEvent<ResearchConsoleComponent, AfterActivatableUIOpenEvent>(OnAfterUIOpen);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnAfterUIOpen(EntityUid uid, ResearchConsoleComponent component, AfterActivatableUIOpenEvent args)
|
||||||
|
{
|
||||||
|
component.PlayKeyboardSound();
|
||||||
|
}
|
||||||
|
|
||||||
public bool RegisterServer(ResearchServerComponent server)
|
public bool RegisterServer(ResearchServerComponent server)
|
||||||
{
|
{
|
||||||
if (_servers.Contains(server)) return false;
|
if (_servers.Contains(server)) return false;
|
||||||
|
|||||||
@@ -112,13 +112,23 @@ namespace Content.Server.UserInterface
|
|||||||
// If we've gotten this far, fire a cancellable event that indicates someone is about to activate this.
|
// If we've gotten this far, fire a cancellable event that indicates someone is about to activate this.
|
||||||
// This is so that stuff can require further conditions (like power).
|
// This is so that stuff can require further conditions (like power).
|
||||||
var oae = new ActivatableUIOpenAttemptEvent(user);
|
var oae = new ActivatableUIOpenAttemptEvent(user);
|
||||||
var uae = new UserOpenActivatableUIAttemptEvent(user);
|
var uae = new UserOpenActivatableUIAttemptEvent(user, aui.Owner);
|
||||||
RaiseLocalEvent(user, uae, false);
|
RaiseLocalEvent(user, uae, false);
|
||||||
RaiseLocalEvent((aui).Owner, oae, false);
|
RaiseLocalEvent((aui).Owner, oae, false);
|
||||||
if (oae.Cancelled || uae.Cancelled) return false;
|
if (oae.Cancelled || uae.Cancelled) return false;
|
||||||
|
|
||||||
|
// Give the UI an opportunity to prepare itself if it needs to do anything
|
||||||
|
// before opening
|
||||||
|
var bae = new BeforeActivatableUIOpenEvent(user);
|
||||||
|
RaiseLocalEvent((aui).Owner, bae, false);
|
||||||
|
|
||||||
SetCurrentSingleUser((aui).Owner, actor.PlayerSession, aui);
|
SetCurrentSingleUser((aui).Owner, actor.PlayerSession, aui);
|
||||||
ui.Toggle(actor.PlayerSession);
|
ui.Toggle(actor.PlayerSession);
|
||||||
|
|
||||||
|
//Let the component know a user opened it so it can do whatever it needs to do
|
||||||
|
var aae = new AfterActivatableUIOpenEvent(user);
|
||||||
|
RaiseLocalEvent((aui).Owner, aae, false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,11 +163,37 @@ namespace Content.Server.UserInterface
|
|||||||
public sealed class UserOpenActivatableUIAttemptEvent : CancellableEntityEventArgs //have to one-up the already stroke-inducing name
|
public sealed class UserOpenActivatableUIAttemptEvent : CancellableEntityEventArgs //have to one-up the already stroke-inducing name
|
||||||
{
|
{
|
||||||
public EntityUid User { get; }
|
public EntityUid User { get; }
|
||||||
public UserOpenActivatableUIAttemptEvent(EntityUid who)
|
public EntityUid Target { get; }
|
||||||
|
public UserOpenActivatableUIAttemptEvent(EntityUid who, EntityUid target)
|
||||||
|
{
|
||||||
|
User = who;
|
||||||
|
Target = target;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class AfterActivatableUIOpenEvent : EntityEventArgs
|
||||||
|
{
|
||||||
|
public EntityUid User { get; }
|
||||||
|
public AfterActivatableUIOpenEvent(EntityUid who)
|
||||||
{
|
{
|
||||||
User = who;
|
User = who;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This is after it's decided the user can open the UI,
|
||||||
|
/// but before the UI actually opens.
|
||||||
|
/// Use this if you need to prepare the UI itself
|
||||||
|
/// </summary>
|
||||||
|
public sealed class BeforeActivatableUIOpenEvent : EntityEventArgs
|
||||||
|
{
|
||||||
|
public EntityUid User { get; }
|
||||||
|
public BeforeActivatableUIOpenEvent(EntityUid who)
|
||||||
|
{
|
||||||
|
User = who;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public sealed class ActivatableUIPlayerChangedEvent : EntityEventArgs
|
public sealed class ActivatableUIPlayerChangedEvent : EntityEventArgs
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,15 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Content.Shared.Interaction;
|
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using System;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.WireHacking;
|
|
||||||
using Content.Shared.Access.Components;
|
using Content.Shared.Access.Components;
|
||||||
using Content.Shared.Access.Systems;
|
using Content.Shared.Access.Systems;
|
||||||
using Content.Shared.VendingMachines;
|
using Content.Shared.VendingMachines;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Content.Server.Throwing;
|
using Content.Server.Throwing;
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Content.Shared.Acts;
|
using Content.Shared.Acts;
|
||||||
using static Content.Shared.VendingMachines.SharedVendingMachineComponent;
|
using static Content.Shared.VendingMachines.SharedVendingMachineComponent;
|
||||||
|
|
||||||
@@ -34,7 +26,6 @@ namespace Content.Server.VendingMachines.systems
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeLocalEvent<VendingMachineComponent, ComponentInit>(OnComponentInit);
|
SubscribeLocalEvent<VendingMachineComponent, ComponentInit>(OnComponentInit);
|
||||||
SubscribeLocalEvent<VendingMachineComponent, ActivateInWorldEvent>(HandleActivate);
|
|
||||||
SubscribeLocalEvent<VendingMachineComponent, PowerChangedEvent>(OnPowerChanged);
|
SubscribeLocalEvent<VendingMachineComponent, PowerChangedEvent>(OnPowerChanged);
|
||||||
SubscribeLocalEvent<VendingMachineComponent, InventorySyncRequestMessage>(OnInventoryRequestMessage);
|
SubscribeLocalEvent<VendingMachineComponent, InventorySyncRequestMessage>(OnInventoryRequestMessage);
|
||||||
SubscribeLocalEvent<VendingMachineComponent, VendingMachineEjectMessage>(OnInventoryEjectMessage);
|
SubscribeLocalEvent<VendingMachineComponent, VendingMachineEjectMessage>(OnInventoryEjectMessage);
|
||||||
@@ -72,30 +63,6 @@ namespace Content.Server.VendingMachines.systems
|
|||||||
AuthorizedVend(uid, entity, args.ID, component);
|
AuthorizedVend(uid, entity, args.ID, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleActivate(EntityUid uid, VendingMachineComponent component, ActivateInWorldEvent args)
|
|
||||||
{
|
|
||||||
if (!TryComp<ActorComponent>(args.User, out var actor))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IsPowered(uid, component))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TryComp<WiresComponent>(uid, out var wires))
|
|
||||||
{
|
|
||||||
if (wires.IsPanelOpen)
|
|
||||||
{
|
|
||||||
wires.OpenInterface(actor.PlayerSession);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
component.UserInterface?.Toggle(actor.PlayerSession);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnPowerChanged(EntityUid uid, VendingMachineComponent component, PowerChangedEvent args)
|
private void OnPowerChanged(EntityUid uid, VendingMachineComponent component, PowerChangedEvent args)
|
||||||
{
|
{
|
||||||
TryUpdateVisualState(uid, null, component);
|
TryUpdateVisualState(uid, null, component);
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
base-computer-ui-component-not-powered = The computer is not powered.
|
base-computer-ui-component-not-powered = {CAPITALIZE(THE($machine))} is not powered.
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
layers:
|
layers:
|
||||||
- state: paper
|
- state: paper
|
||||||
- type: Paper
|
- type: Paper
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.PaperUiKey.Key
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.PaperUiKey.Key
|
- key: enum.PaperUiKey.Key
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
state: icon
|
state: icon
|
||||||
netsync: false
|
netsync: false
|
||||||
- type: GasAnalyzer
|
- type: GasAnalyzer
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.GasAnalyzerUiKey.Key
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.GasAnalyzerUiKey.Key
|
- key: enum.GasAnalyzerUiKey.Key
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Tanks/generic.rsi
|
sprite: Objects/Tanks/generic.rsi
|
||||||
state: icon
|
state: icon
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.SharedGasTankUiKey.Key
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.SharedGasTankUiKey.Key
|
- key: enum.SharedGasTankUiKey.Key
|
||||||
|
|||||||
@@ -26,6 +26,9 @@
|
|||||||
- SmallImpassable
|
- SmallImpassable
|
||||||
- type: ApcPowerReceiver
|
- type: ApcPowerReceiver
|
||||||
- type: ExtensionCableReceiver
|
- type: ExtensionCableReceiver
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.ReagentDispenserUiKey.Key
|
||||||
|
- type: ActivatableUIRequiresPower
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.ReagentDispenserUiKey.Key
|
- key: enum.ReagentDispenserUiKey.Key
|
||||||
|
|||||||
@@ -41,6 +41,9 @@
|
|||||||
- type: SpaceVillainArcade
|
- type: SpaceVillainArcade
|
||||||
- type: Wires
|
- type: Wires
|
||||||
BoardName: "Arcade"
|
BoardName: "Arcade"
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.SpaceVillainArcadeUiKey.Key
|
||||||
|
- type: ActivatableUIRequiresPower
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.SpaceVillainArcadeUiKey.Key
|
- key: enum.SpaceVillainArcadeUiKey.Key
|
||||||
@@ -57,6 +60,9 @@
|
|||||||
parent: ArcadeBase
|
parent: ArcadeBase
|
||||||
components:
|
components:
|
||||||
- type: BlockGameArcade
|
- type: BlockGameArcade
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.BlockGameUiKey.Key
|
||||||
|
- type: ActivatableUIRequiresPower
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.BlockGameUiKey.Key
|
- key: enum.BlockGameUiKey.Key
|
||||||
|
|||||||
@@ -156,6 +156,9 @@
|
|||||||
- type: ResearchClient
|
- type: ResearchClient
|
||||||
- type: ResearchConsole
|
- type: ResearchConsole
|
||||||
- type: TechnologyDatabase
|
- type: TechnologyDatabase
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.ResearchConsoleUiKey.Key
|
||||||
|
- type: ActivatableUIRequiresPower
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.ResearchConsoleUiKey.Key
|
- key: enum.ResearchConsoleUiKey.Key
|
||||||
@@ -226,6 +229,9 @@
|
|||||||
description: That's a body scanner.
|
description: That's a body scanner.
|
||||||
components:
|
components:
|
||||||
- type: BodyScanner
|
- type: BodyScanner
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.BodyScannerUiKey.Key
|
||||||
|
- type: ActivatableUIRequiresPower
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.BodyScannerUiKey.Key
|
- key: enum.BodyScannerUiKey.Key
|
||||||
@@ -295,6 +301,10 @@
|
|||||||
radius: 1.5
|
radius: 1.5
|
||||||
energy: 1.6
|
energy: 1.6
|
||||||
color: "#e6e227"
|
color: "#e6e227"
|
||||||
|
- type: Tag
|
||||||
|
tags:
|
||||||
|
- DroneUsable
|
||||||
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: ComputerBase
|
parent: ComputerBase
|
||||||
|
|||||||
@@ -45,6 +45,9 @@
|
|||||||
node: machineFrame
|
node: machineFrame
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.ChemMasterUiKey.Key
|
||||||
|
- type: ActivatableUIRequiresPower
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.ChemMasterUiKey.Key
|
- key: enum.ChemMasterUiKey.Key
|
||||||
|
|||||||
@@ -54,6 +54,8 @@
|
|||||||
enum.CloningPodStatus.NoMind: pod_e
|
enum.CloningPodStatus.NoMind: pod_e
|
||||||
enum.CloningPodStatus.Gore: pod_g
|
enum.CloningPodStatus.Gore: pod_g
|
||||||
enum.CloningPodStatus.Idle: pod_0
|
enum.CloningPodStatus.Idle: pod_0
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.CloningPodUIKey.Key #Ejecting doesn't require power so I didn't give it that component
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.CloningPodUIKey.Key
|
- key: enum.CloningPodUIKey.Key
|
||||||
|
|||||||
@@ -70,6 +70,9 @@
|
|||||||
visuals:
|
visuals:
|
||||||
- type: AutolatheVisualizer
|
- type: AutolatheVisualizer
|
||||||
- type: WiresVisualizer
|
- type: WiresVisualizer
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.LatheUiKey.Key
|
||||||
|
- type: ActivatableUIRequiresPower
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.LatheUiKey.Key
|
- key: enum.LatheUiKey.Key
|
||||||
@@ -182,6 +185,9 @@
|
|||||||
- KitchenKnife
|
- KitchenKnife
|
||||||
- ButchCleaver
|
- ButchCleaver
|
||||||
- FlashlightLantern
|
- FlashlightLantern
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.LatheUiKey.Key #Yes only having 1 of them here doesn't break anything
|
||||||
|
- type: ActivatableUIRequiresPower
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.LatheUiKey.Key
|
- key: enum.LatheUiKey.Key
|
||||||
|
|||||||
@@ -49,6 +49,9 @@
|
|||||||
- type: Appearance
|
- type: Appearance
|
||||||
visuals:
|
visuals:
|
||||||
- type: MedicalScannerVisualizer
|
- type: MedicalScannerVisualizer
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.MedicalScannerUiKey.Key
|
||||||
|
- type: ActivatableUIRequiresPower
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.MedicalScannerUiKey.Key
|
- key: enum.MedicalScannerUiKey.Key
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
- type: Appearance
|
- type: Appearance
|
||||||
visuals:
|
visuals:
|
||||||
- type: MicrowaveVisualizer
|
- type: MicrowaveVisualizer
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.MicrowaveUiKey.Key
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.MicrowaveUiKey.Key
|
- key: enum.MicrowaveUiKey.Key
|
||||||
|
|||||||
@@ -37,6 +37,9 @@
|
|||||||
behaviors:
|
behaviors:
|
||||||
- !type:DoActsBehavior
|
- !type:DoActsBehavior
|
||||||
acts: ["Breakage"]
|
acts: ["Breakage"]
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.VendingMachineUiKey.Key
|
||||||
|
- type: ActivatableUIRequiresPower
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.VendingMachineUiKey.Key
|
- key: enum.VendingMachineUiKey.Key
|
||||||
@@ -188,6 +191,9 @@
|
|||||||
- type: Advertise
|
- type: Advertise
|
||||||
pack: ClothesMateAds
|
pack: ClothesMateAds
|
||||||
- type: Speech
|
- type: Speech
|
||||||
|
- type: Tag
|
||||||
|
tags:
|
||||||
|
- DroneUsable
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Structures/Machines/VendingMachines/clothing.rsi
|
sprite: Structures/Machines/VendingMachines/clothing.rsi
|
||||||
layers:
|
layers:
|
||||||
@@ -657,6 +663,9 @@
|
|||||||
radius: 1.5
|
radius: 1.5
|
||||||
energy: 1.6
|
energy: 1.6
|
||||||
color: "#c73434"
|
color: "#c73434"
|
||||||
|
- type: Tag
|
||||||
|
tags:
|
||||||
|
- DroneUsable
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: VendingMachine
|
parent: VendingMachine
|
||||||
@@ -754,6 +763,9 @@
|
|||||||
radius: 1.5
|
radius: 1.5
|
||||||
energy: 1.6
|
energy: 1.6
|
||||||
color: "#d4ab33"
|
color: "#d4ab33"
|
||||||
|
- type: Tag
|
||||||
|
tags:
|
||||||
|
- DroneUsable
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: VendingMachine
|
parent: VendingMachine
|
||||||
|
|||||||
@@ -114,6 +114,8 @@
|
|||||||
- type: DisposalVisualizer
|
- type: DisposalVisualizer
|
||||||
state_free: conpipe-tagger
|
state_free: conpipe-tagger
|
||||||
state_anchored: pipe-tagger
|
state_anchored: pipe-tagger
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.DisposalTaggerUiKey.Key
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.DisposalTaggerUiKey.Key
|
- key: enum.DisposalTaggerUiKey.Key
|
||||||
@@ -178,6 +180,8 @@
|
|||||||
state_anchored: pipe-j1s
|
state_anchored: pipe-j1s
|
||||||
- type: Flippable
|
- type: Flippable
|
||||||
mirrorEntity: DisposalRouterFlipped
|
mirrorEntity: DisposalRouterFlipped
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.DisposalRouterUiKey.Key
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.DisposalRouterUiKey.Key
|
- key: enum.DisposalRouterUiKey.Key
|
||||||
|
|||||||
@@ -23,6 +23,9 @@
|
|||||||
- type: Construction
|
- type: Construction
|
||||||
graph: ParticleAcceleratorControlBox
|
graph: ParticleAcceleratorControlBox
|
||||||
node: completed
|
node: completed
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.ParticleAcceleratorControlBoxUiKey.Key
|
||||||
|
- type: ActivatableUIRequiresPower
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.ParticleAcceleratorControlBoxUiKey.Key
|
- key: enum.ParticleAcceleratorControlBoxUiKey.Key
|
||||||
|
|||||||
@@ -46,6 +46,8 @@
|
|||||||
- type: Anchorable
|
- type: Anchorable
|
||||||
- type: Pullable
|
- type: Pullable
|
||||||
- type: AMEController
|
- type: AMEController
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.AMEControllerUiKey.Key
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.AMEControllerUiKey.Key
|
- key: enum.AMEControllerUiKey.Key
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
- type: Transform
|
- type: Transform
|
||||||
anchored: true
|
anchored: true
|
||||||
- type: MagicMirror
|
- type: MagicMirror
|
||||||
|
- type: ActivatableUI
|
||||||
|
key: enum.MagicMirrorUiKey.Key
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.MagicMirrorUiKey.Key
|
- key: enum.MagicMirrorUiKey.Key
|
||||||
|
|||||||
Reference in New Issue
Block a user