From a731e5016c8984238bf80acbb45fc4ee3b4e8531 Mon Sep 17 00:00:00 2001 From: pacable <77161122+pxc1984@users.noreply.github.com> Date: Fri, 7 Jun 2024 11:14:54 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B1=D0=B0=D1=87=D1=8C=D0=B5=20?= =?UTF-8?q?=D0=B7=D1=80=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B8=20=D0=B5=D0=B3?= =?UTF-8?q?=D0=BE=20=D1=82=D1=80=D0=B5=D0=B9=D1=82=20(#32)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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> --- .../_Sunrise/Overlays/DogVisionOverlay.cs | 42 +++++++++++++++ .../_Sunrise/Overlays/DogVisionSystem.cs | 53 +++++++++++++++++++ .../_Sunrise/Abilities/DogVisionComponent.cs | 11 ++++ Resources/Changelog/ChangelogSunrise.yml | 11 ++++ Resources/Locale/en-US/traits/traits.ftl | 5 +- Resources/Locale/ru-RU/traits/traits.ftl | 4 ++ .../Prototypes/Entities/Mobs/NPCs/animals.yml | 1 + .../Prototypes/Entities/Mobs/NPCs/pets.yml | 2 + Resources/Prototypes/Shaders/dogvision.yml | 4 ++ Resources/Prototypes/Traits/disabilities.yml | 8 +++ Resources/Textures/Shaders/dogvision.swsl | 14 +++++ 11 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 Content.Client/_Sunrise/Overlays/DogVisionOverlay.cs create mode 100644 Content.Client/_Sunrise/Overlays/DogVisionSystem.cs create mode 100644 Content.Shared/_Sunrise/Abilities/DogVisionComponent.cs create mode 100644 Resources/Prototypes/Shaders/dogvision.yml create mode 100644 Resources/Textures/Shaders/dogvision.swsl diff --git a/Content.Client/_Sunrise/Overlays/DogVisionOverlay.cs b/Content.Client/_Sunrise/Overlays/DogVisionOverlay.cs new file mode 100644 index 0000000000..85994cfa65 --- /dev/null +++ b/Content.Client/_Sunrise/Overlays/DogVisionOverlay.cs @@ -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("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(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); + } +} diff --git a/Content.Client/_Sunrise/Overlays/DogVisionSystem.cs b/Content.Client/_Sunrise/Overlays/DogVisionSystem.cs new file mode 100644 index 0000000000..986ebbb432 --- /dev/null +++ b/Content.Client/_Sunrise/Overlays/DogVisionSystem.cs @@ -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(OnDogVisionInit); + SubscribeLocalEvent(OnDogVisionShutdown); + + SubscribeLocalEvent(OnPlayerAttached); + SubscribeLocalEvent(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); + } + } +} diff --git a/Content.Shared/_Sunrise/Abilities/DogVisionComponent.cs b/Content.Shared/_Sunrise/Abilities/DogVisionComponent.cs new file mode 100644 index 0000000000..1284932c38 --- /dev/null +++ b/Content.Shared/_Sunrise/Abilities/DogVisionComponent.cs @@ -0,0 +1,11 @@ +// Inspired by Nyanotrasen + +using Robust.Shared.GameStates; + +namespace Content.Shared.Abilities; + +[RegisterComponent, NetworkedComponent] +public sealed partial class DogVisionComponent : Component +{ + +} diff --git a/Resources/Changelog/ChangelogSunrise.yml b/Resources/Changelog/ChangelogSunrise.yml index 49b99246ef..7751e48ef5 100644 --- a/Resources/Changelog/ChangelogSunrise.yml +++ b/Resources/Changelog/ChangelogSunrise.yml @@ -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' diff --git a/Resources/Locale/en-US/traits/traits.ftl b/Resources/Locale/en-US/traits/traits.ftl index e3aed1c8b2..1d01b2b52d 100644 --- a/Resources/Locale/en-US/traits/traits.ftl +++ b/Resources/Locale/en-US/traits/traits.ftl @@ -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! \ No newline at end of file +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 diff --git a/Resources/Locale/ru-RU/traits/traits.ftl b/Resources/Locale/ru-RU/traits/traits.ftl index acc3029d0b..51012cf9fe 100644 --- a/Resources/Locale/ru-RU/traits/traits.ftl +++ b/Resources/Locale/ru-RU/traits/traits.ftl @@ -29,3 +29,7 @@ trait-snoring-name = Храп trait-snoring-desc = Вы храпите во время сна. trait-liar-name = Патологический лжец trait-liar-desc = Вы с трудом заставляете себя говорить правду. Иногда вы всё равно лжёте. + +trait-colorblindness-name = Дальтонизм +trait-colorblindness-desc = Вы видите мир не так, как все. + diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index 51647f6985..dd9a31368f 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -2601,6 +2601,7 @@ - type: Inventory speciesId: dog templateId: pet + - type: DogVision # Sunrise-DogVision - type: InventorySlots - type: Strippable - type: UserInterface diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml b/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml index db2da13072..1ee77b56db 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml @@ -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: diff --git a/Resources/Prototypes/Shaders/dogvision.yml b/Resources/Prototypes/Shaders/dogvision.yml new file mode 100644 index 0000000000..945b2e43aa --- /dev/null +++ b/Resources/Prototypes/Shaders/dogvision.yml @@ -0,0 +1,4 @@ +- type: shader + id: DogVision + kind: source + path: "/Textures/Shaders/dogvision.swsl" diff --git a/Resources/Prototypes/Traits/disabilities.yml b/Resources/Prototypes/Traits/disabilities.yml index 6e0026e44e..33aa30ff50 100644 --- a/Resources/Prototypes/Traits/disabilities.yml +++ b/Resources/Prototypes/Traits/disabilities.yml @@ -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 diff --git a/Resources/Textures/Shaders/dogvision.swsl b/Resources/Textures/Shaders/dogvision.swsl new file mode 100644 index 0000000000..1e8c7d2ed3 --- /dev/null +++ b/Resources/Textures/Shaders/dogvision.swsl @@ -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); +}