Adds shuttle controller

Moves all ferry shuttle processing into one place: the new shuttle
controller.

Also cleans up the emergency shuttle controller a bit more and fixes
multi-shuttle cooldown.
This commit is contained in:
mwerezak
2014-06-23 11:57:32 -04:00
parent 81f0f868b4
commit 9e0562b16c
12 changed files with 542 additions and 543 deletions

View File

@@ -78,6 +78,7 @@
#include "code\controllers\_DynamicAreaLighting_TG.dm" #include "code\controllers\_DynamicAreaLighting_TG.dm"
#include "code\controllers\autotransfer.dm" #include "code\controllers\autotransfer.dm"
#include "code\controllers\configuration.dm" #include "code\controllers\configuration.dm"
#include "code\controllers\emergency_shuttle_controller.dm"
#include "code\controllers\failsafe.dm" #include "code\controllers\failsafe.dm"
#include "code\controllers\hooks-defs.dm" #include "code\controllers\hooks-defs.dm"
#include "code\controllers\hooks.dm" #include "code\controllers\hooks.dm"

View File

@@ -0,0 +1,293 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
// Controls the emergency shuttle
// these define the time taken for the shuttle to get to SS13
// and the time before it leaves again
#define SHUTTLE_PREPTIME 300 // 5 minutes = 300 seconds - after this time, the shuttle cannot be recalled
#define SHUTTLE_LEAVETIME 180 // 3 minutes = 180 seconds - the duration for which the shuttle will wait at the station
#define SHUTTLE_TRANSIT_DURATION 300 // 5 minutes = 300 seconds - how long it takes for the shuttle to get to the station
#define SHUTTLE_TRANSIT_DURATION_RETURN 120 // 2 minutes = 120 seconds - for some reason it takes less time to come back, go figure.
var/global/datum/emergency_shuttle_controller/emergency_shuttle
/datum/emergency_shuttle_controller
var/datum/shuttle/ferry/emergency/shuttle
var/list/escape_pods
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/evac = 0 //1 = emergency evacuation, 0 = crew transfer
var/wait_for_launch = 0 //if the shuttle is waiting to launch
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/emergency_shuttle_controller/proc/setup_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_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/emergency_shuttle_controller/proc/process()
if (wait_for_launch)
if (auto_recall && world.time >= auto_recall_time)
recall()
if (world.time >= launch_time) //time to launch the shuttle
stop_launch_countdown()
//set the travel time
if (!shuttle.location) //leaving from the station
//launch the pods!
for (var/datum/shuttle/ferry/escape_pod/pod in escape_pods)
pod.launch(src)
shuttle.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN
else
shuttle.travel_time = SHUTTLE_TRANSIT_DURATION
shuttle.launch(src)
//called when the shuttle has arrived.
/datum/emergency_shuttle_controller/proc/shuttle_arrived()
if (!shuttle.location) //at station
set_launch_countdown(SHUTTLE_LEAVETIME) //get ready to return
//begins the launch countdown and sets the amount of time left until launch
//if the launch countdown has already been set then this may reduce the countdown time, but not extend it
//to reset for a later time, just stop the timer first
/datum/emergency_shuttle_controller/proc/set_launch_countdown(var/seconds)
if (wait_for_launch)
launch_time = min(world.time + seconds*10, launch_time)
else
wait_for_launch = 1
launch_time = world.time + seconds*10
/datum/emergency_shuttle_controller/proc/stop_launch_countdown()
wait_for_launch = 0
//calls the shuttle for an emergency evacuation
/datum/emergency_shuttle_controller/proc/call_evac()
if(!can_call()) return
//set the launch timer
set_launch_countdown(get_shuttle_prep_time())
auto_recall_time = rand(world.time + 300, launch_time - 300)
evac = 1
captain_announce("An emergency evacuation shuttle has been called. It will arrive in approximately [round(estimate_arrival_time()/60)] minutes.")
world << sound('sound/AI/shuttlecalled.ogg')
for(var/area/A in world)
if(istype(A, /area/hallway))
A.readyalert()
//calls the shuttle for a routine crew transfer
/datum/emergency_shuttle_controller/proc/call_transfer()
if(!can_call()) return
//set the launch timer
set_launch_countdown(get_shuttle_prep_time())
auto_recall_time = rand(world.time + 300, launch_time - 300)
captain_announce("A crew transfer has been initiated. The shuttle has been called. It will arrive in [round(estimate_arrival_time()/60)] minutes.")
//recalls the shuttle
/datum/emergency_shuttle_controller/proc/recall()
if (!can_recall()) return
wait_for_launch = 0
shuttle.cancel_launch(src)
if (evac)
captain_announce("The emergency shuttle has been recalled.")
world << sound('sound/AI/shuttlerecalled.ogg')
for(var/area/A in world)
if(istype(A, /area/hallway))
A.readyreset()
evac = 0
else
captain_announce("The scheduled crew transfer has been cancelled.")
/datum/emergency_shuttle_controller/proc/can_call()
if (deny_shuttle)
return 0
if (shuttle.moving_status != SHUTTLE_IDLE || !shuttle.location) //must be idle at centcom
return 0
if (wait_for_launch) //already launching
return 0
return 1
//this only returns 0 if it would absolutely make no sense to recall
//e.g. the shuttle is already at the station or wasn't called to begin with
//other reasons for the shuttle not being recallable should be handled elsewhere
/datum/emergency_shuttle_controller/proc/can_recall()
if (shuttle.moving_status == SHUTTLE_INTRANSIT) //if the shuttle is already in transit then it's too late
return 0
if (!shuttle.location) //already at the station.
return 0
if (!wait_for_launch) //we weren't going anywhere, anyways...
return 0
return 1
/datum/emergency_shuttle_controller/proc/get_shuttle_prep_time()
// During mutiny rounds, the shuttle takes twice as long.
if(ticker && istype(ticker.mode,/datum/game_mode/mutiny))
return SHUTTLE_PREPTIME * 3 //15 minutes
return SHUTTLE_PREPTIME
/*
These procs are not really used by the controller itself, but are for other parts of the
game whose logic depends on the emergency shuttle.
*/
//so we don't have emergency_shuttle.shuttle.location everywhere
/datum/emergency_shuttle_controller/proc/location()
if (!shuttle)
return 1 //if we dont have a shuttle datum, just act like it's at centcom
return shuttle.location
//returns the time left until the shuttle arrives at it's destination, in seconds
/datum/emergency_shuttle_controller/proc/estimate_arrival_time()
var/eta
if (isnull(shuttle.jump_time))
eta = launch_time + shuttle.travel_time
else
eta = shuttle.jump_time + shuttle.travel_time
return (eta - world.time)/10
//returns the time left until the shuttle launches, in seconds
/datum/emergency_shuttle_controller/proc/estimate_launch_time()
return (launch_time - world.time)/10
/datum/emergency_shuttle_controller/proc/has_eta()
return (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE)
//returns 1 if the shuttle has gone to the station and come back at least once,
//used for game completion checking purposes
/datum/emergency_shuttle_controller/proc/returned()
return (departed && shuttle.moving_status != SHUTTLE_IDLE && shuttle.location) //we've gone to the station at least once, no longer in transit and are idle back at centcom
//returns 1 if the shuttle is not idle at centcom
/datum/emergency_shuttle_controller/proc/online()
if (!shuttle.location) //not at centcom
return 1
if (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE)
return 1
return 0
//returns 1 if the shuttle is currently in transit (or just leaving) to the station
/datum/emergency_shuttle_controller/proc/going_to_station()
return (!shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE)
//returns 1 if the shuttle is currently in transit (or just leaving) to centcom
/datum/emergency_shuttle_controller/proc/going_to_centcom()
return (shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE)
//returns 1 if the shuttle is docked at the station and waiting to leave
/datum/emergency_shuttle_controller/proc/waiting_to_leave()
if (shuttle.location)
return 0 //not at station
if (!wait_for_launch)
return 0 //not going anywhere
if (shuttle.moving_status != SHUTTLE_IDLE)
return 0 //shuttle is doing stuff
return 1
/*
Some slapped-together star effects for maximum spess immershuns. Basically consists of a
spawner, an ender, and bgstar. Spawners create bgstars, bgstars shoot off into a direction
until they reach a starender.
*/
/obj/effect/bgstar
name = "star"
var/speed = 10
var/direction = SOUTH
layer = 2 // TURF_LAYER
/obj/effect/bgstar/New()
..()
pixel_x += rand(-2,30)
pixel_y += rand(-2,30)
var/starnum = pick("1", "1", "1", "2", "3", "4")
icon_state = "star"+starnum
speed = rand(2, 5)
/obj/effect/bgstar/proc/startmove()
while(src)
sleep(speed)
step(src, direction)
for(var/obj/effect/starender/E in loc)
del(src)
/obj/effect/starender
invisibility = 101
/obj/effect/starspawner
invisibility = 101
var/spawndir = SOUTH
var/spawning = 0
/obj/effect/starspawner/West
spawndir = WEST
/obj/effect/starspawner/proc/startspawn()
spawning = 1
while(spawning)
sleep(rand(2, 30))
var/obj/effect/bgstar/S = new/obj/effect/bgstar(locate(x,y,z))
S.direction = spawndir
spawn()
S.startmove()
#undef SHUTTLE_PREPTIME
#undef SHUTTLE_LEAVETIME
#undef SHUTTLE_TRANSIT_DURATION
#undef SHUTTLE_TRANSIT_DURATION_RETURN

