Welder flame fix (#7021)
This commit is contained in:
21
Content.Client/Tools/Visualizers/WelderVisualizerSystem.cs
Normal file
21
Content.Client/Tools/Visualizers/WelderVisualizerSystem.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using Content.Client.Tools.Components;
|
||||||
|
using Content.Shared.Tools.Components;
|
||||||
|
using Robust.Client.GameObjects;
|
||||||
|
|
||||||
|
namespace Content.Client.Tools.Visualizers;
|
||||||
|
|
||||||
|
public sealed class WelderVisualizerSystem : VisualizerSystem<WelderComponent>
|
||||||
|
{
|
||||||
|
protected override void OnAppearanceChange(EntityUid uid, WelderComponent component, ref AppearanceChangeEvent args)
|
||||||
|
{
|
||||||
|
base.OnAppearanceChange(uid, component, ref args);
|
||||||
|
|
||||||
|
if (!TryComp(uid, out SpriteComponent? sprite))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (args.Component.TryGetData(WelderVisuals.Lit, out bool isLit))
|
||||||
|
{
|
||||||
|
sprite.LayerSetVisible(WelderLayers.Flame, isLit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Linq;
|
||||||
using System.Linq;
|
|
||||||
using Content.Server.Chemistry.Components;
|
using Content.Server.Chemistry.Components;
|
||||||
using Content.Server.Chemistry.Components.SolutionManager;
|
using Content.Server.Chemistry.Components.SolutionManager;
|
||||||
using Content.Server.Chemistry.EntitySystems;
|
using Content.Server.Chemistry.EntitySystems;
|
||||||
@@ -15,9 +14,7 @@ using Content.Shared.Temperature;
|
|||||||
using Content.Shared.Tools.Components;
|
using Content.Shared.Tools.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Server.Tools
|
namespace Content.Server.Tools
|
||||||
@@ -64,7 +61,7 @@ namespace Content.Server.Tools
|
|||||||
SolutionContainerManagerComponent? solutionContainer = null,
|
SolutionContainerManagerComponent? solutionContainer = null,
|
||||||
SharedItemComponent? item = null,
|
SharedItemComponent? item = null,
|
||||||
PointLightComponent? light = null,
|
PointLightComponent? light = null,
|
||||||
SpriteComponent? sprite = null)
|
AppearanceComponent? appearance = null)
|
||||||
{
|
{
|
||||||
// Right now, we only need the welder.
|
// Right now, we only need the welder.
|
||||||
// So let's not unnecessarily resolve components
|
// So let's not unnecessarily resolve components
|
||||||
@@ -72,8 +69,8 @@ namespace Content.Server.Tools
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
return !welder.Lit
|
return !welder.Lit
|
||||||
? TryTurnWelderOn(uid, user, welder, solutionContainer, item, light, sprite)
|
? TryTurnWelderOn(uid, user, welder, solutionContainer, item, light, appearance)
|
||||||
: TryTurnWelderOff(uid, user, welder, item, light, sprite);
|
: TryTurnWelderOff(uid, user, welder, item, light, appearance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryTurnWelderOn(EntityUid uid, EntityUid? user,
|
public bool TryTurnWelderOn(EntityUid uid, EntityUid? user,
|
||||||
@@ -81,13 +78,13 @@ namespace Content.Server.Tools
|
|||||||
SolutionContainerManagerComponent? solutionContainer = null,
|
SolutionContainerManagerComponent? solutionContainer = null,
|
||||||
SharedItemComponent? item = null,
|
SharedItemComponent? item = null,
|
||||||
PointLightComponent? light = null,
|
PointLightComponent? light = null,
|
||||||
SpriteComponent? sprite = null)
|
AppearanceComponent? appearance = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref welder, ref solutionContainer))
|
if (!Resolve(uid, ref welder, ref solutionContainer))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Optional components.
|
// Optional components.
|
||||||
Resolve(uid, ref item, ref light, ref sprite);
|
Resolve(uid, ref item, ref light, ref appearance, false);
|
||||||
|
|
||||||
if (!_solutionContainerSystem.TryGetSolution(uid, welder.FuelSolution, out var solution, solutionContainer))
|
if (!_solutionContainerSystem.TryGetSolution(uid, welder.FuelSolution, out var solution, solutionContainer))
|
||||||
return false;
|
return false;
|
||||||
@@ -109,7 +106,7 @@ namespace Content.Server.Tools
|
|||||||
if(item != null)
|
if(item != null)
|
||||||
item.EquippedPrefix = "on";
|
item.EquippedPrefix = "on";
|
||||||
|
|
||||||
sprite?.LayerSetVisible(1, true);
|
appearance?.SetData(WelderVisuals.Lit, true);
|
||||||
|
|
||||||
if (light != null)
|
if (light != null)
|
||||||
light.Enabled = true;
|
light.Enabled = true;
|
||||||
@@ -129,13 +126,13 @@ namespace Content.Server.Tools
|
|||||||
WelderComponent? welder = null,
|
WelderComponent? welder = null,
|
||||||
SharedItemComponent? item = null,
|
SharedItemComponent? item = null,
|
||||||
PointLightComponent? light = null,
|
PointLightComponent? light = null,
|
||||||
SpriteComponent? sprite = null)
|
AppearanceComponent? appearance = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref welder))
|
if (!Resolve(uid, ref welder))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Optional components.
|
// Optional components.
|
||||||
Resolve(uid, ref item, ref light, ref sprite);
|
Resolve(uid, ref item, ref light, ref appearance, false);
|
||||||
|
|
||||||
welder.Lit = false;
|
welder.Lit = false;
|
||||||
|
|
||||||
@@ -144,7 +141,7 @@ namespace Content.Server.Tools
|
|||||||
item.EquippedPrefix = "off";
|
item.EquippedPrefix = "off";
|
||||||
|
|
||||||
// Layer 1 is the flame.
|
// Layer 1 is the flame.
|
||||||
sprite?.LayerSetVisible(1, false);
|
appearance?.SetData(WelderVisuals.Lit, false);
|
||||||
|
|
||||||
if (light != null)
|
if (light != null)
|
||||||
light.Enabled = false;
|
light.Enabled = false;
|
||||||
|
|||||||
@@ -25,4 +25,17 @@ namespace Content.Shared.Tools.Components
|
|||||||
Lit = lit;
|
Lit = lit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public enum WelderVisuals : byte
|
||||||
|
{
|
||||||
|
Lit
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public enum WelderLayers : byte
|
||||||
|
{
|
||||||
|
Base,
|
||||||
|
Flame
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,11 +117,6 @@
|
|||||||
components:
|
components:
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Tools/Cowtools/cowelder.rsi
|
sprite: Objects/Tools/Cowtools/cowelder.rsi
|
||||||
layers:
|
|
||||||
- state: icon
|
|
||||||
- state: welder_flame
|
|
||||||
shader: unshaded
|
|
||||||
visible: false
|
|
||||||
- type: Item
|
- type: Item
|
||||||
size: 10
|
size: 10
|
||||||
sprite: Objects/Tools/Cowtools/cowelder.rsi
|
sprite: Objects/Tools/Cowtools/cowelder.rsi
|
||||||
|
|||||||
@@ -12,7 +12,9 @@
|
|||||||
netsync: false
|
netsync: false
|
||||||
layers:
|
layers:
|
||||||
- state: icon
|
- state: icon
|
||||||
|
map: ["enum.WelderLayers.Base"]
|
||||||
- state: welder_flame
|
- state: welder_flame
|
||||||
|
map: ["enum.WelderLayers.Flame"]
|
||||||
shader: unshaded
|
shader: unshaded
|
||||||
visible: false
|
visible: false
|
||||||
- type: Item
|
- type: Item
|
||||||
@@ -47,6 +49,7 @@
|
|||||||
enabled: false
|
enabled: false
|
||||||
radius: 1.5
|
radius: 1.5
|
||||||
color: orange
|
color: orange
|
||||||
|
- type: Appearance
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: experimental welding tool
|
name: experimental welding tool
|
||||||
|
|||||||
Reference in New Issue
Block a user