User Tools

Site Tools


Sidebar



Minetest Forum
Content Database
Git Repository
Bug Tracker
Website

dev:proposals:paintable_elements

This is an old revision of the document!


Paintable Elements

In real life railways, a lot of stuff is paintable. Italy sometimes paints their tracks white to stave off the brutal summer heat, signs are painted over to make them useless, and platforms can be given a strong yellow to push players away.

In advtrains, many components could be coloured to help alongside trains.

  • ATC (Lua or not) tracks can be coloured for disambiguation with some form of server-wide colour scheme (purple for digiline-data sending components, green for interlocking-helping tracks, so on)
  • Station tracks can be disambiguated based on what type of train they are for (maybe a metro train stops for 10 seconds whilst a mainline stops for 60)
  • Signal masts can be coloured for the track they aim for instead of being a solid blue

This also seems rather simple to implement. I, (56independent) have said this fraudulently multiple times, so here is my proof:

This is how the E231 train changes its colour. The actually colour-changing code is only 7 lines long.

local meta = itemstack:get_meta()
local color = meta:get_string("paint_color")
local alpha = tonumber(meta:get_string("alpha"))
if color and color:find("^#%x%x%x%x%x%x$") then
	data.livery = self.base_texture.."^("..self.base_livery.."^[colorize:"..color..":255)" -- livery texture has no own texture....
	self:set_textures(data)
end

From here, it's quite easy to change the texture name to be that for the track pointed.

This can be turned into a global function. In fact, it's so easy, i might as well bother to do it given community approval.

QED.

Later on, a feature to automatically weaken the colour by x every time a train runs over a coloured track or by y every hundred hours would be helpful for realism (which is proven by Italy's tracks not being white all the time.

dev/proposals/paintable_elements.1673609928.txt.gz · Last modified: 2023-01-13 12:38 by 56independent