Невидимая невидимость
This commit is contained in:
parent
1ce9247f54
commit
9bf5f73ec3
15 changed files with 228 additions and 167 deletions
|
|
@ -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<ShaderPrototype>("Stealth").InstanceUnique();
|
||||
_noMirageShader = _protoMan.Index<ShaderPrototype>("NoMirageStealth").InstanceUnique(); // Sunrise-Edit
|
||||
|
||||
SubscribeLocalEvent<StealthComponent, ComponentShutdown>(OnShutdown);
|
||||
SubscribeLocalEvent<StealthComponent, ComponentStartup>(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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
/// <summary>
|
||||
/// The creature will continue invisible at death.
|
||||
/// </summary>
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -108,4 +108,4 @@
|
|||
- type: shader
|
||||
id: Hologram
|
||||
kind: source
|
||||
path: "/Textures/Shaders/hologram.swsl"
|
||||
path: "/Textures/Shaders/hologram.swsl"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
22
Resources/Textures/_Sunrise/Shaders/no_mirage_stealth.swsl
Normal file
22
Resources/Textures/_Sunrise/Shaders/no_mirage_stealth.swsl
Normal file
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue