mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 02:34:00 +00:00
Adds direction arg for area/move_contents_to()
Attempts to fix shuttle corner transition effect Fixes bad ETAs appearing on status displays
This commit is contained in:
@@ -1294,6 +1294,7 @@
|
|||||||
#include "code\modules\shuttles\shuttle.dm"
|
#include "code\modules\shuttles\shuttle.dm"
|
||||||
#include "code\modules\shuttles\shuttle_console.dm"
|
#include "code\modules\shuttles\shuttle_console.dm"
|
||||||
#include "code\modules\shuttles\shuttle_emergency.dm"
|
#include "code\modules\shuttles\shuttle_emergency.dm"
|
||||||
|
#include "code\modules\shuttles\shuttle_ferry.dm"
|
||||||
#include "code\modules\shuttles\shuttle_specops.dm"
|
#include "code\modules\shuttles\shuttle_specops.dm"
|
||||||
#include "code\modules\shuttles\shuttle_supply.dm"
|
#include "code\modules\shuttles\shuttle_supply.dm"
|
||||||
#include "code\modules\shuttles\shuttles_multi.dm"
|
#include "code\modules\shuttles\shuttles_multi.dm"
|
||||||
|
|||||||
@@ -2,14 +2,6 @@
|
|||||||
|
|
||||||
// Controls the emergency shuttle
|
// 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
|
var/global/datum/emergency_shuttle_controller/emergency_shuttle
|
||||||
|
|
||||||
/datum/emergency_shuttle_controller
|
/datum/emergency_shuttle_controller
|
||||||
@@ -37,7 +29,8 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
|
|||||||
pod.area_station = locate(/area/shuttle/escape_pod1/station)
|
pod.area_station = locate(/area/shuttle/escape_pod1/station)
|
||||||
pod.area_offsite = locate(/area/shuttle/escape_pod1/centcom)
|
pod.area_offsite = locate(/area/shuttle/escape_pod1/centcom)
|
||||||
pod.area_transition = locate(/area/shuttle/escape_pod1/transit)
|
pod.area_transition = locate(/area/shuttle/escape_pod1/transit)
|
||||||
pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN
|
pod.transit_direction = NORTH
|
||||||
|
pod.move_time = SHUTTLE_TRANSIT_DURATION_RETURN
|
||||||
escape_pods += pod
|
escape_pods += pod
|
||||||
|
|
||||||
pod = new()
|
pod = new()
|
||||||
@@ -46,7 +39,8 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
|
|||||||
pod.area_station = locate(/area/shuttle/escape_pod2/station)
|
pod.area_station = locate(/area/shuttle/escape_pod2/station)
|
||||||
pod.area_offsite = locate(/area/shuttle/escape_pod2/centcom)
|
pod.area_offsite = locate(/area/shuttle/escape_pod2/centcom)
|
||||||
pod.area_transition = locate(/area/shuttle/escape_pod2/transit)
|
pod.area_transition = locate(/area/shuttle/escape_pod2/transit)
|
||||||
pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN
|
pod.transit_direction = NORTH
|
||||||
|
pod.move_time = SHUTTLE_TRANSIT_DURATION_RETURN
|
||||||
escape_pods += pod
|
escape_pods += pod
|
||||||
|
|
||||||
pod = new()
|
pod = new()
|
||||||
@@ -55,7 +49,8 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
|
|||||||
pod.area_station = locate(/area/shuttle/escape_pod3/station)
|
pod.area_station = locate(/area/shuttle/escape_pod3/station)
|
||||||
pod.area_offsite = locate(/area/shuttle/escape_pod3/centcom)
|
pod.area_offsite = locate(/area/shuttle/escape_pod3/centcom)
|
||||||
pod.area_transition = locate(/area/shuttle/escape_pod3/transit)
|
pod.area_transition = locate(/area/shuttle/escape_pod3/transit)
|
||||||
pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN
|
pod.transit_direction = EAST
|
||||||
|
pod.move_time = SHUTTLE_TRANSIT_DURATION_RETURN
|
||||||
escape_pods += pod
|
escape_pods += pod
|
||||||
|
|
||||||
//There is no pod 4, apparently.
|
//There is no pod 4, apparently.
|
||||||
@@ -66,7 +61,8 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
|
|||||||
pod.area_station = locate(/area/shuttle/escape_pod5/station)
|
pod.area_station = locate(/area/shuttle/escape_pod5/station)
|
||||||
pod.area_offsite = locate(/area/shuttle/escape_pod5/centcom)
|
pod.area_offsite = locate(/area/shuttle/escape_pod5/centcom)
|
||||||
pod.area_transition = locate(/area/shuttle/escape_pod5/transit)
|
pod.area_transition = locate(/area/shuttle/escape_pod5/transit)
|
||||||
pod.travel_time = SHUTTLE_TRANSIT_DURATION_RETURN
|
pod.transit_direction = EAST //should this be WEST? I have no idea.
|
||||||
|
pod.move_time = SHUTTLE_TRANSIT_DURATION_RETURN
|
||||||
escape_pods += pod
|
escape_pods += pod
|
||||||
|
|
||||||
|
|
||||||
@@ -187,9 +183,9 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
|
|||||||
/datum/emergency_shuttle_controller/proc/estimate_arrival_time()
|
/datum/emergency_shuttle_controller/proc/estimate_arrival_time()
|
||||||
var/eta
|
var/eta
|
||||||
if (isnull(shuttle.last_move_time))
|
if (isnull(shuttle.last_move_time))
|
||||||
eta = launch_time + shuttle.travel_time*10
|
eta = launch_time + shuttle.move_time*10
|
||||||
else
|
else
|
||||||
eta = shuttle.last_move_time + shuttle.travel_time*10
|
eta = shuttle.last_move_time + shuttle.move_time*10
|
||||||
return (eta - world.time)/10
|
return (eta - world.time)/10
|
||||||
|
|
||||||
//returns the time left until the shuttle launches, in seconds
|
//returns the time left until the shuttle launches, in seconds
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ var/global/datum/shuttle_controller/shuttle_controller
|
|||||||
shuttle.area_offsite = locate(/area/shuttle/escape/centcom)
|
shuttle.area_offsite = locate(/area/shuttle/escape/centcom)
|
||||||
shuttle.area_station = locate(/area/shuttle/escape/station)
|
shuttle.area_station = locate(/area/shuttle/escape/station)
|
||||||
shuttle.area_transition = locate(/area/shuttle/escape/transit)
|
shuttle.area_transition = locate(/area/shuttle/escape/transit)
|
||||||
shuttle.travel_time = 300
|
shuttle.transit_direction = NORTH
|
||||||
|
shuttle.move_time = 300
|
||||||
//shuttle.docking_controller_tag = "supply_shuttle"
|
//shuttle.docking_controller_tag = "supply_shuttle"
|
||||||
//shuttle.dock_target_station = "cargo_bay"
|
//shuttle.dock_target_station = "cargo_bay"
|
||||||
shuttles["Escape"] = shuttle
|
shuttles["Escape"] = shuttle
|
||||||
|
|||||||
@@ -22,7 +22,8 @@
|
|||||||
move(origin, destination)
|
move(origin, destination)
|
||||||
moving_status = SHUTTLE_IDLE
|
moving_status = SHUTTLE_IDLE
|
||||||
|
|
||||||
/datum/shuttle/proc/long_jump(var/area/departing,var/area/destination,var/area/interim,var/travel_time)
|
/datum/shuttle/proc/long_jump(var/area/departing, var/area/destination, var/area/interim, var/travel_time, var/direction)
|
||||||
|
//world << "shuttle/long_jump: departing=[departing], destination=[destination], interim=[interim], travel_time=[travel_time]"
|
||||||
if(moving_status != SHUTTLE_IDLE) return
|
if(moving_status != SHUTTLE_IDLE) return
|
||||||
|
|
||||||
//it would be cool to play a sound here
|
//it would be cool to play a sound here
|
||||||
@@ -31,11 +32,11 @@
|
|||||||
if (moving_status == SHUTTLE_IDLE)
|
if (moving_status == SHUTTLE_IDLE)
|
||||||
return //someone cancelled the launch
|
return //someone cancelled the launch
|
||||||
|
|
||||||
move(departing, interim)
|
move(departing, interim, direction)
|
||||||
|
|
||||||
sleep(travel_time*10)
|
sleep(travel_time*10)
|
||||||
|
|
||||||
move(interim, destination)
|
move(interim, destination, direction)
|
||||||
|
|
||||||
moving_status = SHUTTLE_IDLE
|
moving_status = SHUTTLE_IDLE
|
||||||
|
|
||||||
@@ -65,7 +66,7 @@
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
//just moves the shuttle from A to B, if it can be moved
|
//just moves the shuttle from A to B, if it can be moved
|
||||||
/datum/shuttle/proc/move(var/area/origin,var/area/destination)
|
/datum/shuttle/proc/move(var/area/origin, var/area/destination, var/direction=null)
|
||||||
|
|
||||||
//world << "move_shuttle() called for [shuttle_tag] leaving [origin] en route to [destination]."
|
//world << "move_shuttle() called for [shuttle_tag] leaving [origin] en route to [destination]."
|
||||||
|
|
||||||
@@ -99,7 +100,7 @@
|
|||||||
for(var/mob/living/simple_animal/pest in destination)
|
for(var/mob/living/simple_animal/pest in destination)
|
||||||
pest.gib()
|
pest.gib()
|
||||||
|
|
||||||
origin.move_contents_to(destination) //might need to use the "direction" argument here, I dunno.
|
origin.move_contents_to(destination, direction=direction)
|
||||||
|
|
||||||
for(var/mob/M in destination)
|
for(var/mob/M in destination)
|
||||||
if(M.client)
|
if(M.client)
|
||||||
|
|||||||
@@ -1,162 +1,3 @@
|
|||||||
#define IDLE_STATE 0
|
|
||||||
#define WAIT_LAUNCH 1
|
|
||||||
#define WAIT_ARRIVE 2
|
|
||||||
#define WAIT_FINISH 3
|
|
||||||
|
|
||||||
|
|
||||||
/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
|
|
||||||
|
|
||||||
var/in_use = null //tells the controller whether this shuttle needs processing
|
|
||||||
|
|
||||||
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.
|
|
||||||
var/dock_target_station
|
|
||||||
var/dock_target_offsite
|
|
||||||
|
|
||||||
/datum/shuttle/ferry/short_jump(var/area/origin,var/area/destination)
|
|
||||||
if(isnull(location))
|
|
||||||
return
|
|
||||||
|
|
||||||
if(!destination)
|
|
||||||
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)
|
|
||||||
if(isnull(location))
|
|
||||||
return
|
|
||||||
|
|
||||||
if(!destination)
|
|
||||||
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)
|
|
||||||
if(!destination)
|
|
||||||
destination = get_location_area(!location)
|
|
||||||
if(!origin)
|
|
||||||
origin = get_location_area(location)
|
|
||||||
|
|
||||||
if (docking_controller && !docking_controller.undocked())
|
|
||||||
docking_controller.force_undock()
|
|
||||||
..(origin, destination)
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
/datum/shuttle/ferry/proc/process()
|
|
||||||
switch(process_state)
|
|
||||||
if (WAIT_LAUNCH)
|
|
||||||
if (skip_docking_checks() || docking_controller.can_launch())
|
|
||||||
|
|
||||||
if (travel_time && area_transition)
|
|
||||||
long_jump(interim=area_transition, travel_time=travel_time)
|
|
||||||
else
|
|
||||||
short_jump()
|
|
||||||
|
|
||||||
process_state = WAIT_ARRIVE
|
|
||||||
if (WAIT_ARRIVE)
|
|
||||||
if (moving_status == SHUTTLE_IDLE)
|
|
||||||
dock()
|
|
||||||
process_state = WAIT_FINISH
|
|
||||||
if (WAIT_FINISH)
|
|
||||||
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
|
|
||||||
if (!location) //station
|
|
||||||
dock_target = dock_target_station
|
|
||||||
else
|
|
||||||
dock_target = dock_target_offsite
|
|
||||||
return dock_target
|
|
||||||
|
|
||||||
|
|
||||||
/datum/shuttle/ferry/proc/launch(var/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/user)
|
|
||||||
if (!can_force()) return
|
|
||||||
|
|
||||||
in_use = user //obtain an exclusive lock on the shuttle
|
|
||||||
|
|
||||||
if (travel_time && area_transition)
|
|
||||||
long_jump(null, null, area_transition, travel_time)
|
|
||||||
else
|
|
||||||
short_jump()
|
|
||||||
|
|
||||||
|
|
||||||
process_state = WAIT_ARRIVE
|
|
||||||
|
|
||||||
/datum/shuttle/ferry/proc/cancel_launch(var/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()
|
|
||||||
if (moving_status == SHUTTLE_IDLE && process_state == WAIT_LAUNCH)
|
|
||||||
return 1
|
|
||||||
return 0
|
|
||||||
|
|
||||||
/datum/shuttle/ferry/proc/can_cancel()
|
|
||||||
if (moving_status == SHUTTLE_WARMUP || process_state == WAIT_LAUNCH)
|
|
||||||
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
|
/obj/machinery/computer/shuttle_control
|
||||||
name = "shuttle control console"
|
name = "shuttle control console"
|
||||||
icon = 'icons/obj/computer.dmi'
|
icon = 'icons/obj/computer.dmi'
|
||||||
@@ -252,4 +93,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]!")
|
||||||
|
|
||||||
|
|||||||
@@ -5,34 +5,25 @@
|
|||||||
/datum/shuttle/ferry/emergency/arrived()
|
/datum/shuttle/ferry/emergency/arrived()
|
||||||
emergency_shuttle.shuttle_arrived()
|
emergency_shuttle.shuttle_arrived()
|
||||||
|
|
||||||
/datum/shuttle/ferry/emergency/long_jump(var/area/departing,var/area/destination,var/area/interim,var/travel_time)
|
/datum/shuttle/ferry/emergency/long_jump(var/area/departing, var/area/destination, var/area/interim, var/travel_time, var/direction)
|
||||||
|
//world << "shuttle/ferry/emergency/long_jump: departing=[departing], destination=[destination], interim=[interim], travel_time=[travel_time]"
|
||||||
if (!location)
|
if (!location)
|
||||||
travel_time = SHUTTLE_TRANSIT_DURATION_RETURN
|
travel_time = SHUTTLE_TRANSIT_DURATION_RETURN
|
||||||
else
|
else
|
||||||
travel_time = SHUTTLE_TRANSIT_DURATION
|
travel_time = SHUTTLE_TRANSIT_DURATION
|
||||||
|
|
||||||
|
//update move_time so we get correct ETAs
|
||||||
|
move_time = travel_time
|
||||||
|
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/*
|
|
||||||
/area/shuttle/escape/centcom/verb/shuttle_long_jump(var/area/A as area, var/area/B as area, var/area/I as area, var/travel_time as num)
|
|
||||||
set category = "Debug"
|
|
||||||
//set src in world
|
|
||||||
var/datum/shuttle/ferry/emergency/E = shuttle_controller.shuttles["Escape"]
|
|
||||||
E.long_jump(A, B, I, travel_time)
|
|
||||||
|
|
||||||
/area/shuttle/escape/centcom/verb/shuttle_move(var/area/A as area, var/area/B as area)
|
|
||||||
set category = "Debug"
|
|
||||||
//set src in world
|
|
||||||
var/datum/shuttle/ferry/emergency/E = shuttle_controller.shuttles["Escape"]
|
|
||||||
E.long_jump(A, B)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/datum/shuttle/ferry/emergency/move(var/area/origin,var/area/destination)
|
/datum/shuttle/ferry/emergency/move(var/area/origin,var/area/destination)
|
||||||
if (destination == area_transition)
|
if (destination == area_transition)
|
||||||
last_move_time = world.time
|
last_move_time = world.time
|
||||||
else
|
else
|
||||||
last_move_time = null
|
last_move_time = null
|
||||||
|
|
||||||
if (!location) //leaving the station
|
if (origin == area_station) //leaving the station
|
||||||
emergency_shuttle.departed = 1
|
emergency_shuttle.departed = 1
|
||||||
captain_announce("The Emergency Shuttle has left the station. Estimate [round(emergency_shuttle.estimate_arrival_time()/60,1)] minutes until the shuttle docks at Central Command.")
|
captain_announce("The Emergency Shuttle has left the station. Estimate [round(emergency_shuttle.estimate_arrival_time()/60,1)] minutes until the shuttle docks at Central Command.")
|
||||||
..(origin, destination)
|
..(origin, destination)
|
||||||
@@ -174,11 +165,11 @@
|
|||||||
for (var/dna_hash in authorized)
|
for (var/dna_hash in authorized)
|
||||||
auth_list[i++] = list("auth_name"=authorized[dna_hash], "auth_hash"=dna_hash)
|
auth_list[i++] = list("auth_name"=authorized[dna_hash], "auth_hash"=dna_hash)
|
||||||
|
|
||||||
while (i <= req_authorizations) //for some reason dream maker gives warnings if you use for(; i <= req_authorizations; i++) here.
|
while (i <= req_authorizations) //fill up the rest of the list with blank entries
|
||||||
auth_list[i++] = list("auth_name"="", "auth_hash"=-1)
|
auth_list[i++] = list("auth_name"="", "auth_hash"=null)
|
||||||
else
|
else
|
||||||
for (var/i = 1; i <= req_authorizations; i++)
|
for (var/i = 1; i <= req_authorizations; i++)
|
||||||
auth_list[i] = list("auth_name"="<font color=\"red\">ERROR</font>", "auth_hash"=-1)
|
auth_list[i] = list("auth_name"="<font color=\"red\">ERROR</font>", "auth_hash"=null)
|
||||||
|
|
||||||
var/has_auth = has_authorization()
|
var/has_auth = has_authorization()
|
||||||
|
|
||||||
@@ -209,6 +200,8 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
if(href_list["auth"])
|
if(href_list["auth"])
|
||||||
|
/*
|
||||||
|
//This doesn't work at all.
|
||||||
if (!emagged && href_list["auth"] == -1)
|
if (!emagged && href_list["auth"] == -1)
|
||||||
//They selected an empty entry. Try to scan their id.
|
//They selected an empty entry. Try to scan their id.
|
||||||
if (ishuman(usr))
|
if (ishuman(usr))
|
||||||
@@ -216,9 +209,10 @@
|
|||||||
if (!read_authorization(H.get_active_hand())) //try to read what's in their hand first
|
if (!read_authorization(H.get_active_hand())) //try to read what's in their hand first
|
||||||
read_authorization(H.wear_id)
|
read_authorization(H.wear_id)
|
||||||
else
|
else
|
||||||
//remove the authorization
|
*/
|
||||||
var/dna_hash = href_list["auth"]
|
//remove the authorization
|
||||||
authorized -= dna_hash
|
var/dna_hash = href_list["auth"]
|
||||||
|
authorized -= dna_hash
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
161
code/modules/shuttles/shuttle_ferry.dm
Normal file
161
code/modules/shuttles/shuttle_ferry.dm
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
#define IDLE_STATE 0
|
||||||
|
#define WAIT_LAUNCH 1
|
||||||
|
#define WAIT_ARRIVE 2
|
||||||
|
#define WAIT_FINISH 3
|
||||||
|
|
||||||
|
|
||||||
|
/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
|
||||||
|
|
||||||
|
var/in_use = null //tells the controller whether this shuttle needs processing
|
||||||
|
|
||||||
|
var/area_transition
|
||||||
|
var/move_time = 0 //the time spent in the transition area
|
||||||
|
var/transit_direction = null //needed for area/move_contents_to() to properly handle shuttle corners - not exactly sure how it works.
|
||||||
|
|
||||||
|
var/area_station
|
||||||
|
var/area_offsite
|
||||||
|
//TODO: change location to a string and use a mapping for area and dock targets.
|
||||||
|
var/dock_target_station
|
||||||
|
var/dock_target_offsite
|
||||||
|
|
||||||
|
/datum/shuttle/ferry/short_jump(var/area/origin,var/area/destination)
|
||||||
|
if(isnull(location))
|
||||||
|
return
|
||||||
|
|
||||||
|
if(!destination)
|
||||||
|
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, var/direction)
|
||||||
|
//world << "shuttle/ferry/long_jump: departing=[departing], destination=[destination], interim=[interim], travel_time=[travel_time]"
|
||||||
|
if(isnull(location))
|
||||||
|
return
|
||||||
|
|
||||||
|
if(!destination)
|
||||||
|
destination = get_location_area(!location)
|
||||||
|
if(!departing)
|
||||||
|
departing = get_location_area(location)
|
||||||
|
|
||||||
|
direction = !location
|
||||||
|
..(departing, destination, interim, travel_time, direction)
|
||||||
|
|
||||||
|
/datum/shuttle/ferry/move(var/area/origin,var/area/destination)
|
||||||
|
if(!destination)
|
||||||
|
destination = get_location_area(!location)
|
||||||
|
if(!origin)
|
||||||
|
origin = get_location_area(location)
|
||||||
|
|
||||||
|
if (docking_controller && !docking_controller.undocked())
|
||||||
|
docking_controller.force_undock()
|
||||||
|
..(origin, destination)
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
/datum/shuttle/ferry/proc/process()
|
||||||
|
switch(process_state)
|
||||||
|
if (WAIT_LAUNCH)
|
||||||
|
if (skip_docking_checks() || docking_controller.can_launch())
|
||||||
|
|
||||||
|
//world << "shuttle/ferry/process: area_transition=[area_transition], travel_time=[travel_time]"
|
||||||
|
if (move_time && area_transition)
|
||||||
|
long_jump(interim=area_transition, travel_time=move_time, direction=transit_direction)
|
||||||
|
else
|
||||||
|
short_jump()
|
||||||
|
|
||||||
|
process_state = WAIT_ARRIVE
|
||||||
|
if (WAIT_ARRIVE)
|
||||||
|
if (moving_status == SHUTTLE_IDLE)
|
||||||
|
dock()
|
||||||
|
process_state = WAIT_FINISH
|
||||||
|
if (WAIT_FINISH)
|
||||||
|
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
|
||||||
|
if (!location) //station
|
||||||
|
dock_target = dock_target_station
|
||||||
|
else
|
||||||
|
dock_target = dock_target_offsite
|
||||||
|
return dock_target
|
||||||
|
|
||||||
|
|
||||||
|
/datum/shuttle/ferry/proc/launch(var/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/user)
|
||||||
|
if (!can_force()) return
|
||||||
|
|
||||||
|
in_use = user //obtain an exclusive lock on the shuttle
|
||||||
|
|
||||||
|
if (move_time && area_transition)
|
||||||
|
long_jump(interim=area_transition, travel_time=move_time, direction=transit_direction)
|
||||||
|
else
|
||||||
|
short_jump()
|
||||||
|
|
||||||
|
|
||||||
|
process_state = WAIT_ARRIVE
|
||||||
|
|
||||||
|
/datum/shuttle/ferry/proc/cancel_launch(var/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()
|
||||||
|
if (moving_status == SHUTTLE_IDLE && process_state == WAIT_LAUNCH)
|
||||||
|
return 1
|
||||||
|
return 0
|
||||||
|
|
||||||
|
/datum/shuttle/ferry/proc/can_cancel()
|
||||||
|
if (moving_status == SHUTTLE_WARMUP || process_state == WAIT_LAUNCH)
|
||||||
|
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
|
||||||
|
|
||||||
@@ -58,9 +58,6 @@
|
|||||||
if (!at_station()) //at centcom
|
if (!at_station()) //at centcom
|
||||||
supply_controller.sell()
|
supply_controller.sell()
|
||||||
|
|
||||||
/datum/shuttle/ferry/supply/long_jump(var/area/departing,var/area/destination,var/area/interim,var/travel_time)
|
|
||||||
short_jump(departing, destination) //long jumps are disabled
|
|
||||||
|
|
||||||
// returns 1 if the supply shuttle should be prevented from moving because it contains forbidden atoms
|
// returns 1 if the supply shuttle should be prevented from moving because it contains forbidden atoms
|
||||||
/datum/shuttle/ferry/supply/proc/forbidden_atoms_check()
|
/datum/shuttle/ferry/supply/proc/forbidden_atoms_check()
|
||||||
if (!at_station())
|
if (!at_station())
|
||||||
|
|||||||
@@ -73,7 +73,6 @@
|
|||||||
user << browse("[dat]", "window=[shuttle_tag]shuttlecontrol;size=300x600")
|
user << browse("[dat]", "window=[shuttle_tag]shuttlecontrol;size=300x600")
|
||||||
|
|
||||||
/obj/machinery/computer/shuttle_control/multi/Topic(href, href_list)
|
/obj/machinery/computer/shuttle_control/multi/Topic(href, href_list)
|
||||||
|
|
||||||
if(..())
|
if(..())
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -82,6 +81,8 @@
|
|||||||
|
|
||||||
var/datum/shuttle/multi_shuttle/MS = shuttle_controller.shuttles[shuttle_tag]
|
var/datum/shuttle/multi_shuttle/MS = shuttle_controller.shuttles[shuttle_tag]
|
||||||
if(!istype(MS)) return
|
if(!istype(MS)) return
|
||||||
|
|
||||||
|
//world << "multi_shuttle: last_departed=[MS.last_departed], origin=[MS.origin], interim=[MS.interim], travel_time=[MS.move_time]"
|
||||||
|
|
||||||
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."
|
||||||
@@ -98,7 +99,7 @@
|
|||||||
//TODO: Actually end the mission.
|
//TODO: Actually end the mission.
|
||||||
MS.return_warning = 1
|
MS.return_warning = 1
|
||||||
return
|
return
|
||||||
|
|
||||||
MS.long_jump(MS.last_departed,MS.origin,MS.interim,MS.move_time)
|
MS.long_jump(MS.last_departed,MS.origin,MS.interim,MS.move_time)
|
||||||
MS.last_departed = MS.origin
|
MS.last_departed = MS.origin
|
||||||
MS.at_origin = 1
|
MS.at_origin = 1
|
||||||
|
|||||||
@@ -762,7 +762,26 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse
|
|||||||
#define COLOR_ORANGE "#FF9900"
|
#define COLOR_ORANGE "#FF9900"
|
||||||
#define COLOR_WHITE "#FFFFFF"
|
#define COLOR_WHITE "#FFFFFF"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Shuttles
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 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 departs centcom and cannot be recalled
|
||||||
|
#define SHUTTLE_LEAVETIME 180 // 3 minutes = 180 seconds - the duration for which the shuttle will wait at the station after arriving
|
||||||
|
#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.
|
||||||
|
|
||||||
//Shuttle moving status
|
//Shuttle moving status
|
||||||
#define SHUTTLE_IDLE 0
|
#define SHUTTLE_IDLE 0
|
||||||
#define SHUTTLE_WARMUP 1
|
#define SHUTTLE_WARMUP 1
|
||||||
#define SHUTTLE_INTRANSIT 2
|
#define SHUTTLE_INTRANSIT 2
|
||||||
|
|
||||||
|
//Ferry shuttle processing status
|
||||||
|
#define IDLE_STATE 0
|
||||||
|
#define WAIT_LAUNCH 1
|
||||||
|
#define WAIT_ARRIVE 2
|
||||||
|
#define WAIT_FINISH 3
|
||||||
|
|||||||
Reference in New Issue
Block a user