Make welder flames like proper unshaded lights. (#12320)

* Make welders use ToggleableLightVisualsComponent.

* Remove old code from ToolSystem.Welder.

* Update welder sprites.
This commit is contained in:
Vordenburg
2022-11-01 21:16:33 -04:00
committed by GitHub
parent 8fcb87d0a3
commit 784e0ab51f
43 changed files with 94 additions and 61 deletions

View File

@@ -4,12 +4,12 @@ using Content.Server.Chemistry.Components.SolutionManager;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Tools.Components;
using Content.Server.Weapons.Melee.Events;
using Content.Shared.Audio;
using Content.Shared.Examine;
using Content.Shared.FixedPoint;
using Content.Shared.Interaction;
using Content.Shared.Item;
using Content.Shared.Temperature;
using Content.Shared.Toggleable;
using Content.Shared.Tools.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
@@ -20,6 +20,11 @@ namespace Content.Server.Tools
{
public sealed partial class ToolSystem
{
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly AppearanceSystem _appearanceSystem = default!;
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
private readonly HashSet<EntityUid> _activeWelders = new();
private const float WelderUpdateTimer = 1f;
@@ -106,15 +111,13 @@ namespace Content.Server.Tools
var ev = new WelderToggledEvent(true);
RaiseLocalEvent(welder.Owner, ev, false);
if(item != null)
_itemSystem.SetHeldPrefix(uid, "on", item);
appearance?.SetData(WelderVisuals.Lit, true);
_appearanceSystem.SetData(uid, WelderVisuals.Lit, true);
_appearanceSystem.SetData(uid, ToggleableLightVisuals.Enabled, true);
if (light != null)
light.Enabled = true;
SoundSystem.Play(welder.WelderOnSounds.GetSound(), Filter.Pvs(uid), uid, AudioHelpers.WithVariation(0.125f).WithVolume(-5f));
_audioSystem.PlayPvs(welder.WelderOnSounds, uid, AudioParams.Default.WithVariation(0.125f).WithVolume(-5f));
if (transform.GridUid is {} gridUid)
{
@@ -122,7 +125,7 @@ namespace Content.Server.Tools
_atmosphereSystem.HotspotExpose(gridUid, position, 700, 50, true);
}
welder.Dirty();
_entityManager.Dirty(welder);
_activeWelders.Add(uid);
return true;
@@ -145,27 +148,24 @@ namespace Content.Server.Tools
var ev = new WelderToggledEvent(false);
RaiseLocalEvent(welder.Owner, ev, false);
// TODO: Make all this use visualizers.
if (item != null)
_itemSystem.SetHeldPrefix(uid, "off", item);
// Layer 1 is the flame.
appearance?.SetData(WelderVisuals.Lit, false);
_appearanceSystem.SetData(uid, WelderVisuals.Lit, false);
_appearanceSystem.SetData(uid, ToggleableLightVisuals.Enabled, false);
if (light != null)
light.Enabled = false;
SoundSystem.Play(welder.WelderOffSounds.GetSound(), Filter.Pvs(uid), uid, AudioHelpers.WithVariation(0.125f).WithVolume(-5f));
_audioSystem.PlayPvs(welder.WelderOffSounds, uid, AudioParams.Default.WithVariation(0.125f).WithVolume(-5f));
welder.Dirty();
_entityManager.Dirty(welder);
_activeWelders.Remove(uid);
return true;
}
private void OnWelderStartup(EntityUid uid, WelderComponent component, ComponentStartup args)
private void OnWelderStartup(EntityUid uid, WelderComponent welder, ComponentStartup args)
{
component.Dirty();
_entityManager.Dirty(welder);
}
private void OnWelderIsHotEvent(EntityUid uid, WelderComponent welder, IsHotEvent args)
@@ -198,7 +198,7 @@ namespace Content.Server.Tools
private void OnWelderSolutionChange(EntityUid uid, WelderComponent welder, SolutionChangedEvent args)
{
welder.Dirty();
_entityManager.Dirty(welder);
}
private void OnWelderActivate(EntityUid uid, WelderComponent welder, ActivateInWorldEvent args)
@@ -226,7 +226,7 @@ namespace Content.Server.Tools
{
var drained = _solutionContainerSystem.Drain(target, targetSolution, trans);
_solutionContainerSystem.TryAddSolution(uid, welderSolution, drained);
SoundSystem.Play(welder.WelderRefill.GetSound(), Filter.Pvs(uid), uid);
_audioSystem.PlayPvs(welder.WelderRefill, uid);
_popupSystem.PopupEntity(Loc.GetString("welder-component-after-interact-refueled-message"), uid, Filter.Entities(args.User));
}
else if (welderSolution.AvailableVolume <= 0)
@@ -292,7 +292,7 @@ namespace Content.Server.Tools
}
solution.RemoveReagent(welder.FuelReagent, neededFuel);
welder.Dirty();
_entityManager.Dirty(welder);
}
private void OnWelderShutdown(EntityUid uid, WelderComponent welder, ComponentShutdown args)
@@ -335,7 +335,7 @@ namespace Content.Server.Tools
if (solution.GetReagentQuantity(welder.FuelReagent) <= FixedPoint2.Zero)
TryTurnWelderOff(tool, null, welder);
welder.Dirty();
_entityManager.Dirty(welder);
}
_welderTimer -= WelderUpdateTimer;