View File

@@ -52,7 +52,8 @@ datum/controller/game_controller/New()
if(!syndicate_code_phrase) syndicate_code_phrase = generate_code_phrase() if(!syndicate_code_phrase) syndicate_code_phrase = generate_code_phrase()
if(!syndicate_code_response) syndicate_code_response = generate_code_phrase() if(!syndicate_code_response) syndicate_code_response = generate_code_phrase()
if(!emergency_shuttle) emergency_shuttle = new /datum/shuttle_controller/emergency_shuttle() if(!emergency_shuttle) emergency_shuttle = new /datum/emergency_shuttle_controller()
if(!shuttle_controller) shuttle_controller = new /datum/shuttle_controller()
datum/controller/game_controller/proc/setup() datum/controller/game_controller/proc/setup()
world.tick_lag = config.Ticklag world.tick_lag = config.Ticklag
@@ -67,9 +68,6 @@ datum/controller/game_controller/proc/setup()
if(!ticker) if(!ticker)
ticker = new /datum/controller/gameticker() ticker = new /datum/controller/gameticker()
if(!shuttles) setup_shuttles()
shuttle_list = shuttles
setup_objects() setup_objects()
setupgenetics() setupgenetics()
setupfactions() setupfactions()
@@ -135,6 +133,7 @@ datum/controller/game_controller/proc/process()
vote.process() vote.process()
transfer_controller.process() transfer_controller.process()
shuttle_controller.process()
process_newscaster() process_newscaster()
//AIR //AIR
@@ -230,7 +229,7 @@ datum/controller/game_controller/proc/process()
total_cost = air_cost + sun_cost + mobs_cost + diseases_cost + machines_cost + objects_cost + networks_cost + powernets_cost + nano_cost + events_cost + ticker_cost total_cost = air_cost + sun_cost + mobs_cost + diseases_cost + machines_cost + objects_cost + networks_cost + powernets_cost + nano_cost + events_cost + ticker_cost
var/end_time = world.timeofday var/end_time = world.timeofday
if(end_time < start_time) if(end_time < start_time) //why not just use world.time instead?
start_time -= 864000 //deciseconds in a day start_time -= 864000 //deciseconds in a day
sleep( round(minimum_ticks - (end_time - start_time),1) ) sleep( round(minimum_ticks - (end_time - start_time),1) )
else else

View File

