[MOD 0.13] Wagon Capacity Color

Topics and discussion about specific mods
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1524
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

[MOD 0.13] Wagon Capacity Color

Post 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 8865 times
NOTES
My mods on the Factorio Mod Portal :geek:
User avatar
Otterbear
Inserter
Inserter
Posts: 48
Joined: Thu May 26, 2016 5:32 am
Contact:

Re: [MOD 0.13] Wagon Capacity Color

Post 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?
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1524
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: [MOD 0.13] Wagon Capacity Color

Post 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.
My mods on the Factorio Mod Portal :geek:
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [MOD 0.13] Wagon Capacity Color

Post 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....
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1524
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: [MOD 0.13] Wagon Capacity Color

Post 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:
My mods on the Factorio Mod Portal :geek:
User avatar
Otterbear
Inserter
Inserter
Posts: 48
Joined: Thu May 26, 2016 5:32 am
Contact:

Re: [MOD 0.13] Wagon Capacity Color

Post 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:
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1524
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: [MOD 0.13] Wagon Capacity Color

Post 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 !
My mods on the Factorio Mod Portal :geek:
User avatar
Otterbear
Inserter
Inserter
Posts: 48
Joined: Thu May 26, 2016 5:32 am
Contact:

Re: [MOD 0.13] Wagon Capacity Color

Post 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.
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1524
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: [MOD 0.13] Wagon Capacity Color

Post 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 ;-)
My mods on the Factorio Mod Portal :geek:
Faark
Burner Inserter
Burner Inserter
Posts: 19
Joined: Tue Apr 25, 2017 8:33 pm
Contact:

Re: [MOD 0.13] Wagon Capacity Color

Post 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
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: [MOD 0.13] Wagon Capacity Color

Post 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.
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1524
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: [MOD 0.13] Wagon Capacity Color

Post 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.
My mods on the Factorio Mod Portal :geek:
tazdu29
Inserter
Inserter
Posts: 24
Joined: Sat Sep 30, 2017 3:19 pm
Contact:

Re: [MOD 0.13] Wagon Capacity Color

Post 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 ;)
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1524
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: [MOD 0.13] Wagon Capacity Color

Post by binbinhfr »

updated 0.16
My mods on the Factorio Mod Portal :geek:
DukeAl
Inserter
Inserter
Posts: 49
Joined: Mon Feb 09, 2015 3:55 pm
Contact:

Re: [MOD 0.13] Wagon Capacity Color

Post 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 ?
markzl
Burner Inserter
Burner Inserter
Posts: 8
Joined: Wed Sep 19, 2018 9:04 am
Contact:

Re: [MOD 0.13] Wagon Capacity Color

Post 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.
Post Reply

Return to “Mods”