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

Closed
wants to merge 66 commits into from
Closed
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
530dcde
Port PR42 files directly
vaketola Nov 6, 2023
487d34b
Port PR130 changes directly
vaketola Nov 6, 2023
b17ccf7
Port PR146 changes directly
vaketola Nov 6, 2023
08ea21b
Port PR157 changes directly
vaketola Nov 6, 2023
dab0059
Port PR188 changes directly
vaketola Nov 6, 2023
45681f1
Port PR189 changes directly
vaketola Nov 6, 2023
20d8546
Port shadowkin visibility flags
vaketola Nov 6, 2023
279bda9
Outline fixes and address some upstream refactor conflicts
vaketola Nov 6, 2023
4577f38
Fix other old refactor conflicts
vaketola Nov 6, 2023
a9c37e6
Add some shadowkin improvements progress
vaketola Nov 7, 2023
145381a
Add more of the shadowkin improvements
vaketola Nov 7, 2023
ad29f04
Revert shadowkin improvements as PR209 is a draft
vaketola Nov 7, 2023
3da460f
Revert "Add some shadowkin improvements progress"
vaketola Nov 7, 2023
d276fb2
Port over PR218 changes
vaketola Nov 7, 2023
1f13d93
Fix directory name entities typo
vaketola Nov 8, 2023
937204e
Add shadowkin ears yml
vaketola Nov 8, 2023
8301021
reformatting and codebase change markers
DEATHB4DEFEAT Nov 8, 2023
616accc
Merge branch 'main' of https://github.com/Simple-Station/Parkstation-…
vaketola Nov 14, 2023
6544c37
Merge commit '8301021ded383099eeff158d6b6fbdd99acc9c03' of https://gi…
vaketola Nov 14, 2023
63b830a
Move over to NetEntity
vaketola Nov 14, 2023
a8e404c
Merge branch 'master' of https://github.com/Simple-Station/Parkstatio…
vaketola Jan 4, 2024
024392c
Move more sprites over
vaketola Jan 4, 2024
fc87717
Fix Wings sprite bug
vaketola Jan 5, 2024
05fb81f
Merge branch 'master' into shadowkin
vaketola Feb 21, 2024
f4bc63e
Fix duplicate wings declaration
vaketola Feb 21, 2024
3bf3545
Fix missing imports
vaketola Feb 21, 2024
d5b22e8
Fix missing merge
vaketola Feb 21, 2024
2902886
Fix shadowkin actions!
vaketola Feb 21, 2024
19c1a4b
fix sprite layers
DEATHB4DEFEAT Feb 22, 2024
6f6a62e
Accept resources suggestions from review
vaketola Feb 22, 2024
54044d9
Undo larger wings sprite additions
vaketola Feb 22, 2024
7968e08
Clean up code comments a bit
vaketola Feb 22, 2024
8bb0c80
Switch to const action prototypes with validators
vaketola Feb 22, 2024
90363d0
Fix rest waking action finally
vaketola Feb 22, 2024
c691569
Switch logger errors to debug assertions
vaketola Feb 22, 2024
2a474d7
Fix darkswap visibility
vaketola Feb 22, 2024
030c3c8
Clean SetDarkened to Darkened and UnDarkened functions
vaketola Feb 22, 2024
bd1f7a8
Fix action ECS again and fix action removal
vaketola Feb 22, 2024
24e03df
Address miscellaneous review items
vaketola Feb 22, 2024
f2cbbae
Give shadowkin lungs so they can breath again
vaketola Feb 22, 2024
e3401d8
Reenable empathy chat
vaketola Feb 22, 2024
74d53c8
Temporarily remove respirator values and psionic chance
vaketola Feb 24, 2024
1ca9a79
Adjust potentialpsionic value for shadowkin
vaketola Mar 1, 2024
58e1f23
Fix shadowkin accent not capitalizing first letters
vaketola 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
vaketola Mar 18, 2024
cd457f3
Merge branch 'shadowkin' of https://github.com/Finket/Parkstation-Fri…
vaketola Mar 18, 2024
00e486f
Fix some dependency namespaces
vaketola Mar 18, 2024
6482129
Fix more dependency namespaces
vaketola Mar 18, 2024
65466c8
Remove redundant hardsuits.yml
vaketola Mar 18, 2024
bece17e
Move from SimpleStation14 to Parkstation namespaces
vaketola Mar 18, 2024
912e699
Fix more namespace issues
vaketola Mar 18, 2024
e6698fe
Move texture references to Parkstation namespace
vaketola Mar 18, 2024
cdf7f1c
Update LocalPlayer to LocalEntity where applicable
vaketola Apr 27, 2024
d07db68
Move ForceDarkSwap and ForceTeleport to their relevant power systems
vaketola Apr 27, 2024
fe60220
Pass ShadowKinPowerSystem Blackeye methods to Blackeye system
vaketola Apr 27, 2024
65e73ff
Fix YAMLs
vaketola Apr 27, 2024
50d3349
Merge branch 'master' of https://github.com/Simple-Station/Parkstatio…
DEATHB4DEFEAT Aug 20, 2024
1606712
remove duplicate namepreset-first
DEATHB4DEFEAT Aug 20, 2024
24f8afe
fix empathy
DEATHB4DEFEAT Aug 20, 2024
23bb1a9
ghosts can see darkswapped Shadowkin
DEATHB4DEFEAT Aug 20, 2024
b88dcb0
fix rest ability
DEATHB4DEFEAT Aug 20, 2024
995676b
fix tests
DEATHB4DEFEAT Aug 20, 2024
9ce2fea
https://github.com/Simple-Station/Parkstation/pull/209
DEATHB4DEFEAT Aug 20, 2024
ade3ff0
fix tests
DEATHB4DEFEAT Aug 20, 2024
aa667ea
consistent variable rest
DEATHB4DEFEAT Aug 20, 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
5 changes: 5 additions & 0 deletions Content.Client/Chat/Managers/ChatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ public void SendMessage(string text, ChatSelectChannel channel)
_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);
}
Expand Down
35 changes: 35 additions & 0 deletions Content.Client/Parkstation/Chat/ShadowkinChatUpdateSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Content.Client.Chat.Managers;
using Content.Shared.Parkstation.Species.Shadowkin.Components;
using Robust.Client.Player;

