shuttle_controller now uses a shuttle datum

Conflicts:
	code/game/machinery/computer/communications.dm
	code/modules/admin/verbs/randomverbs.dm
	code/modules/mob/living/silicon/ai/ai.dm
	code/modules/power/singularity/singularity.dm
This commit is contained in:
mwerezak
2014-06-22 18:10:56 -04:00
committed by ZomgPonies
parent 55532e51a0
commit 9874ce38ce
34 changed files with 441 additions and 585 deletions
+5 -5
View File
@@ -391,15 +391,15 @@
dat += "Current Game Mode: <B>[ticker.mode.name]</B><BR>"
dat += "Round Duration: <B>[round(world.time / 36000)]:[add_zero(world.time / 600 % 60, 2)]:[world.time / 100 % 6][world.time / 100 % 10]</B><BR>"
dat += "<B>Emergency shuttle</B><BR>"
if (!emergency_shuttle.online)
if (!emergency_shuttle.online())
dat += "<a href='?src=\ref[src];call_shuttle=1'>Call Shuttle</a><br>"
else
var/timeleft = emergency_shuttle.timeleft()
switch(emergency_shuttle.location)
if(0)
var/timeleft = emergency_shuttle.estimate_launch_time()
switch(emergency_shuttle.location())
if(1)
dat += "ETA: <a href='?src=\ref[src];edit_shuttle_time=1'>[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]</a><BR>"
dat += "<a href='?src=\ref[src];call_shuttle=2'>Send Back</a><br>"
if(1)
if(0)
dat += "ETA: <a href='?src=\ref[src];edit_shuttle_time=1'>[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]</a><BR>"
dat += "<a href='?src=\ref[src];delay_round_end=1'>[ticker.delay_end ? "End Round Normally" : "Delay Round End"]</a><br>"
if(ticker.mode.syndicates.len)
+21 -20
View File
@@ -218,36 +218,37 @@
switch(href_list["call_shuttle"])
if("1")
if ((!( ticker ) || emergency_shuttle.location))
if ((!( ticker ) || !emergency_shuttle.location()))
return
emergency_shuttle.incall()
captain_announce("The emergency shuttle has been called. It will arrive in [round(emergency_shuttle.timeleft()/60)] minutes.")
log_admin("[key_name(usr)] called the Emergency Shuttle")
message_admins("\blue [key_name_admin(usr)] called the Emergency Shuttle to the station", 1)
if (emergency_shuttle.can_call())
emergency_shuttle.call_evac()
log_admin("[key_name(usr)] called the Emergency Shuttle")
message_admins("\blue [key_name_admin(usr)] called the Emergency Shuttle to the station", 1)
if("2")
if ((!( ticker ) || emergency_shuttle.location || emergency_shuttle.direction == 0))
if (!( ticker ) || !emergency_shuttle.location())
return
switch(emergency_shuttle.direction)
if(-1)
emergency_shuttle.incall()
captain_announce("The emergency shuttle has been called. It will arrive in [round(emergency_shuttle.timeleft()/60)] minutes.")
log_admin("[key_name(usr)] called the Emergency Shuttle")
message_admins("\blue [key_name_admin(usr)] called the Emergency Shuttle to the station", 1)
if(1)
emergency_shuttle.recall()
log_admin("[key_name(usr)] sent the Emergency Shuttle back")
message_admins("\blue [key_name_admin(usr)] sent the Emergency Shuttle back", 1)
if (emergency_shuttle.can_call())
emergency_shuttle.call_evac()
log_admin("[key_name(usr)] called the Emergency Shuttle")
message_admins("\blue [key_name_admin(usr)] called the Emergency Shuttle to the station", 1)
else if (emergency_shuttle.can_recall())
emergency_shuttle.recall()
log_admin("[key_name(usr)] sent the Emergency Shuttle back")
message_admins("\blue [key_name_admin(usr)] sent the Emergency Shuttle back", 1)
href_list["secretsadmin"] = "check_antagonist"
else if(href_list["edit_shuttle_time"])
if(!check_rights(R_SERVER)) return
emergency_shuttle.settimeleft( input("Enter new shuttle duration (seconds):","Edit Shuttle Timeleft", emergency_shuttle.timeleft() ) as num )
log_admin("[key_name(usr)] edited the Emergency Shuttle's timeleft to [emergency_shuttle.timeleft()]")
captain_announce("The emergency shuttle has been called. It will arrive in [round(emergency_shuttle.timeleft()/60)] minutes.")
message_admins("\blue [key_name_admin(usr)] edited the Emergency Shuttle's timeleft to [emergency_shuttle.timeleft()]", 1)
var/new_time_left = input("Enter new shuttle launch duration (seconds):","Edit Shuttle Timeleft", emergency_shuttle.estimate_launch_time() ) as num
emergency_shuttle.launch_time = world.time + new_time_left*10
log_admin("[key_name(usr)] edited the Emergency Shuttle's timeleft to [new_time_left]")
message_admins("\blue [key_name_admin(usr)] edited the Emergency Shuttle's timeleft to [new_time_left*10]", 1)
href_list["secretsadmin"] = "check_antagonist"
else if(href_list["delay_round_end"])
+12 -8
View File
@@ -367,7 +367,6 @@ Ccomp's first proc.
message_admins("Admin [key_name_admin(usr)] has [action] on joining the round if they use AntagHUD", 1)
*/
/*
If a guy was gibbed and you want to revive him, this is a good way to do so.
Works kind of like entering the game with a new character. Character receives a new mind if they didn't have one.
@@ -928,7 +927,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
@@ -936,16 +935,21 @@ Traitors and the like can also be revived with the previous role mostly intact.
var/confirm = alert(src, "You sure?", "Confirm", "Yes", "No")
if(confirm != "Yes") return
var/choice
if(ticker.mode.name == "revolution" || ticker.mode.name == "AI malfunction" || ticker.mode.name == "confliction")
var/choice = input("The shuttle will just return if you call it. Call anyway?") in list("Confirm", "Cancel")
choice = input("The shuttle will just return if you call it. Call anyway?") in list("Confirm", "Cancel")
if(choice == "Confirm")
emergency_shuttle.fake_recall = rand(300,500)
emergency_shuttle.auto_recall = 1 //enable auto-recall
else
return
emergency_shuttle.incall()
captain_announce("The emergency shuttle has been called. It will arrive in [round(emergency_shuttle.timeleft()/60)] minutes.")
world << sound('sound/AI/shuttlecalled.ogg')
choice = input("Is this an emergency evacuation or a crew transfer?") in list("Emergency", "Crew Transfer")
if (choice == "Emergency")
emergency_shuttle.call_evac()
else
emergency_shuttle.call_transfer()
feedback_add_details("admin_verb","CSHUT") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
log_admin("[key_name(usr)] admin-called the emergency shuttle.")
message_admins("\blue [key_name_admin(usr)] admin-called the emergency shuttle.", 1)
@@ -959,7 +963,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
if(alert(src, "You sure?", "Confirm", "Yes", "No") != "Yes") return
if(!ticker || emergency_shuttle.location || emergency_shuttle.direction == 0)
if(!ticker || !emergency_shuttle.can_recall())
return
emergency_shuttle.recall()
+1 -1
View File
@@ -30,7 +30,7 @@ var/global/sent_strike_team = 0
sent_strike_team = 1
if (emergency_shuttle.direction == 1 && emergency_shuttle.online == 1)
if (emergency_shuttle.can_recall())
emergency_shuttle.recall()
var/commando_number = commandos_possible //for selecting a leader
@@ -35,8 +35,8 @@ var/global/sent_syndicate_strike_team = 0
sent_syndicate_strike_team = 1
if (emergency_shuttle.direction == 1 && emergency_shuttle.online == 1)
emergency_shuttle.recall()
//if (emergency_shuttle.can_recall())
// emergency_shuttle.recall() //why, exactly? Admins can do this themselves.
var/syndicate_commando_number = syndicate_commandos_possible //for selecting a leader
var/syndicate_leader_selected = 0 //when the leader is chosen. The last person spawned.
+2 -2
View File
@@ -222,8 +222,8 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if(ticker.mode:malf_mode_declared)
stat(null, "Time left: [max(ticker.mode:AI_win_timeleft/(ticker.mode:apcs/3), 0)]")
if(emergency_shuttle)
if(emergency_shuttle.online && emergency_shuttle.location < 2)
var/timeleft = emergency_shuttle.timeleft()
if(emergency_shuttle.has_eta() && !emergency_shuttle.returned())
var/timeleft = emergency_shuttle.estimate_arrival_time()
if (timeleft)
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
@@ -167,8 +167,8 @@
stat(null, "Plasma Stored: [getPlasma()]/[max_plasma]")
if(emergency_shuttle)
if(emergency_shuttle.online && emergency_shuttle.location < 2)
var/timeleft = emergency_shuttle.timeleft()
if(emergency_shuttle.has_eta() && !emergency_shuttle.returned())
var/timeleft = emergency_shuttle.estimate_arrival_time()
if (timeleft)
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
@@ -195,8 +195,8 @@
if(ticker.mode:malf_mode_declared)
stat(null, "Time left: [max(ticker.mode:AI_win_timeleft/(ticker.mode:apcs/3), 0)]")
if(emergency_shuttle)
if(emergency_shuttle.online && emergency_shuttle.location < 2)
var/timeleft = emergency_shuttle.timeleft()
if(emergency_shuttle.has_eta() && !emergency_shuttle.returned())
var/timeleft = emergency_shuttle.estimate_arrival_time()
if (timeleft)
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
+6 -9
View File
@@ -303,14 +303,11 @@ var/list/ai_list = list()
call_shuttle_proc(src)
// hack to display shuttle timer
if(emergency_shuttle.online)
var/datum/radio_frequency/frequency = radio_controller.return_frequency(1435)
if(!frequency) return
var/datum/signal/status_signal = new
status_signal.source = src
status_signal.transmission_method = 1
status_signal.data["command"] = "shuttle"
frequency.post_signal(src, status_signal)
if(emergency_shuttle.online())
var/obj/machinery/computer/communications/C = locate() in machines
if(C)
C.post_status("shuttle")
return
/mob/living/silicon/ai/verb/toggle_anchor()
@@ -337,7 +334,7 @@ var/list/ai_list = list()
if(AI.control_disabled)
src << "Wireless control is disabled!"
return
recall_shuttle(src)
cancel_call_proc(src)
return
/mob/living/silicon/ai/check_eye(var/mob/user as mob)
+1 -3
View File
@@ -39,11 +39,9 @@
callshuttle = 0
if(callshuttle == 3) //if all three conditions are met
emergency_shuttle.incall(2)
emergency_shuttle.call_evac()
log_game("All the AIs, comm consoles and boards are destroyed. Shuttle called.")
message_admins("All the AIs, comm consoles and boards are destroyed. Shuttle called.", 1)
captain_announce("The emergency shuttle has been called. It will arrive in [round(emergency_shuttle.timeleft()/60)] minutes.")
world << sound('sound/AI/shuttlecalled.ogg')
if(explosive)
spawn(10)
+5 -4
View File
@@ -176,10 +176,11 @@
// this function displays the shuttles ETA in the status panel if the shuttle has been called
/mob/living/silicon/proc/show_emergency_shuttle_eta()
if(emergency_shuttle.online && emergency_shuttle.location < 2)
var/timeleft = emergency_shuttle.timeleft()
if (timeleft)
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
if(emergency_shuttle)
if(emergency_shuttle.has_eta() && !emergency_shuttle.returned())
var/timeleft = emergency_shuttle.estimate_arrival_time()
if (timeleft)
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
@@ -145,8 +145,8 @@
statpanel("Status")
if(emergency_shuttle)
if(emergency_shuttle.online && emergency_shuttle.location < 2)
var/timeleft = emergency_shuttle.timeleft()
if(emergency_shuttle.has_eta() && !emergency_shuttle.returned())
var/timeleft = emergency_shuttle.estimate_arrival_time()
if (timeleft)
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
+6 -5
View File
@@ -346,12 +346,13 @@
dat += "Round Duration: [round(hours)]h [round(mins)]m<br>"
if(emergency_shuttle) //In case Nanotrasen decides reposess CentComm's shuttles.
if(emergency_shuttle.direction == 2) //Shuttle is going to centcomm, not recalled
if(emergency_shuttle.going_to_centcom()) //Shuttle is going to centcomm, not recalled
dat += "<font color='red'><b>The station has been evacuated.</b></font><br>"
if(emergency_shuttle.direction == 1 && emergency_shuttle.timeleft() < 300 && emergency_shuttle.alert == 0) // Emergency shuttle is past the point of no recall
dat += "<font color='red'>The station is currently undergoing evacuation procedures.</font><br>"
if(emergency_shuttle.direction == 1 && emergency_shuttle.alert == 1) // Crew transfer initiated
dat += "<font color='red'>The station is currently undergoing crew transfer procedures.</font><br>"
if(emergency_shuttle.online())
if (emergency_shuttle.evac) // Emergency shuttle is past the point of no recall
dat += "<font color='red'>The station is currently undergoing evacuation procedures.</font><br>"
else // Crew transfer initiated
dat += "<font color='red'>The station is currently undergoing crew transfer procedures.</font><br>"
dat += "Choose from the following open positions:<br>"
for(var/datum/job/job in job_master.occupations)
@@ -499,9 +499,10 @@ var/global/list/uneatable = list(
/obj/machinery/singularity/narsie/large/New()
..()
world << "<font size='15' color='red'><b>NAR-SIE HAS RISEN</b></font>"
if(emergency_shuttle)
emergency_shuttle.incall(0.3) // Cannot recall
world << "<font size='28' color='red'><b>NAR-SIE HAS RISEN</b></font>"
if(emergency_shuttle && emergency_shuttle.can_call())
emergency_shuttle.call_evac()
emergency_shuttle.launch_time = 0 // Cannot recall
/obj/machinery/singularity/narsie/process()
eat()
+46 -31
View File
@@ -6,11 +6,15 @@
/datum/shuttle/ferry
var/location = 0 //0 = at area_station, 1 = at area_offsite
var/direction = 0 //0 = going to station, 1 = going to offsite.
var/process_state = IDLE_STATE
//this mutex ensures that only one console is processing the shuttle's controls at a time
var/obj/machinery/computer/shuttle_control/in_use = null
var/obj/machinery/computer/shuttle_control/in_use = null //this doesn't have to be a console...
var/area_transition
var/travel_time = 0
var/area_station
var/area_offsite
//TODO: change location to a string and use a mapping for area and dock targets.
@@ -25,7 +29,8 @@
destination = get_location_area(!location)
if(!origin)
origin = get_location_area(location)
direction = !location
..(origin, destination)
/datum/shuttle/ferry/long_jump(var/area/departing,var/area/destination,var/area/interim,var/travel_time)
@@ -36,7 +41,8 @@
destination = get_location_area(!location)
if(!departing)
departing = get_location_area(location)
direction = !location
..(departing, destination, interim, travel_time)
/datum/shuttle/ferry/move(var/area/origin,var/area/destination)
@@ -44,16 +50,20 @@
destination = get_location_area(!location)
if(!origin)
origin = get_location_area(location)
if (docking_controller && !docking_controller.undocked())
docking_controller.force_undock()
..(origin, destination)
location = !location
if (destination == area_station) location = 0
if (destination == area_offsite) location = 1
//if this is a long_jump retain the location we were last at until we get to the new one
/datum/shuttle/ferry/proc/get_location_area(location_id = null)
if (isnull(location_id))
location_id = location
if (!location_id)
return area_station
return area_offsite
@@ -62,12 +72,12 @@
switch(process_state)
if (WAIT_LAUNCH)
if (skip_docking_checks() || docking_controller.can_launch())
//once you have a transition area, making ferry shuttles have a transition would merely requre replacing this with
//if (transition_area) long_jump(...)
//else short_jump ()
short_jump()
if (travel_time && area_transition)
long_jump(null, null, area_transition, travel_time)
else
short_jump()
process_state = WAIT_ARRIVE
if (WAIT_ARRIVE)
if (moving_status == SHUTTLE_IDLE)
@@ -77,6 +87,7 @@
if (skip_docking_checks() || docking_controller.docked())
process_state = IDLE_STATE
in_use = null //release lock
arrived()
/datum/shuttle/ferry/current_dock_target()
var/dock_target
@@ -89,42 +100,42 @@
/datum/shuttle/ferry/proc/launch(var/obj/machinery/computer/shuttle_control/user)
if (!can_launch()) return
in_use = user //obtain an exclusive lock on the shuttle
process_state = WAIT_LAUNCH
undock()
/datum/shuttle/ferry/proc/force_launch(var/obj/machinery/computer/shuttle_control/user)
if (!can_force()) return
in_use = user //obtain an exclusive lock on the shuttle
short_jump()
process_state = WAIT_ARRIVE
/datum/shuttle/ferry/proc/cancel_launch(var/obj/machinery/computer/shuttle_control/user)
if (!can_cancel()) return
moving_status = SHUTTLE_IDLE
process_state = WAIT_FINISH
if (docking_controller && !docking_controller.undocked())
docking_controller.force_undock()
spawn(10)
dock()
return
/datum/shuttle/ferry/proc/can_launch()
if (moving_status != SHUTTLE_IDLE)
return 0
if (in_use)
return 0
return 1
/datum/shuttle/ferry/proc/can_force()
@@ -137,6 +148,10 @@
return 1
return 0
//This gets called when the shuttle finishes arriving at it's destination
//This can be used by subtypes to do things when the shuttle arrives.
/datum/shuttle/ferry/proc/arrived()
return //do nothing for now
/obj/machinery/computer/shuttle_control
@@ -145,7 +160,7 @@
icon_state = "shuttle"
req_access = list(access_engine)
circuit = null
var/shuttle_tag // Used to coordinate data in shuttle controller.
var/hacked = 0 // Has been emagged, no access restrictions.
var/launch_override = 0
@@ -156,11 +171,11 @@
/obj/machinery/computer/shuttle_control/process()
if (!shuttles || !(shuttle_tag in shuttles))
return
var/datum/shuttle/ferry/shuttle = shuttles[shuttle_tag]
if (!istype(shuttle))
return
if (shuttle.in_use == src)
shuttle.process_shuttle()
@@ -168,7 +183,7 @@
var/datum/shuttle/ferry/shuttle = shuttles[shuttle_tag]
if (!istype(shuttle))
return
if (shuttle.in_use == src)
shuttle.in_use = null //shuttle may not dock properly if this gets deleted while in transit, but its not a big deal
@@ -206,7 +221,7 @@
shuttle_status = "Proceeding to destination."
if(WAIT_FINISH)
shuttle_status = "Arriving at destination now."
data = list(
"shuttle_status" = shuttle_status,
"shuttle_state" = shuttle_state,
@@ -237,7 +252,7 @@
var/datum/shuttle/ferry/shuttle = shuttles[shuttle_tag]
if (!istype(shuttle))
return
if(href_list["move"])
shuttle.launch(src)
if(href_list["force"])
@@ -0,0 +1,69 @@
/datum/shuttle/ferry/emergency
//pass
/datum/shuttle/ferry/emergency/arrived()
emergency_shuttle.shuttle_arrived()
/*
/datum/shuttle/ferry/emergency/move()
if (!location) //leaving the station
emergency_shuttle.departed = 1
..()
*/
/datum/shuttle/ferry/escape_pod
//pass
/datum/shuttle/ferry/escape_pod/can_launch()
if(location)
return 0 //it's a one-way trip.
return ..()
/datum/shuttle/ferry/escape_pod/can_force()
return 0
/datum/shuttle/ferry/escape_pod/can_cancel()
return 0
//TODO replace this with proper door controllers
/datum/shuttle/ferry/escape_pod/move(var/area/origin,var/area/destination)
for(var/obj/machinery/door/D in origin)
spawn(0)
D.close()
..(origin, destination) //might need to adjust shuttle/move so that it can take into account the direction argument to area/move_contents_to, I dunno.
for(var/obj/machinery/door/D in destination)
spawn(0)
D.open()
//Escape pod garbage, copied from the controller
/*
//pods
start_location = locate(/area/shuttle/escape_pod1/station)
end_location = locate(/area/shuttle/escape_pod1/transit)
end_location = locate(/area/shuttle/escape_pod1/centcom)
start_location.move_contents_to(end_location, null, NORTH)
start_location = locate(/area/shuttle/escape_pod2/station)
end_location = locate(/area/shuttle/escape_pod2/transit)
end_location = locate(/area/shuttle/escape_pod2/centcom)
start_location.move_contents_to(end_location, null, NORTH)
start_location = locate(/area/shuttle/escape_pod3/station)
end_location = locate(/area/shuttle/escape_pod3/transit)
end_location = locate(/area/shuttle/escape_pod3/centcom)
start_location.move_contents_to(end_location, null, NORTH)
//There is no pod 4, apparently.
start_location = locate(/area/shuttle/escape_pod5/station)
end_location = locate(/area/shuttle/escape_pod5/transit)
end_location = locate(/area/shuttle/escape_pod5/centcom)
start_location.move_contents_to(end_location, null, EAST)
*/