From 9bf5f73ec32176fc8e63f2c297b254466c5c359d Mon Sep 17 00:00:00 2001 From: Vigers Ray Date: Thu, 30 Jan 2025 13:35:45 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=D0=B2=D0=B8=D0=B4=D0=B8=D0=BC?= =?UTF-8?q?=D0=B0=D1=8F=20=D0=BD=D0=B5=D0=B2=D0=B8=D0=B4=D0=B8=D0=BC=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Client/Stealth/StealthSystem.cs | 16 +- .../Stealth/Components/StealthComponent.cs | 9 +- Content.Shared/Stealth/SharedStealthSystem.cs | 3 +- Resources/Changelog/ChangelogSunrise.yml | 13 ++ .../Entities/Clothing/OuterClothing/suits.yml | 4 +- .../Circuitboards/Machine/production.yml | 30 ++-- .../Devices/Circuitboards/computer.yml | 20 +-- .../Machines/Computers/computers.yml | 104 ++++++------ .../Structures/Machines/cloning_machine.yml | 152 +++++++++--------- .../Structures/Storage/Closets/big_boxes.yml | 5 +- .../Structures/Storage/Crates/crates.yml | 5 +- Resources/Prototypes/Shaders/shaders.yml | 2 +- .../XenoArch/Effects/normal_effects.yml | 5 +- .../Prototypes/_Sunrise/Shaders/sharders.yml | 5 + .../_Sunrise/Shaders/no_mirage_stealth.swsl | 22 +++ 15 files changed, 228 insertions(+), 167 deletions(-) create mode 100644 Resources/Textures/_Sunrise/Shaders/no_mirage_stealth.swsl diff --git a/Content.Client/Stealth/StealthSystem.cs b/Content.Client/Stealth/StealthSystem.cs index adb25e1ef6..f9d464825b 100644 --- a/Content.Client/Stealth/StealthSystem.cs +++ b/Content.Client/Stealth/StealthSystem.cs @@ -14,12 +14,14 @@ public sealed class StealthSystem : SharedStealthSystem [Dependency] private readonly SharedTransformSystem _transformSystem = default!; private ShaderInstance _shader = default!; + private ShaderInstance _noMirageShader = default!; // Sunrise-Edit public override void Initialize() { base.Initialize(); _shader = _protoMan.Index("Stealth").InstanceUnique(); + _noMirageShader = _protoMan.Index("NoMirageStealth").InstanceUnique(); // Sunrise-Edit SubscribeLocalEvent(OnShutdown); SubscribeLocalEvent(OnStartup); @@ -41,7 +43,12 @@ public sealed class StealthSystem : SharedStealthSystem return; sprite.Color = Color.White; - sprite.PostShader = enabled ? _shader : null; + // Sunrise-Start + if (component.Mirage) + sprite.PostShader = enabled ? _shader : null; + else + sprite.PostShader = enabled ? _noMirageShader : null; + // Sunrise-End sprite.GetScreenTexture = enabled; sprite.RaiseShaderEvent = enabled; @@ -89,8 +96,11 @@ public sealed class StealthSystem : SharedStealthSystem // actual visual visibility effect is limited to +/- 1. visibility = Math.Clamp(visibility, -1f, 1f); - _shader.SetParameter("reference", reference); - _shader.SetParameter("visibility", visibility); + // Sunrise-Start + ShaderInstance shaderToUse = component.Mirage ? _shader : _noMirageShader; + shaderToUse.SetParameter("reference", reference); + shaderToUse.SetParameter("visibility", visibility); + // Sunrise-End visibility = MathF.Max(0, visibility); args.Sprite.Color = new Color(visibility, visibility, 1, 1); diff --git a/Content.Shared/Stealth/Components/StealthComponent.cs b/Content.Shared/Stealth/Components/StealthComponent.cs index 1a8a647768..07526dd5d4 100644 --- a/Content.Shared/Stealth/Components/StealthComponent.cs +++ b/Content.Shared/Stealth/Components/StealthComponent.cs @@ -19,6 +19,11 @@ public sealed partial class StealthComponent : Component [DataField("enabled")] public bool Enabled = true; + // Sunrise-Start + [DataField("mirage")] + public bool Mirage; + // Sunrise-End + /// /// The creature will continue invisible at death. /// @@ -80,11 +85,13 @@ public sealed class StealthComponentState : ComponentState public readonly float Visibility; public readonly TimeSpan? LastUpdated; public readonly bool Enabled; + public readonly bool Mirage; - public StealthComponentState(float stealthLevel, TimeSpan? lastUpdated, bool enabled) + public StealthComponentState(float stealthLevel, TimeSpan? lastUpdated, bool enabled, bool mirage) { Visibility = stealthLevel; LastUpdated = lastUpdated; Enabled = enabled; + Mirage = mirage; } } diff --git a/Content.Shared/Stealth/SharedStealthSystem.cs b/Content.Shared/Stealth/SharedStealthSystem.cs index 1bab55589f..954467e110 100644 --- a/Content.Shared/Stealth/SharedStealthSystem.cs +++ b/Content.Shared/Stealth/SharedStealthSystem.cs @@ -98,7 +98,7 @@ public abstract class SharedStealthSystem : EntitySystem private void OnStealthGetState(EntityUid uid, StealthComponent component, ref ComponentGetState args) { - args.State = new StealthComponentState(component.LastVisibility, component.LastUpdated, component.Enabled); + args.State = new StealthComponentState(component.LastVisibility, component.LastUpdated, component.Enabled, component.Mirage); // Sunrise-Edit } private void OnStealthHandleState(EntityUid uid, StealthComponent component, ref ComponentHandleState args) @@ -106,6 +106,7 @@ public abstract class SharedStealthSystem : EntitySystem if (args.Current is not StealthComponentState cast) return; + component.Mirage = cast.Mirage; // Sunrise-Edit SetEnabled(uid, cast.Enabled, component); component.LastVisibility = cast.Visibility; component.LastUpdated = cast.LastUpdated; diff --git a/Resources/Changelog/ChangelogSunrise.yml b/Resources/Changelog/ChangelogSunrise.yml index 07963a1bf7..72958eeeba 100644 --- a/Resources/Changelog/ChangelogSunrise.yml +++ b/Resources/Changelog/ChangelogSunrise.yml @@ -11253,3 +11253,16 @@ id: 780 time: '2025-01-30T08:11:40.0000000+00:00' url: https://github.com/space-sunrise/space-station-14/pull/1212 +- author: VigersRay + changes: + - message: "\u041D\u0438\u043D\u0434\u0437\u044F \u0442\u0435\u043F\u0435\u0440\u044C\ + \ \u043F\u043E\u043B\u043D\u043E\u0441\u0442\u044C\u044E \u043D\u0435\u0432\u0438\ + \u0434\u0438\u043C\u044B\u0439." + type: Tweak + - message: "\u041D\u0435\u0432\u0438\u0434\u0438\u043C\u044B\u0435 \u043A\u043E\u0440\ + \u043E\u0431\u043A\u0438 \u0438 \u044F\u0449\u0438\u043A\u0438 \u0442\u0435\u043F\ + \u0435\u0440\u044C \u043F\u043E\u043B\u043D\u043E\u0441\u0442\u044C\u044E \u043D\ + \u0435\u0432\u0438\u0434\u0438\u043C\u044B\u0435." + type: Tweak + id: 781 + time: '2025-01-30T10:35:24.610080+00:00' diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml index 6d893169e5..db66c5d22b 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml @@ -160,8 +160,8 @@ parent: true components: - type: Stealth - minVisibility: 0.1 - lastVisibility: 0.1 + minVisibility: 0 # Sunrise-Edit + lastVisibility: 0 # Sunrise-Edit - type: PowerCellDraw drawRate: 1.8 # 200 seconds on the default cell - type: ToggleCellDraw diff --git a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml index fde151f20e..c0f60d9ae2 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml @@ -472,21 +472,21 @@ Capacitor: 2 Cable: 5 -- type: entity - id: CloningPodMachineCircuitboard - parent: BaseMachineCircuitboard - name: cloning pod machine board - description: A machine printed circuit board for a cloning pod. - components: - - type: Sprite - state: medical - - type: MachineBoard - prototype: CloningPod - stackRequirements: - MatterBin: 2 - Manipulator: 2 - Glass: 1 - Cable: 1 +#- type: entity +# id: CloningPodMachineCircuitboard +# parent: BaseMachineCircuitboard +# name: cloning pod machine board +# description: A machine printed circuit board for a cloning pod. +# components: +# - type: Sprite +# state: medical +# - type: MachineBoard +# prototype: CloningPod +# stackRequirements: +# MatterBin: 2 +# Manipulator: 2 +# Glass: 1 +# Cable: 1 - type: entity id: MedicalScannerMachineCircuitboard diff --git a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/computer.yml b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/computer.yml index 5c755f3189..de26f6f219 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/computer.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/computer.yml @@ -364,16 +364,16 @@ - type: ComputerBoard prototype: ComputerShuttleSyndie -- type: entity - parent: BaseComputerCircuitboard - id: CloningConsoleComputerCircuitboard - name: cloning console computer board - description: A computer printed circuit board for a cloning console. - components: - - type: Sprite - state: cpu_medical - - type: ComputerBoard - prototype: ComputerCloningConsole +#- type: entity +# parent: BaseComputerCircuitboard +# id: CloningConsoleComputerCircuitboard +# name: cloning console computer board +# description: A computer printed circuit board for a cloning console. +# components: +# - type: Sprite +# state: cpu_medical +# - type: ComputerBoard +# prototype: ComputerCloningConsole - type: entity parent: BaseComputerCircuitboard diff --git a/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml b/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml index 467d7fb072..76f63ffbad 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml @@ -1009,58 +1009,58 @@ - CargoBounties - Cargo -- type: entity - parent: BaseComputerAiAccess - id: ComputerCloningConsole - name: cloning console computer - description: The centerpiece of the cloning system, medicine's greatest accomplishment. It has lots of ports and wires. - components: - - type: CloningConsole - - type: DeviceList - - type: DeviceNetwork - deviceNetId: Wired - - type: Sprite - layers: - - map: ["computerLayerBody"] - state: computer - - map: ["computerLayerKeyboard"] - state: generic_keyboard - - map: ["computerLayerScreen"] - state: dna - - map: ["computerLayerKeys"] - state: generic_keys - - map: [ "enum.WiresVisualLayers.MaintenancePanel" ] - state: generic_panel_open - - type: ApcPowerReceiver - powerLoad: 3100 #We want this to fail first so I transferred most of the scanner and pod's power here. (3500 in total) - - type: Computer - board: CloningConsoleComputerCircuitboard - - type: PointLight - radius: 1.5 - energy: 1.6 - color: "#1f8c28" - - type: DeviceLinkSource - range: 4 - ports: - - MedicalScannerSender - - CloningPodSender - - type: ActivatableUI - key: enum.CloningConsoleUiKey.Key - - type: UserInterface - interfaces: - enum.CloningConsoleUiKey.Key: - type: CloningConsoleBoundUserInterface - enum.WiresUiKey.Key: - type: WiresBoundUserInterface - - type: Speech - speechVerb: Robotic - speechSounds: Pai - - type: Damageable - damageContainer: StructuralInorganic - damageModifierSet: StructuralMetallicStrong - - type: GuideHelp - guides: - - Cloning +#- type: entity +# parent: BaseComputerAiAccess +# id: ComputerCloningConsole +# name: cloning console computer +# description: The centerpiece of the cloning system, medicine's greatest accomplishment. It has lots of ports and wires. +# components: +# - type: CloningConsole +# - type: DeviceList +# - type: DeviceNetwork +# deviceNetId: Wired +# - type: Sprite +# layers: +# - map: ["computerLayerBody"] +# state: computer +# - map: ["computerLayerKeyboard"] +# state: generic_keyboard +# - map: ["computerLayerScreen"] +# state: dna +# - map: ["computerLayerKeys"] +# state: generic_keys +# - map: [ "enum.WiresVisualLayers.MaintenancePanel" ] +# state: generic_panel_open +# - type: ApcPowerReceiver +# powerLoad: 3100 #We want this to fail first so I transferred most of the scanner and pod's power here. (3500 in total) +# - type: Computer +# board: CloningConsoleComputerCircuitboard +# - type: PointLight +# radius: 1.5 +# energy: 1.6 +# color: "#1f8c28" +# - type: DeviceLinkSource +# range: 4 +# ports: +# - MedicalScannerSender +# - CloningPodSender +# - type: ActivatableUI +# key: enum.CloningConsoleUiKey.Key +# - type: UserInterface +# interfaces: +# enum.CloningConsoleUiKey.Key: +# type: CloningConsoleBoundUserInterface +# enum.WiresUiKey.Key: +# type: WiresBoundUserInterface +# - type: Speech +# speechVerb: Robotic +# speechSounds: Pai +# - type: Damageable +# damageContainer: StructuralInorganic +# damageModifierSet: StructuralMetallicStrong +# - type: GuideHelp +# guides: +# - Cloning - type: entity id: ComputerSalvageExpedition diff --git a/Resources/Prototypes/Entities/Structures/Machines/cloning_machine.yml b/Resources/Prototypes/Entities/Structures/Machines/cloning_machine.yml index 09902be970..e648ab2e92 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/cloning_machine.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/cloning_machine.yml @@ -1,76 +1,76 @@ -- type: entity - id: CloningPod - parent: BaseMachinePowered - name: cloning pod - description: A Cloning Pod. 50% reliable. - components: - - type: CloningPod - - type: DeviceList - - type: DeviceNetwork - deviceNetId: Wired - receiveFrequencyId: BasicDevice - - type: DeviceLinkSink - ports: - - CloningPodReceiver - - type: Sprite - sprite: Structures/Machines/cloning.rsi - snapCardinals: true - layers: - - state: pod_0 - map: ["base"] - - type: Physics - bodyType: Static - - type: Construction - graph: Machine - node: machine - containers: - - machine_board - - machine_parts - - clonepod-bodyContainer - - type: EmptyOnMachineDeconstruct - containers: - - clonepod-bodyContainer - - type: Damageable - damageContainer: StructuralInorganic - damageModifierSet: StrongMetallic - - type: Destructible - thresholds: - - trigger: - !type:DamageTrigger - damage: 100 - behaviors: - - !type:PlaySoundBehavior - sound: - collection: MetalGlassBreak - - !type:ChangeConstructionNodeBehavior - node: machineFrame - - !type:DoActsBehavior - acts: ["Destruction"] - - type: Machine - board: CloningPodMachineCircuitboard - - type: MaterialStorage - materialWhiteList: - - Biomass - - type: WiresPanel - - type: ApcPowerReceiver - powerLoad: 200 #Receives most of its power from the console - - type: Appearance - - type: GenericVisualizer - visuals: - enum.CloningPodVisuals.Status: - base: - Cloning: { state: pod_1 } - NoMind: { state: pod_e } - Gore: { state: pod_g } - Idle: { state: pod_0 } - - type: Climbable - - type: StaticPrice - price: 1000 - - type: ContainerContainer - containers: - machine_board: !type:Container - machine_parts: !type:Container - clonepod-bodyContainer: !type:ContainerSlot - - type: GuideHelp - guides: - - Cloning +#- type: entity +# id: CloningPod +# parent: BaseMachinePowered +# name: cloning pod +# description: A Cloning Pod. 50% reliable. +# components: +# - type: CloningPod +# - type: DeviceList +# - type: DeviceNetwork +# deviceNetId: Wired +# receiveFrequencyId: BasicDevice +# - type: DeviceLinkSink +# ports: +# - CloningPodReceiver +# - type: Sprite +# sprite: Structures/Machines/cloning.rsi +# snapCardinals: true +# layers: +# - state: pod_0 +# map: ["base"] +# - type: Physics +# bodyType: Static +# - type: Construction +# graph: Machine +# node: machine +# containers: +# - machine_board +# - machine_parts +# - clonepod-bodyContainer +# - type: EmptyOnMachineDeconstruct +# containers: +# - clonepod-bodyContainer +# - type: Damageable +# damageContainer: StructuralInorganic +# damageModifierSet: StrongMetallic +# - type: Destructible +# thresholds: +# - trigger: +# !type:DamageTrigger +# damage: 100 +# behaviors: +# - !type:PlaySoundBehavior +# sound: +# collection: MetalGlassBreak +# - !type:ChangeConstructionNodeBehavior +# node: machineFrame +# - !type:DoActsBehavior +# acts: ["Destruction"] +# - type: Machine +# board: CloningPodMachineCircuitboard +# - type: MaterialStorage +# materialWhiteList: +# - Biomass +# - type: WiresPanel +# - type: ApcPowerReceiver +# powerLoad: 200 #Receives most of its power from the console +# - type: Appearance +# - type: GenericVisualizer +# visuals: +# enum.CloningPodVisuals.Status: +# base: +# Cloning: { state: pod_1 } +# NoMind: { state: pod_e } +# Gore: { state: pod_g } +# Idle: { state: pod_0 } +# - type: Climbable +# - type: StaticPrice +# price: 1000 +# - type: ContainerContainer +# containers: +# machine_board: !type:Container +# machine_parts: !type:Container +# clonepod-bodyContainer: !type:ContainerSlot +# - type: GuideHelp +# guides: +# - Cloning diff --git a/Resources/Prototypes/Entities/Structures/Storage/Closets/big_boxes.yml b/Resources/Prototypes/Entities/Structures/Storage/Closets/big_boxes.yml index 99432a2604..106bd5e34d 100644 --- a/Resources/Prototypes/Entities/Structures/Storage/Closets/big_boxes.yml +++ b/Resources/Prototypes/Entities/Structures/Storage/Closets/big_boxes.yml @@ -67,10 +67,11 @@ - type: CardboardBox quiet: true - type: Stealth + mirage: false # Sunrise-Edit hadOutline: true - type: StealthOnMove - passiveVisibilityRate: -0.37 - movementVisibilityRate: 0.20 + minVisibility: -1.5 # Sunrise-Edit + examineThreshold: 0.9 # Sunrise-Edit - type: entity id: BigBox diff --git a/Resources/Prototypes/Entities/Structures/Storage/Crates/crates.yml b/Resources/Prototypes/Entities/Structures/Storage/Crates/crates.yml index 7abba65c86..2245610a30 100644 --- a/Resources/Prototypes/Entities/Structures/Storage/Crates/crates.yml +++ b/Resources/Prototypes/Entities/Structures/Storage/Crates/crates.yml @@ -696,7 +696,8 @@ suffix: Stealth components: - type: Stealth + mirage: false # Sunrise-Edit hadOutline: true - type: StealthOnMove - passiveVisibilityRate: -0.10 - movementVisibilityRate: 0.10 + minVisibility: -1.5 # Sunrise-Edit + examineThreshold: 0.9 # Sunrise-Edit diff --git a/Resources/Prototypes/Shaders/shaders.yml b/Resources/Prototypes/Shaders/shaders.yml index 6e0bbd55b4..1f537c6e6c 100644 --- a/Resources/Prototypes/Shaders/shaders.yml +++ b/Resources/Prototypes/Shaders/shaders.yml @@ -108,4 +108,4 @@ - type: shader id: Hologram kind: source - path: "/Textures/Shaders/hologram.swsl" \ No newline at end of file + path: "/Textures/Shaders/hologram.swsl" diff --git a/Resources/Prototypes/XenoArch/Effects/normal_effects.yml b/Resources/Prototypes/XenoArch/Effects/normal_effects.yml index f2723e5369..8d8c72f9c2 100644 --- a/Resources/Prototypes/XenoArch/Effects/normal_effects.yml +++ b/Resources/Prototypes/XenoArch/Effects/normal_effects.yml @@ -293,10 +293,11 @@ effectHint: artifact-effect-hint-visual components: - type: Stealth + mirage: false # Sunrise-Edit hadOutline: true - type: StealthOnMove - passiveVisibilityRate: -0.10 - movementVisibilityRate: 0.10 + minVisibility: -1.5 # Sunrise-Edit + examineThreshold: 0.9 # Sunrise-Edit - type: artifactEffect id: EffectExplosionScary diff --git a/Resources/Prototypes/_Sunrise/Shaders/sharders.yml b/Resources/Prototypes/_Sunrise/Shaders/sharders.yml index 3d3d5719f0..51eda3a463 100644 --- a/Resources/Prototypes/_Sunrise/Shaders/sharders.yml +++ b/Resources/Prototypes/_Sunrise/Shaders/sharders.yml @@ -5,3 +5,8 @@ params: luminance_threshold: 0.5 noise_amount: 0.5 + +- type: shader + id: NoMirageStealth + kind: source + path: "/Textures/_Sunrise/Shaders/no_mirage_stealth.swsl" diff --git a/Resources/Textures/_Sunrise/Shaders/no_mirage_stealth.swsl b/Resources/Textures/_Sunrise/Shaders/no_mirage_stealth.swsl new file mode 100644 index 0000000000..c30b635624 --- /dev/null +++ b/Resources/Textures/_Sunrise/Shaders/no_mirage_stealth.swsl @@ -0,0 +1,22 @@ +light_mode unshaded; + +uniform sampler2D SCREEN_TEXTURE; +uniform highp float visibility; // number between -1 and 1 + +void fragment() { + + highp vec4 sprite = zTexture(UV); + + if (sprite.a == 0.0) { + discard; + } + + lowp float alpha; + if (visibility > 0.0) + alpha = sprite.a * visibility; + else + alpha = 0.0; + + COLOR.xyz = sprite.xyz; + COLOR.a = alpha; +}