- Type: Mod
- Name: Wagon Capacity Color
- Description: Change the color of the wagon, whether it's empty or partially filled.
- Tested-With-Factorio-Version: 0.13.0
- Multiplayer compatible: tested on a headless server...
- Locale: none
- Tags: wagon, color.
- License: You are free to use and distribute this mod and also to modify it for personal use, but not to release a modified version without permission (unless visibly not maintained anymore).
- Portal download : https://mods.factorio.com/mods/binbinhf ... acityColor
[MOD 0.13] Wagon Capacity Color
[MOD 0.13] Wagon Capacity Color
Infos
NOTES
My mods on the Factorio Mod Portal 

Re: [MOD 0.13] Wagon Capacity Color
I love the idea of this mod but, I can't help but be bothered by the color arrangement. lol
Red is typically a Warning color, and green is typically a "all is well" color.
IMHO, the color scheme of this mod is reversed.
Can this be changed in the Lua file?
Red is typically a Warning color, and green is typically a "all is well" color.
IMHO, the color scheme of this mod is reversed.
Can this be changed in the Lua file?
Re: [MOD 0.13] Wagon Capacity Color
Code: Select all
Red is typically a Warning color, and green is typically a "all is well" color.
- Red is for : warning this wagon must be emptied as fast as possible
- Green is for : everything is OK with this wagon that is ready to be filled.

So, you see that it depends on where you see the problem.

Code: Select all
Can this be changed in the Lua file?

Or even if you are daltonian.
My mods on the Factorio Mod Portal 

Re: [MOD 0.13] Wagon Capacity Color
Well now I need to wipe up the coffee I spilled on the floor after I read this....binbinhfr wrote:Yes, you are perfectly right :
- Red is for : warning this wagon must be emptied as fast as possible
- Green is for : everything is OK with this wagon that is ready to be filled.
Re: [MOD 0.13] Wagon Capacity Color
As my wife says, everything depends on what side of your brain you are using the most.
Presuming that both parts are not empty.
Eeasy to detect: these are colored in green !
Presuming that both parts are not empty.
Eeasy to detect: these are colored in green !

My mods on the Factorio Mod Portal 

Re: [MOD 0.13] Wagon Capacity Color
Thanks Binbinhfr! *I realize that not all people use their brain correctly(as I do).binbinhfr wrote:Yes, you are perfectly right :Code: Select all
Red is typically a Warning color, and green is typically a "all is well" color.
- Red is for : warning this wagon must be emptied as fast as possible
- Green is for : everything is OK with this wagon that is ready to be filled.![]()
So, you see that it depends on where you see the problem.
But you can edit the config.lua file for thisCode: Select all
Can this be changed in the Lua file?
Or even if you are daltonian.


Re: [MOD 0.13] Wagon Capacity Color
Otterbear wrote:Thanks Binbinhfr! *I realize that not all people use their brain correctly(as I do).(I just wanted to know if I could FIX this error in the Lua file.)

My mods on the Factorio Mod Portal 

Re: [MOD 0.13] Wagon Capacity Color
I saw that. I just had to respond to your humorous remarks.
* You made me laugh, I just wanted to return the favor.

Re: [MOD 0.13] Wagon Capacity Color
Yes, afterall even if it's a serious game, we're here for having funOtterbear wrote:I saw that. I just had to respond to your humorous remarks.* You made me laugh, I just wanted to return the favor.

My mods on the Factorio Mod Portal 

Re: [MOD 0.13] Wagon Capacity Color
Love the mod but it doesn't scale that well on / isn't optimized for larger games. In my save this mod takes about 1.3ms, nearly 10% of total time available when targeting 60fps. In comparison, Bottleneck does kind of the same function for production facilities of which i have at least 25 times as many, but only takes around 0.4ms.
The easiest optimization might be to only update a limited number of wagons per tick, though i wonder if we can find more creative approaches. Like not updating trains that are moving or outside of stations, but a player might still interact with them. I also don't like the idea of that inner loop potentially doing the same check 40 times for a full wagon containing a single item type. Have you considered iterating over inventory.get_contents() instead of inventory slots? The following seems to cuts my time down to less than 0.1ms.
The easiest optimization might be to only update a limited number of wagons per tick, though i wonder if we can find more creative approaches. Like not updating trains that are moving or outside of stations, but a player might still interact with them. I also don't like the idea of that inner loop potentially doing the same check 40 times for a full wagon containing a single item type. Have you considered iterating over inventory.get_contents() instead of inventory slots? The following seems to cuts my time down to less than 0.1ms.
Code: Select all
local function update_wagon_color(wagon)
local invent = wagon.get_inventory(1)
if invent then
if invent.is_empty() then
wagon.color = color_empty
else
for key, cnt in pairs(invent.get_contents()) do
if invent.can_insert(key) then
wagon.color = color_partial
return
end
end
wagon.color = color_full
end
else
wagon.color = {}
end
end
Re: [MOD 0.13] Wagon Capacity Color
Can it recolor locomotive for resources inside wagons? Iron is blue, copper is red, stone is gray, uranium is green, empty - do nothing.
Re: [MOD 0.13] Wagon Capacity Color
Hi. I integrated your optimized code.Faark wrote:Love the mod but it doesn't scale that well on / isn't optimized for larger games.
Well I use wagon for a lot of other items, not only for resources... And a train can contain diffents wagons with different items type per wagon. So it would be a big check routine to determinate a unique locomotive color. I won't do it.darkfrei wrote:Can it recolor locomotive for resources inside wagons? Iron is blue, copper is red, stone is gray, uranium is green, empty - do nothing.
My mods on the Factorio Mod Portal 

Re: [MOD 0.13] Wagon Capacity Color
Just press alt instead ! You'll see the resources' icons over the wagonsdarkfrei wrote:Can it recolor locomotive for resources inside wagons? Iron is blue, copper is red, stone is gray, uranium is green, empty - do nothing.

Re: [MOD 0.13] Wagon Capacity Color
Hi,
i wonder why after such a long time of 0.17 being out no one asked for an update for this great mod.
So, would it possible to update it to 0.17 ?
i wonder why after such a long time of 0.17 being out no one asked for an update for this great mod.
So, would it possible to update it to 0.17 ?
Re: [MOD 0.13] Wagon Capacity Color
If you want to update it just unzip it (it'll create a subfolder on its own thats already in the zip) then change the line:
"factorio_version": "0.16",
into
"factorio_version": "1.1",
...save the file, leave the folder there & delete the original zip. This works on most mods - including minecraft mods.
"factorio_version": "0.16",
into
"factorio_version": "1.1",
...save the file, leave the folder there & delete the original zip. This works on most mods - including minecraft mods.