Page 1 of 1
LuaEntity.color can also get/set the color of locomotive
Posted: Tue Aug 09, 2016 8:15 pm
by Mooncat
I wish LuaEntity.color can also link to the color of locomotive.
A player suggested to implement my
Color Picker for changing locomotive color. But when I attempted to get the opened locomotive's color, it returns nil. So I don't know how to get and set the color now.
PS: according to the document, "The character or
rolling stock color", so I think it is also supposed to link to the colors of car and tank? But now it is also nil when I get their colors. character.color works however.

Re: LuaEntity.color can also get/set the color of locomotive
Posted: Tue Aug 09, 2016 10:40 pm
by Rseding91
The color property for LuaEntity returns nil if the locomotive/train doesn't have a custom color set.
If it has one set it returns the color value that it's set too.
Re: LuaEntity.color can also get/set the color of locomotive
Posted: Wed Aug 10, 2016 2:32 am
by Mooncat
I see... what if it provides the default (prototype) color instead of nil in that case? If it is nil, I will have to assume that the locomotive has default color of Red. Unfortunately,
FARL provides a locomotive with default color of Yellow. So the assumption will be wrong. And it seems there is no color property in LuaEntityPrototype.
If it is implemented, is it also possible to make that changing LuaEntity.color will also update the GUI?

I have checked that it doesn't update the GUI now.
Re: LuaEntity.color can also get/set the color of locomotive
Posted: Wed Aug 10, 2016 2:39 am
by aubergine18
Mooncat wrote:If it is implemented, is it also possible to make that changing LuaEntity.color will also update the GUI?

I have checked that it doesn't update the GUI now.
IMO the GUI colour should not be based on player colour (and if it was, maybe only the toolbar above the minimap).
Re: LuaEntity.color can also get/set the color of locomotive
Posted: Wed Aug 10, 2016 2:48 am
by Mooncat
aubergine18 wrote:Mooncat wrote:If it is implemented, is it also possible to make that changing LuaEntity.color will also update the GUI?

I have checked that it doesn't update the GUI now.
IMO the GUI colour should not be based on player colour (and if it was, maybe only the toolbar above the minimap).
It isn't related to player color. I meant the GUI for changing locomotive's color. The one that has 3 scrollbars, with an image of the locomotive at the left side.