Merge branch 'master' into 2020-08-19-firelocks

This commit is contained in:
Víctor Aguilera Puerto
2020-09-12 15:52:20 +02:00
committed by GitHub
20 changed files with 355 additions and 11 deletions

View File

@@ -0,0 +1,68 @@
using Content.Shared.GameObjects.Atmos;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.ResourceManagement;
using Robust.Shared.GameObjects.Components.Renderable;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Utility;
using System;
using YamlDotNet.RepresentationModel;
namespace Content.Client.GameObjects.Components.Atmos
{
[UsedImplicitly]
public class SiphonVisualizer : AppearanceVisualizer
{
private RSI _siphonRSI;
public override void LoadData(YamlMappingNode node)
{
base.LoadData(node);
var rsiString = node.GetNode("siphonRSI").ToString();
var rsiPath = SharedSpriteComponent.TextureRoot / rsiString;
try
{
var resourceCache = IoCManager.Resolve<IResourceCache>();
var resource = resourceCache.GetResource<RSIResource>(rsiPath);
_siphonRSI = resource.RSI;
}
catch (Exception e)
{
Logger.ErrorS("go.siphonvisualizer", "Unable to load RSI '{0}'. Trace:\n{1}", rsiPath, e);
}
}
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
if (!component.Owner.TryGetComponent(out ISpriteComponent sprite))
{
return;
}
if (!component.TryGetData(SiphonVisuals.VisualState, out SiphonVisualState siphonVisualState))
{
return;
}
var siphonBaseState = "scrub";
siphonBaseState += siphonVisualState.SiphonEnabled ? "On" : "Off";
sprite.LayerMapReserveBlank(Layer.SiphonBase);
var baseSiphonLayer = sprite.LayerMapGet(Layer.SiphonBase);
sprite.LayerSetRSI(baseSiphonLayer, _siphonRSI);
sprite.LayerSetState(baseSiphonLayer, siphonBaseState);
sprite.LayerSetVisible(baseSiphonLayer, true);
}
private enum Layer
{
SiphonBase,
}
}
}

View File

@@ -0,0 +1,68 @@
using Content.Shared.GameObjects.Atmos;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.ResourceManagement;
using Robust.Shared.GameObjects.Components.Renderable;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Utility;
using System;
using YamlDotNet.RepresentationModel;
namespace Content.Client.GameObjects.Components.Atmos
{
[UsedImplicitly]
public class VentVisualizer : AppearanceVisualizer
{
private RSI _ventRSI;
public override void LoadData(YamlMappingNode node)
{
base.LoadData(node);
var rsiString = node.GetNode("ventRSI").ToString();
var rsiPath = SharedSpriteComponent.TextureRoot / rsiString;
try
{
var resourceCache = IoCManager.Resolve<IResourceCache>();
var resource = resourceCache.GetResource<RSIResource>(rsiPath);
_ventRSI = resource.RSI;
}
catch (Exception e)
{
Logger.ErrorS("go.ventvisualizer", "Unable to load RSI '{0}'. Trace:\n{1}", rsiPath, e);
}
}
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
if (!component.Owner.TryGetComponent(out ISpriteComponent sprite))
{
return;
}
if (!component.TryGetData(VentVisuals.VisualState, out VentVisualState ventVisualState))
{
return;
}
var ventBaseState = "vent";
ventBaseState += ventVisualState.VentEnabled ? "On" : "Off";
sprite.LayerMapReserveBlank(Layer.VentBase);
var baseVentLayer = sprite.LayerMapGet(Layer.VentBase);
sprite.LayerSetRSI(baseVentLayer, _ventRSI);
sprite.LayerSetState(baseVentLayer, ventBaseState);
sprite.LayerSetVisible(baseVentLayer, true);
}
private enum Layer
{
VentBase,
}
}
}

View File

@@ -177,7 +177,8 @@
"ExtinguisherCabinetFilled",
"FireExtinguisher",
"Firelock",
"AtmosPlaque"
"AtmosPlaque",
"Spillable",
};
}
}

View File

