Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port Shadowkin #23

Open
wants to merge 57 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
530dcde
Port PR42 files directly
Finket Nov 6, 2023
487d34b
Port PR130 changes directly
Finket Nov 6, 2023
b17ccf7
Port PR146 changes directly
Finket Nov 6, 2023
08ea21b
Port PR157 changes directly
Finket Nov 6, 2023
dab0059
Port PR188 changes directly
Finket Nov 6, 2023
45681f1
Port PR189 changes directly
Finket Nov 6, 2023
20d8546
Port shadowkin visibility flags
Finket Nov 6, 2023
279bda9
Outline fixes and address some upstream refactor conflicts
Finket Nov 6, 2023
4577f38
Fix other old refactor conflicts
Finket Nov 6, 2023
a9c37e6
Add some shadowkin improvements progress
Finket Nov 7, 2023
145381a
Add more of the shadowkin improvements
Finket Nov 7, 2023
ad29f04
Revert shadowkin improvements as PR209 is a draft
Finket Nov 7, 2023
3da460f
Revert "Add some shadowkin improvements progress"
Finket Nov 7, 2023
d276fb2
Port over PR218 changes
Finket Nov 7, 2023
1f13d93
Fix directory name entities typo
Finket Nov 8, 2023
937204e
Add shadowkin ears yml
Finket Nov 8, 2023
8301021
reformatting and codebase change markers
DEATHB4DEFEAT Nov 8, 2023
616accc
Merge branch 'main' of https://github.com/Simple-Station/Parkstation-…
Finket Nov 14, 2023
6544c37
Merge commit '8301021ded383099eeff158d6b6fbdd99acc9c03' of https://gi…
Finket Nov 14, 2023
63b830a
Move over to NetEntity
Finket Nov 14, 2023
a8e404c
Merge branch 'master' of https://github.com/Simple-Station/Parkstatio…
Finket Jan 4, 2024
024392c
Move more sprites over
Finket Jan 4, 2024
fc87717
Fix Wings sprite bug
Finket Jan 5, 2024
05fb81f
Merge branch 'master' into shadowkin
Finket Feb 21, 2024
f4bc63e
Fix duplicate wings declaration
Finket Feb 21, 2024
3bf3545
Fix missing imports
Finket Feb 21, 2024
d5b22e8
Fix missing merge
Finket Feb 21, 2024
2902886
Fix shadowkin actions!
Finket Feb 21, 2024
19c1a4b
fix sprite layers
DEATHB4DEFEAT Feb 22, 2024
6f6a62e
Accept resources suggestions from review
Finket Feb 22, 2024
54044d9
Undo larger wings sprite additions
Finket Feb 22, 2024
7968e08
Clean up code comments a bit
Finket Feb 22, 2024
8bb0c80
Switch to const action prototypes with validators
Finket Feb 22, 2024
90363d0
Fix rest waking action finally
Finket Feb 22, 2024
c691569
Switch logger errors to debug assertions
Finket Feb 22, 2024
2a474d7
Fix darkswap visibility
Finket Feb 22, 2024
030c3c8
Clean SetDarkened to Darkened and UnDarkened functions
Finket Feb 22, 2024
bd1f7a8
Fix action ECS again and fix action removal
Finket Feb 22, 2024
24e03df
Address miscellaneous review items
Finket Feb 22, 2024
f2cbbae
Give shadowkin lungs so they can breath again
Finket Feb 22, 2024
e3401d8
Reenable empathy chat
Finket Feb 22, 2024
74d53c8
Temporarily remove respirator values and psionic chance
Finket Feb 24, 2024
1ca9a79
Adjust potentialpsionic value for shadowkin
Finket Mar 1, 2024
58e1f23
Fix shadowkin accent not capitalizing first letters
Finket Mar 1, 2024
bb5d848
Remove Finket's grubby mitts from comments that aren't hers
Finket Mar 6, 2024
d127704
Merge branch 'master' into shadowkin
Finket Mar 18, 2024
cd457f3
Merge branch 'shadowkin' of https://github.com/Finket/Parkstation-Fri…
Finket Mar 18, 2024
00e486f
Fix some dependency namespaces
Finket Mar 18, 2024
6482129
Fix more dependency namespaces
Finket Mar 18, 2024
65466c8
Remove redundant hardsuits.yml
Finket Mar 18, 2024
bece17e
Move from SimpleStation14 to Parkstation namespaces
Finket Mar 18, 2024
912e699
Fix more namespace issues
Finket Mar 18, 2024
e6698fe
Move texture references to Parkstation namespace
Finket Mar 18, 2024
cdf7f1c
Update LocalPlayer to LocalEntity where applicable
Finket Apr 27, 2024
d07db68
Move ForceDarkSwap and ForceTeleport to their relevant power systems
Finket Apr 27, 2024
fe60220
Pass ShadowKinPowerSystem Blackeye methods to Blackeye system
Finket Apr 27, 2024
65e73ff
Fix YAMLs
Finket Apr 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Content.Client/Chat/Managers/ChatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal sealed class ChatManager : IChatManager
[Dependency] private readonly IEntitySystemManager _systems = default!;

