Собачье зрение и его трейт (#32)
* Adds dogvision to game * Added DogVision to vulps, corgi, walter and mcgriff * changelog * locale fix + added category * Buffed vulps * Removed dog vision from vulps, nerfed eyesight --------- Co-authored-by: Vigers Ray <60344369+VigersRay@users.noreply.github.com>
This commit is contained in:
parent
c6df996f23
commit
a731e5016c
11 changed files with 154 additions and 1 deletions
42
Content.Client/_Sunrise/Overlays/DogVisionOverlay.cs
Normal file
42
Content.Client/_Sunrise/Overlays/DogVisionOverlay.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
// Inspired by Nyanotrasen
|
||||
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Content.Shared.Abilities;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Content.Client._Sunrise.Overlays;
|
||||
|
||||
public sealed class DogVisionOverlay : Overlay
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] IEntityManager _entityManager = default!;
|
||||
public override bool RequestScreenTexture => true;
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
||||
private readonly ShaderInstance _dogVisionShader;
|
||||
|
||||
public DogVisionOverlay()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
_dogVisionShader = _prototypeManager.Index<ShaderPrototype>("DogVision").Instance().Duplicate();
|
||||
}
|
||||
|
||||
protected override void Draw(in OverlayDrawArgs args)
|
||||
{
|
||||
if (ScreenTexture == null)
|
||||
return;
|
||||
if (_playerManager.LocalPlayer?.ControlledEntity is not { Valid: true } player)
|
||||
return;
|
||||
if (!_entityManager.HasComponent<DogVisionComponent>(player))
|
||||
return;
|
||||
_dogVisionShader?.SetParameter("SCREEN_TEXTURE", ScreenTexture);
|
||||
var worldHandle = args.WorldHandle;
|
||||
var viewport = args.WorldBounds;
|
||||
worldHandle.SetTransform(Matrix3x2.Identity);
|
||||
worldHandle.UseShader(_dogVisionShader);
|
||||
worldHandle.DrawRect(viewport, Color.White);
|
||||
}
|
||||
}
|
||||
53
Content.Client/_Sunrise/Overlays/DogVisionSystem.cs
Normal file
53
Content.Client/_Sunrise/Overlays/DogVisionSystem.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
// Inspired by Nyanotrasen
|
||||
|
||||
using Content.Shared.Abilities;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Client._Sunrise.Overlays;
|
||||
public sealed class DogVisionSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IPlayerManager _player = default!;
|
||||
[Dependency] private readonly IOverlayManager _overlayMan = default!;
|
||||
|
||||
private DogVisionOverlay _overlay = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<DogVisionComponent, ComponentInit>(OnDogVisionInit);
|
||||
SubscribeLocalEvent<DogVisionComponent, ComponentShutdown>(OnDogVisionShutdown);
|
||||
|
||||
SubscribeLocalEvent<DogVisionComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
|
||||
SubscribeLocalEvent<DogVisionComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);
|
||||
|
||||
_overlay = new();
|
||||
}
|
||||
|
||||
private void OnPlayerAttached(EntityUid uid, DogVisionComponent component, LocalPlayerAttachedEvent args)
|
||||
{
|
||||
_overlayMan.AddOverlay(_overlay);
|
||||
}
|
||||
|
||||
private void OnPlayerDetached(EntityUid uid, DogVisionComponent component, LocalPlayerDetachedEvent args)
|
||||
{
|
||||
_overlayMan.RemoveOverlay(_overlay);
|
||||
}
|
||||
|
||||
private void OnDogVisionInit(EntityUid uid, DogVisionComponent component, ComponentInit args)
|
||||
{
|
||||
if (_player.LocalPlayer?.ControlledEntity == uid)
|
||||
_overlayMan.AddOverlay(_overlay);
|
||||
}
|
||||
|
||||
private void OnDogVisionShutdown(EntityUid uid, DogVisionComponent component, ComponentShutdown args)
|
||||
{
|
||||
if (_player.LocalPlayer?.ControlledEntity == uid)
|
||||
{
|
||||
_overlayMan.RemoveOverlay(_overlay);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Content.Shared/_Sunrise/Abilities/DogVisionComponent.cs
Normal file
11
Content.Shared/_Sunrise/Abilities/DogVisionComponent.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// Inspired by Nyanotrasen
|
||||
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Abilities;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class DogVisionComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -280,3 +280,14 @@ Entries:
|
|||
type: Add
|
||||
id: 24
|
||||
time: '2024-06-05T18:51:04.319862+00:00'
|
||||
- author: pacable
|
||||
changes:
|
||||
- message: "\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u043E \u0441\u043E\u0431\
|
||||
\u0430\u0447\u044C\u0435 \u0437\u0440\u0435\u043D\u0438\u0435 \u043A\u0430\u043A\
|
||||
\ \u0447\u0435\u0440\u0442\u0430 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u0436\
|
||||
\u0430, \u0434\u043B\u044F \u0432\u0443\u043B\u044C\u043F\u0430\u043D\u0438\u043D\
|
||||
\u043E\u0432 \u0438 \u0441\u043E\u0431\u0430\u0447\u044C\u0438\u0445 \u043F\u0438\
|
||||
\u0442\u043E\u043C\u0446\u0435\u0432."
|
||||
type: Add
|
||||
id: 25
|
||||
time: '2024-06-06T15:19:19.017263+00:00'
|
||||
|
|
|
|||
|
|
@ -49,4 +49,7 @@ trait-cowboy-name = Cowboy accent
|
|||
trait-cowboy-desc = You speak with a distinct cowboy accent!
|
||||
|
||||
trait-italian-name = Italian accent
|
||||
trait-italian-desc = Mamma mia! You seem to have lived in space italy!
|
||||
trait-italian-desc = Mamma mia! You seem to have lived in space italy!
|
||||
|
||||
trait-colorblindness-name = Color blindness
|
||||
trait-colorblindness-desc = You see the world differently than everyone else
|
||||
|
|
|
|||
|
|
@ -29,3 +29,7 @@ trait-snoring-name = Храп
|
|||
trait-snoring-desc = Вы храпите во время сна.
|
||||
trait-liar-name = Патологический лжец
|
||||
trait-liar-desc = Вы с трудом заставляете себя говорить правду. Иногда вы всё равно лжёте.
|
||||
|
||||
trait-colorblindness-name = Дальтонизм
|
||||
trait-colorblindness-desc = Вы видите мир не так, как все.
|
||||
|
||||
|
|
|
|||
|
|
@ -2601,6 +2601,7 @@
|
|||
- type: Inventory
|
||||
speciesId: dog
|
||||
templateId: pet
|
||||
- type: DogVision # Sunrise-DogVision
|
||||
- type: InventorySlots
|
||||
- type: Strippable
|
||||
- type: UserInterface
|
||||
|
|
|
|||
|
|
@ -288,6 +288,7 @@
|
|||
spawned:
|
||||
- id: FoodMeat
|
||||
amount: 2
|
||||
- type: DogVision # Sunrise-DogVision
|
||||
- type: ReplacementAccent
|
||||
accent: dog
|
||||
- type: InteractionPopup
|
||||
|
|
@ -370,6 +371,7 @@
|
|||
speciesId: dog
|
||||
templateId: pet
|
||||
- type: InventorySlots
|
||||
- type: DogVision # Sunrise-DogVision
|
||||
- type: Strippable
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
|
|
|
|||
4
Resources/Prototypes/Shaders/dogvision.yml
Normal file
4
Resources/Prototypes/Shaders/dogvision.yml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
- type: shader
|
||||
id: DogVision
|
||||
kind: source
|
||||
path: "/Textures/Shaders/dogvision.swsl"
|
||||
|
|
@ -89,3 +89,11 @@
|
|||
category: Disabilities
|
||||
components:
|
||||
- type: Snoring
|
||||
|
||||
- type: trait # Sunrise-DogVision
|
||||
id: Colorblindness
|
||||
name: trait-colorblindness-name
|
||||
description: trait-colorblindness-desc
|
||||
category: Disabilities
|
||||
components:
|
||||
- type: DogVision
|
||||
|
|
|
|||
14
Resources/Textures/Shaders/dogvision.swsl
Normal file
14
Resources/Textures/Shaders/dogvision.swsl
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
uniform sampler2D SCREEN_TEXTURE;
|
||||
|
||||
void fragment() {
|
||||
highp vec4 color = zTextureSpec(SCREEN_TEXTURE, UV);
|
||||
|
||||
highp mat3 m = mat3(
|
||||
vec3(0.625,0.375,0.000),
|
||||
vec3(0.700,0.300,0.000),
|
||||
vec3(0.000,0.300,0.700)
|
||||
);
|
||||
highp vec3 result = color.rgb * m;
|
||||
|
||||
COLOR = vec4(result, 1);
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue