Lazily create landable ship's overmap z-level on first use.

- Create the landmark as normal, but instead of allocating a z-level and placing it, register a pre_move listener on the shuttle and setup the z-level only when the shuttle is about to move to its overmap landmark.
- Change when shuttles fire the shuttle_pre_move_event to before calculating translation list to give us a chance to allocate the z-level.
This commit is contained in:
Leshana
2020-04-17 10:22:22 -04:00
parent 0c3126ffad
commit 796c406965
3 changed files with 47 additions and 9 deletions
+5 -5
View File
@@ -249,16 +249,16 @@
log_shuttle("Shuttle [src] aborting attempt_move() because current_location=[current_location] refuses.")
return FALSE
// Observer pattern pre-move
var/old_location = current_location
GLOB.shuttle_pre_move_event.raise_event(src, old_location, destination)
current_location.shuttle_departed(src)
log_shuttle("[src] moving to [destination]. Areas are [english_list(shuttle_area)]")
var/list/translation = list()
for(var/area/A in shuttle_area)
log_shuttle("Translating [A]")
translation += get_turf_translation(get_turf(current_location), get_turf(destination), A.contents)
var/old_location = current_location
// Observer pattern pre-move
GLOB.shuttle_pre_move_event.raise_event(src, old_location, destination)
current_location.shuttle_departed(src)
// Actually do it! (This never fails)
perform_shuttle_move(destination, translation)