@@ -1,287 +1,220 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
// Controls the emergency shuttle var/global/datum/shuttle_controller/shuttle_controller
// these define the time taken for the shuttle to get to SS13 /datum/shuttle_controller
// and the time before it leaves again var/list/shuttles //maps shuttle tags to shuttle datums, so that they can be looked up.
#define SHUTTLE_PREPTIME 300 // 5 minutes = 300 seconds - after this time, the shuttle cannot be recalled var/list/process_shuttles //simple list of shuttles, for processing
#define SHUTTLE_LEAVETIME 180 // 3 minutes = 180 seconds - the duration for which the shuttle will wait at the station
#define SHUTTLE_TRANSIT_DURATION 300 // 5 minutes = 300 seconds - how long it takes for the shuttle to get to the station
#define SHUTTLE_TRANSIT_DURATION_RETURN 120 // 2 minutes = 120 seconds - for some reason it takes less time to come back, go figure.
var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle /datum/shuttle_controller/proc/process()
//process ferry shuttles
/datum/shuttle_controller/emergency_shuttle for (var/datum/shuttle/ferry/shuttle in process_shuttles)
var/datum/shuttle/ferry/emergency/shuttle if (shuttle.in_use)
var/list/escape_pods shuttle.process()
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/evac = 0 //1 = emergency evacuation, 0 = crew transfer
var/wait_for_launch = 0 //if the shuttle is waiting to launch
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/proc/setup_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_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() /datum/shuttle_controller/New()
if (wait_for_launch) shuttles = list()
if (auto_recall && world.time >= auto_recall_time) process_shuttles = list()
recall()
if (world.time >= launch_time) //time to launch the shuttle
wait_for_launch = 0
//set the travel time var/datum/shuttle/ferry/shuttle
if (!shuttle.location) //leaving from the station
//launch the pods!
for (var/datum/shuttle/ferry/escape_pod/pod in escape_pods)
pod.launch(src)
shuttle.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN // Escape shuttle and pods
else shuttle = new/datum/shuttle/ferry/emergency()
shuttle.travel_time = SHUTTLE_TRANSIT_DURATION 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 = 300
//shuttle.docking_controller_tag = "supply_shuttle"
//shuttle.dock_target_station = "cargo_bay"
shuttles["Escape"] = shuttle
process_shuttles += shuttle
shuttle.launch(src) //give the emergency shuttle controller it's shuttle
emergency_shuttle.shuttle = shuttle
emergency_shuttle.setup_pods()
process_shuttles += emergency_shuttle.escape_pods
//process the shuttles // Supply shuttle
if (shuttle.in_use) shuttle = new/datum/shuttle/ferry/supply()
shuttle.process_shuttle() shuttle.location = 1
for (var/datum/shuttle/ferry/escape_pod/pod in escape_pods) shuttle.warmup_time = 10
if (pod.in_use) shuttle.area_offsite = locate(/area/supply/dock)
pod.process_shuttle() 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
//called when the shuttle has arrived. supply_controller.shuttle = shuttle
/datum/shuttle_controller/emergency_shuttle/proc/shuttle_arrived()
if (!shuttle.location) //at station
launch_time = world.time + SHUTTLE_LEAVETIME*10
wait_for_launch = 1 //get ready to return
//so we don't have emergency_shuttle.shuttle.location everywhere // Admin shuttles.
/datum/shuttle_controller/emergency_shuttle/proc/location() shuttle = new()
if (!shuttle) shuttle.location = 1
return 1 //if we dont have a shuttle datum, just act like it's at centcom shuttle.warmup_time = 10
return shuttle.location shuttle.area_offsite = locate(/area/shuttle/transport1/centcom)
shuttle.area_station = locate(/area/shuttle/transport1/station)
shuttle.docking_controller_tag = "centcom_shuttle"
shuttle.dock_target_station = "centcom_shuttle_dock_airlock"
shuttle.dock_target_offsite = "centcom_shuttle_bay"
shuttles["Centcom"] = shuttle
process_shuttles += shuttle
//calls the shuttle for an emergency evacuation shuttle = new()
/datum/shuttle_controller/emergency_shuttle/proc/call_evac() shuttle.location = 1
if(!can_call()) return shuttle.warmup_time = 10 //want some warmup time so people can cancel.
shuttle.area_offsite = locate(/area/shuttle/administration/centcom)
shuttle.area_station = locate(/area/shuttle/administration/station)
shuttle.docking_controller_tag = "admin_shuttle"
shuttle.dock_target_station = "admin_shuttle_dock_airlock"
shuttle.dock_target_offsite = "admin_shuttle_bay"
shuttles["Administration"] = shuttle
process_shuttles += shuttle
//set the launch timer shuttle = new()
launch_time = world.time + get_shuttle_prep_time()*10 shuttle.area_offsite = locate(/area/shuttle/alien/base)
auto_recall_time = rand(world.time + 300, launch_time - 300) shuttle.area_station = locate(/area/shuttle/alien/mine)
wait_for_launch = 1 shuttles["Alien"] = shuttle
//process_shuttles += shuttle //don't need to process this. It can only be moved using admin magic anyways.
evac = 1 // Public shuttles
captain_announce("An emergency evacuation shuttle has been called. It will arrive in approximately [round(estimate_arrival_time()/60)] minutes.") shuttle = new()
world << sound('sound/AI/shuttlecalled.ogg') shuttle.location = 1
for(var/area/A in world) shuttle.warmup_time = 10
if(istype(A, /area/hallway)) shuttle.area_offsite = locate(/area/shuttle/constructionsite/site)
A.readyalert() shuttle.area_station = locate(/area/shuttle/constructionsite/station)
shuttle.docking_controller_tag = "engineering_shuttle"
shuttle.dock_target_station = "engineering_dock_airlock"
shuttle.dock_target_offsite = "engineering_station_airlock"
shuttles["Engineering"] = shuttle
process_shuttles += shuttle
//calls the shuttle for a routine crew transfer shuttle = new()
/datum/shuttle_controller/emergency_shuttle/proc/call_transfer() shuttle.warmup_time = 10
if(!can_call()) return shuttle.area_offsite = locate(/area/shuttle/mining/outpost)
shuttle.area_station = locate(/area/shuttle/mining/station)
shuttle.docking_controller_tag = "mining_shuttle"
shuttle.dock_target_station = "mining_dock_airlock"
shuttle.dock_target_offsite = "mining_outpost_airlock"
shuttles["Mining"] = shuttle
process_shuttles += shuttle
//set the launch timer shuttle = new()
launch_time = world.time + get_shuttle_prep_time() shuttle.warmup_time = 10
auto_recall_time = rand(world.time + 300, launch_time - 300) shuttle.area_offsite = locate(/area/shuttle/research/outpost)
wait_for_launch = 1 shuttle.area_station = locate(/area/shuttle/research/station)
shuttle.docking_controller_tag = "research_shuttle"
shuttle.dock_target_station = "research_dock_airlock"
shuttle.dock_target_offsite = "research_outpost_dock"
shuttles["Research"] = shuttle
process_shuttles += shuttle
captain_announce("A crew transfer has been initiated. The shuttle has been called. It will arrive in [round(estimate_arrival_time()/60)] minutes.") // ERT Shuttle
var/datum/shuttle/ferry/multidock/specops/ERT = new()
ERT.location = 0
ERT.warmup_time = 10
ERT.area_offsite = locate(/area/shuttle/specops/station) //centcom is the home station, the Exodus is offsite
ERT.area_station = locate(/area/shuttle/specops/centcom)
ERT.docking_controller_tag = "specops_shuttle_port"
ERT.docking_controller_tag_station = "specops_shuttle_port"
ERT.docking_controller_tag_offsite = "specops_shuttle_fore"
ERT.dock_target_station = "specops_centcom_dock"
ERT.dock_target_offsite = "specops_dock_airlock"
shuttles["Special Operations"] = ERT
process_shuttles += ERT
//recalls the shuttle //Vox Shuttle.
/datum/shuttle_controller/emergency_shuttle/proc/recall() var/datum/shuttle/multi_shuttle/VS = new/datum/shuttle/multi_shuttle()
if (!can_recall()) return VS.origin = /area/shuttle/vox/station
wait_for_launch = 0 VS.destinations = list(
shuttle.cancel_launch(src) "Fore Starboard Solars" = /area/vox_station/northeast_solars,
"Fore Port Solars" = /area/vox_station/northwest_solars,
"Aft Starboard Solars" = /area/vox_station/southeast_solars,
"Aft Port Solars" = /area/vox_station/southwest_solars,
"Mining asteroid" = /area/vox_station/mining
)
if (evac) VS.announcer = "NSV Icarus"
captain_announce("The emergency shuttle has been recalled.") VS.arrival_message = "Attention, Exodus, we just tracked a small target bypassing our defensive perimeter. Can't fire on it without hitting the station - you've got incoming visitors, like it or not."
world << sound('sound/AI/shuttlerecalled.ogg') VS.departure_message = "Your guests are pulling away, Exodus - moving too fast for us to draw a bead on them. Looks like they're heading out of the system at a rapid clip."
VS.interim = /area/vox_station/transit
for(var/area/A in world) VS.warmup_time = 10
if(istype(A, /area/hallway)) shuttles["Vox Skipjack"] = VS
A.readyreset()
evac = 0
else
captain_announce("The scheduled crew transfer has been cancelled.")
/datum/shuttle_controller/emergency_shuttle/proc/can_call() //Nuke Ops shuttle.
if (deny_shuttle) var/datum/shuttle/multi_shuttle/MS = new/datum/shuttle/multi_shuttle()
return 0 MS.origin = /area/syndicate_station/start
if (shuttle.moving_status != SHUTTLE_IDLE || !shuttle.location) //must be idle at centcom
return 0
if (wait_for_launch) //already launching
return 0
return 1
//this only returns 0 if it would absolutely make no sense to recall MS.destinations = list(
//e.g. the shuttle is already at the station or wasn't called to begin with "Northwest of the station" = /area/syndicate_station/northwest,
//other reasons for the shuttle not being recallable should be handled elsewhere "North of the station" = /area/syndicate_station/north,
/datum/shuttle_controller/emergency_shuttle/proc/can_recall() "Northeast of the station" = /area/syndicate_station/northeast,
if (shuttle.moving_status == SHUTTLE_INTRANSIT) //if the shuttle is already in transit then it's too late "Southwest of the station" = /area/syndicate_station/southwest,
return 0 "South of the station" = /area/syndicate_station/south,
if (!shuttle.location) //already at the station. "Southeast of the station" = /area/syndicate_station/southeast,
return 0 "Telecomms Satellite" = /area/syndicate_station/commssat,
if (!wait_for_launch) //we weren't going anywhere, anyways... "Mining Asteroid" = /area/syndicate_station/mining
return 0 )
return 1
/datum/shuttle_controller/emergency_shuttle/proc/get_shuttle_prep_time() MS.announcer = "NSV Icarus"
// During mutiny rounds, the shuttle takes twice as long. MS.arrival_message = "Attention, Exodus, you have a large signature approaching the station - looks unarmed to surface scans. We're too far out to intercept - brace for visitors."
if(ticker && istype(ticker.mode,/datum/game_mode/mutiny)) MS.departure_message = "Your visitors are on their way out of the system, Exodus, burning delta-v like it's nothing. Good riddance."
return SHUTTLE_PREPTIME * 3 //15 minutes MS.interim = /area/syndicate_station/transit
return SHUTTLE_PREPTIME MS.warmup_time = 10
shuttles["Syndicate"] = MS
/* //This is called by gameticker after all the machines and radio frequencies have been properly initialized
These procs are not really used by the controller itself, but are for other parts of the /datum/shuttle_controller/proc/setup_shuttle_docks()
game whose logic depends on the emergency shuttle. var/datum/shuttle/shuttle
*/ var/datum/shuttle/ferry/multidock/multidock
var/list/dock_controller_map = list() //so we only have to iterate once through each list
//returns the time left until the shuttle arrives at it's destination, in seconds //multidock shuttles
/datum/shuttle_controller/emergency_shuttle/proc/estimate_arrival_time() var/list/dock_controller_map_station = list()
var/eta var/list/dock_controller_map_offsite = list()
if (isnull(shuttle.jump_time))
eta = launch_time + shuttle.travel_time
else
eta = shuttle.jump_time + shuttle.travel_time
return (eta - world.time)/10
//returns the time left until the shuttle launches, in seconds for (var/shuttle_tag in shuttles)
/datum/shuttle_controller/emergency_shuttle/proc/estimate_launch_time() shuttle = shuttles[shuttle_tag]
return (launch_time - world.time)/10 if (shuttle.docking_controller_tag)
dock_controller_map[shuttle.docking_controller_tag] = shuttle
if (istype(shuttle, /datum/shuttle/ferry/multidock))
multidock = shuttle
dock_controller_map_station[multidock.docking_controller_tag_station] = multidock
dock_controller_map_offsite[multidock.docking_controller_tag_offsite] = multidock
/datum/shuttle_controller/emergency_shuttle/proc/has_eta() //search for the controllers, if we have one.
return (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE) if (dock_controller_map.len)
for (var/obj/machinery/embedded_controller/radio/C in machines) //only radio controllers are supported at the moment
//returns 1 if the shuttle has gone to the station and come back at least once, if (istype(C.program, /datum/computer/file/embedded_program/docking))
//used for game completion checking purposes if (C.id_tag in dock_controller_map)
/datum/shuttle_controller/emergency_shuttle/proc/returned() shuttle = dock_controller_map[C.id_tag]
return (departed && shuttle.moving_status != SHUTTLE_IDLE && shuttle.location) //we've gone to the station at least once, no longer in transit and are idle back at centcom shuttle.docking_controller = C.program
dock_controller_map -= C.id_tag
//returns 1 if the shuttle is not idle at centcom if (C.id_tag in dock_controller_map_station)
/datum/shuttle_controller/emergency_shuttle/proc/online() multidock = dock_controller_map_station[C.id_tag]
if (!shuttle.location) //not at centcom if (istype(multidock))
return 1 multidock.docking_controller_station = C.program
if (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE) dock_controller_map_station -= C.id_tag
return 1 if (C.id_tag in dock_controller_map_offsite)
return 0 multidock = dock_controller_map_offsite[C.id_tag]
if (istype(multidock))
//returns 1 if the shuttle is currently in transit (or just leaving) to the station multidock.docking_controller_offsite = C.program
/datum/shuttle_controller/emergency_shuttle/proc/going_to_station() dock_controller_map_offsite -= C.id_tag
return (!shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE)
//returns 1 if the shuttle is currently in transit (or just leaving) to centcom
/datum/shuttle_controller/emergency_shuttle/proc/going_to_centcom()
return (shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE)
//returns 1 if the shuttle is docked at the station and waiting to leave
/datum/shuttle_controller/emergency_shuttle/proc/waiting_to_leave()
if (shuttle.location)
return 0 //not at station
if (!wait_for_launch)
return 0 //not going anywhere
if (shuttle.moving_status != SHUTTLE_IDLE)
return 0 //shuttle is doing stuff
return 1
/*
Some slapped-together star effects for maximum spess immershuns. Basically consists of a
spawner, an ender, and bgstar. Spawners create bgstars, bgstars shoot off into a direction
until they reach a starender.
*/
/obj/effect/bgstar
name = "star"
var/speed = 10
var/direction = SOUTH
layer = 2 // TURF_LAYER
/obj/effect/bgstar/New()
..()
pixel_x += rand(-2,30)
pixel_y += rand(-2,30)
var/starnum = pick("1", "1", "1", "2", "3", "4")
icon_state = "star"+starnum
speed = rand(2, 5)
/obj/effect/bgstar/proc/startmove()
while(src)
sleep(speed)
step(src, direction)
for(var/obj/effect/starender/E in loc)
del(src)
/obj/effect/starender
invisibility = 101
/obj/effect/starspawner
invisibility = 101
var/spawndir = SOUTH
var/spawning = 0
/obj/effect/starspawner/West
spawndir = WEST
/obj/effect/starspawner/proc/startspawn()
spawning = 1
while(spawning)
sleep(rand(2, 30))
var/obj/effect/bgstar/S = new/obj/effect/bgstar(locate(x,y,z))
S.direction = spawndir
spawn()
S.startmove()
//sanity check
if (dock_controller_map.len || dock_controller_map_station.len || dock_controller_map_offsite.len)
var/dat = ""
for (var/dock_tag in dock_controller_map + dock_controller_map_station + dock_controller_map_offsite)
dat += "\"[dock_tag]\", "
world << "/red /b warning: shuttles with docking tags [dat] could not find their controllers!"
//makes all shuttles docked to something at round start go into the docked state
for (var/shuttle_tag in shuttles)
shuttle = shuttles[shuttle_tag]
shuttle.dock()