namespace Content.Client.Parkstation.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();
}
}
}
63 changes: 63 additions & 0 deletions Content.Client/Parkstation/Overlays/Shaders/ColorTintOverlay.cs
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.Parkstation.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/Parkstation/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.Parkstation.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.Parkstation.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 Content.Client.Parkstation.Overlays.Shaders;
using Content.Shared.Humanoid;
using Content.Shared.Parkstation.Species.Shadowkin.Components;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Player;

namespace Content.Client.Parkstation.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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using Content.Shared.Humanoid;
using Content.Shared.Parkstation.Species.Shadowkin.Events;
using Content.Shared.Parkstation.Species.Shadowkin.Components;
using Robust.Client.GameObjects;

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

public sealed class ShadowkinBlackeyeSystem : EntitySystem
{
[Dependency] private readonly IEntityManager _entity = default!;


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

SubscribeNetworkEvent<ShadowkinBlackeyeEvent>(OnBlackeye);

SubscribeLocalEvent<ShadowkinComponent, ComponentInit>(OnInit);
}


private void OnBlackeye(ShadowkinBlackeyeEvent ev)
{
var uid = _entity.GetEntity(ev.Ent);
SetColor(uid, Color.Black);
}


private void OnInit(EntityUid uid, ShadowkinComponent component, ComponentInit args)
{
if (!_entity.TryGetComponent<SpriteComponent>(uid, out var sprite) ||
!sprite.LayerMapTryGet(HumanoidVisualLayers.Eyes, out var index) ||
!sprite.TryGetLayer(index, out var layer))
return;

// Blackeye if none of the RGB values are greater than 75
if (layer.Color.R * 255 < 75 && layer.Color.G * 255 < 75 && layer.Color.B * 255 < 75)
{
// TODO Need to move this to server somehow, can't trust the client with this
var ent = _entity.GetNetEntity(uid);
RaiseNetworkEvent(new ShadowkinBlackeyeEvent(ent, false));
}
}


private void SetColor(EntityUid uid, Color color)
{
if (!_entity.TryGetComponent<SpriteComponent>(uid, out var sprite) ||
!sprite.LayerMapTryGet(HumanoidVisualLayers.Eyes, out var index) ||
!sprite.TryGetLayer(index, out var layer))
return;

sprite.LayerSetColor(index, color);
}
}
Loading
Loading