mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-16 21:17:39 +03:00
# Description This PR adds the ability to transfer objects from one player's hand to another player's hand, as in SS13. I have little coding experience, so my solutions may not be ideal. --- # TODO - [x] Make the code work - [x] Add popup - [x] Write a summary of the code - [x] Сorrect inaccuracies <details><summary><h1>Media</h1></summary> <p> https://youtu.be/zTQWTsYm1gw </p> </details> --- # Changelog 🆑 - add: Added system - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --------- Co-authored-by: Danger Revolution! <142105406+DangerRevolution@users.noreply.github.com>
52 lines
1.5 KiB
C#
52 lines
1.5 KiB
C#
using Content.Shared.CCVar;
|
|
using Content.Shared.OfferItem;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Client.Input;
|
|
using Robust.Client.Player;
|
|
using Robust.Shared.Configuration;
|
|
|
|
namespace Content.Client.OfferItem;
|
|
|
|
public sealed class OfferItemSystem : SharedOfferItemSystem
|
|
{
|
|
[Dependency] private readonly IOverlayManager _overlayManager = default!;
|
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
|
[Dependency] private readonly IInputManager _inputManager = default!;
|
|
[Dependency] private readonly IEyeManager _eye = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
Subs.CVar(_cfg, CCVars.OfferModeIndicatorsPointShow, OnShowOfferIndicatorsChanged, true);
|
|
}
|
|
public override void Shutdown()
|
|
{
|
|
_overlayManager.RemoveOverlay<OfferItemIndicatorsOverlay>();
|
|
|
|
base.Shutdown();
|
|
}
|
|
|
|
public bool IsInOfferMode()
|
|
{
|
|
var entity = _playerManager.LocalEntity;
|
|
|
|
if (entity == null)
|
|
return false;
|
|
|
|
return IsInOfferMode(entity.Value);
|
|
}
|
|
private void OnShowOfferIndicatorsChanged(bool isShow)
|
|
{
|
|
if (isShow)
|
|
{
|
|
_overlayManager.AddOverlay(new OfferItemIndicatorsOverlay(
|
|
_inputManager,
|
|
EntityManager,
|
|
_eye,
|
|
this));
|
|
}
|
|
else
|
|
_overlayManager.RemoveOverlay<OfferItemIndicatorsOverlay>();
|
|
}
|
|
}
|