private ISawmill _sawmill = default!;
public event Action? PermissionsUpdated; //Nyano - Summary: need to be able to update perms for new psionics.
public event Action? PermissionsUpdated; //Nyano - Summary: need to be able to update perms for new psionics
Finket marked this conversation as resolved.
Show resolved Hide resolved
public void Initialize()
{
_sawmill = Logger.GetSawmill("chat");
Expand Down Expand Up @@ -67,16 +67,21 @@ public void SendMessage(string text, ChatSelectChannel channel)
_consoleHost.ExecuteCommand($"whisper \"{CommandParsing.Escape(str)}\"");
break;

//Nyano - Summary: sends the command for telepath communication.
//Nyano - Summary: sends the command for telepath communication
Finket marked this conversation as resolved.
Show resolved Hide resolved
case ChatSelectChannel.Telepathic:
_consoleHost.ExecuteCommand($"tsay \"{CommandParsing.Escape(str)}\"");
break;

// Parkstation-EmpathyChat
case ChatSelectChannel.Empathy:
_consoleHost.ExecuteCommand($"esay \"{CommandParsing.Escape(str)}\"");
break;

default:
throw new ArgumentOutOfRangeException(nameof(channel), channel, null);
}
}
//Nyano - Summary: fires off the update permissions script.
//Nyano - Summary: fires off the update permissions script
Finket marked this conversation as resolved.
Show resolved Hide resolved
public void UpdatePermissions()
{
PermissionsUpdated?.Invoke();
Expand Down
35 changes: 35 additions & 0 deletions Content.Client/SimpleStation14/Chat/ShadowkinChatUpdateSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Content.Client.Chat.Managers;
using Robust.Client.Player;
using Content.Shared.SimpleStation14.Species.Shadowkin.Components;

namespace Content.Client.SimpleStation14.Chat
{
public sealed class ShadowkinChatUpdateSystem : EntitySystem
{
[Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;


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

SubscribeLocalEvent<EmpathyChatComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<EmpathyChatComponent, ComponentRemove>(OnRemove);
}


public EmpathyChatComponent? Player => CompOrNull<EmpathyChatComponent>(_playerManager.LocalPlayer?.ControlledEntity);
public bool IsShadowkin => Player != null;

private void OnInit(EntityUid uid, EmpathyChatComponent component, ComponentInit args)
{
_chatManager.UpdatePermissions();
}

private void OnRemove(EntityUid uid, EmpathyChatComponent component, ComponentRemove args)
{
_chatManager.UpdatePermissions();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;

namespace Content.Client.SimpleStation14.Overlays.Shaders;

/// <summary>
/// A simple overlay that applies a colored tint to the screen.
/// </summary>
public sealed class ColorTintOverlay : Overlay
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly IEntityManager _entity = default!;

public override bool RequestScreenTexture => true;
public override OverlaySpace Space => OverlaySpace.WorldSpace;
private readonly ShaderInstance _shader;

/// <summary>
/// The color to tint the screen to as RGB on a scale of 0-1.
/// </summary>
public Vector3? TintColor = null;
/// <summary>
/// The percent to tint the screen by on a scale of 0-1.
/// </summary>
public float? TintAmount = null;
/// <summary>
/// Component required to be on the entity to tint the screen.
/// </summary>
public Component? Comp = null;


public ColorTintOverlay()
{
IoCManager.InjectDependencies(this);

_shader = _prototype.Index<ShaderPrototype>("ColorTint").InstanceUnique();
}


protected override void Draw(in OverlayDrawArgs args)
{
if (ScreenTexture == null ||
_player.LocalPlayer?.ControlledEntity is not { Valid: true } player ||
Comp != null && !_entity.HasComponent(player, Comp.GetType()))
return;

_shader.SetParameter("SCREEN_TEXTURE", ScreenTexture);
if (TintColor != null)
_shader.SetParameter("tint_color", (Vector3) TintColor);
if (TintAmount != null)
_shader.SetParameter("tint_amount", (float) TintAmount);

var worldHandle = args.WorldHandle;
var viewport = args.WorldBounds;
worldHandle.SetTransform(Matrix3.Identity);
worldHandle.UseShader(_shader);
worldHandle.DrawRect(viewport, Color.White);
worldHandle.UseShader(null);
}
}
39 changes: 39 additions & 0 deletions Content.Client/SimpleStation14/Overlays/Shaders/EtherealOverlay.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;

namespace Content.Client.SimpleStation14.Overlays.Shaders;

public sealed class EtherealOverlay : Overlay
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IPlayerManager _player = default!;

public override bool RequestScreenTexture => true;
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
private readonly ShaderInstance _shader;


public EtherealOverlay()
{
IoCManager.InjectDependencies(this);
_shader = _prototype.Index<ShaderPrototype>("Ethereal").InstanceUnique();
}


protected override void Draw(in OverlayDrawArgs args)
{
if (ScreenTexture == null) return;
if (_player.LocalPlayer?.ControlledEntity is not { Valid: true } player) return;

_shader?.SetParameter("SCREEN_TEXTURE", ScreenTexture);

var worldHandle = args.WorldHandle;
var viewport = args.WorldBounds;
worldHandle.SetTransform(Matrix3.Identity);
worldHandle.UseShader(_shader);
worldHandle.DrawRect(viewport, Color.White);
worldHandle.UseShader(null);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
using Content.Shared.Humanoid;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Player;

namespace Content.Client.SimpleStation14.Overlays.Shaders;

/// <remarks>
/// Not really an overlay to be honest
/// </remarks>
public sealed class IgnoreHumanoidWithComponentOverlay : Overlay
{
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;

public List<Component> IgnoredComponents = new();
public List<Component> AllowAnywayComponents = new();
private readonly List<EntityUid> _nonVisibleList = new();


public IgnoreHumanoidWithComponentOverlay()
{
IoCManager.InjectDependencies(this);
}


protected override void Draw(in OverlayDrawArgs args)
{
var spriteQuery = _entityManager.GetEntityQuery<SpriteComponent>();

foreach (var humanoid in _entityManager.EntityQuery<HumanoidAppearanceComponent>(true))
{
if (_playerManager.LocalPlayer?.ControlledEntity == humanoid.Owner)
continue;

var cont = true;
foreach (var comp in IgnoredComponents)
{
if (!_entityManager.HasComponent(humanoid.Owner, comp.GetType()))
continue;

cont = false;
break;
}
foreach (var comp in AllowAnywayComponents)
{
if (!_entityManager.HasComponent(humanoid.Owner, comp.GetType()))
continue;

cont = true;
break;
}
if (cont)
{
Reset(humanoid.Owner);
continue;
}


if (!spriteQuery.TryGetComponent(humanoid.Owner, out var sprite))
continue;

if (!sprite.Visible || _nonVisibleList.Contains(humanoid.Owner))
continue;

sprite.Visible = false;
_nonVisibleList.Add(humanoid.Owner);
}

foreach (var humanoid in _nonVisibleList.ToArray())
{
if (!_entityManager.Deleted(humanoid))
continue;

_nonVisibleList.Remove(humanoid);
}
}


/// <summary>
/// Resets the overlay, making all entities visible again
/// </summary>
public void Reset()
{
foreach (var humanoid in _nonVisibleList.ToArray())
{
_nonVisibleList.Remove(humanoid);

if (_entityManager.TryGetComponent<SpriteComponent>(humanoid, out var sprite))
sprite.Visible = true;
}
}

/// <summary>
/// Resets the overlay for a specific entity, making it visible again
/// </summary>
public void Reset(EntityUid entity)
{
if (!_nonVisibleList.Contains(entity))
return;

_nonVisibleList.Remove(entity);

if (_entityManager.TryGetComponent<SpriteComponent>(entity, out var sprite))
sprite.Visible = true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using Robust.Client.Graphics;
using Robust.Client.Player;
using Content.Client.SimpleStation14.Overlays.Shaders;
using Content.Shared.SimpleStation14.Species.Shadowkin.Components;
using Content.Shared.Humanoid;
using Robust.Shared.Player;

namespace Content.Client.SimpleStation14.Species.Shadowkin.Systems;

public sealed class ShadowkinDarkSwappedSystem : EntitySystem
{
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly IOverlayManager _overlay = default!;

private IgnoreHumanoidWithComponentOverlay _ignoreOverlay = default!;
private EtherealOverlay _etherealOverlay = default!;


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

_ignoreOverlay = new IgnoreHumanoidWithComponentOverlay();
_ignoreOverlay.IgnoredComponents.Add(new HumanoidAppearanceComponent());
_ignoreOverlay.AllowAnywayComponents.Add(new ShadowkinDarkSwappedComponent());
_etherealOverlay = new EtherealOverlay();

SubscribeLocalEvent<ShadowkinDarkSwappedComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<ShadowkinDarkSwappedComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<ShadowkinDarkSwappedComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<ShadowkinDarkSwappedComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);
}


private void OnStartup(EntityUid uid, ShadowkinDarkSwappedComponent component, ComponentStartup args)
{
if (_player.LocalPlayer?.ControlledEntity != uid)
return;

AddOverlay();
}

private void OnShutdown(EntityUid uid, ShadowkinDarkSwappedComponent component, ComponentShutdown args)
{
if (_player.LocalPlayer?.ControlledEntity != uid)
return;

RemoveOverlay();
}

private void OnPlayerAttached(EntityUid uid, ShadowkinDarkSwappedComponent component, LocalPlayerAttachedEvent args)
{
AddOverlay();
}

private void OnPlayerDetached(EntityUid uid, ShadowkinDarkSwappedComponent component, LocalPlayerDetachedEvent args)
{
RemoveOverlay();
}


private void AddOverlay()
{
_overlay.AddOverlay(_ignoreOverlay);
_overlay.AddOverlay(_etherealOverlay);
}

private void RemoveOverlay()
{
_ignoreOverlay.Reset();
_overlay.RemoveOverlay(_ignoreOverlay);
_overlay.RemoveOverlay(_etherealOverlay);
}
}
Loading
Loading