-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Simple-Station:master' into Walls/Windows-Resprites
- Loading branch information
Showing
350 changed files
with
6,607 additions
and
502 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Close PR's on master | ||
name: Close PRs on master | ||
|
||
on: | ||
pull_request_target: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
using System.Linq; | ||
using Robust.Client.GameObjects; | ||
using static Robust.Client.GameObjects.SpriteComponent; | ||
using Content.Shared.Clothing; | ||
using Content.Shared.Hands; | ||
using Content.Shared.Paint; | ||
using Robust.Client.Graphics; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Client.Paint | ||
{ | ||
public sealed class PaintedVisualizerSystem : VisualizerSystem<PaintedComponent> | ||
{ | ||
/// <summary> | ||
/// Visualizer for Paint which applies a shader and colors the entity. | ||
/// </summary> | ||
|
||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!; | ||
[Dependency] private readonly IPrototypeManager _protoMan = default!; | ||
|
||
public ShaderInstance? Shader; // in Robust.Client.Graphics so cannot move to shared component. | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<PaintedComponent, HeldVisualsUpdatedEvent>(OnHeldVisualsUpdated); | ||
SubscribeLocalEvent<PaintedComponent, ComponentShutdown>(OnShutdown); | ||
SubscribeLocalEvent<PaintedComponent, EquipmentVisualsUpdatedEvent>(OnEquipmentVisualsUpdated); | ||
} | ||
|
||
protected override void OnAppearanceChange(EntityUid uid, PaintedComponent component, ref AppearanceChangeEvent args) | ||
{ | ||
// ShaderPrototype sadly in Robust.Client, cannot move to shared component. | ||
Shader = _protoMan.Index<ShaderPrototype>(component.ShaderName).Instance(); | ||
|
||
if (args.Sprite == null) | ||
return; | ||
|
||
if (!_appearance.TryGetData<bool>(uid, PaintVisuals.Painted, out bool isPainted)) | ||
return; | ||
|
||
var sprite = args.Sprite; | ||
|
||
|
||
foreach (var spriteLayer in sprite.AllLayers) | ||
{ | ||
if (spriteLayer is not Layer layer) | ||
continue; | ||
|
||
if (layer.Shader == null) // If shader isn't null we dont want to replace the original shader. | ||
{ | ||
layer.Shader = Shader; | ||
layer.Color = component.Color; | ||
} | ||
} | ||
} | ||
|
||
private void OnHeldVisualsUpdated(EntityUid uid, PaintedComponent component, HeldVisualsUpdatedEvent args) | ||
{ | ||
if (args.RevealedLayers.Count == 0) | ||
return; | ||
|
||
if (!TryComp(args.User, out SpriteComponent? sprite)) | ||
return; | ||
|
||
foreach (var revealed in args.RevealedLayers) | ||
{ | ||
if (!sprite.LayerMapTryGet(revealed, out var layer) || sprite[layer] is not Layer notlayer) | ||
continue; | ||
|
||
sprite.LayerSetShader(layer, component.ShaderName); | ||
sprite.LayerSetColor(layer, component.Color); | ||
} | ||
} | ||
|
||
private void OnEquipmentVisualsUpdated(EntityUid uid, PaintedComponent component, EquipmentVisualsUpdatedEvent args) | ||
{ | ||
if (args.RevealedLayers.Count == 0) | ||
return; | ||
|
||
if (!TryComp(args.Equipee, out SpriteComponent? sprite)) | ||
return; | ||
|
||
foreach (var revealed in args.RevealedLayers) | ||
{ | ||
if (!sprite.LayerMapTryGet(revealed, out var layer) || sprite[layer] is not Layer notlayer) | ||
continue; | ||
|
||
sprite.LayerSetShader(layer, component.ShaderName); | ||
sprite.LayerSetColor(layer, component.Color); | ||
} | ||
} | ||
|
||
private void OnShutdown(EntityUid uid, PaintedComponent component, ref ComponentShutdown args) | ||
{ | ||
if (!TryComp(uid, out SpriteComponent? sprite)) | ||
return; | ||
|
||
component.BeforeColor = sprite.Color; | ||
Shader = _protoMan.Index<ShaderPrototype>(component.ShaderName).Instance(); | ||
|
||
if (!Terminating(uid)) | ||
{ | ||
foreach (var spriteLayer in sprite.AllLayers) | ||
{ | ||
if (spriteLayer is not Layer layer) | ||
continue; | ||
|
||
if (layer.Shader == Shader) // If shader isn't same as one in component we need to ignore it. | ||
{ | ||
layer.Shader = null; | ||
if (layer.Color == component.Color) // If color isn't the same as one in component we don't want to change it. | ||
layer.Color = component.BeforeColor; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Robust.Shared.Configuration; | ||
|
||
namespace Content.Server.Cargo.Systems | ||
{ | ||
public sealed partial class CargoSystem | ||
{ | ||
[Dependency] private readonly IConfigurationManager _cfg = default!; | ||
} | ||
|
||
[CVarDefs] | ||
public sealed class CargoCVars | ||
{ | ||
/// <summary> | ||
/// Determines if a trade station spawns in its own FTL map. | ||
/// </summary> | ||
/// <remarks> | ||
/// Set this to true if and only if you are disabling the normal spawning method. | ||
/// Otherwise you get two trade stations. | ||
/// This does NOTHING to the trade station that spawns on the default map. | ||
/// To change that, in Resources/Prototypes/Entities/Stations/base.yml; | ||
/// comment out the "trade:" section. | ||
/// </remarks> | ||
public static readonly CVarDef<bool> CreateCargoMap = | ||
CVarDef.Create("cargo.tradestation_spawns_in_ftl_map", false, CVar.SERVERONLY); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.