@@ -11,10 +11,8 @@ namespace Content.IntegrationTests.Tests
[TestFixture]
public class PostMapInitTest : ContentIntegrationTest
{
public readonly string[] SkippedMaps =
{
"/Maps/Pathfinding/simple.yml"
};
public const bool SkipTestMaps = true;
public const string TestMapsPath = "/Maps/Test/";
[Test]
public async Task NoSavedPostMapInitTest()
@@ -34,7 +32,8 @@ namespace Content.IntegrationTests.Tests
{
var rootedPath = map.ToRootedPath();
if (SkippedMaps.Contains(rootedPath.ToString()))
// ReSharper disable once RedundantLogicalConditionalExpressionOperand
if (SkipTestMaps && rootedPath.ToString().StartsWith(TestMapsPath))
{
continue;
}
@@ -53,7 +52,7 @@ namespace Content.IntegrationTests.Tests
var meta = root["meta"];
var postMapInit = meta["postmapinit"].AsBool();
Assert.False(postMapInit);
Assert.False(postMapInit, $"Map {map.Filename} was saved postmapinit");
}
}
}

View File

@@ -2,6 +2,8 @@
using Content.Server.GameObjects.Components.NodeContainer;
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Atmos;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Log;
using Robust.Shared.ViewVariables;
@@ -23,6 +25,20 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
private AtmosphereSystem _atmosSystem;
[ViewVariables(VVAccess.ReadWrite)]
public bool SiphonEnabled
{
get => _siphonEnabled;
set
{
_siphonEnabled = value;
UpdateAppearance();
}
}
private bool _siphonEnabled = true;
private AppearanceComponent _appearance;
public override void Initialize()
{
base.Initialize();
@@ -40,10 +56,15 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
Logger.Error($"{typeof(BaseSiphonComponent)} on entity {Owner.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
return;
}
Owner.TryGetComponent(out _appearance);
UpdateAppearance();
}
public override void Update()
{
if (!SiphonEnabled)
return;
var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere(_entityManager);
if (tileAtmos == null)
return;
@@ -52,5 +73,10 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
}
protected abstract void ScrubGas(GasMixture inletGas, GasMixture outletGas);
private void UpdateAppearance()
{
_appearance?.SetData(SiphonVisuals.VisualState, new SiphonVisualState(SiphonEnabled));
}
}
}

View File

@@ -2,6 +2,8 @@
using Content.Server.GameObjects.Components.NodeContainer;
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Atmos;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Log;
using Robust.Shared.ViewVariables;
@@ -23,6 +25,20 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
private AtmosphereSystem _atmosSystem;
[ViewVariables(VVAccess.ReadWrite)]
public bool VentEnabled
{
get => _ventEnabled;
set
{
_ventEnabled = value;
UpdateAppearance();
}
}
private bool _ventEnabled = true;
private AppearanceComponent _appearance;
public override void Initialize()
{
base.Initialize();
@@ -40,10 +56,15 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
Logger.Error($"{typeof(BaseVentComponent)} on entity {Owner.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
return;
}
Owner.TryGetComponent(out _appearance);
UpdateAppearance();
}
public override void Update()
{
if (!VentEnabled)
return;
var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere(_entityManager);
if (tileAtmos == null)
return;
@@ -52,5 +73,10 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
}
protected abstract void VentGas(GasMixture inletGas, GasMixture outletGas);
private void UpdateAppearance()
{
_appearance?.SetData(VentVisuals.VisualState, new VentVisualState(VentEnabled));
}
}
}

View File