View File

@@ -20,7 +20,15 @@
- type: Item
size: 10
sprite: Objects/Tools/welder.rsi
heldPrefix: off
- type: ToggleableLightVisuals
spriteLayer: flame
inhandVisuals:
left:
- state: inhand-left-flame
shader: unshaded
right:
- state: inhand-right-flame
shader: unshaded
- type: ItemCooldown
- type: MeleeWeapon
damage:
@@ -46,6 +54,7 @@
Heat: 10
Blunt: -10
- type: PointLight
netsync: false
enabled: false
radius: 1.5
color: orange

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 B

After

Width:  |  Height:  |  Size: 352 B

View File

@@ -20,54 +20,62 @@
]
},
{
"name": "off-inhand-left",
"name": "inhand-left",
"directions": 4
},
{
"name": "off-inhand-right",
"name": "inhand-right",
"directions": 4
},
{
"name": "on-inhand-left",
"name": "inhand-left-flame",
"directions": 4,
"delays": [
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
]
]
},
{
"name": "on-inhand-right",
"name": "inhand-right-flame",
"directions": 4,
"delays": [
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
]
]
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 583 B

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 B

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

View File

@@ -28,15 +28,15 @@
]
},
{
"name": "off-inhand-left",
"name": "inhand-left",
"directions": 4
},
{
"name": "off-inhand-right",
"name": "inhand-right",
"directions": 4
},
{
"name": "on-inhand-left",
"name": "inhand-left-flame",
"directions": 4,
"delays": [
[
@@ -62,7 +62,7 @@
]
},
{
"name": "on-inhand-right",
"name": "inhand-right-flame",
"directions": 4,
"delays": [
[

Binary file not shown.

Before

Width:  |  Height:  |  Size: 868 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 809 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

View File

@@ -20,54 +20,62 @@
]
},
{
"name": "off-inhand-left",
"name": "inhand-left",
"directions": 4
},
{
"name": "off-inhand-right",
"name": "inhand-right",
"directions": 4
},
{
"name": "on-inhand-left",
"name": "inhand-left-flame",
"directions": 4,
"delays": [
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
]
]
},
{
"name": "on-inhand-right",
"name": "inhand-right-flame",
"directions": 4,
"delays": [
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
]
]
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 B

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

View File

@@ -20,54 +20,62 @@
]
},
{
"name": "off-inhand-left",
"name": "inhand-left",
"directions": 4
},
{
"name": "off-inhand-right",
"name": "inhand-right",
"directions": 4
},
{
"name": "on-inhand-left",
"name": "inhand-left-flame",
"directions": 4,
"delays": [
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
]
]
},
{
"name": "on-inhand-right",
"name": "inhand-right-flame",
"directions": 4,
"delays": [
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
],
[
0.2,
0.1
0.2,
0.2
]
]
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

After

Width:  |  Height:  |  Size: 297 B