[NML] How to remove grass tunnel portal?

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

[NML] How to remove grass tunnel portal?

Post 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
     }
 }
No pics no clicks. Seriously.
ImageImageImageImageImageImage
User avatar
GarryG
Tycoon
Tycoon
Posts: 5869
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

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

Post 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
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335
Auz Eyecandy TramTracks: viewtopic.php?t=89908
User avatar
Quast65
Tycoon
Tycoon
Posts: 2661
Joined: 09 Oct 2011 13:51
Location: The Netherlands

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

Post 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 3321 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 3321 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:
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

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

Post 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!
No pics no clicks. Seriously.
ImageImageImageImageImageImage
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 3 guests