Skip to content

Commit 18ac6c9

Browse files
committed
Added litersPerSecondText for setting custom text in GUI
1 parent 89ac07b commit 18ac6c9

4 files changed

Lines changed: 12 additions & 1 deletion

File tree

docs/PROCESSOR_BLEND.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ vehicle.materialProcessor.configurations.configuration(%)
7070
| Name | Type | Required | Default | Description |
7171
|-----------------|--------|----------|-----------|------------------------------|
7272
| litersPerSecond | int | Yes | ```400``` | Amount of liters per second produced |
73+
| litersPerSecondText|string|No | | Set custom liters per second text in GUI |
7374
| name | string | No | | Display name in GUI |
7475

7576

docs/PROCESSOR_SPLIT.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ vehicle.materialProcessor.configurations.configuration(%)
8383
| Name | Type | Required | Default | Description |
8484
|-----------------|--------|----------|-----------|------------------------------|
8585
| litersPerSecond | int | Yes | ```400``` | Amount of liters per second processed by input |
86+
| litersPerSecondText|string|No | | Set custom liters per second text in GUI |
8687
| name | string | No | | Display name in GUI |
8788

8889

scripts/Configuration.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
---@field index number
44
---
55
---@field displayName string
6+
---@field litersPerSecondText? string
67
---@field litersPerSecond number
78
---@field litersPerMs number
89
---@field fillUnitToConfigurationUnit table<number, ConfigurationUnit>
@@ -13,6 +14,7 @@ Configuration = {}
1314
function Configuration.registerXMLPaths(schema, key)
1415
schema:register(XMLValueType.L10N_STRING, key .. '#name', 'Name to display in GUI')
1516
schema:register(XMLValueType.INT, key .. '#litersPerSecond', 'Liters processed per second', 400, true)
17+
schema:register(XMLValueType.L10N_STRING, key .. '#litersPerSecondText', 'Set custom text in GUI')
1618

1719
BlendConfiguration.registerXMLPaths(schema, key)
1820
SplitConfiguration.registerXMLPaths(schema, key)
@@ -57,6 +59,8 @@ function Configuration:load(xmlFile, key)
5759
self.litersPerSecond = litersPerSecond
5860
self.litersPerMs = self.litersPerSecond / 1000
5961
end
62+
63+
self.litersPerSecondText = xmlFile:getValue(key .. '#litersPerSecondText', nil, self.processor.vehicle.customEnvironment)
6064
end
6165

6266
function Configuration:activate()

scripts/gui/ProcessorDialog.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,12 @@ function ProcessorDialog:populateCellForItemInSection(list, section, index, cell
124124
cell:getAttribute('title'):setText(configuration.displayName)
125125
cell:getAttribute('image'):setImageFilename(unit.fillType.hudOverlayFilename)
126126
cell:getAttribute('text'):setText(unit.fillType.title)
127-
cell:getAttribute('info'):setText(string.format('%i l/s', configuration.litersPerSecond))
127+
128+
if configuration.litersPerSecondText ~= nil then
129+
cell:getAttribute('info'):setText(configuration.litersPerSecondText)
130+
else
131+
cell:getAttribute('info'):setText(string.format('%i l/s', configuration.litersPerSecond))
132+
end
128133
end
129134
else
130135
local unit = self.units[index]

0 commit comments

Comments
 (0)