View File

@@ -27,8 +27,7 @@
message_admins("Admin [key_name_admin(usr)] has restarted the [controller] controller.") message_admins("Admin [key_name_admin(usr)] has restarted the [controller] controller.")
return return
/client/proc/debug_controller(controller in list("Master","Failsafe","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply","Shuttles","Emergency Shuttle","Configuration","pAI", "Cameras", "Transfer Controller"))
/client/proc/debug_controller(controller in list("Master","Failsafe","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply","Emergency Shuttle","Configuration","pAI", "Cameras", "Transfer Controller"))
set category = "Debug" set category = "Debug"
set name = "Debug Controller" set name = "Debug Controller"
set desc = "Debug the various periodic loop controllers for the game (be careful!)" set desc = "Debug the various periodic loop controllers for the game (be careful!)"
@@ -62,6 +61,9 @@
if("Supply") if("Supply")
debug_variables(supply_controller) debug_variables(supply_controller)
feedback_add_details("admin_verb","DSupply") feedback_add_details("admin_verb","DSupply")
if("Shuttles")
debug_variables(shuttle_controller)
feedback_add_details("admin_verb","DShuttles")
if("Emergency Shuttle") if("Emergency Shuttle")
debug_variables(emergency_shuttle) debug_variables(emergency_shuttle)
feedback_add_details("admin_verb","DEmergency") feedback_add_details("admin_verb","DEmergency")

View File

@@ -130,7 +130,7 @@ var/global/datum/controller/gameticker/ticker
//here to initialize the random events nicely at round start //here to initialize the random events nicely at round start
setup_economy() setup_economy()
setup_shuttle_docks() shuttle_controller.setup_shuttle_docks()
spawn(0)//Forking here so we dont have to wait for this to finish spawn(0)//Forking here so we dont have to wait for this to finish
mode.post_setup() mode.post_setup()

View File

@@ -41,7 +41,7 @@
message_admins("[key_name_admin(user)] has launched the shuttle") message_admins("[key_name_admin(user)] has launched the shuttle")
log_game("[user.ckey] has launched the shuttle early") log_game("[user.ckey] has launched the shuttle early")
world << "\blue <B>Alert: Shuttle launch time shortened to 10 seconds!</B>" world << "\blue <B>Alert: Shuttle launch time shortened to 10 seconds!</B>"
emergency_shuttle.launch_time = min(world.time + 100, emergency_shuttle.launch_time) emergency_shuttle.set_launch_countdown(10)
//src.authorized = null //src.authorized = null
del(src.authorized) del(src.authorized)
src.authorized = list( ) src.authorized = list( )
@@ -62,7 +62,7 @@
switch(choice) switch(choice)
if("Launch") if("Launch")
world << "\blue <B>Alert: Shuttle launch time shortened to 10 seconds!</B>" world << "\blue <B>Alert: Shuttle launch time shortened to 10 seconds!</B>"
emergency_shuttle.launch_time = min(world.time + 100, emergency_shuttle.launch_time) emergency_shuttle.set_launch_countdown(10)
emagged = 1 emagged = 1
if("Cancel") if("Cancel")
return return

