Merge pull request #1157 from Thrain856/master

Crew Transfer
This commit is contained in:
CIB
2012-05-24 04:38:58 -07:00
2 changed files with 88 additions and 20 deletions

View File

@@ -11,6 +11,8 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle
datum/shuttle_controller datum/shuttle_controller
var var
alert = 0 //0 = emergency, 1 = crew cycle
location = 0 //0 = somewhere far away (in spess), 1 = at SS13, 2 = returned from SS13 location = 0 //0 = somewhere far away (in spess), 1 = at SS13, 2 = returned from SS13
online = 0 online = 0
direction = 1 //-1 = going back to central command, 1 = going to SS13, 2 = in transit to centcom (not recalled) direction = 1 //-1 = going back to central command, 1 = going to SS13, 2 = in transit to centcom (not recalled)
@@ -36,28 +38,35 @@ datum/shuttle_controller
settimeleft(SHUTTLEARRIVETIME*coeff) settimeleft(SHUTTLEARRIVETIME*coeff)
online = 1 online = 1
//turning on the red lights in hallways and siren //turning on the red lights in hallways and siren
for(var/area/A in world) if(coeff == 1)
if(istype(A, /area/hallway)) for(var/area/A in world)
A.readyalert() if(istype(A, /area/hallway))
//sound_siren = 1 A.readyalert()
//sound_siren = 1
proc/shuttlealert(var/X)
alert = X
proc/recall() proc/recall()
if(direction == 1) if(direction == 1)
var/timeleft = timeleft() var/timeleft = timeleft()
if(timeleft >= 600) if(alert == 0)
if(timeleft >= 600)
return
captain_announce("The emergency shuttle has been recalled.")
world << sound('shuttlerecalled.ogg')
setdirection(-1)
online = 1
for(var/area/A in world)
if(istype(A, /area/hallway))
A.readyreset()
return
else //makes it possible to send shuttle back.
captain_announce("The shuttle has been recalled.")
setdirection(-1)
online = 1
return return
captain_announce("The emergency shuttle has been recalled.")
world << sound('shuttlerecalled.ogg')
setdirection(-1)
online = 1
//turning off the red lights in hallways and siren
for(var/area/A in world)
if(istype(A, /area/hallway))
A.readyreset()
// sound_siren = 0
// returns the time (in seconds) before shuttle arrival // returns the time (in seconds) before shuttle arrival
// note if direction = -1, gives a count-up to SHUTTLEARRIVETIME // note if direction = -1, gives a count-up to SHUTTLEARRIVETIME
@@ -192,9 +201,11 @@ datum/shuttle_controller
start_location.move_contents_to(end_location) start_location.move_contents_to(end_location)
settimeleft(SHUTTLELEAVETIME) settimeleft(SHUTTLELEAVETIME)
captain_announce("The Emergency Shuttle has docked with the station. You have [timeleft()/60] minutes to board the Emergency Shuttle.") if(alert == 0)
world << sound('shuttledock.ogg') captain_announce("The Emergency Shuttle has docked with the station. You have [timeleft()/60] minutes to board the Emergency Shuttle.")
world << sound('shuttledock.ogg')
else
captain_announce("The shuttle has docked with the station. You have [timeleft()/60] minutes to board the shuttle.")
return 1 return 1
if(1) if(1)
@@ -262,8 +273,10 @@ datum/shuttle_controller
spawn(0) spawn(0)
D.close() D.close()
if(alert == 0)
captain_announce("The Emergency Shuttle has left the station. Estimate [timeleft()/60] minutes until the shuttle docks at Central Command.") captain_announce("The Emergency Shuttle has left the station. Estimate [timeleft()/60] minutes until the shuttle docks at Central Command.")
else
captain_announce("The shuttle has left the station. Estimate [timeleft()/60] minutes until the shuttle docks at Central Command.")
// Some aesthetic turbulance shaking // Some aesthetic turbulance shaking
for(var/mob/M in end_location) for(var/mob/M in end_location)

View File

