Page 1 of 1

0.12.22 change color of poles

Posted: Wed Feb 10, 2016 8:03 pm
by osldgoth
I am attempting to change the color of the electric poles on the map. I am basing this on the visibleBots mod. I have tried:

Code: Select all

for k, v in pairs(data.raw["electric-pole"]) do
	v["small-electric-pole"].map_color = {r=0, g=1, b=0}
end
and

Code: Select all

for k, v in pairs(data.raw["electric-pole"]) do
	v.map_color = {r=0, g=1, b=0}
end
other variations have also been tried. I can't get the poles to change color. is this even possible? has anyone been able to do it? any tips, hits, suggestions?

in the end I don't want all poles to be a different color, I eventually want to change only a few poles that meet specific criteria. I have to be able to change the color of the poles before I get that far...

Re: 0.12.22 change color of poles

Posted: Wed Feb 10, 2016 8:32 pm
by mophydeen
My mod changes the color for the M1-5 versions

eg.
custommep.pictures.tint=Colortint.Tier5

Re: 0.12.22 change color of poles

Posted: Wed Feb 10, 2016 9:13 pm
by keyboardhack
mophydeen wrote:My mod changes the color for the M1-5 versions

eg.
custommep.pictures.tint=Colortint.Tier5
This is about the color shown on the map/minimap.

Have tried to do it myself and it doesn't look like it's possible.

Re: 0.12.22 change color of poles

Posted: Thu Feb 11, 2016 7:20 pm
by Rseding91
map_color, friendly_map_color, and enemy_map_color on the entity prototype will do what you're after. Keep in mind you'll need to trigger a re-chart of the chunk(s) in order to see the changes.

Re: 0.12.22 change color of poles

Posted: Sun Feb 14, 2016 3:35 pm
by osldgoth
well I have tried all versions of 'my code' to select the power poles and set the color after which I've run rechart in game several times, the power poles just don't change color. is there anything else I should know about?

Re: 0.12.22 change color of poles

Posted: Mon Feb 15, 2016 7:12 am
by Rseding91

Code: Select all

data.raw["electric-pole"]["small-electric-pole"].friendly_map_color = {r = 1, g = 1, b = 1, a = 1}
Works perfectly for me. Throw it in a mod, start up a game and build some small electric poles. They'll show white on the map.

Re: 0.12.22 change color of poles

Posted: Mon Feb 15, 2016 10:12 am
by keyboardhack
Rseding91 wrote:

Code: Select all

data.raw["electric-pole"]["small-electric-pole"].friendly_map_color = {r = 1, g = 1, b = 1, a = 1}
Works perfectly for me. Throw it in a mod, start up a game and build some small electric poles. They'll show white on the map.
Just want to make sure why this works. It works because a small-electric-pole is placed in the neutral force because it has this flag "placeable-neutral" and to get "map_color" to work the flag have to be changed to "placeable-player"? If that's how it works then is it possible to make your own "placeable-force" flags?

Re: 0.12.22 change color of poles

Posted: Mon Feb 15, 2016 3:05 pm
by Rseding91
keyboardhack wrote:
Rseding91 wrote:

Code: Select all

data.raw["electric-pole"]["small-electric-pole"].friendly_map_color = {r = 1, g = 1, b = 1, a = 1}
Works perfectly for me. Throw it in a mod, start up a game and build some small electric poles. They'll show white on the map.
Just want to make sure why this works. It works because a small-electric-pole is placed in the neutral force because it has this flag "placeable-neutral" and to get "map_color" to work the flag have to be changed to "placeable-player"? If that's how it works then is it possible to make your own "placeable-force" flags?
It works because map_color is used first if it exists else friendly_map_color is used for most friendly entities.

small-electric-poles are not placed as neutral. They're placed as the force that builds them.

Re: 0.12.22 change color of poles

Posted: Tue Feb 16, 2016 4:36 am
by osldgoth
Rseding91 wrote:

Code: Select all

data.raw["electric-pole"]["small-electric-pole"].friendly_map_color = {r = 1, g = 1, b = 1, a = 1}
Works perfectly for me. Throw it in a mod, start up a game and build some small electric poles. They'll show white on the map.
Thank you for helping with this. I tried recreating your code to test it, but when that didn't work, I copied your code thinking maybe I was spelling something wrong, or there was some other typing error... still didn't work. ... about an hour later still not working but I managed to figure out the problem: the file name containing the script wasn't named 'data.lua'. :evil: so the game didn't know what to do with it i guess. perhaps I missed the memo which spelled that out.