Loading

Paste #pcjb2md75

  1. GRF loading stages:
  2.   The stages are processed after each other. All GRFs are processed for the same stage before advancing.
  3.  
  4.   # Initialiation stage
  5.   for newgrf in configured_newgrfs:
  6.      # Each NewGRF peforms checks on its own wrt. its parameters and general game variables (like climate).
  7.      if newgrf.is_happy_with_parameters():
  8.         # Shout out "hello" to other GRFs.
  9.      else:
  10.         # disable newgrf
  11.  
  12.   # Reservation stage
  13.   for newgrf in configured_newgrfs:
  14.      # Each NewGRF may check what other GRFs called "hello", and may choose to leave the room if they don't like them,
  15.      # and the other one did not leave again on its own.
  16.      if newgrf.is_happy_with_other_grfs():
  17.         # Make promises what this NewGRF provides wrt. shared items, like cargo and railtype definitions.
  18.         newgrf.provide_cargos()
  19.         newgrf.provide_railtypes()
  20.      else:
  21.         # disable newgrf
  22.  
  23.   # Activation stage
  24.   for newgrf in configured_newgrfs:
  25.      # Each NewGRF provides all the stuff, sometimes depending on what cargos and railtypes were promised by other GRFs.
  26.      # Erroring out here is considered rude.
  27.      newgrf.provide_stuff(available_cargotypes, available_railtypes)

Comments