Rail Type Introduction & its relationship to Introduction Date
Moderator: Graphics Moderators
Rail Type Introduction & its relationship to Introduction Date
So I was playing around with making some of my own railtypes, and to make some railtypes that were required from a technical standpoint but should not available to the player (let's call it railtype X), I set the property "introduction_date" of the tracktype to the year 5000000, the quoted maximum from: https://newgrf-specs.tt-wiki.net/wiki/NML:Railtypes.
When I compiled this into a NewGRF regardless of the date, once the first train for railtype X was made available (~1980) railtype X was made available.
Some more digging on that same page tells me that the game will basically ignore the "introduction_date" property, unless no trains are explicitly allowed on it. To me this seem unintuitive and unhelpful. Yes, I am pushing the limits of the design for a specific use case, but nonetheless this implication does not appear to be the best possible.
When I compiled this into a NewGRF regardless of the date, once the first train for railtype X was made available (~1980) railtype X was made available.
Some more digging on that same page tells me that the game will basically ignore the "introduction_date" property, unless no trains are explicitly allowed on it. To me this seem unintuitive and unhelpful. Yes, I am pushing the limits of the design for a specific use case, but nonetheless this implication does not appear to be the best possible.
Re: Rail Type Introduction & its relationship to Introduction Date
with openttd 1.9 was added the ability to hide railtypes from the construction menu. that sounds like what you're looking for here. (property 10 bit 2)
Re: Rail Type Introduction & its relationship to Introduction Date
Is there a way to implement this using NML?
Re: Rail Type Introduction & its relationship to Introduction Date
yes, property 10 is called "railtype_flags" there. i imagine it hasn't got a name for the bit, though, so you'd have to use the raw number, like
Code: Select all
bitmask(2)
Re: Rail Type Introduction & its relationship to Introduction Date
I tried to do something like that after reading the nfo specs about it, but I couldn't seem to get the desired result.
Re: Rail Type Introduction & its relationship to Introduction Date
i'm afraid you need to provide us with more details
Re: Rail Type Introduction & its relationship to Introduction Date
What I'm trying to ask is how would I set flags in the item block of some item which doesn't have a name implemented into NML like RAILTYPE_FLAG_CATENARY, but rather one that is defined under property 10 for NFO.
In this particular case, I want to set the railtype to have the "hidden in construction menu" flag enabled, which in NFO is defined as bit 2 with a value of 4 in property 10. I have attempted this in NML by trying the code
In the item block of the railtype in question, but this didn't seem to work.
This suggests either:
I wasn't being rigorous in testing the change
or I'm doing it wrong.
EDIT: I just had to copy Eddi's post to hide the track type, thank you for your help. Still unsure on the behaviour of railtype releases.
In this particular case, I want to set the railtype to have the "hidden in construction menu" flag enabled, which in NFO is defined as bit 2 with a value of 4 in property 10. I have attempted this in NML by trying the code
Code: Select all
bitmask(4)
This suggests either:
I wasn't being rigorous in testing the change
or I'm doing it wrong.
EDIT: I just had to copy Eddi's post to hide the track type, thank you for your help. Still unsure on the behaviour of railtype releases.
-
- Tycoon
- Posts: 2781
- Joined: 22 Feb 2011 18:34
Re: Rail Type Introduction & its relationship to Introduction Date
It didn't work because you misunderstood how the bitmask() function works, it sets the bit at the position you provide. So if you need to set a property to value 4, you can do that by setting bit 2 (1x2^n, where n is the bit you set, in this case 2).Gwyd wrote: ↑16 Jul 2019 22:18 What I'm trying to ask is how would I set flags in the item block of some item which doesn't have a name implemented into NML like RAILTYPE_FLAG_CATENARY, but rather one that is defined under property 10 for NFO.
In this particular case, I want to set the railtype to have the "hidden in construction menu" flag enabled, which in NFO is defined as bit 2 with a value of 4 in property 10. I have attempted this in NML by trying the codeIn the item block of the railtype in question, but this didn't seem to work.Code: Select all
bitmask(4)
This suggests either:
I wasn't being rigorous in testing the change
or I'm doing it wrong.
EDIT: I just had to copy Eddi's post to hide the track type, thank you for your help. Still unsure on the behaviour of railtype releases.
I think the railtype release behavior is a bit of a safeguard against several things (vehicle introduction dates randomization, different vehicle and track NewGRFs), so the safe behavior is to forcefully introduce the railtype when a vehicle becomes available for it. But there are cases where a railtype should not become available as it is a technical type, which is now covered with the "hidden in construction menu" flag.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Who is online
Users browsing this forum: No registered users and 5 guests