From aa8723b724bf2afaa6af2bb46aff115e4e3b6ef7 Mon Sep 17 00:00:00 2001 From: Leshana Date: Wed, 14 Jun 2017 19:34:01 -0400 Subject: [PATCH] Switch tether shuttles over to self-initializing shuttle paradigm * Deleted shuttle_controller_vr.dm as it is no longer needed. Using standard shuttle_controller.dm again - It has no map-specific info! * Converted the former contents of shuttle_controller_vr.dm into proper shuttle datums that self-initialize for each of our shuttles! * Converted the tether_backup shuttle crashing mechanic to support self-initialization also. --- code/controllers/shuttle_controller_vr.dm | 210 ---------------------- code/modules/shuttles/crashes.dm | 6 + maps/tether/tether.dm | 1 + maps/tether/tether_shuttle_defs.dm | 159 ++++++++++++++++ maps/tether/tether_shuttles.dm | 13 ++ vorestation.dme | 2 +- 6 files changed, 180 insertions(+), 211 deletions(-) delete mode 100644 code/controllers/shuttle_controller_vr.dm create mode 100644 maps/tether/tether_shuttle_defs.dm diff --git a/code/controllers/shuttle_controller_vr.dm b/code/controllers/shuttle_controller_vr.dm deleted file mode 100644 index e3cca60514..0000000000 --- a/code/controllers/shuttle_controller_vr.dm +++ /dev/null @@ -1,210 +0,0 @@ - -var/global/datum/shuttle_controller/shuttle_controller - - -/datum/shuttle_controller - var/list/shuttles //maps shuttle tags to shuttle datums, so that they can be looked up. - var/list/process_shuttles //simple list of shuttles, for processing - -/datum/shuttle_controller/proc/process() - //process ferry shuttles - for (var/datum/shuttle/ferry/shuttle in process_shuttles) - if (shuttle.process_state) - shuttle.process() - - -//This is called by gameticker after all the machines and radio frequencies have been properly initialized -/datum/shuttle_controller/proc/setup_shuttle_docks() - for(var/shuttle_tag in shuttles) - var/datum/shuttle/shuttle = shuttles[shuttle_tag] - shuttle.init_docking_controllers() - shuttle.dock() //makes all shuttles docked to something at round start go into the docked state - - for(var/obj/machinery/embedded_controller/C in machines) - if(istype(C.program, /datum/computer/file/embedded_program/docking)) - C.program.tag = null //clear the tags, 'cause we don't need 'em anymore - -/datum/shuttle_controller/New() - shuttles = list() - process_shuttles = list() - - var/datum/shuttle/ferry/shuttle - - ////////////////////////////////////////////////////////////// - // Escape shuttle and pods - shuttle = new/datum/shuttle/ferry/emergency() - shuttle.location = 1 // At offsite - shuttle.warmup_time = 10 - shuttle.area_offsite = locate(/area/shuttle/escape/centcom) - shuttle.area_station = locate(/area/shuttle/escape/station) - shuttle.area_transition = locate(/area/shuttle/escape/transit) - shuttle.docking_controller_tag = "escape_shuttle" - shuttle.dock_target_station = "escape_dock" - shuttle.dock_target_offsite = "centcom_dock" - shuttle.move_time = SHUTTLE_TRANSIT_DURATION_RETURN - shuttles["Escape"] = shuttle - process_shuttles += shuttle - - ////////////////////////////////////////////////////////////// - shuttle = new/datum/shuttle/ferry/escape_pod() - shuttle.location = 0 // At station - shuttle.warmup_time = 0 - shuttle.area_station = locate(/area/shuttle/large_escape_pod1/station) - shuttle.area_offsite = locate(/area/shuttle/large_escape_pod1/centcom) - shuttle.area_transition = locate(/area/shuttle/large_escape_pod1/transit) - shuttle.docking_controller_tag = "large_escape_pod_1" - shuttle.dock_target_station = "large_escape_pod_1_berth" - shuttle.move_time = SHUTTLE_TRANSIT_DURATION_RETURN + rand(-30, 60) //randomize this so it seems like the pods are being picked up one by one - process_shuttles += shuttle - shuttles["Large Escape Pod 1"] = shuttle - - ////////////////////////////////////////////////////////////// - shuttle = new/datum/shuttle/ferry/escape_pod() - shuttle.location = 0 // At station - shuttle.warmup_time = 0 - shuttle.area_station = locate(/area/shuttle/large_escape_pod2/station) - shuttle.area_offsite = locate(/area/shuttle/large_escape_pod2/centcom) - shuttle.area_transition = locate(/area/shuttle/large_escape_pod2/transit) - shuttle.docking_controller_tag = "large_escape_pod_2" - shuttle.dock_target_station = "large_escape_pod_2_berth" - shuttle.move_time = SHUTTLE_TRANSIT_DURATION_RETURN + rand(-30, 60) //randomize this so it seems like the pods are being picked up one by one - process_shuttles += shuttle - shuttles["Large Escape Pod 2"] = shuttle - - //give the emergency shuttle controller it's shuttles - emergency_shuttle.shuttle = shuttles["Escape"] - emergency_shuttle.escape_pods = list( - shuttles["Large Escape Pod 1"], - shuttles["Large Escape Pod 2"], - ) - - ////////////////////////////////////////////////////////////// - // Supply shuttle - shuttle = new/datum/shuttle/ferry/supply() - shuttle.location = 1 - shuttle.warmup_time = 10 - shuttle.area_offsite = locate(/area/supply/dock) - shuttle.area_station = locate(/area/supply/station) - shuttle.docking_controller_tag = "supply_shuttle" - shuttle.dock_target_station = "cargo_bay" - shuttles["Supply"] = shuttle - process_shuttles += shuttle - - supply_controller.shuttle = shuttle - - ////////////////////////////////////////////////////////////// - // Trade Ship - shuttle = new() - shuttle.location = 1 - shuttle.warmup_time = 10 //want some warmup time so people can cancel. - shuttle.area_offsite = locate(/area/shuttle/trade/centcom) - shuttle.area_station = locate(/area/shuttle/trade/station) - shuttle.docking_controller_tag = "trade_shuttle" - shuttle.dock_target_station = "trade_shuttle_dock_airlock" - shuttle.dock_target_offsite = "trade_shuttle_bay" - shuttles["Trade"] = shuttle - process_shuttles += shuttle - - ////////////////////////////////////////////////////////////// - // Away Mission Shuttle - var/datum/shuttle/multi_shuttle/AM = new/datum/shuttle/multi_shuttle() - AM.legit = 1 - AM.origin = locate(/area/shuttle/awaymission/home) - AM.start_location = "NSS Adephagia (AM)" - - AM.destinations = list( - "Old Engineering Base (AM)" = locate(/area/shuttle/awaymission/oldengbase) - ) - - AM.docking_controller_tag = "awaymission_shuttle" - AM.destination_dock_targets = list( - "NSS Adephagia (AM)" = "d1a2_dock_airlock" - ) - - var/area/awaym_dest = locate(/area/shuttle/awaymission/away) - if(awaym_dest.contents.len) //Otherwise this is an empty imaginary area - AM.destinations["Unknown Location [rand(1000,9999)]"] = awaym_dest - - AM.announcer = "Automated Traffic Control" - //These seem backwards because they are written from the perspective of the merc and vox ships - AM.departure_message = "Attention. The away mission vessel is approaching the colony." - AM.arrival_message = "Attention. The away mission vessel is now leaving from the colony." - AM.interim = locate(/area/shuttle/awaymission/warp) - - AM.move_time = 60 - AM.warmup_time = 8 - shuttles["AwayMission"] = AM - - - // TODO - Not implemented yet on new map - /////////////////////////////////////////////// - //VOREStation Add - Belter Shuttle - // shuttle = new/datum/shuttle/ferry() - // shuttle.location = 0 - // shuttle.warmup_time = 6 - // shuttle.area_station = locate(/area/shuttle/belter/station) - // shuttle.area_offsite = locate(/area/shuttle/belter/belt/zone1) - // shuttle.area_transition = locate(/area/shuttle/belter/transit) - // shuttle.docking_controller_tag = "belter_docking" - // shuttle.dock_target_station = "belter_nodocking" //Fake tags to prevent the shuttle from opening doors. - // shuttle.dock_target_offsite = "belter_nodocking" - // shuttle.transit_direction = EAST - // shuttle.move_time = 60 + rand(10,40) - // process_shuttles += shuttle - // shuttles["Belter"] = shuttle - //VOREStation Add End - Belter Shuttle - - ////////////////////////////////////////////////////////////// - // Tether Shuttle - var/datum/shuttle/ferry/tether_backup/TB = new() - TB.location = 1 // At offsite - TB.warmup_time = 5 - TB.move_time = 45 - TB.area_offsite = locate(/area/shuttle/tether/surface) - TB.area_station = locate(/area/shuttle/tether/station) - TB.area_transition = locate(/area/shuttle/tether/transit) - TB.crash_areas = list(locate(/area/shuttle/tether/crash1), locate(/area/shuttle/tether/crash2)) - TB.docking_controller_tag = "tether_shuttle" - TB.dock_target_station = "tether_dock_airlock" - TB.dock_target_offsite = "tether_pad_airlock" - shuttles["Tether Backup"] = TB - process_shuttles += TB - - for(var/obj/structure/shuttle/engine/propulsion/E in TB.area_offsite) - TB.engines += E - for(var/obj/machinery/computer/shuttle_control/tether_backup/comp in TB.area_offsite) - TB.computer = comp - break - - - ////////////////////////////////////////////////////////////// - // Antag Space "Proto Shuttle" Shuttle - AM = new/datum/shuttle/multi_shuttle() - AM.docking_controller_tag = "antag_space_shuttle" - AM.start_location = "Home Base" - AM.origin = locate(/area/shuttle/antag_space/base) - AM.interim = locate(/area/shuttle/antag_space/transit) - AM.destinations = list( - "Nearby" = locate(/area/shuttle/antag_space/north), - "Docks" = locate(/area/shuttle/antag_space/docks) - ) - AM.destination_dock_targets = list("Home Base" = "antag_space_dock") - AM.move_time = 60 - AM.warmup_time = 8 - shuttles["Proto"] = AM - - ////////////////////////////////////////////////////////////// - // Antag Surface "Land Crawler" Shuttle - AM = new/datum/shuttle/multi_shuttle() - AM.docking_controller_tag = "antag_ground_shuttle" - AM.start_location = "Home Base" - AM.origin = locate(/area/shuttle/antag_ground/base) - AM.interim = locate(/area/shuttle/antag_ground/transit) - AM.destinations = list( - "Solar Array" = locate(/area/shuttle/antag_ground/solars), - "Mining Outpost" = locate(/area/shuttle/antag_ground/mining) - ) - AM.destination_dock_targets = list("Home Base" = "antag_ground_dock") - AM.move_time = 60 - AM.warmup_time = 8 - shuttles["Land Crawler"] = AM diff --git a/code/modules/shuttles/crashes.dm b/code/modules/shuttles/crashes.dm index 0e190c5399..eaf7e06019 100644 --- a/code/modules/shuttles/crashes.dm +++ b/code/modules/shuttles/crashes.dm @@ -6,6 +6,12 @@ var/list/crash_areas = null var/crash_message = "Oops. The shuttle blew up." // Announcement made when shuttle crashes +/datum/shuttle/New() + if(crash_areas) + for(var/i in 1 to crash_areas.len) + crash_areas[i] = locate(crash_areas[i]) + ..() + // Return 0 to let the jump continue, 1 to abort the jump. // Default implementation checks if the shuttle should crash and if so crashes it. /datum/shuttle/proc/process_longjump(var/area/origin, var/area/intended_destination, var/direction) diff --git a/maps/tether/tether.dm b/maps/tether/tether.dm index 6de1a83e9b..7db16e4a4d 100644 --- a/maps/tether/tether.dm +++ b/maps/tether/tether.dm @@ -6,6 +6,7 @@ #include "tether_phoronlock.dm" #include "tether_areas.dm" #include "tether_areas2.dm" + #include "tether_shuttle_defs.dm" #include "tether_shuttles.dm" #include "tether_telecomms.dm" #include "tether_virgo3b.dm" diff --git a/maps/tether/tether_shuttle_defs.dm b/maps/tether/tether_shuttle_defs.dm new file mode 100644 index 0000000000..b16eb49b85 --- /dev/null +++ b/maps/tether/tether_shuttle_defs.dm @@ -0,0 +1,159 @@ +////////////////////////////////////////////////////////////// +// Escape shuttle and pods +/datum/shuttle/ferry/emergency/escape + name = "Escape" + location = 1 // At offsite + warmup_time = 10 + area_offsite = /area/shuttle/escape/centcom + area_station = /area/shuttle/escape/station + area_transition = /area/shuttle/escape/transit + docking_controller_tag = "escape_shuttle" + dock_target_station = "escape_dock" + dock_target_offsite = "centcom_dock" + move_time = SHUTTLE_TRANSIT_DURATION_RETURN + +////////////////////////////////////////////////////////////// +/datum/shuttle/ferry/escape_pod/large_escape_pod1 + name = "Large Escape Pod 1" + location = 0 + warmup_time = 0 + area_station = /area/shuttle/large_escape_pod1/station + area_offsite = /area/shuttle/large_escape_pod1/centcom + area_transition = /area/shuttle/large_escape_pod1/transit + docking_controller_tag = "large_escape_pod_1" + dock_target_station = "large_escape_pod_1_berth" + dock_target_offsite = "large_escape_pod_1_recovery" + move_time = SHUTTLE_TRANSIT_DURATION_RETURN + +////////////////////////////////////////////////////////////// +/datum/shuttle/ferry/escape_pod/large_escape_pod2 + name = "Large Escape Pod 2" + location = 0 + warmup_time = 0 + area_station = /area/shuttle/large_escape_pod2/station + area_offsite = /area/shuttle/large_escape_pod2/centcom + area_transition = /area/shuttle/large_escape_pod2/transit + docking_controller_tag = "large_escape_pod_2" + dock_target_station = "large_escape_pod_2_berth" + dock_target_offsite = "large_escape_pod_2_recovery" + move_time = SHUTTLE_TRANSIT_DURATION_RETURN + +////////////////////////////////////////////////////////////// +// Supply shuttle +/datum/shuttle/ferry/supply/cargo + name = "Supply" + location = 1 + warmup_time = 10 + area_offsite = /area/supply/dock + area_station = /area/supply/station + docking_controller_tag = "supply_shuttle" + dock_target_station = "cargo_bay" + flags = SHUTTLE_FLAGS_PROCESS|SHUTTLE_FLAGS_SUPPLY + +////////////////////////////////////////////////////////////// +// Trade Ship +/datum/shuttle/ferry/trade + name = "Trade" + location = 1 + warmup_time = 10 //want some warmup time so people can cancel. + area_offsite = /area/shuttle/trade/centcom + area_station = /area/shuttle/trade/station + docking_controller_tag = "trade_shuttle" + dock_target_station = "trade_shuttle_dock_airlock" + dock_target_offsite = "trade_shuttle_bay" + +////////////////////////////////////////////////////////////// +// Away Mission Shuttle +/datum/shuttle/multi_shuttle/awaymission + name = "AwayMission" + legit = TRUE + warmup_time = 8 + move_time = 60 + origin = /area/shuttle/awaymission/home + interim = /area/shuttle/awaymission/warp + start_location = "NSS Adephagia (AM)" + destinations = list( + "Old Engineering Base (AM)" = /area/shuttle/awaymission/oldengbase + ) + docking_controller_tag = "awaymission_shuttle" + destination_dock_targets = list( + "NSS Adephagia (AM)" = "d1a2_dock_airlock" + ) + announcer = "Automated Traffic Control" + //These seem backwards because they are written from the perspective of the merc and vox ships + departure_message = "Attention. The away mission vessel is approaching the colony." + arrival_message = "Attention. The away mission vessel is now leaving from the colony." + +/datum/shuttle/multi_shuttle/awaymission/New() + ..() + var/area/awaym_dest = locate(/area/shuttle/awaymission/away) + if(awaym_dest && awaym_dest.contents.len) // Otherwise this is an empty imaginary area + destinations["Unknown Location [rand(1000,9999)]"] = awaym_dest + +////////////////////////////////////////////////////////////// +// Tether Shuttle +/datum/shuttle/ferry/tether_backup/goodluckmcgee + name = "Tether Backup" + location = 1 // At offsite + warmup_time = 5 + move_time = 45 + area_offsite = /area/shuttle/tether/surface + area_station = /area/shuttle/tether/station + area_transition = /area/shuttle/tether/transit + crash_areas = list(/area/shuttle/tether/crash1, /area/shuttle/tether/crash2) + docking_controller_tag = "tether_shuttle" + dock_target_station = "tether_dock_airlock" + dock_target_offsite = "tether_pad_airlock" + +////////////////////////////////////////////////////////////// +// Antag Space "Proto Shuttle" Shuttle +/datum/shuttle/multi_shuttle/protoshuttle + name = "Proto" + warmup_time = 8 + move_time = 60 + origin = /area/shuttle/antag_space/base + interim = /area/shuttle/antag_space/transit + start_location = "Home Base" + destinations = list( + "Nearby" = /area/shuttle/antag_space/north, + "Docks" = /area/shuttle/antag_space/docks + ) + docking_controller_tag = "antag_space_shuttle" + destination_dock_targets = list("Home Base" = "antag_space_dock") + +////////////////////////////////////////////////////////////// +// Antag Surface "Land Crawler" Shuttle +/datum/shuttle/multi_shuttle/landcrawler + name = "Land Crawler" + warmup_time = 8 + move_time = 60 + origin = /area/shuttle/antag_ground/base + interim = /area/shuttle/antag_ground/transit + start_location = "Home Base" + destinations = list( + "Solar Array" = /area/shuttle/antag_ground/solars, + "Mining Outpost" = /area/shuttle/antag_ground/mining + ) + docking_controller_tag = "antag_ground_shuttle" + destination_dock_targets = list("Home Base" = "antag_ground_dock") + +////////////////////////////////////////////////////////////// +// RogueMiner "Belter: Shuttle +// TODO - Not implemented yet on new map +/* +/datum/shuttle/ferry/belter + name = "Belter" + location = 0 + warmup_time = 6 + move_time = 60 + area_station = /area/shuttle/belter/station + area_offsite = /area/shuttle/belter/belt/zone1 + area_transition = /area/shuttle/belter/transit + docking_controller_tag = "belter_docking" + dock_target_station = "belter_nodocking" //Fake tags to prevent the shuttle from opening doors. + dock_target_offsite = "belter_nodocking" + +/datum/shuttle/ferry/belter/New() + move_time = move_time + rand(10, 40) + ..() +*/ diff --git a/maps/tether/tether_shuttles.dm b/maps/tether/tether_shuttles.dm index 0328233a98..8bd433ab16 100644 --- a/maps/tether/tether_shuttles.dm +++ b/maps/tether/tether_shuttles.dm @@ -1,3 +1,7 @@ +//////////////////////////////////////// +// Tether custom shuttle implemnetations +//////////////////////////////////////// + /obj/machinery/computer/shuttle_control/tether_backup name = "tether backup shuttle control console" shuttle_tag = "Tether Backup" @@ -56,9 +60,18 @@ // /datum/shuttle/ferry/tether_backup crash_message = "Tether shuttle distress signal received. Shuttle location is approximately 200 meters from tether base." + category = /datum/shuttle/ferry/tether_backup // So shuttle_controller.dm doesn't try and instantiate this type as an acutal mapped in shuttle. var/list/engines = list() var/obj/machinery/computer/shuttle_control/tether_backup/computer +/datum/shuttle/ferry/tether_backup/New() + ..() + var/area/current_area = get_location_area(location) + for(var/obj/structure/shuttle/engine/propulsion/E in current_area) + engines += E + for(var/obj/machinery/computer/shuttle_control/tether_backup/comp in current_area) + computer = comp + /datum/shuttle/ferry/tether_backup/process_longjump(var/area/origin, var/area/intended_destination) var/failures = engines.len for(var/engine in engines) diff --git a/vorestation.dme b/vorestation.dme index 78dac03d8b..3b28d436bc 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -159,7 +159,7 @@ #include "code\controllers\hooks.dm" #include "code\controllers\master.dm" #include "code\controllers\master_controller.dm" -#include "code\controllers\shuttle_controller_vr.dm" +#include "code\controllers\shuttle_controller.dm" #include "code\controllers\subsystem.dm" #include "code\controllers\verbs.dm" #include "code\controllers\voting.dm"