K1 Advanced fluid


Fluid storage Krastorio Legacy. Liquid storage like FS-50 and FS-200 whitch have 50k and 200k capacity.

Content
3 years ago
1.1
9.77K
Storage

g Customisable tank sizes?

3 years ago
(updated 3 years ago)

Question - can you make tank sizes customisable? I'm used to working with 450K size tanks, so the larger one is a bit small for me. I can obviously change it by modding the mod file, but you have the size baked directly into the localisation files. I'd recommend going with "Large" and "Small" for the text description and pulling the sizes for both tanks as a mod option. It's what I ended up doing locally for my own use.

3 years ago

Question - can you make tank sizes customisable? I'm used to working with 450K size tanks, so the larger one is a bit small for me. I can obviously change it by modding the mod file, but you have the size baked directly into the localisation files. I'd recommend going with "Large" and "Small" for the text description and pulling the sizes for both tanks as a mod option. It's what I ended up doing locally for my own use.

Use the "Fluid Memory Storage". I can change the capacity for this mod. Heh, i'm not a moder, it just a port.

3 years ago

I actually already did :) Put in options menu options for the sizes of both tanks. I'm not a mod maker either, not really, but this seemed simple enough. It's 5 AM right now, but I can post my changes tomorrow when I have a chance to look through the code.

3 years ago

I actually already did :) Put in options menu options for the sizes of both tanks. I'm not a mod maker either, not really, but this seemed simple enough. It's 5 AM right now, but I can post my changes tomorrow when I have a chance to look through the code.

No problem.

3 years ago
(updated 3 years ago)

OK, for anyone looking to do what I did (or if you fancy implementing it):

Firstly, I created a settings.lua file in the root folder (where data.lua and info.json are). In that file, I included the following:

data:extend
({
{
type = "int-setting",
name = "small_tank_size",
order = "a",
setting_type = "startup",
default_value = 500,
minimum_value = 250,
maximum_value = 10000
},
{
type = "int-setting",
name = "large_tank_size",
order = "b",
setting_type = "startup",
default_value = 2000,
minimum_value = 250,
maximum_value = 10000
}
})

That creates 2 variables. To actually use them, I edited prototypes/entities.lua . That file defines both fluid tanks as fs-50 and fs-200. We need to change the volume of those. They're both a height of 1, so their volume is equal to their base area * 100. The base area for fs-50 is on line 22 for me, which I changed to base_area = settings.startup["small_tank_size"].value, . The base area for fs-200 is on line 141, which I changed to base_area = settings.startup["large_tank_size"].value, .

Finally, we want to make this look pretty, so we need localisation strings. I don't speak Russian so I only added English localisation, but the process is identical for Russian as well. I edited locale/en/locale.cfg . I added the following entries at the end of the file, giving the menu options a localised name and a localised mouse-over tooltip:

[mod-setting-name]
small_tank_size=Small tank capacity
large_tank_size=Large tank capacoty

[mod-setting-description]
small_tank_size=The amount of fluid the small tank can hold. Actual value is multipled by 100. Default is 500.
large_tank_size=The amount of fluid the large tank can hold. Actual value is multipled by 100. Default is 2000.

That's your lot. The first file creates the options, the last file creates human-readable text for the options and the tweak to the middle file changes the tanks from using a fixed size to using whatever size the player enters through mod options. I did spend some time reading up on mod structure, but most of this is cribbed from other mods with options. I really hate Lua as a programming language so this seemed like the easiest approach :)

edit
The text editor on this site eats code tabulation and I don't know how to post a code block. Sorry about that.

3 years ago
(updated 3 years ago)

OK, for anyone looking to do what I did (or if you fancy implementing it):

Firstly, I created a settings.lua file in the root folder (where data.lua and info.json are). In that file, I included the following:

data:extend
({
{
type = "int-setting",
name = "small_tank_size",
order = "a",
setting_type = "startup",
default_value = 500,
minimum_value = 250,
maximum_value = 10000
},
{
type = "int-setting",
name = "large_tank_size",
order = "b",
setting_type = "startup",
default_value = 2000,
minimum_value = 250,
maximum_value = 10000
}
})

That creates 2 variables. To actually use them, I edited prototypes/entities.lua . That file defines both fluid tanks as fs-50 and fs-200. We need to change the volume of those. They're both a height of 1, so their volume is equal to their base area * 100. The base area for fs-50 is on line 22 for me, which I changed to base_area = settings.startup["small_tank_size"].value, . The base area for fs-200 is on line 141, which I changed to base_area = settings.startup["large_tank_size"].value, .

Finally, we want to make this look pretty, so we need localisation strings. I don't speak Russian so I only added English localisation, but the process is identical for Russian as well. I edited locale/en/locale.cfg . I added the following entries at the end of the file, giving the menu options a localised name and a localised mouse-over tooltip:

[mod-setting-name]
small_tank_size=Small tank capacity
large_tank_size=Large tank capacoty

[mod-setting-description]
small_tank_size=The amount of fluid the small tank can hold. Actual value is multipled by 100. Default is 500.
large_tank_size=The amount of fluid the large tank can hold. Actual value is multipled by 100. Default is 2000.

That's your lot. The first file creates the options, the last file creates human-readable text for the options and the tweak to the middle file changes the tanks from using a fixed size to using whatever size the player enters through mod options. I did spend some time reading up on mod structure, but most of this is cribbed from other mods with options. I really hate Lua as a programming language so this seemed like the easiest approach :)

edit
The text editor on this site eats code tabulation and I don't know how to post a code block. Sorry about that.

Done, bro:) 10 minets to edit and check in game. My fastest mod change.

3 years ago

Hah! Glad I could help, then :) I like mods that let me tweak their parameters within reason, so always happy to pitch in with that.

New response