From 5eb0282b9490906dbd342454247607aa367e1d8a Mon Sep 17 00:00:00 2001 From: Lazzi0706 Date: Wed, 14 Feb 2024 11:14:24 +0700 Subject: [PATCH 1/5] huh, skub! --- Content.Client/Ghost/GhostSystem.cs | 8 ++++++-- Content.Server/Ghost/GhostSystem.cs | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Content.Client/Ghost/GhostSystem.cs b/Content.Client/Ghost/GhostSystem.cs index f6913d257864..018fa6d147f4 100644 --- a/Content.Client/Ghost/GhostSystem.cs +++ b/Content.Client/Ghost/GhostSystem.cs @@ -3,9 +3,9 @@ using Content.Shared.Ghost; using Robust.Client.Console; using Robust.Client.GameObjects; -using Robust.Client.Graphics; using Robust.Client.Player; using Robust.Shared.Player; +using Robust.Shared.Random; namespace Content.Client.Ghost { @@ -131,8 +131,12 @@ private void OnGhostPlayerAttach(EntityUid uid, GhostComponent component, LocalP private void OnGhostState(EntityUid uid, GhostComponent component, ref AfterAutoHandleStateEvent args) { + // при прямом указаний цвета в sprite.LayerSetColor цвет назначается, если это делать через рандомизацию (даже если цвет успешно сгенерирован и это видно в дебагере)... + // ...тогда стандартный гост, увы + var _random = new Random(); + var color = new Color(_random.Next(1, 255), _random.Next(1, 255), _random.Next(1, 255)); if (TryComp(uid, out var sprite)) - sprite.LayerSetColor(0, component.color); + sprite.LayerSetColor(0, color); if (uid != _playerManager.LocalEntity) return; diff --git a/Content.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs index c0e753c4c555..0fda1bb2deca 100644 --- a/Content.Server/Ghost/GhostSystem.cs +++ b/Content.Server/Ghost/GhostSystem.cs @@ -42,7 +42,6 @@ public sealed class GhostSystem : SharedGhostSystem [Dependency] private readonly GameTicker _ticker = default!; [Dependency] private readonly TransformSystem _transformSystem = default!; [Dependency] private readonly VisibilitySystem _visibilitySystem = default!; - public override void Initialize() { base.Initialize(); From 3501a7858b5673f0a6903069ec3b93a04dcc0fda Mon Sep 17 00:00:00 2001 From: werzet <10843461+Werzet@users.noreply.github.com> Date: Sun, 5 May 2024 17:11:47 +1000 Subject: [PATCH 2/5] fix after merge --- Content.Client/Ghost/GhostSystem.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Content.Client/Ghost/GhostSystem.cs b/Content.Client/Ghost/GhostSystem.cs index 9a22326ed6a5..43e412985d46 100644 --- a/Content.Client/Ghost/GhostSystem.cs +++ b/Content.Client/Ghost/GhostSystem.cs @@ -170,6 +170,7 @@ private void OnGhostState(EntityUid uid, GhostComponent component, ref AfterAuto var _random = new Random(); var color = new Color(_random.Next(1, 255), _random.Next(1, 255), _random.Next(1, 255)); if (TryComp(uid, out var sprite)) + { sprite.LayerSetColor(0, color); //SS220-ghost-hats From d955c3be39e2e9ccca18f49a8bf042de05cf5418 Mon Sep 17 00:00:00 2001 From: werzet <10843461+Werzet@users.noreply.github.com> Date: Mon, 6 May 2024 21:18:34 +1000 Subject: [PATCH 3/5] fix set ghost color --- Content.Client/Ghost/GhostSystem.cs | 49 +++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/Content.Client/Ghost/GhostSystem.cs b/Content.Client/Ghost/GhostSystem.cs index 43e412985d46..a71bbbbd2753 100644 --- a/Content.Client/Ghost/GhostSystem.cs +++ b/Content.Client/Ghost/GhostSystem.cs @@ -9,6 +9,8 @@ using Robust.Shared.Random; using Robust.Shared.Prototypes; using System.Linq; +using System.Threading.Tasks; +using Content.Shared.Sprite; namespace Content.Client.Ghost { @@ -19,6 +21,7 @@ public sealed class GhostSystem : SharedGhostSystem [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly SharedActionsSystem _actions = default!; [Dependency] private readonly ContentEyeSystem _contentEye = default!; + [Dependency] private readonly IEntityManager _entityManager = default!; public int AvailableGhostRoleCount { get; private set; } @@ -94,6 +97,31 @@ private void OnToggleLighting(EntityUid uid, EyeComponent component, ToggleLight private void OnToggleFoV(EntityUid uid, EyeComponent component, ToggleFoVActionEvent args) { + if (TryComp(uid, out var sprite)) + { + var _random = new Random(); + var color = new Color(_random.Next(1, 255), _random.Next(1, 255), _random.Next(1, 255)); + + // sprite.Color = color; + + sprite.Rotation += Angle.FromDegrees(180.0f); + + sprite.Color = sprite.Color.WithBlue(10); + //var t = sprite.GetType(); + + //var pr = t.GetProperties(); + + //var col = pr.FirstOrDefault(x => x.Name == "Color"); + + //if (col is not null) + //{ + + // col.GetSetMethod(true)!.Invoke(sprite, new object[] { color }); + //} + + // sprite. + // PlayerUpdated?.Invoke(Player); + } if (args.Handled) return; @@ -159,20 +187,29 @@ private void OnGhostRemove(EntityUid uid, GhostComponent component, ComponentRem private void OnGhostPlayerAttach(EntityUid uid, GhostComponent component, LocalPlayerAttachedEvent localPlayerAttachedEvent) { + // SS220 colorful ghost begin + if (TryComp(uid, out var sprite)) + { + var random = new Random(); + + var color = new Color( + (float) random.Next(1, 255) / byte.MaxValue, + (float) random.Next(1, 255) / byte.MaxValue, + (float) random.Next(1, 255) / byte.MaxValue, + sprite.Color.A); + + sprite.Color = color; + } + // SS220 colorful ghost end + GhostVisibility = true; PlayerAttached?.Invoke(component); } private void OnGhostState(EntityUid uid, GhostComponent component, ref AfterAutoHandleStateEvent args) { - // ��� ������ �������� ����� � sprite.LayerSetColor ���� �����������, ���� ��� ������ ����� ������������ (���� ���� ���� ������� ������������ � ��� ����� � ��������)... - // ...����� ����������� ����, ��� - var _random = new Random(); - var color = new Color(_random.Next(1, 255), _random.Next(1, 255), _random.Next(1, 255)); if (TryComp(uid, out var sprite)) { - sprite.LayerSetColor(0, color); - //SS220-ghost-hats SetBodyVisuals(uid, sprite, component.BodyVisible); } From 4d2f860f9482a576e1f1ecdb1530968da249fcbb Mon Sep 17 00:00:00 2001 From: Dexler <69513582+DexlerXD@users.noreply.github.com> Date: Tue, 7 May 2024 00:32:05 +0300 Subject: [PATCH 4/5] Fix RobustToolbox merge --- RobustToolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobustToolbox b/RobustToolbox index 3330d9617728..970da5f717c9 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 3330d9617728534bfef313201de0327c4e7f0627 +Subproject commit 970da5f717c921bfa110aa5dc31e74edb96dcf99 From e5a186ad6f785113078afa6f43509dad7777c24b Mon Sep 17 00:00:00 2001 From: Dexler <69513582+DexlerXD@users.noreply.github.com> Date: Tue, 7 May 2024 00:45:22 +0300 Subject: [PATCH 5/5] we should prob comment that... --- Content.Client/Ghost/GhostSystem.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Content.Client/Ghost/GhostSystem.cs b/Content.Client/Ghost/GhostSystem.cs index a71bbbbd2753..a8ce5d7df01a 100644 --- a/Content.Client/Ghost/GhostSystem.cs +++ b/Content.Client/Ghost/GhostSystem.cs @@ -97,6 +97,7 @@ private void OnToggleLighting(EntityUid uid, EyeComponent component, ToggleLight private void OnToggleFoV(EntityUid uid, EyeComponent component, ToggleFoVActionEvent args) { + //SS220-colorful-ghosts begin if (TryComp(uid, out var sprite)) { var _random = new Random(); @@ -122,6 +123,8 @@ private void OnToggleFoV(EntityUid uid, EyeComponent component, ToggleFoVActionE // sprite. // PlayerUpdated?.Invoke(Player); } + //SS220-colorful-ghosts end + if (args.Handled) return; @@ -210,6 +213,9 @@ private void OnGhostState(EntityUid uid, GhostComponent component, ref AfterAuto { if (TryComp(uid, out var sprite)) { + //SS220-colorful-ghosts + //sprite.LayerSetColor(0, component.color); + //SS220-ghost-hats SetBodyVisuals(uid, sprite, component.BodyVisible); }