Callback: Control special industry effects

From GRFSpecs
Jump to navigationJump to search

Control special industry effects (3B)

This callback allows you to control some aspects of the special effects enabled in property 1A. The lowest byte of variable 18 always contains the number of the special effect, which equals to the bit number being set in property 1A. Currently only effect 0 (plant fields periodically) and effect 1 (cut nearby trees periodically) are supported.

  • For effect 0 you should return 0 to avoid planting fields and 1 to plant a field. The callback is called every 256 ticks for a given industry. Variable 10 contains 32 random bits that can be used to randomize the behaviour. Industry variable AAh (word) can be used to make the plantings rarer, but please note that the low byte is always zero at this point. The default behaviour is giving 1/8 chance to plant a new field every 256 ticks.
  • For effect 1 you should return 0 to avoid cutting a tree and 1 to try cutting one. The callback is called every 256 ticks for a given industry. In TTDPatch and OpenTTD prior to r22673, you don't get random values this case, but you can still use variable AAh; the low byte is always zero here as well. The default behaviour is trying to cut a tree every 512 ticks.

This callback is available from Supported by TTDPatch 2.52.5 TTDPatch 2.0.1 a73 and above

GRFv≤7 Note that GRF versions 7 and lower only distinguished zero and non-zero return values for effect 0 and 1.