View File

@@ -163,15 +163,6 @@ var/list/mechtoys = list(
sleep(processing_interval) sleep(processing_interval)
spawn(0)
set background = 1
while(1)
if(processing)
if (shuttle.in_use)
shuttle.process_shuttle()
sleep(10)
//To stop things being sent to centcomm which should not be sent to centcomm. Recursively checks for these types. //To stop things being sent to centcomm which should not be sent to centcomm. Recursively checks for these types.
proc/forbidden_atoms_check(atom/A) proc/forbidden_atoms_check(atom/A)
if(istype(A,/mob/living)) if(istype(A,/mob/living))

View File

@@ -1924,15 +1924,15 @@
if("moveshuttle") if("moveshuttle")
if(!shuttles) return // Something is very wrong, the global shuttle list has not been created. if(!shuttle_controller) return // Something is very wrong, the shuttle controller has not been created.
feedback_inc("admin_secrets_fun_used",1) feedback_inc("admin_secrets_fun_used",1)
feedback_add_details("admin_secrets_fun_used","ShA") feedback_add_details("admin_secrets_fun_used","ShA")
var/shuttle_tag = input("Which shuttle do you want to call?") as null|anything in shuttles var/shuttle_tag = input("Which shuttle do you want to call?") as null|anything in shuttle_controller.shuttles
if(shuttle_tag) if(shuttle_tag)
var/datum/shuttle/S = shuttles[shuttle_tag] var/datum/shuttle/S = shuttle_controller.shuttles[shuttle_tag]
if(istype(S) && S.moving_status == 0) if(istype(S) && S.moving_status == 0)
S.move() S.move()
message_admins("\blue [key_name_admin(usr)] moved the [shuttle_tag] shuttle", 1) message_admins("\blue [key_name_admin(usr)] moved the [shuttle_tag] shuttle", 1)

View File

@@ -3,14 +3,12 @@
//shuttle moving state defines are in setup.dm //shuttle moving state defines are in setup.dm
var/global/list/shuttles
/datum/shuttle /datum/shuttle
var/warmup_time = 0 var/warmup_time = 0
var/moving_status = SHUTTLE_IDLE //prevents people from doing things they shouldn't when the shuttle is in transit var/moving_status = SHUTTLE_IDLE
var/docking_controller_tag //tag of the controller used to coordinate docking var/docking_controller_tag //tag of the controller used to coordinate docking
var/datum/computer/file/embedded_program/docking/docking_controller //the controller itself var/datum/computer/file/embedded_program/docking/docking_controller //the controller itself. (micro-controller, not game controller)
/datum/shuttle/proc/short_jump(var/area/origin,var/area/destination) /datum/shuttle/proc/short_jump(var/area/origin,var/area/destination)
if(moving_status != SHUTTLE_IDLE) return if(moving_status != SHUTTLE_IDLE) return
@@ -35,7 +33,7 @@ var/global/list/shuttles
move(locate(departing),locate(interim)) move(locate(departing),locate(interim))
sleep(travel_time) sleep(travel_time*10)
move(locate(interim),locate(destination)) move(locate(interim),locate(destination))
@@ -117,199 +115,3 @@ var/global/list/shuttles
M.Weaken(3) M.Weaken(3)
return return
/proc/setup_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()
shuttle.location = 1
shuttle.warmup_time = 10
shuttle.area_offsite = locate(/area/shuttle/transport1/centcom)
shuttle.area_station = locate(/area/shuttle/transport1/station)
shuttle.docking_controller_tag = "centcom_shuttle"
shuttle.dock_target_station = "centcom_shuttle_dock_airlock"
shuttle.dock_target_offsite = "centcom_shuttle_bay"
shuttles["Centcom"] = shuttle
shuttle = new()
shuttle.location = 1
shuttle.warmup_time = 10 //want some warmup time so people can cancel.
shuttle.area_offsite = locate(/area/shuttle/administration/centcom)
shuttle.area_station = locate(/area/shuttle/administration/station)
shuttle.docking_controller_tag = "admin_shuttle"
shuttle.dock_target_station = "admin_shuttle_dock_airlock"
shuttle.dock_target_offsite = "admin_shuttle_bay"
shuttles["Administration"] = shuttle
shuttle = new()
shuttle.area_offsite = locate(/area/shuttle/alien/base)
shuttle.area_station = locate(/area/shuttle/alien/mine)
shuttles["Alien"] = shuttle
// Public shuttles
shuttle = new()
shuttle.location = 1
shuttle.warmup_time = 10
shuttle.area_offsite = locate(/area/shuttle/constructionsite/site)
shuttle.area_station = locate(/area/shuttle/constructionsite/station)
shuttle.docking_controller_tag = "engineering_shuttle"
shuttle.dock_target_station = "engineering_dock_airlock"
shuttle.dock_target_offsite = "engineering_station_airlock"
shuttles["Engineering"] = shuttle
shuttle = new()
shuttle.warmup_time = 10
shuttle.area_offsite = locate(/area/shuttle/mining/outpost)
shuttle.area_station = locate(/area/shuttle/mining/station)
shuttle.docking_controller_tag = "mining_shuttle"
shuttle.dock_target_station = "mining_dock_airlock"
shuttle.dock_target_offsite = "mining_outpost_airlock"
shuttles["Mining"] = shuttle
shuttle = new()
shuttle.warmup_time = 10
shuttle.area_offsite = locate(/area/shuttle/research/outpost)
shuttle.area_station = locate(/area/shuttle/research/station)
shuttle.docking_controller_tag = "research_shuttle"
shuttle.dock_target_station = "research_dock_airlock"
shuttle.dock_target_offsite = "research_outpost_dock"
shuttles["Research"] = shuttle
// ERT Shuttle
var/datum/shuttle/ferry/multidock/specops/ERT = new()
ERT.location = 0
ERT.warmup_time = 10
ERT.area_offsite = locate(/area/shuttle/specops/station) //centcom is the home station, the Exodus is offsite
ERT.area_station = locate(/area/shuttle/specops/centcom)
ERT.docking_controller_tag = "specops_shuttle_port"
ERT.docking_controller_tag_station = "specops_shuttle_port"
ERT.docking_controller_tag_offsite = "specops_shuttle_fore"
ERT.dock_target_station = "specops_centcom_dock"
ERT.dock_target_offsite = "specops_dock_airlock"
shuttles["Special Operations"] = ERT
//Vox Shuttle.
var/datum/shuttle/multi_shuttle/VS = new/datum/shuttle/multi_shuttle()
VS.origin = /area/shuttle/vox/station
VS.destinations = list(
"Fore Starboard Solars" = /area/vox_station/northeast_solars,
"Fore Port Solars" = /area/vox_station/northwest_solars,
"Aft Starboard Solars" = /area/vox_station/southeast_solars,
"Aft Port Solars" = /area/vox_station/southwest_solars,
"Mining asteroid" = /area/vox_station/mining
)
VS.announcer = "NSV Icarus"
VS.arrival_message = "Attention, Exodus, we just tracked a small target bypassing our defensive perimeter. Can't fire on it without hitting the station - you've got incoming visitors, like it or not."
VS.departure_message = "Your guests are pulling away, Exodus - moving too fast for us to draw a bead on them. Looks like they're heading out of the system at a rapid clip."
VS.interim = /area/vox_station/transit
VS.warmup_time = 10
shuttles["Vox Skipjack"] = VS
//Nuke Ops shuttle.
var/datum/shuttle/multi_shuttle/MS = new/datum/shuttle/multi_shuttle()
MS.origin = /area/syndicate_station/start
MS.destinations = list(
"Northwest of the station" = /area/syndicate_station/northwest,
"North of the station" = /area/syndicate_station/north,
"Northeast of the station" = /area/syndicate_station/northeast,
"Southwest of the station" = /area/syndicate_station/southwest,
"South of the station" = /area/syndicate_station/south,
"Southeast of the station" = /area/syndicate_station/southeast,
"Telecomms Satellite" = /area/syndicate_station/commssat,
"Mining Asteroid" = /area/syndicate_station/mining
)
MS.announcer = "NSV Icarus"
MS.arrival_message = "Attention, Exodus, you have a large signature approaching the station - looks unarmed to surface scans. We're too far out to intercept - brace for visitors."
MS.departure_message = "Your visitors are on their way out of the system, Exodus, burning delta-v like it's nothing. Good riddance."
MS.interim = /area/syndicate_station/transit
MS.warmup_time = 10
shuttles["Syndicate"] = MS
/proc/setup_shuttle_docks()
var/datum/shuttle/shuttle
var/datum/shuttle/ferry/multidock/multidock
var/list/dock_controller_map = list() //so we only have to iterate once through each list
//multidock shuttles
var/list/dock_controller_map_station = list()
var/list/dock_controller_map_offsite = list()
for (var/shuttle_tag in shuttles)
shuttle = shuttles[shuttle_tag]
if (shuttle.docking_controller_tag)
dock_controller_map[shuttle.docking_controller_tag] = shuttle
if (istype(shuttle, /datum/shuttle/ferry/multidock))
multidock = shuttle
dock_controller_map_station[multidock.docking_controller_tag_station] = multidock
dock_controller_map_offsite[multidock.docking_controller_tag_offsite] = multidock
//search for the controllers, if we have one.
if (dock_controller_map.len)
for (var/obj/machinery/embedded_controller/radio/C in machines) //only radio controllers are supported at the moment
if (istype(C.program, /datum/computer/file/embedded_program/docking))
if (C.id_tag in dock_controller_map)
shuttle = dock_controller_map[C.id_tag]
shuttle.docking_controller = C.program
dock_controller_map -= C.id_tag
if (C.id_tag in dock_controller_map_station)
multidock = dock_controller_map_station[C.id_tag]
if (istype(multidock))
multidock.docking_controller_station = C.program
dock_controller_map_station -= C.id_tag
if (C.id_tag in dock_controller_map_offsite)
multidock = dock_controller_map_offsite[C.id_tag]
if (istype(multidock))
multidock.docking_controller_offsite = C.program
dock_controller_map_offsite -= C.id_tag
//sanity check
if (dock_controller_map.len || dock_controller_map_station.len || dock_controller_map_offsite.len)
var/dat = ""
for (var/dock_tag in dock_controller_map + dock_controller_map_station + dock_controller_map_offsite)
dat += "\"[dock_tag]\", "
world << "/red /b warning: shuttles with docking tags [dat] could not find their controllers!"
//makes all shuttles docked to something at round start go into the docked state
for (var/shuttle_tag in shuttles)
shuttle = shuttles[shuttle_tag]
shuttle.dock()

View File

@@ -9,8 +9,7 @@
var/direction = 0 //0 = going to station, 1 = going to offsite. var/direction = 0 //0 = going to station, 1 = going to offsite.
var/process_state = IDLE_STATE var/process_state = IDLE_STATE
//this mutex ensures that only one console is processing the shuttle's controls at a time var/in_use = null //tells the controller whether this shuttle needs processing
var/obj/machinery/computer/shuttle_control/in_use = null //this doesn't have to be a console...
var/area_transition var/area_transition
var/travel_time = 0 var/travel_time = 0
@@ -68,7 +67,7 @@
return area_station return area_station
return area_offsite return area_offsite
/datum/shuttle/ferry/proc/process_shuttle() /datum/shuttle/ferry/proc/process()
switch(process_state) switch(process_state)
if (WAIT_LAUNCH) if (WAIT_LAUNCH)
if (skip_docking_checks() || docking_controller.can_launch()) if (skip_docking_checks() || docking_controller.can_launch())
@@ -98,7 +97,7 @@
return dock_target return dock_target
/datum/shuttle/ferry/proc/launch(var/obj/machinery/computer/shuttle_control/user) /datum/shuttle/ferry/proc/launch(var/user)
if (!can_launch()) return if (!can_launch()) return
in_use = user //obtain an exclusive lock on the shuttle in_use = user //obtain an exclusive lock on the shuttle
@@ -106,12 +105,15 @@
process_state = WAIT_LAUNCH process_state = WAIT_LAUNCH
undock() undock()
/datum/shuttle/ferry/proc/force_launch(var/obj/machinery/computer/shuttle_control/user) /datum/shuttle/ferry/proc/force_launch(var/user)
if (!can_force()) return if (!can_force()) return
in_use = user //obtain an exclusive lock on the shuttle in_use = user //obtain an exclusive lock on the shuttle
short_jump() if (travel_time && area_transition)
long_jump(null, null, area_transition, travel_time)
else
short_jump()
process_state = WAIT_ARRIVE process_state = WAIT_ARRIVE
@@ -166,27 +168,6 @@
var/launch_override = 0 var/launch_override = 0
//TODO move this stuff into the shuttle datum itself, instead of manipulating the shuttle's members
/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()
/obj/machinery/computer/shuttle_control/Del()
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
/obj/machinery/computer/shuttle_control/attack_hand(user as mob) /obj/machinery/computer/shuttle_control/attack_hand(user as mob)
if(..(user)) if(..(user))
return return
@@ -196,7 +177,7 @@
/obj/machinery/computer/shuttle_control/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null) /obj/machinery/computer/shuttle_control/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
var/data[0] var/data[0]
var/datum/shuttle/ferry/shuttle = shuttles[shuttle_tag] var/datum/shuttle/ferry/shuttle = shuttle_controller.shuttles[shuttle_tag]
if (!istype(shuttle)) if (!istype(shuttle))
return return
@@ -241,7 +222,6 @@
ui.open() ui.open()
ui.set_auto_update(1) ui.set_auto_update(1)
//TODO: Canceling launches, dock overrides using the console, forcing dock/undock
/obj/machinery/computer/shuttle_control/Topic(href, href_list) /obj/machinery/computer/shuttle_control/Topic(href, href_list)
if(..()) if(..())
return return
@@ -249,7 +229,7 @@
usr.set_machine(src) usr.set_machine(src)
src.add_fingerprint(usr) src.add_fingerprint(usr)
var/datum/shuttle/ferry/shuttle = shuttles[shuttle_tag] var/datum/shuttle/ferry/shuttle = shuttle_controller.shuttles[shuttle_tag]
if (!istype(shuttle)) if (!istype(shuttle))
return return
@@ -260,11 +240,11 @@
else if(href_list["cancel"]) else if(href_list["cancel"])
shuttle.cancel_launch() shuttle.cancel_launch()
/obj/machinery/computer/shuttle_control/attackby(obj/item/weapon/W as obj, mob/user as mob) /obj/machinery/computer/shuttle_control/attackby(obj/item/weapon/W as obj, mob/user as mob)
if (istype(W, /obj/item/weapon/card/emag)) if (istype(W, /obj/item/weapon/card/emag))
src.req_access = list() src.req_access = list()
src.req_one_access = list()
hacked = 1 hacked = 1
usr << "You short out the console's ID checking system. It's now available to everyone!" usr << "You short out the console's ID checking system. It's now available to everyone!"
else else
@@ -273,8 +253,3 @@
/obj/machinery/computer/shuttle_control/bullet_act(var/obj/item/projectile/Proj) /obj/machinery/computer/shuttle_control/bullet_act(var/obj/item/projectile/Proj)
visible_message("[Proj] ricochets off [src]!") visible_message("[Proj] ricochets off [src]!")
#undef IDLE_STATE
#undef WAIT_LAUNCH
#undef WAIT_ARRIVE
#undef WAIT_FINISH

