Frontier Port: Pretty Money (#2398)
* Frontier Port: Pretty Money * Update Resources/Prototypes/Entities/Objects/Misc/space_cash.yml Co-authored-by: Whatstone <166147148+whatston3@users.noreply.github.com> Signed-off-by: Unkn0wn_Gh0st <shadowstalkermll@gmail.com> * Updated 100k texture --------- Signed-off-by: Unkn0wn_Gh0st <shadowstalkermll@gmail.com> Co-authored-by: Whatstone <166147148+whatston3@users.noreply.github.com> (cherry picked from commit da772611f8b2b02f21f801ccf255220602e850e5)
@@ -8,7 +8,7 @@ using Robust.Client.GameObjects;
|
||||
namespace Content.Client.Stack
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class StackSystem : SharedStackSystem
|
||||
public sealed partial class StackSystem : SharedStackSystem // Frontier: add partial to class definition
|
||||
{
|
||||
[Dependency] private readonly AppearanceSystem _appearanceSystem = default!;
|
||||
[Dependency] private readonly ItemCounterSystem _counterSystem = default!;
|
||||
@@ -56,20 +56,25 @@ namespace Content.Client.Stack
|
||||
if (args.Sprite == null || comp.LayerStates.Count < 1)
|
||||
return;
|
||||
|
||||
StackLayerData data = new StackLayerData(); // Frontier: use structure to store StackLayerData
|
||||
|
||||
// Skip processing if no actual
|
||||
if (!_appearanceSystem.TryGetData<int>(uid, StackVisuals.Actual, out var actual, args.Component))
|
||||
if (!_appearanceSystem.TryGetData<int>(uid, StackVisuals.Actual, out data.Actual, args.Component))
|
||||
return;
|
||||
|
||||
if (!_appearanceSystem.TryGetData<int>(uid, StackVisuals.MaxCount, out var maxCount, args.Component))
|
||||
maxCount = comp.LayerStates.Count;
|
||||
if (!_appearanceSystem.TryGetData<int>(uid, StackVisuals.MaxCount, out data.MaxCount, args.Component))
|
||||
data.MaxCount = comp.LayerStates.Count;
|
||||
|
||||
if (!_appearanceSystem.TryGetData<bool>(uid, StackVisuals.Hide, out var hidden, args.Component))
|
||||
hidden = false;
|
||||
if (!_appearanceSystem.TryGetData<bool>(uid, StackVisuals.Hide, out data.Hidden, args.Component))
|
||||
data.Hidden = false;
|
||||
|
||||
if (comp.LayerFunction != StackLayerFunction.None) // Frontier: use stack layer function to modify appearance if provided.
|
||||
ApplyLayerFunction(uid, comp, ref data); // Frontier: definition in _NF/Stack/StackSystem.Layers.cs
|
||||
|
||||
if (comp.IsComposite)
|
||||
_counterSystem.ProcessCompositeSprite(uid, actual, maxCount, comp.LayerStates, hidden, sprite: args.Sprite);
|
||||
_counterSystem.ProcessCompositeSprite(uid, data.Actual, data.MaxCount, comp.LayerStates, data.Hidden, sprite: args.Sprite);
|
||||
else
|
||||
_counterSystem.ProcessOpaqueSprite(uid, comp.BaseLayer, actual, maxCount, comp.LayerStates, hidden, sprite: args.Sprite);
|
||||
_counterSystem.ProcessOpaqueSprite(uid, comp.BaseLayer, data.Actual, data.MaxCount, comp.LayerStates, data.Hidden, sprite: args.Sprite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
56
Content.Client/_NF/Stack/StackSystem.Layers.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using Content.Shared.Stacks.Components;
|
||||
using Content.Shared.Stacks;
|
||||
|
||||
namespace Content.Client.Stack
|
||||
{
|
||||
/// <summary>
|
||||
/// Data used to determine which layers of a stack's sprite are visible.
|
||||
/// </summary>
|
||||
public struct StackLayerData
|
||||
{
|
||||
public int Actual;
|
||||
public int MaxCount;
|
||||
public bool Hidden;
|
||||
}
|
||||
|
||||
public sealed partial class StackSystem : SharedStackSystem
|
||||
{
|
||||
// Modifies a given stack component to adjust the layers to display.
|
||||
private bool ApplyLayerFunction(EntityUid uid, StackComponent comp, ref StackLayerData data)
|
||||
{
|
||||
switch (comp.LayerFunction)
|
||||
{
|
||||
case StackLayerFunction.Threshold:
|
||||
if (TryComp<StackLayerThresholdComponent>(uid, out var threshold))
|
||||
{
|
||||
ApplyThreshold(threshold, ref data);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// No function applied.
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets Actual to the number of thresholds that Actual exceeds from the beginning of the list.
|
||||
/// Sets MaxCount to the total number of thresholds plus one (for values under thresholds).
|
||||
/// </summary>
|
||||
private static void ApplyThreshold(StackLayerThresholdComponent comp, ref StackLayerData data)
|
||||
{
|
||||
// We must stop before we run out of thresholds or layers, whichever's smaller.
|
||||
data.MaxCount = Math.Min(comp.Thresholds.Count + 1, data.MaxCount);
|
||||
int newActual = 0;
|
||||
foreach (var threshold in comp.Thresholds)
|
||||
{
|
||||
//If our value exceeds threshold, the next layer should be displayed.
|
||||
//Note: we must ensure actual <= MaxCount.
|
||||
if (data.Actual >= threshold && newActual < data.MaxCount)
|
||||
newActual++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
data.Actual = newActual;
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Content.Packaging/Properties/launchSettings.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"profiles": {
|
||||
"WSL": {
|
||||
"commandName": "WSL2",
|
||||
"distributionName": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ namespace Content.Shared.Stacks
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
[DataField("maxCountOverride")]
|
||||
public int? MaxCountOverride { get; set; }
|
||||
public int? MaxCountOverride { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set to true to not reduce the count when used.
|
||||
@@ -78,6 +78,14 @@ namespace Content.Shared.Stacks
|
||||
[DataField("layerStates")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public List<string> LayerStates = new();
|
||||
|
||||
// Frontier: transforming Amount, MaxCount in speso stacks
|
||||
/// <summary>
|
||||
/// An optional function to adjust the layers used for a stack's appearance.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public StackLayerFunction LayerFunction = StackLayerFunction.None;
|
||||
// End Frontier
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Content.Shared.Stacks.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class StackLayerThresholdComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// A list of thresholds to check against the number of things in the stack.
|
||||
/// Each exceeded threshold will cause the next layer to be displayed.
|
||||
/// Should be sorted in ascending order.
|
||||
/// </summary>
|
||||
[DataField(required: true)]
|
||||
public List<int> Thresholds = new List<int>();
|
||||
}
|
||||
7
Content.Shared/_NF/Stacks/StackLayerFunction.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Content.Shared.Stacks;
|
||||
|
||||
public enum StackLayerFunction
|
||||
{
|
||||
None,
|
||||
Threshold
|
||||
}
|
||||
@@ -25,9 +25,17 @@
|
||||
- cash_100
|
||||
- cash_500
|
||||
- cash_1000
|
||||
- cash_1000000
|
||||
- cash_5000 # Frontier: larger denominations
|
||||
- cash_10000 # Frontier: larger denominations
|
||||
- cash_25000 # Frontier: larger denominations
|
||||
- cash_50000 # Frontier: larger denominations
|
||||
- cash_100000 # Frontier: larger denominations
|
||||
- cash_250000 # Frontier: larger denominations (cash_1000000<cash_250000)
|
||||
layerFunction: Threshold # Frontier: multicolour cash
|
||||
- type: StackLayerThreshold # Frontier
|
||||
thresholds: [10, 100, 500, 1000, 5000, 10000, 25000, 50000, 100000, 250000] # Frontier
|
||||
- type: Sprite
|
||||
sprite: Objects/Economy/cash.rsi
|
||||
sprite: _NF/Objects/Economy/cash.rsi # Frontier: larger denominations
|
||||
state: cash
|
||||
layers:
|
||||
- state: cash
|
||||
@@ -44,19 +52,20 @@
|
||||
mask:
|
||||
- ItemMask
|
||||
- type: Appearance
|
||||
- type: CargoSellBlacklist
|
||||
|
||||
- type: material
|
||||
id: Credit
|
||||
name: speso
|
||||
unit: materials-unit-bill
|
||||
stackEntity: SpaceCash
|
||||
icon: { sprite: /Textures/Objects/Economy/cash.rsi, state: cash }
|
||||
icon: { sprite: _NF/Objects/Economy/cash.rsi, state: cash } # Frontier: use Frontier sprite set
|
||||
price: 1
|
||||
|
||||
- type: stack
|
||||
id: Credit
|
||||
name: speso
|
||||
icon: { sprite: /Textures/Objects/Economy/cash.rsi, state: cash }
|
||||
icon: { sprite: _NF/Objects/Economy/cash.rsi, state: cash } # Frontier: use Frontier sprite set
|
||||
spawn: SpaceCash
|
||||
|
||||
- type: entity
|
||||
@@ -65,7 +74,7 @@
|
||||
suffix: 10
|
||||
components:
|
||||
- type: Icon
|
||||
sprite: Objects/Economy/cash.rsi
|
||||
sprite: _NF/Objects/Economy/cash.rsi # Frontier: use Frontier sprite set
|
||||
state: cash_10
|
||||
- type: Stack
|
||||
count: 10
|
||||
@@ -76,7 +85,7 @@
|
||||
suffix: 100
|
||||
components:
|
||||
- type: Icon
|
||||
sprite: Objects/Economy/cash.rsi
|
||||
sprite: _NF/Objects/Economy/cash.rsi # Frontier: use Frontier sprite set
|
||||
state: cash_100
|
||||
- type: Stack
|
||||
count: 100
|
||||
@@ -87,7 +96,7 @@
|
||||
suffix: 500
|
||||
components:
|
||||
- type: Icon
|
||||
sprite: Objects/Economy/cash.rsi
|
||||
sprite: _NF/Objects/Economy/cash.rsi # Frontier: use Frontier sprite set
|
||||
state: cash_500
|
||||
- type: Stack
|
||||
count: 500
|
||||
@@ -98,7 +107,7 @@
|
||||
suffix: 1000
|
||||
components:
|
||||
- type: Icon
|
||||
sprite: Objects/Economy/cash.rsi
|
||||
sprite: _NF/Objects/Economy/cash.rsi # Frontier: use Frontier sprite set
|
||||
state: cash_1000
|
||||
- type: Stack
|
||||
count: 1000
|
||||
@@ -109,7 +118,7 @@
|
||||
suffix: 2500
|
||||
components:
|
||||
- type: Icon
|
||||
sprite: Objects/Economy/cash.rsi
|
||||
sprite: _NF/Objects/Economy/cash.rsi # Frontier: use Frontier sprite set
|
||||
state: cash_1000
|
||||
- type: Stack
|
||||
count: 2500
|
||||
@@ -120,8 +129,8 @@
|
||||
suffix: 5000
|
||||
components:
|
||||
- type: Icon
|
||||
sprite: Objects/Economy/cash.rsi
|
||||
state: cash_1000
|
||||
sprite: _NF/Objects/Economy/cash.rsi # Frontier: use Frontier sprite set
|
||||
state: cash_5000 # Frontier: cash_1000<cash_5000
|
||||
- type: Stack
|
||||
count: 5000
|
||||
|
||||
@@ -131,8 +140,8 @@
|
||||
suffix: 10000
|
||||
components:
|
||||
- type: Icon
|
||||
sprite: Objects/Economy/cash.rsi
|
||||
state: cash_1000
|
||||
sprite: _NF/Objects/Economy/cash.rsi # Frontier: use Frontier sprite set
|
||||
state: cash_10000 # Frontier: cash_1000<cash_10000
|
||||
- type: Stack
|
||||
count: 10000
|
||||
|
||||
@@ -142,8 +151,8 @@
|
||||
suffix: 20000
|
||||
components:
|
||||
- type: Icon
|
||||
sprite: Objects/Economy/cash.rsi
|
||||
state: cash_1000
|
||||
sprite: _NF/Objects/Economy/cash.rsi # Frontier: use Frontier sprite set
|
||||
state: cash_10000 # Frontier: cash_1000<cash_10000
|
||||
- type: Stack
|
||||
count: 20000
|
||||
|
||||
@@ -153,8 +162,8 @@
|
||||
suffix: 30000
|
||||
components:
|
||||
- type: Icon
|
||||
sprite: Objects/Economy/cash.rsi
|
||||
state: cash_1000
|
||||
sprite: _NF/Objects/Economy/cash.rsi # Frontier: use Frontier sprite set
|
||||
state: cash_25000 # Frontier: cash_1000<cash_25000
|
||||
- type: Stack
|
||||
count: 30000
|
||||
|
||||
@@ -164,7 +173,7 @@
|
||||
suffix: 1000000
|
||||
components:
|
||||
- type: Icon
|
||||
sprite: Objects/Economy/cash.rsi
|
||||
state: cash_1000000
|
||||
sprite: _NF/Objects/Economy/cash.rsi # Frontier: use Frontier sprite set
|
||||
state: cash_250000 # Frontier: cash_1000000<cash_250000
|
||||
- type: Stack
|
||||
count: 1000000
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
- type: entity
|
||||
parent: SpaceCash
|
||||
id: SpaceCash15000
|
||||
suffix: 15000
|
||||
components:
|
||||
- type: Icon
|
||||
sprite: _NF/Objects/Economy/cash.rsi
|
||||
state: cash_10000
|
||||
- type: Stack
|
||||
count: 15000
|
||||
|
||||
- type: entity
|
||||
parent: SpaceCash
|
||||
id: SpaceCash25000
|
||||
suffix: 25000
|
||||
components:
|
||||
- type: Icon
|
||||
sprite: _NF/Objects/Economy/cash.rsi
|
||||
state: cash_25000
|
||||
- type: Stack
|
||||
count: 25000
|
||||
BIN
Resources/Textures/_NF/Objects/Economy/cash.rsi/cash.png
Normal file
|
After Width: | Height: | Size: 286 B |
BIN
Resources/Textures/_NF/Objects/Economy/cash.rsi/cash_10.png
Normal file
|
After Width: | Height: | Size: 292 B |
BIN
Resources/Textures/_NF/Objects/Economy/cash.rsi/cash_100.png
Normal file
|
After Width: | Height: | Size: 291 B |
BIN
Resources/Textures/_NF/Objects/Economy/cash.rsi/cash_1000.png
Normal file
|
After Width: | Height: | Size: 290 B |
BIN
Resources/Textures/_NF/Objects/Economy/cash.rsi/cash_10000.png
Normal file
|
After Width: | Height: | Size: 695 B |
BIN
Resources/Textures/_NF/Objects/Economy/cash.rsi/cash_100000.png
Normal file
|
After Width: | Height: | Size: 797 B |
BIN
Resources/Textures/_NF/Objects/Economy/cash.rsi/cash_25000.png
Normal file
|
After Width: | Height: | Size: 681 B |
BIN
Resources/Textures/_NF/Objects/Economy/cash.rsi/cash_250000.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Resources/Textures/_NF/Objects/Economy/cash.rsi/cash_500.png
Normal file
|
After Width: | Height: | Size: 299 B |
BIN
Resources/Textures/_NF/Objects/Economy/cash.rsi/cash_5000.png
Normal file
|
After Width: | Height: | Size: 231 B |
BIN
Resources/Textures/_NF/Objects/Economy/cash.rsi/cash_50000.png
Normal file
|
After Width: | Height: | Size: 701 B |
136
Resources/Textures/_NF/Objects/Economy/cash.rsi/meta.json
Normal file
@@ -0,0 +1,136 @@
|
||||
{
|
||||
"version": 1,
|
||||
"size": {
|
||||
"x": 32,
|
||||
"y": 32
|
||||
},
|
||||
"license": "CC-BY-NC-SA-3.0",
|
||||
"copyright": "Modified by EmoGarbage404 and taken from https://github.com/goonstation/goonstation at commit b951a2c12d967af1295a3e6d33a861e7e1f21299. cash_5000, cash_10000, cash_25000, cash_50000, cash_100000, cash_250000 modified by Whatstone (Discord)",
|
||||
"states": [
|
||||
{
|
||||
"name": "cash"
|
||||
},
|
||||
{
|
||||
"name": "cash_10"
|
||||
},
|
||||
{
|
||||
"name": "cash_100"
|
||||
},
|
||||
{
|
||||
"name": "cash_500"
|
||||
},
|
||||
{
|
||||
"name": "cash_1000"
|
||||
},
|
||||
{
|
||||
"name": "cash_5000"
|
||||
},
|
||||
{
|
||||
"name": "cash_10000",
|
||||
"delays": [
|
||||
[
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "cash_25000",
|
||||
"delays": [
|
||||
[
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "cash_50000",
|
||||
"delays": [
|
||||
[
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "cash_100000",
|
||||
"delays": [
|
||||
[
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "cash_250000",
|
||||
"delays": [
|
||||
[
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2,
|
||||
0.2
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||