Page 1 of 1

[NML] How to remove grass tunnel portal?

Posted: 01 Dec 2018 00:49
by Erato
Hey

Recently I've been working on a monorail track replacement newgrf. All I want to do is replace monorail. I don't want to add anything new. However when working on the tunnel portal, I came across this problem where it shows the grass tunnel portal that is used for the basegame standard rail portal, sticking through my tunnel portal.
Image
Would anyone know of a way to remove this grass tunnel portal in nml?

See the code for the railtype here:
[+] Spoiler

Code: Select all

item(FEAT_RAILTYPES, MONO, 3) {
     property {
         label:                      "MONO";
         railtype_flags:             bitmask();				//Prevents other newgrfs from disabling level crossings
     }
     graphics {
         track_overlay:		MONO_overlay;				
         underlay:			MONO_underlay;				
         bridge_surfaces:	MONO_bridge;				
		 tunnels:			MONO_tunnel;				
         depots:            switch_MONO_depot;    		
		 gui:				MONO_gui;					
		 tunnel_overlay:	UM_tunnel_overlay;			
         fences:        	NO_fences;             		
		 level_crossings:	left_level_crossing_state_switch; //Allows me to change the level crossing sprite
     }
 }

Re: [NML] How to remove grass tunnel portal?

Posted: 01 Dec 2018 01:22
by GarryG
I had similar problems when making my track set.

Quast65 came up with a solution with some sprites he did for the tracks and tunnels.

Can find his information at Railtype Templates in NML over on the Simuscape Website at
http://www.simuscape.net/simutalk/viewt ... 4df68fb9d6

Hope it might help you.

Cheers

Re: [NML] How to remove grass tunnel portal?

Posted: 01 Dec 2018 14:54
by Quast65
The solution is indeed very simple, you need to replace the graphics from the OpenGFX-extra base set.
So you need to use:

Code: Select all

replacenew(RAILTYPE_TUNNELS
To completely remove them use this code (change the path to the graphicsfile ofcourse to where your graphicsfile will be placed):

Code: Select all

//Remove trackless tunnelgraphics from OpenGFX-extra
replacenew (RAILTYPE_TUNNELS, "FARTStest/gfx/notracklesstunnels.png") { 
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
} 
And this graphic (difficult to see, but its a single transparent blue pixel):
notracklesstunnels.png
notracklesstunnels.png (3.49 KiB) Viewed 3347 times
You only have to do this once in your GRF, so not for each railtype you add.
Do keep in mind that you then have to provide full-tile graphics for your custom tunnels, otherwise you get some strange glitches ;-)
And keep in mind that this will remove all of the tunnel base-graphics for all tracksets you will load into your game (also vanilla tracks by the way)!!
In most cases that will not be an issue, as almost all tracksets (and also vanilla tracks) provide full-tile custom tunnels, but there is at least one exception and that is WIRED.
This is what happens with WIRED:
Example525.png
Example525.png (61.06 KiB) Viewed 3347 times
As you can see, WIRED has no custom tunnel graphics, so you get some weird glitches.
I was already planning to contact McZapkie when I am ready to release my trackset to ask him to provide custom tunnels for his GRF so that removing the tunnel base graphics wont be an issue anymore with his GRF, but maybe he will read this post in the meantime ;-)
AFAIK I dont think there are any other current tracksets that have no custom tunnels...




But maybe you do want to use some sort of tunnel base graphics (and then design custom tunnels for your railtypes around those) and want them to be climate aware...

This is the code I used for the trackset I am currently working on:

Code: Select all

//Parameter to manually set Alpine climate
param 7  {
	   param_alpine {
			name: string(STR_PARAM_NAME_ALPINE);
			desc: string(STR_PARAM_DESC_ALPINE);
			min_value:	0;
			max_value:	1;
			def_value: 0;
			names: {
				0: string(STR_PARAM_ALPINE_NONE);
				1: string(STR_PARAM_ALPINE_CUSTOM);
			};
		}
	}
 }
 
 
//Replace trackless tunnelgraphics from OpenGFX-extra
template tmpl_trackless_tunnel(y) {
	[ 10, y,  64, 39,  -31,  -8]
	[ 84, y,  64, 39,  -31, -38]
	[158, y,  64, 23,  -31,   0]
	[232, y,  64, 23,  -31, -30]
	[306, y,  64, 23,  -31,   0]
	[380, y,  64, 23,  -31, -30]
	[454, y,  64, 39,  -31,  -8]
	[528, y,  64, 39,  -31, -38]
}


if (param[7] == 1) {
replacenew(RAILTYPE_TUNNELS, "FARTS/gfx/tracklesstunnel-overlay-sprites.png") {		tmpl_trackless_tunnel(10) 
		tmpl_trackless_tunnel(265)
	}
 } else {
 if (climate == CLIMATE_TROPICAL) {
	replacenew(RAILTYPE_TUNNELS, "FARTS/gfx/tracklesstunnel-overlay-sprites.png") {		tmpl_trackless_tunnel(180)
		tmpl_trackless_tunnel(350)
	}
} 
else {
	replacenew(RAILTYPE_TUNNELS, "FARTS/gfx/tracklesstunnel-overlay-sprites.png") {		tmpl_trackless_tunnel(10)
		tmpl_trackless_tunnel(265)
	}

if (climate == CLIMATE_ARCTIC) {
	replacenew(RAILTYPE_TUNNELS, "FARTS/gfx/tracklesstunnel-overlay-sprites.png") { 		tmpl_trackless_tunnel(95) 
	}
	}

if (climate == CLIMATE_TOYLAND) {
	replacenew(RAILTYPE_TUNNELS, "FARTS/gfx/tracklesstunnel-overlay-sprites.png") { 		tmpl_trackless_tunnel(435) 
	}
	}

 }
}
 
And these are the graphics I replaced them with:
tracklesstunnel-overlay-sprites.png
(115.52 KiB) Not downloaded yet
So in my case I replace the tunnelgraphics with walls with (climate aware) grass on them, I can then design my custom tunnels using those as a base.
I also wanted them to be able to adapt to Alpine climate (so Temperate grass in Arctic), but a player has to do that manually, so thats why there is a parameter.

Hope this helps! :tongue:

Re: [NML] How to remove grass tunnel portal?

Posted: 01 Dec 2018 17:00
by Erato
Quast65 wrote:The solution is indeed very simple, you need to replace the graphics from the OpenGFX-extra base set.
So you need to use:

Code: Select all

replacenew(RAILTYPE_TUNNELS
To completely remove them use this code (change the path to the graphicsfile ofcourse to where your graphicsfile will be placed):

Code: Select all

//Remove trackless tunnelgraphics from OpenGFX-extra
replacenew (RAILTYPE_TUNNELS, "FARTStest/gfx/notracklesstunnels.png") { 
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
	[  0,0,1,1,0,0]
} 
<snip>
Thanks! This worked!