View File

@@ -4,8 +4,8 @@
var/cloaked = 1 var/cloaked = 1
var/at_origin = 1 var/at_origin = 1
var/move_time = 240 var/move_time = 240
var/cooldown = 200 var/cooldown = 20
var/last_move = 0 var/last_move = 0 //the time at which we last moved
var/announcer var/announcer
var/arrival_message var/arrival_message
@@ -21,6 +21,10 @@
..() ..()
if(origin) last_departed = origin if(origin) last_departed = origin
/datum/shuttle/multi_shuttle/move()
..()
last_move = world.time
/datum/shuttle/multi_shuttle/proc/announce_departure() /datum/shuttle/multi_shuttle/proc/announce_departure()
if(cloaked || isnull(departure_message)) if(cloaked || isnull(departure_message))
@@ -44,7 +48,7 @@
return return
src.add_fingerprint(user) src.add_fingerprint(user)
var/datum/shuttle/multi_shuttle/MS = shuttles[shuttle_tag] var/datum/shuttle/multi_shuttle/MS = shuttle_controller.shuttles[shuttle_tag]
if(!istype(MS)) return if(!istype(MS)) return
var/dat var/dat
@@ -57,7 +61,7 @@
var/area/areacheck = get_area(src) var/area/areacheck = get_area(src)
dat += "Location: [areacheck.name]<br>" dat += "Location: [areacheck.name]<br>"
if((MS.last_move + MS.cooldown) > world.time) if((MS.last_move + MS.cooldown*10) > world.time)
dat += "<font color='red'>Engines charging.</font><br>" dat += "<font color='red'>Engines charging.</font><br>"
else else
dat += "<font color='green'>Engines ready.</font><br>" dat += "<font color='green'>Engines ready.</font><br>"
@@ -76,17 +80,13 @@
usr.set_machine(src) usr.set_machine(src)
src.add_fingerprint(usr) src.add_fingerprint(usr)
var/datum/shuttle/multi_shuttle/MS = shuttles[shuttle_tag] var/datum/shuttle/multi_shuttle/MS = shuttle_controller.shuttles[shuttle_tag]
if(!istype(MS)) return if(!istype(MS)) return
if (MS.moving_status != SHUTTLE_IDLE) if (MS.moving_status != SHUTTLE_IDLE)
usr << "\blue [shuttle_tag] vessel is moving." usr << "\blue [shuttle_tag] vessel is moving."
return return
if((MS.last_move + MS.cooldown) > world.time)
usr << "\red The ship is inoperable while the engines are charging."
return
if(href_list["start"]) if(href_list["start"])
if(MS.at_origin) if(MS.at_origin)
@@ -109,6 +109,9 @@
usr << "\red Ship stealth systems have been [(MS.cloaked ? "activated. The station will not" : "deactivated. The station will")] be warned of our arrival." usr << "\red Ship stealth systems have been [(MS.cloaked ? "activated. The station will not" : "deactivated. The station will")] be warned of our arrival."
if(href_list["move_multi"]) if(href_list["move_multi"])
if((MS.last_move + MS.cooldown) > world.time)
usr << "\red The ship's drive is inoperable while the engines are charging."
return
var/choice = input("Select a destination.") as null|anything in MS.destinations var/choice = input("Select a destination.") as null|anything in MS.destinations
if(!choice) return if(!choice) return