From 71351bd2858b77bbe2f9301f2e9e42738d756496 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sun, 22 Jun 2014 20:40:08 -0400 Subject: [PATCH] Some fixes --- code/controllers/shuttle_controller.dm | 112 ++++++++++-------------- code/game/supplyshuttle.dm | 13 --- code/modules/admin/verbs/randomverbs.dm | 2 +- code/modules/shuttles/shuttle.dm | 27 ++++++ 4 files changed, 76 insertions(+), 78 deletions(-) diff --git a/code/controllers/shuttle_controller.dm b/code/controllers/shuttle_controller.dm index 467637714a1..83baa847104 100644 --- a/code/controllers/shuttle_controller.dm +++ b/code/controllers/shuttle_controller.dm @@ -25,65 +25,48 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle var/deny_shuttle = 0 //allows admins to prevent the shuttle from being called var/departed = 0 //if the shuttle has left the station at least once -/datum/shuttle_controller/emergency_shuttle/New() - if ("Escape" in shuttles && istype(shuttles["Escape"], /datum/shuttle/ferry/emergency)) - shuttle = shuttles["Escape"] +/datum/shuttle_controller/emergency_shuttle/proc/setup_pods() + escape_pods = list() - //still don't have the shuttle, so create one - if (!shuttle) - shuttle = new/datum/shuttle/ferry/emergency() - shuttle.location = 1 - 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.travel_time = SHUTTLE_TRANSIT_DURATION - //shuttle.docking_controller_tag = "supply_shuttle" - //shuttle.dock_target_station = "cargo_bay" - shuttles["Escape"] = shuttle + var/datum/shuttle/ferry/escape_pod/pod - if (!escape_pods) - escape_pods = list() - - var/datum/shuttle/ferry/escape_pod/pod - - pod = new() - pod.location = 0 - pod.warmup_time = 0 - pod.area_station = locate(/area/shuttle/escape_pod1/station) - pod.area_offsite = locate(/area/shuttle/escape_pod1/centcom) - pod.area_transition = locate(/area/shuttle/escape_pod1/transit) - pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN - escape_pods += pod + pod = new() + pod.location = 0 + pod.warmup_time = 0 + pod.area_station = locate(/area/shuttle/escape_pod1/station) + pod.area_offsite = locate(/area/shuttle/escape_pod1/centcom) + pod.area_transition = locate(/area/shuttle/escape_pod1/transit) + pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN + escape_pods += pod - pod = new() - pod.location = 0 - pod.warmup_time = 0 - pod.area_station = locate(/area/shuttle/escape_pod2/station) - pod.area_offsite = locate(/area/shuttle/escape_pod2/centcom) - pod.area_transition = locate(/area/shuttle/escape_pod2/transit) - pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN - escape_pods += pod - - pod = new() - pod.location = 0 - pod.warmup_time = 0 - pod.area_station = locate(/area/shuttle/escape_pod3/station) - pod.area_offsite = locate(/area/shuttle/escape_pod3/centcom) - pod.area_transition = locate(/area/shuttle/escape_pod3/transit) - pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN - escape_pods += pod - - //There is no pod 4, apparently. - - pod = new() - pod.location = 0 - pod.warmup_time = 0 - pod.area_station = locate(/area/shuttle/escape_pod5/station) - pod.area_offsite = locate(/area/shuttle/escape_pod5/centcom) - pod.area_transition = locate(/area/shuttle/escape_pod5/transit) - pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN - escape_pods += pod + pod = new() + pod.location = 0 + pod.warmup_time = 0 + pod.area_station = locate(/area/shuttle/escape_pod2/station) + pod.area_offsite = locate(/area/shuttle/escape_pod2/centcom) + pod.area_transition = locate(/area/shuttle/escape_pod2/transit) + pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN + escape_pods += pod + + pod = new() + pod.location = 0 + pod.warmup_time = 0 + pod.area_station = locate(/area/shuttle/escape_pod3/station) + pod.area_offsite = locate(/area/shuttle/escape_pod3/centcom) + pod.area_transition = locate(/area/shuttle/escape_pod3/transit) + pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN + escape_pods += pod + + //There is no pod 4, apparently. + + pod = new() + pod.location = 0 + pod.warmup_time = 0 + pod.area_station = locate(/area/shuttle/escape_pod5/station) + pod.area_offsite = locate(/area/shuttle/escape_pod5/centcom) + pod.area_transition = locate(/area/shuttle/escape_pod5/transit) + pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN + escape_pods += pod /datum/shuttle_controller/emergency_shuttle/proc/process() @@ -91,6 +74,7 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle if (auto_recall && can_recall() && world.time >= auto_recall_time) recall() if (world.time >= launch_time) //time to launch the shuttle + wait_for_launch = 0 //set the travel time if (!shuttle.location) //at station @@ -116,17 +100,17 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle //called when the shuttle has arrived. /datum/shuttle_controller/emergency_shuttle/proc/shuttle_arrived() if (!shuttle.location) //at station - launch_time = world.time + SHUTTLE_LEAVETIME + launch_time = world.time + SHUTTLE_LEAVETIME*10 wait_for_launch = 1 //get ready to return -//returns the time left until the shuttle arrives at it's destination, in ticks +//returns the time left until the shuttle arrives at it's destination, in seconds /datum/shuttle_controller/emergency_shuttle/proc/estimate_arrival_time() var/eta = launch_time + shuttle.travel_time - return (eta - world.time) + return (eta - world.time)/10 -//returns the time left until the shuttle launches, in ticks +//returns the time left until the shuttle launches, in seconds /datum/shuttle_controller/emergency_shuttle/proc/estimate_launch_time() - return (launch_time - world.time) + return (launch_time - world.time)/10 /datum/shuttle_controller/emergency_shuttle/proc/has_eta() return (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE) @@ -173,8 +157,8 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle if(!can_call()) return //set the launch timer - launch_time = world.time + get_shuttle_prep_time() - auto_recall_time = world.time + rand(300,500) + launch_time = world.time + get_shuttle_prep_time()*10 + auto_recall_time = rand(world.time + 300, launch_time - 300) wait_for_launch = 1 evac = 1 @@ -190,7 +174,7 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle //set the launch timer launch_time = world.time + get_shuttle_prep_time() - auto_recall_time = world.time + rand(100,SHUTTLE_PREPTIME-30) + auto_recall_time = rand(world.time + 300, launch_time - 300) wait_for_launch = 1 captain_announce("A crew transfer has been initiated. The shuttle has been called. It will arrive in [round(estimate_arrival_time()/60)] minutes.") diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm index 4ce6d25b7c7..e2dfe3b4423 100644 --- a/code/game/supplyshuttle.dm +++ b/code/game/supplyshuttle.dm @@ -147,19 +147,6 @@ var/list/mechtoys = list( New() ordernum = rand(1,9000) - if ("Supply" in shuttles && istype(shuttles["Supply"], /datum/shuttle/ferry/supply)) - shuttle = shuttles["Supply"] - - //still don't have the shuttle, so create one - if (!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 //Supply shuttle ticker - handles supply point regenertion and shuttle travelling between centcomm and the station proc/process() diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 1ce5b057eeb..ce2a2800bbc 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -883,7 +883,7 @@ Traitors and the like can also be revived with the previous role mostly intact. set category = "Admin" set name = "Call Shuttle" - if ((!( ticker ) || emergency_shuttle.location())) + if ((!( ticker ) || !emergency_shuttle.location())) return if(!check_rights(R_ADMIN)) return diff --git a/code/modules/shuttles/shuttle.dm b/code/modules/shuttles/shuttle.dm index 274597ef4cf..abc02e90f84 100644 --- a/code/modules/shuttles/shuttle.dm +++ b/code/modules/shuttles/shuttle.dm @@ -124,6 +124,33 @@ var/global/list/shuttles shuttles = list() var/datum/shuttle/ferry/shuttle + + // Escape shuttle and pods + shuttle = new/datum/shuttle/ferry/emergency() + shuttle.location = 1 + 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.travel_time = SHUTTLE_TRANSIT_DURATION + //shuttle.docking_controller_tag = "supply_shuttle" + //shuttle.dock_target_station = "cargo_bay" + shuttles["Escape"] = shuttle + + emergency_shuttle.shuttle = shuttle + emergency_shuttle.setup_pods() + + // 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 + + supply_controller.shuttle = shuttle // Admin shuttles. shuttle = new()