Skip to content

Commit

Permalink
Merge branch 'xtray85:master' into resprites
Browse files Browse the repository at this point in the history
  • Loading branch information
Ratyyy authored May 21, 2024
2 parents 1641f8e + 4b9f008 commit 660baff
Show file tree
Hide file tree
Showing 422 changed files with 729,616 additions and 82,002 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 8.0.203

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 8.0.203

- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yaml-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 8.0.203
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion ADT_STATION
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();
}
}
2 changes: 1 addition & 1 deletion Content.Client/Overlays/ShowHealthIconsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected override void DeactivateInternal()

private void OnGetStatusIconsEvent(Entity<DamageableComponent> entity, ref GetStatusIconsEvent args)
{
if (!IsActive || args.InContainer)
if (!IsActive || args.InContainer || args.HasStealthComponent)
return;

var healthIcons = DecideHealthIcons(entity);
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Overlays/ShowHungerIconsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public override void Initialize()

private void OnGetStatusIconsEvent(EntityUid uid, HungerComponent hungerComponent, ref GetStatusIconsEvent args)
{
if (!IsActive || args.InContainer)
if (!IsActive || args.InContainer || args.HasStealthComponent)
return;

var hungerIcons = DecideHungerIcon(uid, hungerComponent);
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Overlays/ShowSecurityIconsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public override void Initialize()

private void OnGetStatusIconsEvent(EntityUid uid, StatusIconComponent _, ref GetStatusIconsEvent @event)
{
if (!IsActive || @event.InContainer)
if (!IsActive || @event.InContainer || @event.HasStealthComponent)
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Overlays/ShowThirstIconsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public override void Initialize()

private void OnGetStatusIconsEvent(EntityUid uid, ThirstComponent thirstComponent, ref GetStatusIconsEvent args)
{
if (!IsActive || args.InContainer)
if (!IsActive || args.InContainer || args.HasStealthComponent)
return;

var thirstIcons = DecideThirstIcon(uid, thirstComponent);
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/SSDIndicator/SSDIndicatorSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Shared.CCVar;
using Content.Shared.CCVar;
using Content.Shared.Mind.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.NPC;
Expand Down Expand Up @@ -31,6 +31,7 @@ private void OnGetStatusIcon(EntityUid uid, SSDIndicatorComponent component, ref
if (component.IsSSD &&
_cfg.GetCVar(CCVars.ICShowSSDIndicator) &&
!args.InContainer &&
!args.HasStealthComponent &&
!_mobState.IsDead(uid) &&
!HasComp<ActiveNPCComponent>(uid) &&
TryComp<MindContainerComponent>(uid, out var mindContainer) &&
Expand Down
5 changes: 4 additions & 1 deletion Content.Client/StatusIcon/StatusIconSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Shared.CCVar;
using Content.Shared.StatusIcon;
using Content.Shared.StatusIcon.Components;
using Content.Shared.Stealth.Components;
using Robust.Client.Graphics;
using Robust.Shared.Configuration;

Expand All @@ -13,6 +14,7 @@ public sealed class StatusIconSystem : SharedStatusIconSystem
{
[Dependency] private readonly IConfigurationManager _configuration = default!;
[Dependency] private readonly IOverlayManager _overlay = default!;
[Dependency] private readonly IEntityManager _entManager = default!;

private bool _globalEnabled;
private bool _localEnabled;
Expand Down Expand Up @@ -55,7 +57,8 @@ public List<StatusIconData> GetStatusIcons(EntityUid uid, MetaDataComponent? met
return list;

var inContainer = (meta.Flags & MetaDataFlags.InContainer) != 0;
var ev = new GetStatusIconsEvent(list, inContainer);
var hasStealthComponent = _entManager.HasComponent<StealthComponent>(uid);
var ev = new GetStatusIconsEvent(list, inContainer, hasStealthComponent);
RaiseLocalEvent(uid, ref ev);
return ev.StatusIcons;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ public partial class RadialContainer : Control
/// <summary>
/// Radial item size, when cursor was focused on button
/// </summary>
public float FocusSize { get; set; } = 64f;
public float FocusSize { get; set; } = 82f;

/// <summary>
/// Normal radial item size, when cursor not focused
/// </summary>
public float NormalSize { get; set; } = 50f;
public float NormalSize { get; set; } = 64f;

/// <summary>
/// Items moving animation time, when radial was opened
Expand Down Expand Up @@ -136,7 +136,7 @@ public void OpenCentered()
if (Parent == null)
return;

LayoutContainer.SetPosition(this, (Parent.Size/2) - (Size/2));
LayoutContainer.SetPosition(this, (Parent.Size / 2) - (Size / 2));
UpdateButtons();
}

Expand All @@ -156,7 +156,7 @@ public void OpenCenteredAt(Vector2 position)
if (Parent == null)
return;

LayoutContainer.SetPosition(this, (Parent.Size * position) - (Size/2));
LayoutContainer.SetPosition(this, (Parent.Size * position) - (Size / 2));
UpdateButtons();
}

Expand Down Expand Up @@ -211,12 +211,13 @@ public RadialItem AddButton(string action, string? texturePath = null)
/// <param name="action">Item content text</param>
/// <param name="texture">Item's icon texture</param>
/// <returns></returns>
public RadialItem AddButton(string action, Texture? texture)
public RadialItem AddButton(string action, Texture? texture, SpriteView spriteView = default!)
{
var button = new RadialItem();
button.Content = action;
button.Controller.TexturePath = ItemBackgroundTexturePath;

if (spriteView != null)
button.EntityView.SetEntity(spriteView.NetEnt != null ? spriteView.NetEnt.Value : NetEntity.Invalid);
if (texture != null)
button.Icon.Texture = texture;

Expand All @@ -229,13 +230,13 @@ private void UpdateButtons()
{
Visible = true;

var angleDegrees = 360/Layout.ChildCount;
var angleDegrees = 360 / Layout.ChildCount;
var stepAngle = -angleDegrees + -90;
var distance = GetDistance();

foreach (var child in Layout.Children)
{
var button = (RadialItem)child;
var button = (RadialItem) child;
button.ButtonSize = new Vector2(NormalSize, NormalSize);
stepAngle += angleDegrees;
var pos = GetPointFromPolar(stepAngle, distance);
Expand Down Expand Up @@ -329,8 +330,8 @@ protected override void Draw(DrawingHandleScreen handle)

foreach (var child in Layout.Children)
{
var button = (RadialItem)child;
LayoutContainer.SetPosition(child, button.Offset - (button.Size/2));
var button = (RadialItem) child;
LayoutContainer.SetPosition(child, button.Offset - (button.Size / 2));
}

// FIXME: We use item's offset like "local item position" for animation. Need make some better way to do it;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
Access="Public"
VerticalExpand="True"
HorizontalExpand="True">
<SpriteView Access="Public" Name="EntityView"
SetSize="64 64"
OverrideDirection="South">
</SpriteView>
<TextureRect Access="Public" Name="Icon"
VerticalExpand="True"
HorizontalExpand="True"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Numerics;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Animations;

Expand Down
5 changes: 3 additions & 2 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ public sealed class PostMapInitTest
"ADTCore",
"ADTMarathon",
"ADTAtlas",

"ADTDelta",
"ADTTrain",
"ADTAvrite",
// Corvax-Start
"CorvaxAvrite",
"CorvaxDelta",
// Corvax-End

"Dev",
Expand Down
Loading

0 comments on commit 660baff

Please sign in to comment.