Add shuttle stranding

This commit is contained in:
Markolie
2015-02-01 16:05:43 +01:00
parent 8fb90212b8
commit 2a1e9931a6
13 changed files with 72 additions and 36 deletions
@@ -11,6 +11,7 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
var/launch_time //the time at which the shuttle will be launched
var/auto_recall = 0 //if set, the shuttle will be auto-recalled
var/auto_recall_time //the time at which the shuttle will be auto-recalled
var/no_escape = 0 //alternative to auto_recall - the shuttle will arrive, but never leave
var/evac = 0 //1 = emergency evacuation, 0 = crew transfer
var/wait_for_launch = 0 //if the shuttle is waiting to launch
var/autopilot = 1 //set to 0 to disable the shuttle automatically launching
@@ -27,6 +28,10 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
stop_launch_countdown()
if (!shuttle.location) //leaving from the station
if(is_stranded())
captain_announce("Hostile environment detected. Departure has been postponed indefinitely pending conflict resolution.")
wait_for_launch = 0
return
//launch the pods!
for (var/datum/shuttle/ferry/escape_pod/pod in escape_pods)
if (!pod.arming_controller || pod.arming_controller.armed)
@@ -38,6 +43,8 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
//called when the shuttle has arrived.
/datum/emergency_shuttle_controller/proc/shuttle_arrived()
if (!shuttle.location) //at station
if(no_escape)
shuttle.moving_status = SHUTTLE_STRANDED
if (autopilot)
set_launch_countdown(SHUTTLE_LEAVETIME) //get ready to return
@@ -154,7 +161,7 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
/datum/emergency_shuttle_controller/proc/waiting_to_leave()
if (shuttle.location)
return 0 //not at station
return (wait_for_launch || shuttle.moving_status != SHUTTLE_INTRANSIT)
return (wait_for_launch || (shuttle.moving_status != SHUTTLE_INTRANSIT && shuttle.moving_status != SHUTTLE_STRANDED))
//so we don't have emergency_shuttle.shuttle.location everywhere
/datum/emergency_shuttle_controller/proc/location()
@@ -178,7 +185,10 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
return (launch_time - world.time)/10
/datum/emergency_shuttle_controller/proc/has_eta()
return (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE)
return (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE && shuttle.moving_status != SHUTTLE_STRANDED)
/datum/emergency_shuttle_controller/proc/is_stranded()
return (shuttle.moving_status == SHUTTLE_STRANDED)
//returns 1 if the shuttle has gone to the station and come back at least once,
//used for game completion checking purposes
@@ -214,7 +224,10 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
var/timeleft = emergency_shuttle.estimate_launch_time()
return "ETD-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]"
if (is_stranded())
return "ETA-ERR"
return ""
/*
Some slapped-together star effects for maximum spess immershuns. Basically consists of a
@@ -136,7 +136,12 @@
if (is_malf_ai_dead())
if(config.continous_rounds)
if(emergency_shuttle)
emergency_shuttle.auto_recall = 0
if(emergency_shuttle.auto_recall)
emergency_shuttle.auto_recall = 0
else if(emergency_shuttle.is_stranded())
emergency_shuttle.no_escape = 0
emergency_shuttle.shuttle.moving_status = SHUTTLE_IDLE
emergency_shuttle.shuttle_arrived()
malf_mode_declared = 0
else
return 1
+7 -2
View File
@@ -92,7 +92,7 @@
greet_revolutionary(rev_mind)
modePlayer += head_revolutionaries
if(emergency_shuttle)
emergency_shuttle.auto_recall = 1
emergency_shuttle.no_escape = 1
spawn (rand(waittime_l, waittime_h))
send_intercept()
..()
@@ -172,7 +172,12 @@
if(config.continous_rounds)
if(finished != 0)
if(emergency_shuttle)
emergency_shuttle.auto_recall = 0
if(emergency_shuttle.auto_recall)
emergency_shuttle.auto_recall = 0
else if(emergency_shuttle.is_stranded())
emergency_shuttle.no_escape = 0
emergency_shuttle.shuttle.moving_status = SHUTTLE_IDLE
emergency_shuttle.shuttle_arrived()
return ..()
if(finished != 0)
return 1
+1 -1
View File
@@ -18,4 +18,4 @@
/datum/game_mode/sandbox/post_setup()
..()
if(emergency_shuttle)
emergency_shuttle.auto_recall = 1
emergency_shuttle.no_escape = 1
@@ -419,11 +419,7 @@ var/shuttle_call/shuttle_calls[0]
if(world.time < 54000) // 30 minute grace period to let the game get going
user << "The shuttle is refueling. Please wait another [round((54000-world.time)/60)] minutes before trying again."
return
if(ticker.mode.name == "revolution" || ticker.mode.name == "AI malfunction" || ticker.mode.name == "sandbox")
//New version pretends to call the shuttle but cause the shuttle to return after a random duration.
emergency_shuttle.auto_recall = 1
if(ticker.mode.name == "epidemic")
user << "Under directive 7-10, [station_name()] is quarantined until further notice."
return
+4
View File
@@ -97,6 +97,10 @@
if(length(message2) > CHARS_PER_LINE)
message2 = "Error"
update_display(message1, message2)
else if(emergency_shuttle.is_stranded())
message1 = "-ERR-"
message2 = "??:??"
update_display(message1, message2)
else
remove_display()
return 1
+7 -4
View File
@@ -937,11 +937,14 @@ Traitors and the like can also be revived with the previous role mostly intact.
if(confirm != "Yes") return
var/choice
if(ticker.mode.name == "revolution" || ticker.mode.name == "AI malfunction" || ticker.mode.name == "confliction")
if(emergency_shuttle.auto_recall)
choice = input("The shuttle will just return if you call it. Call anyway?") in list("Confirm", "Cancel")
if(choice == "Confirm")
emergency_shuttle.auto_recall = 1 //enable auto-recall
else
if(choice != "Confirm")
return
if(emergency_shuttle.no_escape)
choice = input("The shuttle will not be able to leave if you call it. Call anyway?") in list("Confirm", "Cancel")
if(choice != "Confirm")
return
choice = input("Is this an emergency evacuation or a crew transfer?") in list("Emergency", "Crew Transfer")
+1 -1
View File
@@ -337,7 +337,7 @@ var/list/ai_list = list()
/mob/living/silicon/ai/proc/ai_cancel_call()
set category = "AI Commands"
set category = "Malfunction"
if(src.stat == 2)
src << "You can't send the shuttle back because you are dead!"
return
@@ -5,7 +5,7 @@
icon_state = "samak"
icon_living = "samak"
icon_dead = "samak_dead"
icon = 'code/WorkInProgress/Cael_Aislinn/Jungle/jungle.dmi'
icon = 'code/modules/jungle/jungle.dmi'
move_to_delay = 2
maxHealth = 125
health = 125
@@ -26,7 +26,7 @@
icon_state = "diyaab"
icon_living = "diyaab"
icon_dead = "diyaab_dead"
icon = 'code/WorkInProgress/Cael_Aislinn/Jungle/jungle.dmi'
icon = 'code/modules/jungle/jungle.dmi'
move_to_delay = 1
maxHealth = 25
health = 25
@@ -47,7 +47,7 @@
icon_state = "shantak"
icon_living = "shantak"
icon_dead = "shantak_dead"
icon = 'code/WorkInProgress/Cael_Aislinn/Jungle/jungle.dmi'
icon = 'code/modules/jungle/jungle.dmi'
move_to_delay = 1
maxHealth = 75
health = 75
@@ -66,7 +66,7 @@
icon_state = "yithian"
icon_living = "yithian"
icon_dead = "yithian_dead"
icon = 'code/WorkInProgress/Cael_Aislinn/Jungle/jungle.dmi'
icon = 'code/modules/jungle/jungle.dmi'
/mob/living/simple_animal/tindalos
name = "tindalos"
@@ -74,4 +74,4 @@
icon_state = "tindalos"
icon_living = "tindalos"
icon_dead = "tindalos_dead"
icon = 'code/WorkInProgress/Cael_Aislinn/Jungle/jungle.dmi'
icon = 'code/modules/jungle/jungle.dmi'
+9 -9
View File
@@ -73,29 +73,29 @@
src.add_fingerprint(usr)
if(href_list["move"])
launch()
launch(usr)
if(href_list["force"])
force_launch()
force_launch(usr)
else if(href_list["cancel"])
cancel_launch()
cancel_launch(usr)
/obj/machinery/computer/shuttle_control/proc/launch()
/obj/machinery/computer/shuttle_control/proc/launch(var/mob/user)
var/datum/shuttle/ferry/shuttle = shuttle_controller.shuttles[shuttle_tag]
if (!istype(shuttle))
return
shuttle.launch(src)
shuttle.launch(user)
/obj/machinery/computer/shuttle_control/proc/force_launch()
/obj/machinery/computer/shuttle_control/proc/force_launch(var/mob/user)
var/datum/shuttle/ferry/shuttle = shuttle_controller.shuttles[shuttle_tag]
if (!istype(shuttle))
return
shuttle.force_launch(src)
shuttle.force_launch(user)
/obj/machinery/computer/shuttle_control/proc/cancel_launch()
/obj/machinery/computer/shuttle_control/proc/cancel_launch(var/mob/user)
var/datum/shuttle/ferry/shuttle = shuttle_controller.shuttles[shuttle_tag]
if (!istype(shuttle))
return
shuttle.cancel_launch(src)
shuttle.cancel_launch(user)
/obj/machinery/computer/shuttle_control/attackby(obj/item/weapon/W as obj, mob/user as mob)
+13 -4
View File
@@ -32,14 +32,17 @@
..(origin, destination)
/datum/shuttle/ferry/emergency/can_launch(var/user)
/datum/shuttle/ferry/emergency/can_launch(var/mob/user)
if (istype(user, /obj/machinery/computer/shuttle_control/emergency))
var/obj/machinery/computer/shuttle_control/emergency/C = user
if (!C.has_authorization())
return 0
if(moving_status == SHUTTLE_STRANDED && C.has_authorization())
return 1
return ..()
/datum/shuttle/ferry/emergency/can_force(var/user)
/datum/shuttle/ferry/emergency/can_force(var/mob/user)
if (istype(user, /obj/machinery/computer/shuttle_control/emergency))
var/obj/machinery/computer/shuttle_control/emergency/C = user
@@ -47,9 +50,10 @@
//this is so that people can force launch if the docking controller cannot safely undock without needing X heads to swipe.
if (process_state != WAIT_LAUNCH && !C.has_authorization())
return 0
return ..()
/datum/shuttle/ferry/emergency/can_cancel(var/user)
/datum/shuttle/ferry/emergency/can_cancel(var/mob/user)
if (istype(user, /obj/machinery/computer/shuttle_control/emergency))
var/obj/machinery/computer/shuttle_control/emergency/C = user
if (!C.has_authorization())
@@ -58,6 +62,10 @@
/datum/shuttle/ferry/emergency/launch(var/user)
if (!can_launch(user)) return
if(emergency_shuttle.no_escape)
user << "<span class='warning'>The emergency shuttle has been disabled by Centcom.</span>"
return
if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) //if we were given a command by an emergency shuttle console
if (emergency_shuttle.autopilot)
@@ -164,6 +172,7 @@
if(SHUTTLE_IDLE) shuttle_state = "idle"
if(SHUTTLE_WARMUP) shuttle_state = "warmup"
if(SHUTTLE_INTRANSIT) shuttle_state = "in_transit"
if(SHUTTLE_STRANDED) shuttle_state = "idle"
var/shuttle_status
switch (shuttle.process_state)
@@ -175,7 +184,7 @@
else
shuttle_status = "Standing-by at Central Command."
if(WAIT_LAUNCH)
shuttle_status = "Shuttle has recieved command and will depart shortly."
shuttle_status = "Shuttle has received command and will depart shortly."
if(WAIT_ARRIVE)
shuttle_status = "Proceeding to destination."
if(WAIT_FINISH)
+1 -1
View File
@@ -145,7 +145,7 @@
return 1
/datum/shuttle/ferry/proc/can_force()
if (moving_status == SHUTTLE_IDLE && process_state == WAIT_LAUNCH)
if ((moving_status == SHUTTLE_IDLE) && process_state == WAIT_LAUNCH)
return 1
return 0
+1
View File
@@ -908,6 +908,7 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse
#define SHUTTLE_IDLE 0
#define SHUTTLE_WARMUP 1
#define SHUTTLE_INTRANSIT 2
#define SHUTTLE_STRANDED 3
//Ferry shuttle processing status
#define IDLE_STATE 0