@@ -13,12 +13,17 @@ namespace Content.Server.Utility
/// </summary>
/// <param name="source">The entity on which to popup the message.</param>
/// <param name="message">The message to show.</param>
/// <param name="playerManager">
/// The instance of player manager to use, will be resolved automatically
/// if null.
/// </param>
/// <param name="range">
/// The range in which to search for players, defaulting to one screen.
/// </param>
public static void PopupMessageOtherClients(this IEntity source, string message, int range = 15)
public static void PopupMessageOtherClients(this IEntity source, string message, IPlayerManager playerManager = null, int range = 15)
{
var playerManager = IoCManager.Resolve<IPlayerManager>();
playerManager ??= IoCManager.Resolve<IPlayerManager>();
var viewers = playerManager.GetPlayersInRange(source.Transform.Coordinates, range);
foreach (var viewer in viewers)
@@ -33,5 +38,24 @@ namespace Content.Server.Utility
source.PopupMessage(viewer.AttachedEntity, message);
}
}
/// <summary>
/// Pops up a message at the given entity's location for everyone,
/// including itself, to see.
/// </summary>
/// <param name="source">The entity above which to show the message.</param>
/// <param name="message">The message to be seen.</param>
/// <param name="playerManager">
/// The instance of player manager to use, will be resolved automatically
/// if null.
/// </param>
/// <param name="range">
/// The range in which to search for players, defaulting to one screen.
/// </param>
public static void PopupMessageEveryone(this IEntity source, string message, IPlayerManager playerManager = null, int range = 15)
{
source.PopupMessage(message);
source.PopupMessageOtherClients(message, playerManager, range);
}
}
}

View File

@@ -0,0 +1,22 @@
using Robust.Shared.Serialization;
using System;
namespace Content.Shared.GameObjects.Atmos
{
[Serializable, NetSerializable]
public enum SiphonVisuals
{
VisualState
}
[Serializable, NetSerializable]
public class SiphonVisualState
{
public readonly bool SiphonEnabled;
public SiphonVisualState(bool siphonEnabled)
{
SiphonEnabled = siphonEnabled;
}
}
}

View File

@@ -0,0 +1,22 @@
using Robust.Shared.Serialization;
using System;
namespace Content.Shared.GameObjects.Atmos
{
[Serializable, NetSerializable]
public enum VentVisuals
{
VisualState
}
[Serializable, NetSerializable]
public class VentVisualState
{
public readonly bool VentEnabled;
public VentVisualState(bool ventEnabled)
{
VentEnabled = ventEnabled;
}
}
}

View File

@@ -12,7 +12,12 @@
- type: Icon
texture: Constructible/Power/eightdirwire.png
- type: Sprite
texture: Constructible/Power/eightdirwire.png
- type: Appearance
visuals:
- type: PipeVisualizer
pipeRSI: Constructible/Atmos/pipe.rsi
- type: SiphonVisualizer
siphonRSI: Constructible/Atmos/scrubber.rsi
- type: Destructible
thresholdvalue: 100

View File

@@ -12,7 +12,12 @@
- type: Icon
texture: Constructible/Power/eightdirwire.png
- type: Sprite
texture: Constructible/Power/eightdirwire.png
- type: Appearance
visuals:
- type: PipeVisualizer
pipeRSI: Constructible/Atmos/pipe.rsi
- type: VentVisualizer
ventRSI: Constructible/Atmos/vent.rsi
- type: Destructible
thresholdvalue: 100

View File

@@ -18,6 +18,7 @@
- type: entity
id: LargeBarSign
name: large bar sign
abstract: true
components:
- type: Clickable
- type: InteractionOutline

View File

@@ -0,0 +1,48 @@
{
"version":1,
"size":{
"x":32,
"y":32
},
"license":"CC-BY-SA-3.0",
"copyright":"Taken from https://github.com/tgstation/tgstation at commit 57cd1d59ca019dd0e7811ac451f295f818e573da",
"states":[
{
"name":"scrubOff",
"directions":1,
"delays":[ [ 1.0 ] ]
},
{
"name":"scrubOn",
"directions":1,
"delays":[
[
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08,
0.08
]
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 767 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -0,0 +1,28 @@
{
"version":1,
"size":{
"x":32,
"y":32
},
"license":"CC-BY-SA-3.0",
"copyright":"Taken from https://github.com/tgstation/tgstation at commit 57cd1d59ca019dd0e7811ac451f295f818e573da",
"states":[
{
"name":"ventOff",
"directions":1,
"delays":[ [ 1.0 ] ]
},
{
"name":"ventOn",
"directions":1,
"delays":[
[
0.08,
0.08,
0.08,
0.08
]
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -102,6 +102,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=soundfonts/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=spawnable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Spawner/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Spillable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Strippable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=stunnable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Superconduct/@EntryIndexedValue">True</s:Boolean>