Page 1 of 1

[MOD 0.13] Wagon Capacity Color

Posted: Thu Jun 30, 2016 9:36 pm
by binbinhfr
Infos
  • 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
screen1.jpg
screen1.jpg (92.22 KiB) Viewed 8860 times
NOTES

Re: [MOD 0.13] Wagon Capacity Color

Posted: Mon Aug 08, 2016 12:41 am
by Otterbear
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?

Re: [MOD 0.13] Wagon Capacity Color

Posted: Mon Aug 08, 2016 6:02 am
by binbinhfr

Code: Select all

Red is typically a Warning color, and green is typically a "all is well" color.
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. :D

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

Code: Select all

Can this be changed in the Lua file?
But you can edit the config.lua file for this :-)
Or even if you are daltonian.

Re: [MOD 0.13] Wagon Capacity Color

Posted: Mon Aug 08, 2016 6:40 am
by Nexela
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. :D
Well now I need to wipe up the coffee I spilled on the floor after I read this....

Re: [MOD 0.13] Wagon Capacity Color

Posted: Mon Aug 08, 2016 6:53 am
by binbinhfr
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 ! :lol:

Re: [MOD 0.13] Wagon Capacity Color

Posted: Thu Aug 11, 2016 5:53 am
by Otterbear
binbinhfr wrote:

Code: Select all

Red is typically a Warning color, and green is typically a "all is well" color.
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. :D

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

Code: Select all

Can this be changed in the Lua file?
But you can edit the config.lua file for this :-)
Or even if you are daltonian.
Thanks Binbinhfr! *I realize that not all people use their brain correctly(as I do). :D (I just wanted to know if I could FIX this error in the Lua file.) :mrgreen:

Re: [MOD 0.13] Wagon Capacity Color

Posted: Thu Aug 11, 2016 7:53 am
by binbinhfr
Otterbear wrote:Thanks Binbinhfr! *I realize that not all people use their brain correctly(as I do). :D (I just wanted to know if I could FIX this error in the Lua file.) :mrgreen:
:-D Yes, as I told you, you can edit the config.lua and inverse colors, or even choose other colors if you want something more funky. You have the right to be different !

Re: [MOD 0.13] Wagon Capacity Color

Posted: Sun Aug 14, 2016 2:34 am
by Otterbear
I saw that. I just had to respond to your humorous remarks. :D * You made me laugh, I just wanted to return the favor.

Re: [MOD 0.13] Wagon Capacity Color

Posted: Sun Aug 14, 2016 8:19 am
by binbinhfr
Otterbear wrote:I saw that. I just had to respond to your humorous remarks. :D * You made me laugh, I just wanted to return the favor.
Yes, afterall even if it's a serious game, we're here for having fun ;-)

Re: [MOD 0.13] Wagon Capacity Color

Posted: Fri Jul 28, 2017 5:40 pm
by Faark
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.

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

Posted: Fri Jul 28, 2017 7:02 pm
by darkfrei
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

Posted: Sat Jul 29, 2017 10:07 am
by binbinhfr
Faark wrote:Love the mod but it doesn't scale that well on / isn't optimized for larger games.
Hi. I integrated your optimized code.
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.
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.

Re: [MOD 0.13] Wagon Capacity Color

Posted: Sun Oct 01, 2017 11:03 am
by tazdu29
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.
Just press alt instead ! You'll see the resources' icons over the wagons ;)

Re: [MOD 0.13] Wagon Capacity Color

Posted: Thu Dec 21, 2017 9:17 am
by binbinhfr
updated 0.16

Re: [MOD 0.13] Wagon Capacity Color

Posted: Fri Apr 19, 2019 6:43 pm
by DukeAl
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 ?

Re: [MOD 0.13] Wagon Capacity Color

Posted: Wed Jan 27, 2021 10:23 am
by markzl
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.