@@ -26,6 +26,7 @@
STATE_STATUSDISPLAY = 7 STATE_STATUSDISPLAY = 7
STATE_ALERT_LEVEL = 8 STATE_ALERT_LEVEL = 8
STATE_CONFIRM_LEVEL = 9 STATE_CONFIRM_LEVEL = 9
STATE_CREWTRANSFER = 10
var/status_display_freq = "1435" var/status_display_freq = "1435"
var/stat_msg1 var/stat_msg1
@@ -117,6 +118,16 @@
if(emergency_shuttle.online) if(emergency_shuttle.online)
post_status("shuttle") post_status("shuttle")
src.state = STATE_DEFAULT src.state = STATE_DEFAULT
if("crewtransfer")
src.state= STATE_DEFAULT
if(src.authenticated)
src.state = STATE_CREWTRANSFER
if("crewtransfer2")
if(src.authenticated)
init_shift_change(usr) //key difference here
if(emergency_shuttle.online)
post_status("shuttle")
src.state = STATE_DEFAULT
if("cancelshuttle") if("cancelshuttle")
src.state = STATE_DEFAULT src.state = STATE_DEFAULT
if(src.authenticated) if(src.authenticated)
@@ -306,6 +317,7 @@
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=cancelshuttle'>Cancel Shuttle Call</A> \]" dat += "<BR>\[ <A HREF='?src=\ref[src];operation=cancelshuttle'>Cancel Shuttle Call</A> \]"
else else
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=callshuttle'>Call Emergency Shuttle</A> \]" dat += "<BR>\[ <A HREF='?src=\ref[src];operation=callshuttle'>Call Emergency Shuttle</A> \]"
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=crewtransfer'>Initiate Crew Transfer</A> \]"
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=status'>Set Status Display</A> \]" dat += "<BR>\[ <A HREF='?src=\ref[src];operation=status'>Set Status Display</A> \]"
else else
@@ -313,6 +325,8 @@
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=messagelist'>Message List</A> \]" dat += "<BR>\[ <A HREF='?src=\ref[src];operation=messagelist'>Message List</A> \]"
if(STATE_CALLSHUTTLE) if(STATE_CALLSHUTTLE)
dat += "Are you sure you want to call the shuttle? \[ <A HREF='?src=\ref[src];operation=callshuttle2'>OK</A> | <A HREF='?src=\ref[src];operation=main'>Cancel</A> \]" dat += "Are you sure you want to call the shuttle? \[ <A HREF='?src=\ref[src];operation=callshuttle2'>OK</A> | <A HREF='?src=\ref[src];operation=main'>Cancel</A> \]"
if(STATE_CREWTRANSFER) // this is the shiftchage screen.
dat += "Are you sure you want to initiate a crew transfer? This will call the shuttle. \[ <a HREF='?src=\ref[src];operation=crewtransfer2'>OK</a> | <A HREF='?src=\ref[src];operation=main'>Cancel</A> \]"
if(STATE_CANCELSHUTTLE) if(STATE_CANCELSHUTTLE)
dat += "Are you sure you want to cancel the shuttle? \[ <A HREF='?src=\ref[src];operation=cancelshuttle2'>OK</A> | <A HREF='?src=\ref[src];operation=main'>Cancel</A> \]" dat += "Are you sure you want to cancel the shuttle? \[ <A HREF='?src=\ref[src];operation=cancelshuttle2'>OK</A> | <A HREF='?src=\ref[src];operation=main'>Cancel</A> \]"
if(STATE_MESSAGELIST) if(STATE_MESSAGELIST)
@@ -468,6 +482,7 @@
return return
emergency_shuttle.incall() emergency_shuttle.incall()
emergency_shuttle.shuttlealert(1)
log_game("[key_name(user)] has called the shuttle.") log_game("[key_name(user)] has called the shuttle.")
message_admins("[key_name_admin(user)] has called the shuttle.", 1) message_admins("[key_name_admin(user)] has called the shuttle.", 1)
captain_announce("The emergency shuttle has been called. It will arrive in [round(emergency_shuttle.timeleft()/60)] minutes.") captain_announce("The emergency shuttle has been called. It will arrive in [round(emergency_shuttle.timeleft()/60)] minutes.")
@@ -475,6 +490,46 @@
return return
/proc/init_shift_change(var/mob/user)
if ((!( ticker ) || emergency_shuttle.location))
return
if(emergency_shuttle.deny_shuttle)
user << "Centcom does not currently have a shuttle available in your sector. Please try again later."
return
if(sent_strike_team == 1)
user << "Centcom will not allow the shuttle to be called. Consider all contracts terminated."
return
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)/600)] minutes before trying again."//may need to change "/600"
return
if(emergency_shuttle.direction == -1)
user << "The shuttle may not be called while returning to CentCom."
return
if(emergency_shuttle.online)
user << "The shuttle is already on its way."
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.fake_recall = rand(300,500)
if(ticker.mode.name == "blob" || ticker.mode.name == "epidemic")
user << "Under directive 7-10, [station_name()] is quarantined until further notice."
return
emergency_shuttle.incall()
emergency_shuttle.shuttlealert(1)
log_game("[key_name(user)] has called the shuttle.")
message_admins("[key_name_admin(user)] has called the shuttle.", 1)
captain_announce("A crew transfer has been initiated. The shuttle has been called. It will arrive in [round(emergency_shuttle.timeleft()/60)] minutes.")
return
/proc/cancel_call_proc(var/mob/user) /proc/cancel_call_proc(var/mob/user)
if ((!( ticker ) || emergency_shuttle.location || emergency_shuttle.direction == 0 || emergency_shuttle.timeleft() < 300)) if ((!( ticker ) || emergency_shuttle.location || emergency_shuttle.direction == 0 || emergency_shuttle.timeleft() < 300))