mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-19 03:55:11 +01:00
Merge pull request #19017 from coiax/dynamic-transit
Dynamic transit space for shuttles
This commit is contained in:
@@ -148,7 +148,8 @@ var/list/admin_verbs_debug = list(
|
||||
/client/proc/debug_huds,
|
||||
/client/proc/map_template_load,
|
||||
/client/proc/map_template_upload,
|
||||
/client/proc/jump_to_ruin
|
||||
/client/proc/jump_to_ruin,
|
||||
/client/proc/clear_dynamic_transit
|
||||
)
|
||||
var/list/admin_verbs_possess = list(
|
||||
/proc/possess,
|
||||
|
||||
@@ -630,7 +630,6 @@ var/global/list/g_fancy_list_of_types = null
|
||||
|
||||
log_admin("[key_name(usr)] changed the equipment of [key_name(M)] to [dresscode].")
|
||||
message_admins("<span class='adminnotice'>[key_name_admin(usr)] changed the equipment of [key_name_admin(M)] to [dresscode]..</span>")
|
||||
return
|
||||
|
||||
/client/proc/startSinglo()
|
||||
|
||||
@@ -766,4 +765,16 @@ var/global/list/g_fancy_list_of_types = null
|
||||
var/datum/map_template/ruin/template = landmark.ruin_template
|
||||
usr.forceMove(get_turf(landmark))
|
||||
usr << "<span class='name'>[template.name]</span>"
|
||||
usr << "<span class='italics'>[template.description]</span>"
|
||||
usr << "<span class='italics'>[template.description]</span>"
|
||||
|
||||
/client/proc/clear_dynamic_transit()
|
||||
set category = "Debug"
|
||||
set name = "Clear Dynamic Transit"
|
||||
set desc = "Deallocates all transit space, restoring it to round start \
|
||||
conditions."
|
||||
if(!holder)
|
||||
return
|
||||
SSshuttle.clear_transit = TRUE
|
||||
message_admins("<span class='adminnotice'>[key_name_admin(src)] cleared dynamic transit space.</span>")
|
||||
feedback_add_details("admin_verb","CDT") // If...
|
||||
log_admin("[key_name(src)] cleared dynamic transit space.")
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
return
|
||||
switch(action)
|
||||
if("send")
|
||||
if(SSshuttle.supply.canMove())
|
||||
if(!SSshuttle.supply.canMove())
|
||||
say(safety_warning)
|
||||
return
|
||||
if(SSshuttle.supply.getDockedId() == "supply_home")
|
||||
@@ -113,10 +113,11 @@
|
||||
if("loan")
|
||||
if(!SSshuttle.shuttle_loan)
|
||||
return
|
||||
if(SSshuttle.supply.canMove())
|
||||
say(safety_warning)
|
||||
else if(SSshuttle.supply.mode != SHUTTLE_IDLE)
|
||||
return
|
||||
else if(SSshuttle.supply.mode == SHUTTLE_IDLE)
|
||||
else if(SSshuttle.supply.getDockedId() != "supply_away")
|
||||
return
|
||||
else
|
||||
SSshuttle.shuttle_loan.loan_shuttle()
|
||||
say("The supply shuttle has been loaned to Centcom.")
|
||||
. = TRUE
|
||||
|
||||
@@ -45,13 +45,8 @@
|
||||
SSshuttle.points += bonus_points
|
||||
endWhen = activeFor + 1
|
||||
|
||||
SSshuttle.supply.sell()
|
||||
SSshuttle.supply.enterTransit()
|
||||
if(SSshuttle.supply.z != ZLEVEL_STATION)
|
||||
SSshuttle.supply.mode = SHUTTLE_CALL
|
||||
SSshuttle.supply.destination = SSshuttle.getDock("supply_home")
|
||||
else
|
||||
SSshuttle.supply.mode = SHUTTLE_RECALL
|
||||
SSshuttle.supply.mode = SHUTTLE_CALL
|
||||
SSshuttle.supply.destination = SSshuttle.getDock("supply_home")
|
||||
SSshuttle.supply.setTimer(3000)
|
||||
|
||||
switch(dispatch_type)
|
||||
@@ -121,23 +116,15 @@
|
||||
if(prob(50))
|
||||
shuttle_spawns.Add(/mob/living/simple_animal/hostile/poison/giant_spider/hunter)
|
||||
|
||||
var/turf/T = pick(empty_shuttle_turfs)
|
||||
empty_shuttle_turfs.Remove(T)
|
||||
var/turf/T = pick_n_take(empty_shuttle_turfs)
|
||||
|
||||
new /obj/effect/decal/remains/human(T)
|
||||
new /obj/item/clothing/shoes/space_ninja(T)
|
||||
new /obj/item/clothing/mask/balaclava(T)
|
||||
|
||||
T = pick(empty_shuttle_turfs)
|
||||
new /obj/effect/spider/stickyweb(T)
|
||||
T = pick(empty_shuttle_turfs)
|
||||
new /obj/effect/spider/stickyweb(T)
|
||||
T = pick(empty_shuttle_turfs)
|
||||
new /obj/effect/spider/stickyweb(T)
|
||||
T = pick(empty_shuttle_turfs)
|
||||
new /obj/effect/spider/stickyweb(T)
|
||||
T = pick(empty_shuttle_turfs)
|
||||
new /obj/effect/spider/stickyweb(T)
|
||||
for(var/i in 1 to 5)
|
||||
T = pick_n_take(empty_shuttle_turfs)
|
||||
new /obj/effect/spider/stickyweb(T)
|
||||
|
||||
if(ANTIDOTE_NEEDED)
|
||||
var/virus_type = pick(/datum/disease/beesease, /datum/disease/brainrot, /datum/disease/fluspanish)
|
||||
@@ -193,4 +180,4 @@
|
||||
#undef RUSKY_PARTY
|
||||
#undef SPIDER_GIFT
|
||||
#undef DEPARTMENT_RESUPPLY
|
||||
#undef ANTIDOTE_NEEDED
|
||||
#undef ANTIDOTE_NEEDED
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
for(var/obj/docking_port/stationary/S in SSshuttle.stationary)
|
||||
if(!options.Find(S.id))
|
||||
continue
|
||||
if(M.canDock(S))
|
||||
if(!M.check_dock(S))
|
||||
continue
|
||||
destination_found = 1
|
||||
dat += "<A href='?src=\ref[src];move=[S.id]'>Send to [S.name]</A><br>"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#define TIME_LEFT (SSshuttle.emergency.timeLeft())
|
||||
#define ENGINES_START_TIME 10
|
||||
#define ENGINES_STARTED (TIME_LEFT <= ENGINES_START_TIME)
|
||||
#define IS_DOCKED (SSshuttle.emergency.mode == SHUTTLE_DOCKED)
|
||||
#define ENGINES_START_TIME 100
|
||||
#define ENGINES_STARTED (SSshuttle.emergency.mode == SHUTTLE_IGNITING)
|
||||
#define IS_DOCKED (SSshuttle.emergency.mode == SHUTTLE_DOCKED || (ENGINES_STARTED))
|
||||
|
||||
/obj/machinery/computer/emergency_shuttle
|
||||
name = "emergency shuttle console"
|
||||
@@ -125,10 +125,10 @@
|
||||
// Check to see if we've reached criteria for early launch
|
||||
if((authorized.len >= auth_need) || emagged)
|
||||
// shuttle timers use 1/10th seconds internally
|
||||
SSshuttle.emergency.setTimer(ENGINES_START_TIME * 10)
|
||||
SSshuttle.emergency.setTimer(ENGINES_START_TIME)
|
||||
var/system_error = emagged ? "SYSTEM ERROR:" : null
|
||||
minor_announce("The emergency shuttle will launch in \
|
||||
[ENGINES_START_TIME] seconds", system_error, alert=TRUE)
|
||||
[TIME_LEFT] seconds", system_error, alert=TRUE)
|
||||
. = TRUE
|
||||
|
||||
/obj/machinery/computer/emergency_shuttle/emag_act(mob/user)
|
||||
@@ -142,7 +142,7 @@
|
||||
(<A HREF='?_src_=holder;adminplayerobservefollow=\ref[user]'>FLW</A>) \
|
||||
has emagged the emergency shuttle [time] seconds before launch.", 0, 1)
|
||||
log_game("[key_name(user)] has emagged the emergency shuttle in \
|
||||
([x],[y],[z]) [time] seconds before launch.")
|
||||
[COORD(src)] [time] seconds before launch.")
|
||||
emagged = TRUE
|
||||
var/datum/species/S = new
|
||||
for(var/i in 1 to 10)
|
||||
@@ -168,6 +168,9 @@
|
||||
|
||||
for(var/obj/item/weapon/card/id/ID in src)
|
||||
qdel(ID)
|
||||
if(authorized && authorized.len)
|
||||
authorized.Cut()
|
||||
authorized = null
|
||||
|
||||
. = ..()
|
||||
|
||||
@@ -179,7 +182,7 @@
|
||||
width = 22
|
||||
height = 11
|
||||
dir = EAST
|
||||
travelDir = -90
|
||||
port_angle = -90
|
||||
roundstart_move = "emergency_away"
|
||||
var/sound_played = 0 //If the launch sound has been sent to all players on the shuttle itself
|
||||
|
||||
@@ -196,34 +199,14 @@
|
||||
|
||||
. = ..()
|
||||
|
||||
/obj/docking_port/mobile/emergency/timeLeft(divisor)
|
||||
if(divisor <= 0)
|
||||
divisor = 10
|
||||
if(!timer)
|
||||
return round(SSshuttle.emergencyCallTime/divisor, 1)
|
||||
|
||||
var/dtime = world.time - timer
|
||||
switch(mode)
|
||||
if(SHUTTLE_ESCAPE)
|
||||
dtime = max(SSshuttle.emergencyEscapeTime - dtime, 0)
|
||||
if(SHUTTLE_DOCKED)
|
||||
dtime = max(SSshuttle.emergencyDockTime - dtime, 0)
|
||||
else
|
||||
dtime = max(SSshuttle.emergencyCallTime - dtime, 0)
|
||||
return round(dtime/divisor, 1)
|
||||
|
||||
/obj/docking_port/mobile/emergency/request(obj/docking_port/stationary/S, coefficient=1, area/signalOrigin, reason, redAlert)
|
||||
SSshuttle.emergencyCallTime = initial(SSshuttle.emergencyCallTime) * coefficient
|
||||
var/call_time = SSshuttle.emergencyCallTime * coefficient
|
||||
switch(mode)
|
||||
if(SHUTTLE_RECALL)
|
||||
// The shuttle can not normally be called while "recalling", so
|
||||
// if this proc is called, it's via admin fiat
|
||||
if(SHUTTLE_RECALL, SHUTTLE_IDLE, SHUTTLE_CALL)
|
||||
mode = SHUTTLE_CALL
|
||||
timer = world.time - timeLeft(1)
|
||||
if(SHUTTLE_IDLE)
|
||||
mode = SHUTTLE_CALL
|
||||
timer = world.time
|
||||
if(SHUTTLE_CALL)
|
||||
if(world.time < timer) //this is just failsafe
|
||||
timer = world.time
|
||||
setTimer(call_time)
|
||||
else
|
||||
return
|
||||
|
||||
@@ -238,7 +221,7 @@
|
||||
if(mode != SHUTTLE_CALL)
|
||||
return
|
||||
|
||||
timer = world.time - timeLeft(1)
|
||||
invertTimer()
|
||||
mode = SHUTTLE_RECALL
|
||||
|
||||
if(prob(70))
|
||||
@@ -247,15 +230,6 @@
|
||||
SSshuttle.emergencyLastCallLoc = null
|
||||
priority_announce("The emergency shuttle has been recalled.[SSshuttle.emergencyLastCallLoc ? " Recall signal traced. Results can be viewed on any communications console." : "" ]", null, 'sound/AI/shuttlerecalled.ogg', "Priority")
|
||||
|
||||
/*
|
||||
/obj/docking_port/mobile/emergency/findTransitDock()
|
||||
. = SSshuttle.getDock("emergency_transit")
|
||||
if(.)
|
||||
return .
|
||||
return ..()
|
||||
*/
|
||||
|
||||
|
||||
/obj/docking_port/mobile/emergency/check()
|
||||
if(!timer)
|
||||
return
|
||||
@@ -283,7 +257,7 @@
|
||||
setTimer(20)
|
||||
return
|
||||
mode = SHUTTLE_DOCKED
|
||||
timer = world.time
|
||||
setTimer(SSshuttle.emergencyDockTime)
|
||||
send2irc("Server", "The Emergency Shuttle has docked with the station.")
|
||||
priority_announce("The Emergency Shuttle has docked with the station. You have [timeLeft(600)] minutes to board the Emergency Shuttle.", null, 'sound/AI/shuttledock.ogg', "Priority")
|
||||
feedback_add_details("emergency_shuttle", src.name)
|
||||
@@ -297,18 +271,36 @@
|
||||
else
|
||||
G.dom_attempts = min(1,G.dom_attempts)
|
||||
|
||||
|
||||
if(SHUTTLE_DOCKED)
|
||||
if(time_left <= ENGINES_START_TIME)
|
||||
if(SSshuttle.emergencyNoEscape)
|
||||
priority_announce("Hostile environment detected. Departure has been postponed indefinitely pending conflict resolution.", null, 'sound/misc/notice1.ogg', "Priority")
|
||||
sound_played = 0 //Since we didn't launch, we will need to rev up the engines again next pass.
|
||||
mode = SHUTTLE_STRANDED
|
||||
else
|
||||
mode = SHUTTLE_IGNITING
|
||||
for(var/A in SSshuttle.mobile)
|
||||
var/obj/docking_port/mobile/M = A
|
||||
if(M.launch_status == UNLAUNCHED) //Pods will not launch from the mine/planet, and other ships won't launch unless we tell them to.
|
||||
M.check_transit_zone()
|
||||
|
||||
if(SHUTTLE_IGNITING)
|
||||
var/success = TRUE
|
||||
|
||||
success &= (check_transit_zone() == TRANSIT_READY)
|
||||
for(var/A in SSshuttle.mobile)
|
||||
var/obj/docking_port/mobile/M = A
|
||||
if(M.launch_status == UNLAUNCHED)
|
||||
success &= (M.check_transit_zone() == TRANSIT_READY)
|
||||
if(!success)
|
||||
setTimer(ENGINES_START_TIME)
|
||||
|
||||
if(time_left <= 50 && !sound_played) //4 seconds left:REV UP THOSE ENGINES BOYS. - should sync up with the launch
|
||||
sound_played = 1 //Only rev them up once.
|
||||
for(var/area/shuttle/escape/E in world)
|
||||
E << 'sound/effects/hyperspace_begin.ogg'
|
||||
|
||||
if(time_left <= 0 && SSshuttle.emergencyNoEscape)
|
||||
priority_announce("Hostile environment detected. Departure has been postponed indefinitely pending conflict resolution.", null, 'sound/misc/notice1.ogg', "Priority")
|
||||
sound_played = 0 //Since we didn't launch, we will need to rev up the engines again next pass.
|
||||
mode = SHUTTLE_STRANDED
|
||||
|
||||
if(time_left <= 0 && !SSshuttle.emergencyNoEscape)
|
||||
//move each escape pod (or applicable spaceship) to its corresponding transit dock
|
||||
for(var/A in SSshuttle.mobile)
|
||||
@@ -323,7 +315,7 @@
|
||||
enterTransit()
|
||||
mode = SHUTTLE_ESCAPE
|
||||
launch_status = ENDGAME_LAUNCHED
|
||||
timer = world.time
|
||||
setTimer(SSshuttle.emergencyEscapeTime)
|
||||
priority_announce("The Emergency Shuttle has left the station. Estimate [timeLeft(600)] minutes until the shuttle docks at Central Command.", null, null, "Priority")
|
||||
if(SHUTTLE_ESCAPE)
|
||||
if(time_left <= 0)
|
||||
@@ -342,14 +334,6 @@
|
||||
dock(SSshuttle.getDock("emergency_away"))
|
||||
mode = SHUTTLE_ENDGAME
|
||||
timer = 0
|
||||
open_dock()
|
||||
|
||||
/obj/docking_port/mobile/emergency/proc/open_dock()
|
||||
for(var/obj/machinery/door/poddoor/shuttledock/D in airlocks)
|
||||
var/turf/T = get_step(D, D.checkdir)
|
||||
if(!istype(T,/turf/open/space))
|
||||
spawn(0)
|
||||
D.open()
|
||||
|
||||
/obj/docking_port/mobile/pod
|
||||
name = "escape pod"
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
icon = 'icons/obj/machines/shuttle_manipulator.dmi'
|
||||
icon_state = "holograph_on"
|
||||
|
||||
anchored = TRUE
|
||||
density = TRUE
|
||||
|
||||
// UI state variables
|
||||
var/datum/map_template/shuttle/selected
|
||||
|
||||
@@ -30,9 +33,6 @@
|
||||
add_overlay(hologram_projection)
|
||||
add_overlay(hologram_ship)
|
||||
|
||||
/obj/machinery/shuttle_manipulator/process()
|
||||
return
|
||||
|
||||
/obj/machinery/shuttle_manipulator/ui_interact(mob/user, ui_key = "main", \
|
||||
datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, \
|
||||
datum/ui_state/state = admin_state)
|
||||
@@ -47,6 +47,8 @@
|
||||
switch(mode)
|
||||
if(SHUTTLE_IDLE)
|
||||
. = "idle"
|
||||
if(SHUTTLE_IGNITING)
|
||||
. = "engines charging"
|
||||
if(SHUTTLE_RECALL)
|
||||
. = "recalled"
|
||||
if(SHUTTLE_CALL)
|
||||
@@ -217,7 +219,7 @@
|
||||
// truthy value means that it cannot dock for some reason
|
||||
// but we can ignore the someone else docked error because we'll
|
||||
// be moving into their place shortly
|
||||
if(result && (result != SHUTTLE_SOMEONE_ELSE_DOCKED))
|
||||
if((result != SHUTTLE_CAN_DOCK) && (result != SHUTTLE_SOMEONE_ELSE_DOCKED))
|
||||
var/m = "Unsuccessful dock of [preview_shuttle] ([result])."
|
||||
WARNING(m)
|
||||
return
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/atom/movable/proc/onShuttleMove(turf/T1, rotation)
|
||||
if(rotation)
|
||||
shuttleRotate(rotation)
|
||||
loc = T1
|
||||
return 1
|
||||
|
||||
/obj/onShuttleMove()
|
||||
if(invisibility >= INVISIBILITY_ABSTRACT)
|
||||
return 0
|
||||
. = ..()
|
||||
|
||||
/atom/movable/light/onShuttleMove()
|
||||
return 0
|
||||
|
||||
/obj/machinery/door/onShuttleMove()
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
addtimer(src, "close", 0, TRUE)
|
||||
// Close any attached airlocks as well
|
||||
for(var/obj/machinery/door/D in orange(1, src))
|
||||
addtimer(src, "close", 0, TRUE)
|
||||
|
||||
/mob/onShuttleMove()
|
||||
if(!move_on_shuttle)
|
||||
return 0
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
if(client)
|
||||
if(buckled)
|
||||
shake_camera(src, 2, 1) // turn it down a bit come on
|
||||
else
|
||||
shake_camera(src, 7, 1)
|
||||
|
||||
/mob/living/carbon/onShuttleMove()
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
if(!buckled)
|
||||
Weaken(3)
|
||||
|
||||
// Shuttle Rotation //
|
||||
|
||||
/atom/proc/shuttleRotate(rotation)
|
||||
//rotate our direction
|
||||
setDir(angle2dir(rotation+dir2angle(dir)))
|
||||
|
||||
//resmooth if need be.
|
||||
if(smooth)
|
||||
queue_smooth(src)
|
||||
|
||||
//rotate the pixel offsets too.
|
||||
if (pixel_x || pixel_y)
|
||||
if (rotation < 0)
|
||||
rotation += 360
|
||||
for (var/turntimes=rotation/90;turntimes>0;turntimes--)
|
||||
var/oldPX = pixel_x
|
||||
var/oldPY = pixel_y
|
||||
pixel_x = oldPY
|
||||
pixel_y = (oldPX*(-1))
|
||||
+145
-191
@@ -12,13 +12,14 @@
|
||||
anchored = 1
|
||||
|
||||
var/id
|
||||
dir = NORTH//this should point -away- from the dockingport door, ie towards the ship
|
||||
// this should point -away- from the dockingport door, ie towards the ship
|
||||
dir = NORTH
|
||||
var/width = 0 //size of covered area, perpendicular to dir
|
||||
var/height = 0 //size of covered area, paralell to dir
|
||||
var/height = 0 //size of covered area, parallel to dir
|
||||
var/dwidth = 0 //position relative to covered area, perpendicular to dir
|
||||
var/dheight = 0 //position relative to covered area, parallel to dir
|
||||
|
||||
//these objects are indestructable
|
||||
//these objects are indestructible
|
||||
/obj/docking_port/Destroy(force)
|
||||
// unless you assert that you know what you're doing. Horrible things
|
||||
// may result.
|
||||
@@ -36,11 +37,11 @@
|
||||
return //we don't rotate with shuttles via this code.
|
||||
//returns a list(x0,y0, x1,y1) where points 0 and 1 are bounding corners of the projected rectangle
|
||||
/obj/docking_port/proc/return_coords(_x, _y, _dir)
|
||||
if(!_dir)
|
||||
if(_dir == null)
|
||||
_dir = dir
|
||||
if(!_x)
|
||||
if(_x == null)
|
||||
_x = x
|
||||
if(!_y)
|
||||
if(_y == null)
|
||||
_y = y
|
||||
|
||||
//byond's sin and cos functions are inaccurate. This is faster and perfectly accurate
|
||||
@@ -135,6 +136,7 @@
|
||||
|
||||
var/turf_type = /turf/open/space
|
||||
var/area_type = /area/space
|
||||
var/last_dock_time
|
||||
|
||||
/obj/docking_port/stationary/New()
|
||||
..()
|
||||
@@ -151,21 +153,35 @@
|
||||
//returns first-found touching shuttleport
|
||||
/obj/docking_port/stationary/get_docked()
|
||||
. = locate(/obj/docking_port/mobile) in loc
|
||||
/*
|
||||
for(var/turf/T in return_ordered_turfs())
|
||||
. = locate(/obj/docking_port/mobile) in loc
|
||||
if(.)
|
||||
return .
|
||||
*/
|
||||
|
||||
/obj/docking_port/stationary/transit
|
||||
name = "In Transit"
|
||||
turf_type = /turf/open/space/transit
|
||||
var/list/turf/assigned_turfs = list()
|
||||
var/obj/docking_port/mobile/owner
|
||||
|
||||
/obj/docking_port/stationary/transit/New()
|
||||
..()
|
||||
SSshuttle.transit += src
|
||||
|
||||
/obj/docking_port/stationary/transit/proc/dezone()
|
||||
for(var/i in assigned_turfs)
|
||||
var/turf/T = i
|
||||
if(T.type == turf_type)
|
||||
T.ChangeTurf(/turf/open/space)
|
||||
T.flags |= UNUSED_TRANSIT_TURF
|
||||
|
||||
/obj/docking_port/stationary/transit/Destroy(force=FALSE)
|
||||
if(force)
|
||||
SSshuttle.transit -= src
|
||||
if(owner)
|
||||
owner = null
|
||||
if(assigned_turfs)
|
||||
dezone()
|
||||
assigned_turfs.Cut()
|
||||
assigned_turfs = null
|
||||
. = ..()
|
||||
|
||||
|
||||
/obj/docking_port/mobile
|
||||
icon_state = "mobile"
|
||||
@@ -175,14 +191,23 @@
|
||||
var/area/shuttle/areaInstance
|
||||
|
||||
var/timer //used as a timer (if you want time left to complete move, use timeLeft proc)
|
||||
var/mode = SHUTTLE_IDLE //current shuttle mode (see /__DEFINES/stat.dm)
|
||||
var/last_timer_length
|
||||
|
||||
var/mode = SHUTTLE_IDLE //current shuttle mode
|
||||
var/callTime = 150 //time spent in transit (deciseconds)
|
||||
var/ignitionTime = 100 // time spent "starting the engines"
|
||||
var/roundstart_move //id of port to send shuttle to at roundstart
|
||||
var/travelDir = 0 //direction the shuttle would travel in
|
||||
|
||||
// The direction the shuttle prefers to travel in
|
||||
var/preferred_direction = NORTH
|
||||
// And the angle from the front of the shuttle to the port
|
||||
var/port_angle = 0 // used to be travelDir
|
||||
|
||||
var/obj/docking_port/stationary/destination
|
||||
var/obj/docking_port/stationary/previous
|
||||
|
||||
var/obj/docking_port/stationary/transit/assigned_transit
|
||||
|
||||
var/launch_status = NOLAUNCH
|
||||
|
||||
// A timid shuttle will not register itself with the shuttle subsystem
|
||||
@@ -202,6 +227,10 @@
|
||||
/obj/docking_port/mobile/Destroy(force)
|
||||
if(force)
|
||||
SSshuttle.mobile -= src
|
||||
destination = null
|
||||
previous = null
|
||||
assigned_transit = null
|
||||
areaInstance = null
|
||||
. = ..()
|
||||
|
||||
/obj/docking_port/mobile/initialize()
|
||||
@@ -225,7 +254,7 @@
|
||||
|
||||
//this is a hook for custom behaviour. Maybe at some point we could add checks to see if engines are intact
|
||||
/obj/docking_port/mobile/proc/canMove()
|
||||
return 0 //0 means we can move
|
||||
return TRUE
|
||||
|
||||
//this is to check if this shuttle can physically dock at dock S
|
||||
/obj/docking_port/mobile/proc/canDock(obj/docking_port/stationary/S)
|
||||
@@ -233,7 +262,7 @@
|
||||
return SHUTTLE_NOT_A_DOCKING_PORT
|
||||
|
||||
if(istype(S, /obj/docking_port/stationary/transit))
|
||||
return FALSE
|
||||
return SHUTTLE_CAN_DOCK
|
||||
|
||||
if(dwidth > S.dwidth)
|
||||
return SHUTTLE_DWIDTH_TOO_LARGE
|
||||
@@ -258,41 +287,45 @@
|
||||
// attempt to move us where we currently are, it will get weird.
|
||||
return SHUTTLE_ALREADY_DOCKED
|
||||
|
||||
return FALSE
|
||||
return SHUTTLE_CAN_DOCK
|
||||
|
||||
/obj/docking_port/mobile/proc/check_dock(obj/docking_port/stationary/S)
|
||||
var/status = canDock(S)
|
||||
if(status == SHUTTLE_CAN_DOCK)
|
||||
return TRUE
|
||||
else if(status == SHUTTLE_ALREADY_DOCKED)
|
||||
// We're already docked there, don't need to do anything.
|
||||
// Triggering shuttle movement code in place is weird
|
||||
return FALSE
|
||||
else
|
||||
var/msg = "Shuttle [src] cannot dock at [S], error: [status]"
|
||||
message_admins(msg)
|
||||
return FALSE
|
||||
|
||||
//call the shuttle to destination S
|
||||
/obj/docking_port/mobile/proc/request(obj/docking_port/stationary/S)
|
||||
var/status = canDock(S)
|
||||
if(status == SHUTTLE_ALREADY_DOCKED)
|
||||
// We're already docked there, don't need to do anything.
|
||||
// Triggering shuttle movement code in place is weird
|
||||
if(!check_dock(S))
|
||||
return
|
||||
else if(status)
|
||||
var/msg = "request(): shuttle [src] cannot dock at [S], \
|
||||
error: [status]"
|
||||
message_admins(msg)
|
||||
throw EXCEPTION(msg)
|
||||
|
||||
switch(mode)
|
||||
if(SHUTTLE_CALL)
|
||||
if(S == destination)
|
||||
if(world.time <= timer)
|
||||
timer = world.time
|
||||
if(timeLeft(1) < callTime)
|
||||
setTimer(callTime)
|
||||
else
|
||||
destination = S
|
||||
timer = world.time
|
||||
setTimer(callTime)
|
||||
if(SHUTTLE_RECALL)
|
||||
if(S == destination)
|
||||
timer = world.time - timeLeft(1)
|
||||
setTimer(callTime - timeLeft(1))
|
||||
else
|
||||
destination = S
|
||||
timer = world.time
|
||||
setTimer(callTime)
|
||||
mode = SHUTTLE_CALL
|
||||
else
|
||||
if(SHUTTLE_IDLE, SHUTTLE_IGNITING)
|
||||
destination = S
|
||||
mode = SHUTTLE_CALL
|
||||
timer = world.time
|
||||
enterTransit() //hyperspace
|
||||
mode = SHUTTLE_IGNITING
|
||||
setTimer(ignitionTime)
|
||||
|
||||
//recall the shuttle to where it was previously
|
||||
/obj/docking_port/mobile/proc/cancel()
|
||||
@@ -301,7 +334,7 @@
|
||||
|
||||
remove_ripples()
|
||||
|
||||
timer = world.time - timeLeft(1)
|
||||
invertTimer()
|
||||
mode = SHUTTLE_RECALL
|
||||
|
||||
/obj/docking_port/mobile/proc/enterTransit()
|
||||
@@ -309,7 +342,7 @@
|
||||
// if(!destination)
|
||||
// return
|
||||
var/obj/docking_port/stationary/S0 = get_docked()
|
||||
var/obj/docking_port/stationary/S1 = findTransitDock()
|
||||
var/obj/docking_port/stationary/S1 = assigned_transit
|
||||
if(S1)
|
||||
if(dock(S1))
|
||||
WARNING("shuttle \"[id]\" could not enter transit space. Docked at [S0 ? S0.id : "null"]. Transit dock [S1 ? S1.id : "null"].")
|
||||
@@ -318,24 +351,6 @@
|
||||
else
|
||||
WARNING("shuttle \"[id]\" could not enter transit space. S0=[S0 ? S0.id : "null"] S1=[S1 ? S1.id : "null"]")
|
||||
|
||||
//default shuttleRotate
|
||||
/atom/proc/shuttleRotate(rotation)
|
||||
//rotate our direction
|
||||
setDir(angle2dir(rotation+dir2angle(dir)))
|
||||
|
||||
//resmooth if need be.
|
||||
if(smooth)
|
||||
queue_smooth(src)
|
||||
|
||||
//rotate the pixel offsets too.
|
||||
if (pixel_x || pixel_y)
|
||||
if (rotation < 0)
|
||||
rotation += 360
|
||||
for (var/turntimes=rotation/90;turntimes>0;turntimes--)
|
||||
var/oldPX = pixel_x
|
||||
var/oldPY = pixel_y
|
||||
pixel_x = oldPY
|
||||
pixel_y = (oldPX*(-1))
|
||||
|
||||
/obj/docking_port/mobile/proc/jumpToNullSpace()
|
||||
// Destroys the docking port and the shuttle contents.
|
||||
@@ -396,28 +411,20 @@
|
||||
ripple_turfs += T1
|
||||
|
||||
return ripple_turfs
|
||||
|
||||
/obj/docking_port/mobile/proc/check_poddoors()
|
||||
for(var/obj/machinery/door/poddoor/shuttledock/pod in airlocks)
|
||||
pod.check()
|
||||
|
||||
//this is the main proc. It instantly moves our mobile port to stationary port S1
|
||||
//it handles all the generic behaviour, such as sanity checks, closing doors on the shuttle, stunning mobs, etc
|
||||
/obj/docking_port/mobile/proc/dock(obj/docking_port/stationary/S1, force=FALSE)
|
||||
// Crashing this ship with NO SURVIVORS
|
||||
if(!force)
|
||||
var/status = canDock(S1)
|
||||
if(status == SHUTTLE_ALREADY_DOCKED)
|
||||
return status
|
||||
else if(status)
|
||||
var/msg = "dock(): shuttle [src] cannot dock at [S1], \
|
||||
error: [status]"
|
||||
message_admins(msg)
|
||||
return status
|
||||
|
||||
if(canMove())
|
||||
if(!check_dock(S1))
|
||||
return -1
|
||||
if(!canMove())
|
||||
return -1
|
||||
|
||||
closePortDoors()
|
||||
|
||||
// //rotate transit docking ports, so we don't need zillions of variants
|
||||
// if(istype(S1, /obj/docking_port/stationary/transit))
|
||||
// S1.setDir(turn(NORTH, -travelDir))
|
||||
|
||||
var/obj/docking_port/stationary/S0 = get_docked()
|
||||
var/turf_type = /turf/open/space
|
||||
@@ -486,98 +493,23 @@
|
||||
T0.CalculateAdjacentTurfs()
|
||||
SSair.add_to_active(T0,1)
|
||||
|
||||
check_poddoors()
|
||||
S1.last_dock_time = world.time
|
||||
|
||||
loc = S1.loc
|
||||
setDir(S1.dir)
|
||||
|
||||
/atom/movable/proc/onShuttleMove(turf/T1, rotation)
|
||||
if(rotation)
|
||||
shuttleRotate(rotation)
|
||||
loc = T1
|
||||
return 1
|
||||
|
||||
/obj/onShuttleMove()
|
||||
if(invisibility >= INVISIBILITY_ABSTRACT)
|
||||
return 0
|
||||
. = ..()
|
||||
|
||||
/atom/movable/light/onShuttleMove()
|
||||
return 0
|
||||
|
||||
/obj/machinery/door/onShuttleMove()
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
addtimer(src, "close", 0)
|
||||
|
||||
/mob/onShuttleMove()
|
||||
if(!move_on_shuttle)
|
||||
return 0
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
if(client)
|
||||
if(buckled)
|
||||
shake_camera(src, 2, 1) // turn it down a bit come on
|
||||
else
|
||||
shake_camera(src, 7, 1)
|
||||
|
||||
/mob/living/carbon/onShuttleMove()
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
if(!buckled)
|
||||
Weaken(3)
|
||||
|
||||
/*
|
||||
if(istype(S1, /obj/docking_port/stationary/transit))
|
||||
var/d = turn(dir, 180 + travelDir)
|
||||
for(var/turf/open/space/transit/T in S1.return_ordered_turfs())
|
||||
T.pushdirection = d
|
||||
T.update_icon()
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/obj/docking_port/mobile/proc/findTransitDock()
|
||||
var/obj/docking_port/stationary/transit/T = SSshuttle.getDock("[id]_transit")
|
||||
if(T && !canDock(T))
|
||||
return T
|
||||
|
||||
/obj/docking_port/mobile/proc/findRoundstartDock()
|
||||
var/obj/docking_port/stationary/D
|
||||
D = SSshuttle.getDock(roundstart_move)
|
||||
|
||||
if(D)
|
||||
return D
|
||||
return SSshuttle.getDock(roundstart_move)
|
||||
|
||||
/obj/docking_port/mobile/proc/dockRoundstart()
|
||||
// Instead of spending a lot of time trying to work out where to place
|
||||
// our shuttle, just create it somewhere empty and send it to where
|
||||
// it should go
|
||||
var/obj/docking_port/stationary/D = findRoundstartDock()
|
||||
return dock(D)
|
||||
var/port = findRoundstartDock()
|
||||
if(port)
|
||||
return dock(port)
|
||||
|
||||
/obj/effect/landmark/shuttle_import
|
||||
name = "Shuttle Import"
|
||||
|
||||
/* commented out due to issues with rotation
|
||||
for(var/obj/docking_port/stationary/transit/S in SSshuttle.transit)
|
||||
if(S.id)
|
||||
continue
|
||||
if(!canDock(S))
|
||||
return S
|
||||
*/
|
||||
|
||||
|
||||
//shuttle-door closing is handled in the dock() proc whilst looping through turfs
|
||||
//this one closes the door where we are docked at, if there is one there.
|
||||
/obj/docking_port/mobile/proc/closePortDoors()
|
||||
var/turf/T = get_step(loc, turn(dir,180))
|
||||
if(T)
|
||||
var/obj/machinery/door/Door = locate() in T
|
||||
if(Door)
|
||||
addtimer(Door, "close", 0)
|
||||
|
||||
/obj/docking_port/mobile/proc/roadkill(list/L0, list/L1, dir)
|
||||
var/list/hurt_mobs = list()
|
||||
for(var/i in 1 to L0.len)
|
||||
@@ -614,61 +546,83 @@
|
||||
step(AM, dir)
|
||||
else
|
||||
qdel(AM)
|
||||
/*
|
||||
//used to check if atom/A is within the shuttle's bounding box
|
||||
/obj/docking_port/mobile/proc/onShuttleCheck(atom/A)
|
||||
var/turf/T = get_turf(A)
|
||||
if(!T)
|
||||
return 0
|
||||
|
||||
var/list/L = return_coords()
|
||||
if(L[1] > L[3])
|
||||
L.Swap(1,3)
|
||||
if(L[2] > L[4])
|
||||
L.Swap(2,4)
|
||||
|
||||
if(L[1] <= T.x && T.x <= L[3])
|
||||
if(L[2] <= T.y && T.y <= L[4])
|
||||
return 1
|
||||
return 0
|
||||
*/
|
||||
//used by shuttle subsystem to check timers
|
||||
/obj/docking_port/mobile/proc/check()
|
||||
var/timeLeft = timeLeft(1)
|
||||
if(!ripples.len && (timeLeft <= SHUTTLE_RIPPLE_TIME) && ((mode == SHUTTLE_CALL) || (mode == SHUTTLE_RECALL)))
|
||||
create_ripples(destination)
|
||||
check_ripples()
|
||||
|
||||
if(timeLeft <= 0)
|
||||
switch(mode)
|
||||
if(SHUTTLE_CALL)
|
||||
if(dock(destination))
|
||||
setTimer(20) //can't dock for some reason, try again in 2 seconds
|
||||
return
|
||||
if(SHUTTLE_RECALL)
|
||||
if(dock(previous))
|
||||
setTimer(20) //can't dock for some reason, try again in 2 seconds
|
||||
return
|
||||
mode = SHUTTLE_IDLE
|
||||
timer = 0
|
||||
destination = null
|
||||
if(mode == SHUTTLE_IGNITING)
|
||||
check_transit_zone()
|
||||
|
||||
if(timeLeft(1) > 0)
|
||||
return
|
||||
// If we can't dock or we don't have a transit slot, wait for 20 ds,
|
||||
// then try again
|
||||
switch(mode)
|
||||
if(SHUTTLE_CALL)
|
||||
if(dock(destination))
|
||||
setTimer(20)
|
||||
return
|
||||
if(SHUTTLE_RECALL)
|
||||
if(dock(previous))
|
||||
setTimer(20)
|
||||
return
|
||||
if(SHUTTLE_IGNITING)
|
||||
if(check_transit_zone() != TRANSIT_READY)
|
||||
setTimer(20)
|
||||
return
|
||||
else
|
||||
mode = SHUTTLE_CALL
|
||||
setTimer(callTime)
|
||||
enterTransit()
|
||||
return
|
||||
|
||||
mode = SHUTTLE_IDLE
|
||||
timer = 0
|
||||
destination = null
|
||||
|
||||
/obj/docking_port/mobile/proc/check_ripples()
|
||||
if(!ripples.len)
|
||||
if((mode == SHUTTLE_CALL) || (mode == SHUTTLE_RECALL))
|
||||
if(timeLeft(1) <= SHUTTLE_RIPPLE_TIME)
|
||||
create_ripples(destination)
|
||||
|
||||
/obj/docking_port/mobile/proc/check_transit_zone()
|
||||
if(assigned_transit)
|
||||
return TRANSIT_READY
|
||||
else
|
||||
SSshuttle.request_transit_dock(src)
|
||||
|
||||
/obj/docking_port/mobile/proc/setTimer(wait)
|
||||
if(timer <= 0)
|
||||
timer = world.time
|
||||
timer += wait - timeLeft(1)
|
||||
timer = world.time + wait
|
||||
last_timer_length = wait
|
||||
|
||||
/obj/docking_port/mobile/proc/invertTimer()
|
||||
if(!last_timer_length)
|
||||
return
|
||||
var/time_remaining = timer - world.time
|
||||
if(time_remaining > 0)
|
||||
var/time_passed = last_timer_length - time_remaining
|
||||
setTimer(time_passed)
|
||||
|
||||
//returns timeLeft
|
||||
/obj/docking_port/mobile/proc/timeLeft(divisor)
|
||||
if(divisor <= 0)
|
||||
divisor = 10
|
||||
|
||||
var/ds_remaining
|
||||
if(!timer)
|
||||
return round(callTime/divisor, 1)
|
||||
return max( round((timer+callTime-world.time)/divisor,1), 0 )
|
||||
ds_remaining = callTime
|
||||
else
|
||||
ds_remaining = max(0, timer - world.time)
|
||||
|
||||
. = round(ds_remaining / divisor, 1)
|
||||
|
||||
// returns 3-letter mode string, used by status screens and mob status panel
|
||||
/obj/docking_port/mobile/proc/getModeStr()
|
||||
switch(mode)
|
||||
if(SHUTTLE_IGNITING)
|
||||
return "IGN"
|
||||
if(SHUTTLE_RECALL)
|
||||
return "RCL"
|
||||
if(SHUTTLE_CALL)
|
||||
|
||||
@@ -20,7 +20,7 @@ var/list/blacklisted_cargo_types = typecacheof(list(
|
||||
callTime = 600
|
||||
|
||||
dir = WEST
|
||||
travelDir = 90
|
||||
port_angle = 90
|
||||
width = 12
|
||||
dwidth = 5
|
||||
height = 7
|
||||
@@ -44,8 +44,8 @@ var/list/blacklisted_cargo_types = typecacheof(list(
|
||||
var/turf/T = trf
|
||||
for(var/a in T.GetAllContents())
|
||||
if(is_type_in_typecache(a, blacklisted_cargo_types))
|
||||
return TRUE
|
||||
return FALSE
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/docking_port/mobile/supply/request()
|
||||
if(mode != SHUTTLE_IDLE)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/obj/effect/landmark/transit
|
||||
name = "transit space marker"
|
||||
desc = "This indicates where transit space begins and ends."
|
||||
invisibility = FALSE
|
||||
icon = 'icons/effects/effects.dmi'
|
||||
icon_state = "at_shield1"
|
||||
|
||||
/obj/effect/landmark/transit/New()
|
||||
. = ..()
|
||||
transit_markers += src
|
||||
|
||||
/obj/effect/landmark/transit/Destroy()
|
||||
transit_markers -= src
|
||||
. = ..()
|
||||
Reference in New Issue
Block a user