Skip to content

Commit

Permalink
sprite added, and I fixed the currently unused loaded chemmaster spri…
Browse files Browse the repository at this point in the history
…te to be used
  • Loading branch information
Temoffy committed Jan 4, 2025
1 parent b31b338 commit e91f7cb
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public sealed class ChemMasterSystem : EntitySystem
{
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly AudioSystem _audioSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!; //Frontier
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
Expand Down Expand Up @@ -70,6 +71,7 @@ private void UpdateUiState(Entity<ChemMasterComponent> ent, bool updateLabel = f
if (!_solutionContainerSystem.TryGetSolution(owner, SharedChemMaster.BufferSolutionName, out _, out var bufferSolution))
return;
var inputContainer = _itemSlotsSystem.GetItemOrNull(owner, SharedChemMaster.InputSlotName);
_appearanceSystem.SetData(owner, ChemMasterVisualState.BeakerInserted, inputContainer.HasValue); //Frontier
var outputContainer = _itemSlotsSystem.GetItemOrNull(owner, SharedChemMaster.OutputSlotName);

var bufferReagents = bufferSolution.Contents;
Expand Down
10 changes: 7 additions & 3 deletions Content.Server/_NF/Chemistry/EntitySystems/ChemPrenticeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Database;
using Content.Shared.FixedPoint;
using Content.Shared.Kitchen;
using Content.Shared.Storage;
using JetBrains.Annotations;
using Robust.Server.Audio;
Expand All @@ -33,6 +34,7 @@ public sealed class ChemPrenticeSystem : EntitySystem
{
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly AudioSystem _audioSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
Expand All @@ -59,18 +61,20 @@ private void SubscribeUpdateUiState<T>(Entity<ChemPrenticeComponent> ent, ref T

private void UpdateUiState(Entity<ChemPrenticeComponent> ent, bool updateLabel = false)
{
var (owner, ChemPrentice) = ent;
var (owner, chemPrentice) = ent;
if (!_solutionContainerSystem.TryGetSolution(owner, SharedChemMaster.BufferSolutionName, out _, out var bufferSolution))
{
return;
}
var inputContainer = _itemSlotsSystem.GetItemOrNull(owner, SharedChemMaster.InputSlotName);
var outputContainer = _itemSlotsSystem.GetItemOrNull(owner, SharedChemMaster.OutputSlotName);
_appearanceSystem.SetData(owner, ChemMasterVisualState.BeakerInserted, inputContainer.HasValue);

var bufferReagents = bufferSolution.Contents;
var bufferCurrentVolume = bufferSolution.Volume;
var bufferMaxVolume = bufferSolution.MaxVolume;

var state = new ChemPrenticeBoundUserInterfaceState(
ChemPrentice.Mode, BuildInputContainerInfo(inputContainer),
chemPrentice.Mode, BuildInputContainerInfo(inputContainer),
bufferReagents, bufferCurrentVolume, bufferMaxVolume);

_userInterfaceSystem.SetUiState(owner, ChemPrenticeUiKey.Key, state);
Expand Down
6 changes: 6 additions & 0 deletions Content.Shared/Chemistry/SharedChemMaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ public enum ChemMasterMode
Discard,
}

[Serializable, NetSerializable]
public enum ChemMasterVisualState : byte //Frontier
{
BeakerInserted
}

public enum ChemMasterReagentAmount
{
U1 = 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
snapCardinals: true
layers:
- state: mixer_empty
map: ["BeakerInserted"] #Frontier
- state: mixer_screens
shader: unshaded
map: ["enum.PowerDeviceVisualLayers.Powered"]
Expand Down Expand Up @@ -61,6 +62,10 @@
enum.PowerDeviceVisualLayers.Powered:
True: { visible: true }
False: { visible: false }
enum.ChemMasterVisualState.BeakerInserted: #Frontier
BeakerInserted: #Frontier
True: {state: "mixer_loaded"} #Frontier
False: {state: "mixer_empty"} #Frontier
# Machine / Construction stuff
- type: WiresPanel
- type: Machine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@
mode: SnapgridCenter
components:
- type: Sprite
sprite: Structures/Machines/mixer.rsi
sprite: _NF/Structures/Machines/chemprentice.rsi
drawdepth: SmallObjects
snapCardinals: true
layers:
- state: mixer_empty
- state: mixer_screens
shader: unshaded
- state: prentice_empty
map: ["BeakerInserted"]
- state: prentice_unlit
map: ["enum.PowerDeviceVisualLayers.Powered"]
- type: Icon
sprite: Structures/Machines/mixer.rsi
state: mixer_loaded
sprite: _NF/Structures/Machines/chemprentice.rsi
state: prentice_full
- type: ChemPrentice
- type: Physics
bodyType: Static
Expand Down Expand Up @@ -59,6 +60,10 @@
enum.PowerDeviceVisualLayers.Powered:
True: { visible: true }
False: { visible: false }
enum.ChemMasterVisualState.BeakerInserted:
BeakerInserted:
True: {state: "prentice_full"}
False: {state: "prentice_empty"}
# Machine / Construction stuff
- type: WiresPanel
- type: Machine
Expand All @@ -76,7 +81,7 @@
- FitsInDispenser
- type: SolutionContainerManager
solutions:
buffer: {maxVol: 500}
buffer: {maxVol: 500, canReact: false}
- type: DumpableSolution
solution: buffer
unlimited: false
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"version": 1,
"size": {
"x": 32,
"y": 32
},
"license": "CC_BY_4.0 excluding use in connection to erotic or pornographic material",
"copyright": "https://github.com/Temoffy, Discord: @telos2387",
"states": [
{
"name": "prentice_empty"
},
{
"name": "prentice_full"
},
{
"name": "prentice_unlit",
"delays": [
[
0.8,
0.8,
0.8,
0.8,
0.8,
0.8,
0.8,
0.8,
0.8
]
]
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e91f7cb

Please sign in to comment.