shadowm

Untitled

Aug 18th, 2012
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.84 KB | None | 0 0
  1. #textdomain wesnoth-After_the_Storm
  2. #
  3. # Macros controlling the segmented scenario mechanism employed
  4. # throughout AtS E3.
  5. #
  6. # The SEGMENTED_SCENARIO macro is one of the cornerstones of this mechanism.
  7. # It is expected to be substituted early in the scenario file, before any
  8. # custom events. Use ADD_SEGMENT to add configurations for each floor.
  9. #
  10. # Scenarios using this mechanisms should provide no initial map data, and
  11. # they should also take care of placing any necessary leaders on the map
  12. # by hand (see below for information about custom events).
  13. #
  14. # The ON_FLOOR macro provides a convenient way to switch floors including
  15. # a minimal amount of code each time. You *must* use this macro in your own
  16. # prestart event to update the gamestate according to your desired initial
  17. # floor.
  18. #
  19. # Events that can only take place when on a given floor can be defined with
  20. # the auxiliary ON_FLOOR macro, which sets or adds a [filter_condition]
  21. # requirement so the event only triggers on that floor.
  22. #
  23. # It is possible to hook into the floors mechanism via specific custom
  24. # event handlers, that will be invoked as appropriate when entering or
  25. # leaving floors, according to any first_time_only limitations for those
  26. # handlers.
  27. #
  28. # The custom events emitted are:
  29. #
  30. # * "enter floor $n": Takes place right after entering the floor $n
  31. # (after the floor switch code is executed and "setup floor $n"
  32. # emitted). If $n is not provided, the handler will run for *any*
  33. # floor before any floor-specific handlers. At this point, the
  34. # $floor_config.current variable reflects the *new* floor number.
  35. #
  36. # * "leave floor $n": Takes place right before leaving the floor $n
  37. # (before the floor switch code is executed and "setup floor $n"
  38. # emitted). If $n is not provided, the handler will run for *any*
  39. # floor before any floor-specific handlers. At this point, the
  40. # $floor_config.current variable reflects the *old* floor number.
  41. #
  42. # * "setup floor $n": Takes place during the configuration of the
  43. # given floor $n, after most of the floor switch code is executed.
  44. # If $n is not provided, the handler will run for *any* floor
  45. # before any floor-specific handlers. At this point, the
  46. # $floor_config.current variable reflects the *new* floor number.
  47. #
  48. # Generally, only the $floor_config.current variable should be accessed
  49. # by your own scenario code, and it should be treated as a *constant*.
  50. #
  51. # During victory events, $floor_config (and thus $floor_config.current)
  52. # ceases to exist unless you use the PRESERVE_FLOOR_CONFIGURATION_ON_VICTORY
  53. # macro before.
  54. #
  55. # When switching floors, all items and units previously on-map (except
  56. # side 1 units) are destroyed without emitting events for them. You might
  57. # want to use the "leave floor" events to take care of tracking any
  58. # units that might remain on-map when this happens. Shroud, fog, and terrain
  59. # changes aren't tracked or handled by this implementation either.
  60. #
  61.  
  62. ##
  63. # Accompanies the definition of an event that's only fired when the player
  64. # is on a specific floor. This should go _after_ or instead of any other
  65. # [filter_condition] nodes for the event definition.
  66. #
  67. # Arguments:
  68. #
  69. # _NUM The required floor number.
  70. #
  71. ##
  72. #define ON_FLOOR _NUM
  73. [+filter_condition]
  74. {VARIABLE_NUMERICAL_EQUALS floor_number {_NUM} }
  75. [/filter_condition]
  76. #enddef
  77.  
  78. ##
  79. # This is the main macro including the code blocks configuring the scenario
  80. # floors and such. It should go near the top of the scenario. You should not
  81. # specify your own initial map data.
  82. ##
  83. #define SEGMENTED_SCENARIO
  84. {NO_MAP_DATA}
  85.  
  86. {FLOOR_VARIABLES_CONFIGURATION}
  87.  
  88. {FLOOR_CONTROLLER}
  89. #enddef
  90.  
  91. ##
  92. # Defines a new floor. Floors are automatically numbered
  93. # in a sequence as they are added, starting from 1. At least
  94. # one floor is needed for the scenario to work properly, and
  95. # there must be a prestart event using the SWITCH_FLOOR macro
  96. # to select the initial floor as well.
  97. #
  98. # Arguments:
  99. #
  100. # _MAP_DATA The terrain map data.
  101. #
  102. # _SCHEDULE_TIME_WML The ToD schedule ([time] nodes) for
  103. # this floor. If empty, the ToD detected
  104. # on prestart for the first turn will be
  105. # used instead.
  106. #
  107. # _PLAYLIST_MUSIC_WML The playlist WML ([music] nodes) for
  108. # this floor. If empty, music is left
  109. # unchanged each time the player enters
  110. # the floor.
  111. #
  112. ##
  113. #define ADD_SEGMENT _MAP_DATA _SCHEDULE_TIME_WML _PLAYLIST_MUSIC_WML
  114. [event]
  115. name=prestart
  116.  
  117. [set_variables]
  118. name=floor_config.floor
  119. mode=append
  120. [value]
  121. map_data={_MAP_DATA}
  122. [schedule]
  123. {_SCHEDULE_TIME_WML}
  124. [/schedule]
  125. [music_playlist]
  126. {_PLAYLIST_MUSIC_WML}
  127. [/music_playlist]
  128. [/value]
  129. [/set_variables]
  130. [/event]
  131. #enddef
  132.  
  133. ##
  134. # Disables the automatic destruction of the $floor_config container
  135. # on victory, making the regular victory event (or subsequent scenarios)
  136. # responsible for its cleanup.
  137. #
  138. # This is provided merely as a convenience to retrieve $floor_config.current
  139. # during victory. Its use is not recommended.
  140. ##
  141. #define PRESERVE_FLOOR_CONFIGURATION_ON_VICTORY
  142. [event]
  143. remove=yes
  144. id=floor_controller_victory_cleanup
  145. [/event]
  146. #enddef
  147.  
  148. ##
  149. # This is the trigger used for switching between floors.
  150. #
  151. # Arguments:
  152. #
  153. # _NUM The new floor number.
  154. #
  155. ##
  156. #define SWITCH_FLOOR _NUM
  157. {VARIABLE new_floor_number {_NUM} }
  158.  
  159. [fire_event]
  160. name="enter floor"
  161. [/fire_event]
  162. #enddef
  163.  
  164. # kate: indent-mode normal; encoding utf-8; space-indent on;
Advertisement
Add Comment
Please, Sign In to add comment