Skip to content

Commit

Permalink
код с АДТ(нуждается в фиксе)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ratyyy committed Jun 27, 2024
1 parent dec91dc commit d3a058a
Show file tree
Hide file tree
Showing 131 changed files with 9,988 additions and 1 deletion.
49 changes: 49 additions & 0 deletions Content.Client/ADT/ApathySystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Content.Shared.Drugs;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Player;
using Content.Shared.Alert;
using Content.Client.UserInterface.Systems.DamageOverlays;
using Content.Shared.ADT;

namespace Content.Client.ADT;

public sealed class ApathySystem : EntitySystem
{
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
public static string ApathyKey = "Apathy";

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ApathyComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<ApathyComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<ApathyComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<ApathyComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);

}

private void OnInit(EntityUid uid, ApathyComponent component, ComponentInit args)
{
if (_player.LocalPlayer?.ControlledEntity == uid)
_alertsSystem.ShowAlert(uid, component.Alert);
}

private void OnShutdown(EntityUid uid, ApathyComponent component, ComponentShutdown args)
{
if (_player.LocalPlayer?.ControlledEntity == uid)
_alertsSystem.ClearAlert(uid, component.Alert);
}

private void OnPlayerAttached(EntityUid uid, ApathyComponent component, LocalPlayerAttachedEvent args)
{
_alertsSystem.ShowAlert(uid, component.Alert);
}

private void OnPlayerDetached(EntityUid uid, ApathyComponent component, LocalPlayerDetachedEvent args)
{
_alertsSystem.ClearAlert(uid, component.Alert);
}
}
67 changes: 67 additions & 0 deletions Content.Client/ADT/BoomBox/UI/BoomBoxBoundUi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using Content.Shared.BoomBox;
using JetBrains.Annotations;
using Robust.Client.GameObjects;

namespace Content.Client.ADT.BoomBox.UI;

[UsedImplicitly]
public sealed class BoomBoxBoundUi : BoundUserInterface
{
[ViewVariables]
private BoomBoxWindow? _window;

public BoomBoxBoundUi(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}

protected override void Open()
{
base.Open();

_window = new BoomBoxWindow();
_window.OpenCentered();

_window.OnClose += Close;
_window.MinusVolButtonPressed += OnMinusVolButtonPressed;
_window.PlusVolButtonPressed += OnPlusVolButtonPressed;
_window.StartButtonPressed += OnStartButtonPressed;
_window.StopButtonPressed += OnStopButtonPressed;
}

private void OnMinusVolButtonPressed()
{
SendMessage(new BoomBoxMinusVolMessage());
}

private void OnPlusVolButtonPressed()
{
SendMessage(new BoomBoxPlusVolMessage());
}

private void OnStartButtonPressed()
{
SendMessage(new BoomBoxStartMessage());
}

private void OnStopButtonPressed()
{
SendMessage(new BoomBoxStopMessage());
}

protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);

if (_window == null || state is not BoomBoxUiState cast)
return;

_window.UpdateState(cast);
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
_window?.Dispose();
}
}
25 changes: 25 additions & 0 deletions Content.Client/ADT/BoomBox/UI/BoomBoxWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<DefaultWindow xmlns="https://spacestation14.io"
Title="{Loc 'boombox-ui-window'}"
MinSize="256 80"
SetSize="256 80">
<BoxContainer Orientation="Vertical" VerticalExpand="True">
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<Button Name="MinusVolButton"
Text="{Loc 'boombox-ui-minusvol-button'}"
HorizontalExpand="True"
Disabled="True" />
<Button Name="StartButton"
Text="{Loc 'boombox-ui-start-button'}"
HorizontalExpand="True"
Disabled="True" />
<Button Name="StopButton"
Text="{Loc 'boombox-ui-stop-button'}"
HorizontalExpand="True"
Disabled="True" />
<Button Name="PlusVolButton"
Text="{Loc 'boombox-ui-plusvol-button'}"
HorizontalExpand="True"
Disabled="True" />
</BoxContainer>
</BoxContainer>
</DefaultWindow>
34 changes: 34 additions & 0 deletions Content.Client/ADT/BoomBox/UI/BoomBoxWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System.Linq;
using Content.Shared.BoomBox;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.ADT.BoomBox.UI;

[GenerateTypedNameReferences]
public sealed partial class BoomBoxWindow : DefaultWindow
{
public event Action? MinusVolButtonPressed;
public event Action? PlusVolButtonPressed;
public event Action? StartButtonPressed;
public event Action? StopButtonPressed;

public BoomBoxWindow()
{
RobustXamlLoader.Load(this);

MinusVolButton.OnPressed += _ => MinusVolButtonPressed?.Invoke();
PlusVolButton.OnPressed += _ => PlusVolButtonPressed?.Invoke();
StartButton.OnPressed += _ => StartButtonPressed?.Invoke();
StopButton.OnPressed += _ => StopButtonPressed?.Invoke();
}

public void UpdateState(BoomBoxUiState state)
{
MinusVolButton.Disabled = !state.CanMinusVol;
PlusVolButton.Disabled = !state.CanPlusVol;
StartButton.Disabled = !state.CanStart;
StopButton.Disabled = !state.CanStop;
}
}
104 changes: 104 additions & 0 deletions Content.Client/ADT/Changeling/ChangelingPanelSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// /// Made for Adventure Time Project by ModerN. https://github.com/modern-nm mailto:[email protected]
// /// see also https://github.com/DocNITE/liebendorf-station/tree/feature/emote-radial-panel
// using Content.Client.Humanoid;
// using Content.Client.UserInterface.Systems.Radial;
// using Content.Client.UserInterface.Systems.Radial.Controls;
// using Content.Shared.Changeling;
// using Content.Shared.Humanoid.Prototypes;
// using Robust.Client.GameObjects;
// using Robust.Client.Player;
// using Robust.Client.UserInterface;
// using Robust.Client.UserInterface.Controls;
// using Robust.Shared.Map;
// using Robust.Shared.Player;
// using Robust.Shared.Prototypes;
// using Robust.Shared.Random;
// using Robust.Shared.Utility;
// using System.Numerics;

