Add inhand fill visuals (#24495)
* Add inhand fill visuals * oops * remove unused import
@@ -1,6 +1,8 @@
|
||||
using Content.Client.Items.Systems;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Rounding;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -10,11 +12,13 @@ namespace Content.Client.Chemistry.Visualizers;
|
||||
public sealed class SolutionContainerVisualsSystem : VisualizerSystem<SolutionContainerVisualsComponent>
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
[Dependency] private readonly ItemSystem _itemSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<SolutionContainerVisualsComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<SolutionContainerVisualsComponent, GetInhandVisualsEvent>(OnGetHeldVisuals);
|
||||
}
|
||||
|
||||
private void OnMapInit(EntityUid uid, SolutionContainerVisualsComponent component, MapInitEvent args)
|
||||
@@ -111,6 +115,35 @@ public sealed class SolutionContainerVisualsSystem : VisualizerSystem<SolutionCo
|
||||
}
|
||||
}
|
||||
|
||||
// in-hand visuals
|
||||
_itemSystem.VisualsChanged(uid);
|
||||
}
|
||||
|
||||
private void OnGetHeldVisuals(EntityUid uid, SolutionContainerVisualsComponent component, GetInhandVisualsEvent args)
|
||||
{
|
||||
if (component.InHandsFillBaseName == null)
|
||||
return;
|
||||
|
||||
if (!TryComp(uid, out AppearanceComponent? appearance))
|
||||
return;
|
||||
|
||||
if (!AppearanceSystem.TryGetData<float>(uid, SolutionContainerVisuals.FillFraction, out var fraction, appearance))
|
||||
return;
|
||||
|
||||
int closestFillSprite = ContentHelpers.RoundToLevels(fraction, 1, component.InHandsMaxFillLevels + 1);
|
||||
|
||||
if (closestFillSprite > 0)
|
||||
{
|
||||
var layer = new PrototypeLayerData();
|
||||
|
||||
var key = "inhand-" + args.Location.ToString().ToLowerInvariant() + component.InHandsFillBaseName + closestFillSprite;
|
||||
|
||||
layer.State = key;
|
||||
|
||||
if (component.ChangeColor && AppearanceSystem.TryGetData<Color>(uid, SolutionContainerVisuals.Color, out var color, appearance))
|
||||
layer.Color = color;
|
||||
|
||||
args.Layers.Add((key, layer));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.Hands.Components;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.Chemistry.Components
|
||||
@@ -40,5 +41,17 @@ namespace Content.Shared.Chemistry.Components
|
||||
|
||||
[DataField]
|
||||
public string InitialDescription = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Optional in-hand visuals to to show someone is holding a filled beaker/jug/etc.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public string? InHandsFillBaseName = null;
|
||||
|
||||
/// <summary>
|
||||
/// A separate max fill levels for in-hands (to reduce number of sprites needed)
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public int InHandsMaxFillLevels = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
- type: SolutionContainerVisuals
|
||||
maxFillLevels: 6
|
||||
fillBaseName: jug
|
||||
inHandsMaxFillLevels: 5
|
||||
inHandsFillBaseName: -fill-
|
||||
- type: StaticPrice
|
||||
price: 60
|
||||
- type: Label
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
- type: SolutionContainerVisuals
|
||||
maxFillLevels: 6
|
||||
fillBaseName: vial-1-
|
||||
inHandsMaxFillLevels: 4
|
||||
inHandsFillBaseName: -fill-
|
||||
- type: Drink
|
||||
solution: beaker
|
||||
- type: SolutionContainerManager
|
||||
|
||||
@@ -158,6 +158,11 @@
|
||||
solution: beaker
|
||||
- type: StaticPrice
|
||||
price: 10
|
||||
- type: SolutionContainerVisuals
|
||||
maxFillLevels: 6
|
||||
fillBaseName: beaker
|
||||
inHandsMaxFillLevels: 3
|
||||
inHandsFillBaseName: -fill-
|
||||
|
||||
- type: entity
|
||||
name: cryoxadone beaker
|
||||
@@ -200,6 +205,8 @@
|
||||
- type: SolutionContainerVisuals
|
||||
maxFillLevels: 6
|
||||
fillBaseName: beakerlarge
|
||||
inHandsMaxFillLevels: 4
|
||||
inHandsFillBaseName: -fill-
|
||||
- type: StaticPrice
|
||||
price: 20
|
||||
|
||||
@@ -277,6 +284,8 @@
|
||||
- type: SolutionContainerVisuals
|
||||
maxFillLevels: 1
|
||||
fillBaseName: dropper
|
||||
inHandsMaxFillLevels: 1
|
||||
inHandsFillBaseName: -fill-
|
||||
- type: StaticPrice
|
||||
price: 40
|
||||
|
||||
@@ -321,7 +330,6 @@
|
||||
- type: Item
|
||||
size: Tiny
|
||||
sprite: Objects/Specific/Chemistry/syringe.rsi
|
||||
heldPrefix: 0
|
||||
- type: SolutionContainerManager
|
||||
solutions:
|
||||
injector:
|
||||
@@ -338,6 +346,8 @@
|
||||
- type: SolutionContainerVisuals
|
||||
maxFillLevels: 2
|
||||
fillBaseName: syringe
|
||||
inHandsMaxFillLevels: 3
|
||||
inHandsFillBaseName: -fill-
|
||||
- type: Tag
|
||||
tags:
|
||||
- Syringe
|
||||
|
||||
|
After Width: | Height: | Size: 126 B |
|
After Width: | Height: | Size: 137 B |
|
After Width: | Height: | Size: 158 B |
|
After Width: | Height: | Size: 128 B |
|
After Width: | Height: | Size: 140 B |
|
After Width: | Height: | Size: 155 B |
@@ -16,10 +16,34 @@
|
||||
{
|
||||
"name": "inhand-left",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left-fill-1",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left-fill-2",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left-fill-3",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right-fill-1",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right-fill-2",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right-fill-3",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "beaker1"
|
||||
|
||||
|
After Width: | Height: | Size: 133 B |
|
After Width: | Height: | Size: 144 B |
|
After Width: | Height: | Size: 156 B |
|
After Width: | Height: | Size: 198 B |
|
After Width: | Height: | Size: 134 B |
|
After Width: | Height: | Size: 147 B |
|
After Width: | Height: | Size: 157 B |
|
After Width: | Height: | Size: 191 B |
@@ -16,10 +16,42 @@
|
||||
{
|
||||
"name": "inhand-left",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left-fill-1",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left-fill-2",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left-fill-3",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left-fill-4",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right-fill-1",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right-fill-2",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right-fill-3",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right-fill-4",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "beakerlarge1"
|
||||
|
||||
|
After Width: | Height: | Size: 253 B |
|
After Width: | Height: | Size: 249 B |
@@ -20,9 +20,17 @@
|
||||
"name": "inhand-left",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left-fill-1",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right-fill-1",
|
||||
"directions": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 173 B |
|
After Width: | Height: | Size: 196 B |
|
After Width: | Height: | Size: 217 B |
|
After Width: | Height: | Size: 221 B |
|
After Width: | Height: | Size: 230 B |
|
Before Width: | Height: | Size: 297 B After Width: | Height: | Size: 411 B |
|
After Width: | Height: | Size: 173 B |
|
After Width: | Height: | Size: 192 B |
|
After Width: | Height: | Size: 233 B |
|
After Width: | Height: | Size: 220 B |
|
After Width: | Height: | Size: 232 B |
|
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 418 B |
@@ -13,10 +13,50 @@
|
||||
{
|
||||
"name": "inhand-left",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left-fill-1",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left-fill-2",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left-fill-3",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left-fill-4",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left-fill-5",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right-fill-1",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right-fill-2",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right-fill-3",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right-fill-4",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right-fill-5",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "jug1"
|
||||
|
||||
|
Before Width: | Height: | Size: 298 B |
|
Before Width: | Height: | Size: 300 B |
|
Before Width: | Height: | Size: 316 B |
|
Before Width: | Height: | Size: 320 B |
|
Before Width: | Height: | Size: 316 B |
|
Before Width: | Height: | Size: 320 B |
|
Before Width: | Height: | Size: 322 B |
|
Before Width: | Height: | Size: 315 B |
|
Before Width: | Height: | Size: 321 B |
|
Before Width: | Height: | Size: 321 B |
|
After Width: | Height: | Size: 121 B |
|
After Width: | Height: | Size: 132 B |
|
After Width: | Height: | Size: 137 B |
|
After Width: | Height: | Size: 177 B |
|
After Width: | Height: | Size: 126 B |
|
After Width: | Height: | Size: 135 B |
|
After Width: | Height: | Size: 143 B |
|
After Width: | Height: | Size: 182 B |
@@ -58,43 +58,35 @@
|
||||
"name": "syringe2"
|
||||
},
|
||||
{
|
||||
"name": "0-inhand-left",
|
||||
"name": "inhand-left",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "0-inhand-right",
|
||||
"name": "inhand-right",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "1-inhand-left",
|
||||
"name": "inhand-left-fill-1",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "1-inhand-right",
|
||||
"name": "inhand-right-fill-1",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "2-inhand-left",
|
||||
"name": "inhand-left-fill-2",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "2-inhand-right",
|
||||
"name": "inhand-right-fill-2",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "3-inhand-left",
|
||||
"name": "inhand-left-fill-3",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "3-inhand-right",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "4-inhand-left",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "4-inhand-right",
|
||||
"name": "inhand-right-fill-3",
|
||||
"directions": 4
|
||||
}
|
||||
]
|
||||
|
||||
|
After Width: | Height: | Size: 122 B |
|
After Width: | Height: | Size: 130 B |
|
After Width: | Height: | Size: 138 B |
|
After Width: | Height: | Size: 142 B |
|
After Width: | Height: | Size: 126 B |
|
After Width: | Height: | Size: 134 B |
|
After Width: | Height: | Size: 142 B |
|
After Width: | Height: | Size: 144 B |
@@ -13,10 +13,42 @@
|
||||
{
|
||||
"name": "inhand-left",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left-fill-1",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left-fill-2",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left-fill-3",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-left-fill-4",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right-fill-1",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right-fill-2",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right-fill-3",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "inhand-right-fill-4",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "vial-1"
|
||||
|
||||