// namespace Content.Client.ADT.Language;

// public sealed class ChangelingPanelSystem : EntitySystem
// {
// [Dependency] private readonly IPrototypeManager _proto = default!;
// [Dependency] private readonly IRobustRandom _random = default!;
// [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
// [Dependency] private readonly IPlayerManager _playerMan = default!;
// [Dependency] private readonly SpriteSystem _spriteSystem = default!;
// [Dependency] private readonly IEntityManager _entManager = default!;
// [Dependency] private readonly HumanoidAppearanceSystem _appearanceSystem = default!;

// /// <summary>
// /// We should enable radial for single target
// /// </summary>
// private RadialContainer? _openedMenu;

// private const string DefaultIcon = "/Textures/Interface/AdminActions/play.png";

// private const string EmptyIcon = "/Textures/Interface/AdminActions/emptyIcon.png";

// public override void Initialize()
// {
// base.Initialize();

// SubscribeLocalEvent<PlayerAttachedEvent>(OnPlayerAttached);
// SubscribeLocalEvent<PlayerDetachedEvent>(OnPlayerDetached);

// SubscribeNetworkEvent<RequestChangelingFormsMenuEvent>(HandleChangelingFormsMenuEvent);
// }

// private void HandleChangelingFormsMenuEvent(RequestChangelingFormsMenuEvent args)
// {
// if (_openedMenu != null)
// return;
// if (_playerMan.LocalEntity == null)
// {
// return;
// }

// //if (!TryComp<ChangelingComponent>(_playerMan.LocalEntity.Value, out var changelingComponent)) // нет на клиенте
// // return;

// _openedMenu = _userInterfaceManager.GetUIController<RadialUiController>()
// .CreateRadialContainer();

// foreach (var humanoid in args.HumanoidData)
// {
// var dummy = _entManager.SpawnEntity(_proto.Index<SpeciesPrototype>(humanoid.Species).DollPrototype, MapCoordinates.Nullspace);
// //var humanoidEntityUid = GetEntity(humanoid); // Entities on the client outside of the FOV are nonexistant. You can see that if you zoom out. //So it'll give you UID 0 which is EntityUid.Invalid.
// _appearanceSystem.LoadProfile(dummy, humanoid.Profile);
// var face = new SpriteView();
// face.SetEntity(dummy);

// var actionName = humanoid.Name;
// var texturePath = _spriteSystem.Frame0(new SpriteSpecifier.Texture(new ResPath(EmptyIcon)));

// var emoteButton = _openedMenu.AddButton(actionName, texturePath, face);
// emoteButton.Opacity = 210;
// emoteButton.Tooltip = null;
// emoteButton.Controller.OnPressed += (_) =>
// {
// var ev = new SelectChangelingFormEvent(args.Target, entitySelected: humanoid.NetEntity);
// RaiseNetworkEvent(ev);
// _openedMenu.Dispose();
// };
// }
// _openedMenu.OnClose += (_) =>
// {
// _openedMenu = null;
// };
// if (_playerMan.LocalEntity != null)
// _openedMenu.OpenAttached(_playerMan.LocalEntity.Value);

// }

// private void OnPlayerAttached(PlayerAttachedEvent args)
// {
// _openedMenu?.Dispose();
// }

// private void OnPlayerDetached(PlayerDetachedEvent args)
// {
// _openedMenu?.Dispose();
// }
// }
49 changes: 49 additions & 0 deletions Content.Client/ADT/ChangelingEggsSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Content.Shared.Drugs;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Player;
using Content.Shared.Alert;
using Content.Client.UserInterface.Systems.DamageOverlays;
using Content.Shared.ADT;
using Content.Shared.Changeling.Components;

namespace Content.Client.Changeling;

public sealed class LingEggsSystem : EntitySystem
{
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
public static string EggKey = "LingEggs";

private void InitializeAlert()
{

SubscribeLocalEvent<LingEggsHolderComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<LingEggsHolderComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<LingEggsHolderComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<LingEggsHolderComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);

}

private void OnInit(EntityUid uid, LingEggsHolderComponent component, ComponentInit args)
{
if (_player.LocalPlayer?.ControlledEntity == uid)
_alertsSystem.ShowAlert(uid, component.Alert);
}

private void OnShutdown(EntityUid uid, LingEggsHolderComponent component, ComponentShutdown args)
{
if (_player.LocalPlayer?.ControlledEntity == uid)
_alertsSystem.ClearAlert(uid, component.Alert);
}

private void OnPlayerAttached(EntityUid uid, LingEggsHolderComponent component, LocalPlayerAttachedEvent args)
{
_alertsSystem.ShowAlert(uid, component.Alert);
}

private void OnPlayerDetached(EntityUid uid, LingEggsHolderComponent component, LocalPlayerDetachedEvent args)
{
_alertsSystem.ClearAlert(uid, component.Alert);
}
}
Loading

0 comments on commit d3a058a

Please sign in to comment.