mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 20:16:55 +01:00
shuttles
This commit is contained in:
@@ -98,6 +98,13 @@
|
||||
shuttle_master.emergency = src
|
||||
return 1
|
||||
|
||||
/obj/docking_port/mobile/emergency/Destroy()
|
||||
if(src.i_know_what_im_doing)
|
||||
// This'll make the shuttle subsystem use the backup shuttle.
|
||||
shuttle_master.emergencyDeregister()
|
||||
|
||||
. = ..()
|
||||
|
||||
/obj/docking_port/mobile/emergency/timeLeft(divisor)
|
||||
if(divisor <= 0)
|
||||
divisor = 10
|
||||
@@ -286,3 +293,22 @@
|
||||
var/list/turfs = get_area_turfs(target_area)
|
||||
var/turf/T = pick(turfs)
|
||||
src.loc = T
|
||||
|
||||
/obj/docking_port/mobile/emergency/backup
|
||||
name = "backup shuttle"
|
||||
id = "backup"
|
||||
dwidth = 2
|
||||
width = 8
|
||||
height = 8
|
||||
dir = 4
|
||||
|
||||
roundstart_move = "backup_away"
|
||||
|
||||
/obj/docking_port/mobile/emergency/backup/New()
|
||||
// We want to be a valid emergency shuttle
|
||||
// but not be the main one, keep whatever's set
|
||||
// valid.
|
||||
var/current_emergency = SSshuttle.emergency
|
||||
..()
|
||||
shuttle_master.emergency = current_emergency
|
||||
shuttle_master.backup_shuttle = src
|
||||
|
||||
+109
-15
@@ -18,9 +18,18 @@
|
||||
var/dwidth = 0 //position relative to covered area, perpendicular to dir
|
||||
var/dheight = 0 //position relative to covered area, parallel to dir
|
||||
|
||||
var/i_know_what_im_doing = 0
|
||||
|
||||
//these objects are indestructable
|
||||
/obj/docking_port/Destroy()
|
||||
return QDEL_HINT_LETMELIVE
|
||||
// unless you assert that you know what you're doing. Horrible things
|
||||
// may result.
|
||||
if(!i_know_what_im_doing)
|
||||
return QDEL_HINT_LETMELIVE
|
||||
else
|
||||
// If not removed immediately, it can interfere with the docking
|
||||
// detection code, which is annoying and inconvinient.
|
||||
return QDEL_HINT_HARDDEL_NOW
|
||||
|
||||
/obj/docking_port/singularity_pull()
|
||||
return
|
||||
@@ -121,7 +130,7 @@
|
||||
|
||||
//return first-found touching dockingport
|
||||
/obj/docking_port/proc/get_docked()
|
||||
return locate(/obj/docking_port/stationary) in loc
|
||||
. = locate(/obj/docking_port/mobile) in loc
|
||||
|
||||
/obj/docking_port/proc/getDockedId()
|
||||
var/obj/docking_port/P = get_docked()
|
||||
@@ -226,6 +235,10 @@
|
||||
|
||||
return 1
|
||||
|
||||
/obj/docking_port/mobile/Destroy()
|
||||
if(i_know_what_im_doing)
|
||||
shuttle_master.mobile -= src
|
||||
. = ..()
|
||||
|
||||
//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()
|
||||
@@ -247,16 +260,30 @@
|
||||
if(height-dheight > S.height-S.dheight)
|
||||
return 5
|
||||
//check the dock isn't occupied
|
||||
if(S.get_docked())
|
||||
return 6
|
||||
var/currently_docked = S.get_docked()
|
||||
// by someone other than us
|
||||
if(currently_docked != src)
|
||||
return 6
|
||||
else
|
||||
// This isn't an error, per se, but we can't let the shuttle code
|
||||
// attempt to move us where we currently are, it will get weird.
|
||||
return SHUTTLE_ALREADY_DOCKED
|
||||
return 0 //0 means we can dock
|
||||
|
||||
//call the shuttle to destination S
|
||||
/obj/docking_port/mobile/proc/request(obj/docking_port/stationary/S)
|
||||
if(canDock(S))
|
||||
. = 1
|
||||
throw EXCEPTION("request(): shuttle cannot dock")
|
||||
return 1 //we can't dock at S
|
||||
var/status = canDock(S)
|
||||
if(status == SHUTTLE_ALREADY_DOCKED)
|
||||
// We're already docked there, don't need to do anything.
|
||||
return
|
||||
else if(status)
|
||||
. = status
|
||||
spawn(0)
|
||||
var/msg = "request(): shuttle [src] cannot dock at [S], \
|
||||
error: [status]"
|
||||
message_admins(msg)
|
||||
throw EXCEPTION(msg)
|
||||
return status //we can't dock at S
|
||||
|
||||
switch(mode)
|
||||
if(SHUTTLE_CALL)
|
||||
@@ -320,17 +347,66 @@
|
||||
if(smooth)
|
||||
smooth_icon(src)
|
||||
|
||||
/obj/docking_port/mobile/proc/jumpToNullSpace()
|
||||
// Destroys the docking port and the shuttle contents.
|
||||
// Not in a fancy way, it just ceases.
|
||||
var/obj/docking_port/stationary/S0 = get_docked()
|
||||
var/turf_type = /turf/open/space
|
||||
var/area_type = /area/space
|
||||
if(S0)
|
||||
if(S0.turf_type)
|
||||
turf_type = S0.turf_type
|
||||
if(S0.area_type)
|
||||
area_type = S0.area_type
|
||||
|
||||
var/list/L0 = return_ordered_turfs(x, y, z, dir, areaInstance)
|
||||
|
||||
//remove area surrounding docking port
|
||||
if(areaInstance.contents.len)
|
||||
var/area/A0 = locate("[area_type]")
|
||||
if(!A0)
|
||||
A0 = new area_type(null)
|
||||
for(var/turf/T0 in L0)
|
||||
A0.contents += T0
|
||||
|
||||
for(var/i=1, i<=L0.len, ++i)
|
||||
var/turf/T0 = L0[i]
|
||||
if(!T0)
|
||||
continue
|
||||
|
||||
for(var/atom/AM in T0.GetAllContents())
|
||||
if(istype(AM, /mob/dead))
|
||||
continue
|
||||
qdel(AM)
|
||||
|
||||
T0.ChangeTurf(turf_type)
|
||||
|
||||
T0.redraw_lighting()
|
||||
air_master.remove_from_active(T0)
|
||||
T0.CalculateAdjacentTurfs()
|
||||
air_master.add_to_active(T0,1)
|
||||
|
||||
src.i_know_what_im_doing = TRUE
|
||||
qdel(src)
|
||||
|
||||
//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)
|
||||
. = canDock(S1)
|
||||
if(.)
|
||||
throw EXCEPTION("dock(): shuttle cannot dock")
|
||||
return .
|
||||
/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 == 7)
|
||||
return SHUTTLE_ALREADY_DOCKED
|
||||
else if(status)
|
||||
spawn(0)
|
||||
var/msg = "dock(): shuttle [src] cannot dock at [S1], \
|
||||
error: [status]"
|
||||
message_admins(msg)
|
||||
throw EXCEPTION(msg)
|
||||
return status
|
||||
|
||||
if(canMove())
|
||||
return -1
|
||||
if(canMove())
|
||||
return -1
|
||||
|
||||
// //rotate transit docking ports, so we don't need zillions of variants
|
||||
// if(istype(S1, /obj/docking_port/stationary/transit))
|
||||
@@ -475,6 +551,24 @@
|
||||
var/obj/docking_port/stationary/transit/T = shuttle_master.getDock("[id]_transit")
|
||||
if(T && !canDock(T))
|
||||
return T
|
||||
|
||||
|
||||
/obj/docking_port/mobile/proc/findRoundstartDock()
|
||||
var/obj/docking_port/stationary/D
|
||||
D = shuttle_master.getDock(roundstart_move)
|
||||
|
||||
if(D)
|
||||
return D
|
||||
|
||||
/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)
|
||||
|
||||
/obj/effect/landmark/shuttle_import
|
||||
name = "Shuttle Import"
|
||||
/* commented out due to issues with rotation
|
||||
for(var/obj/docking_port/stationary/transit/S in shuttle_master.transit)
|
||||
if(S.id)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/obj/machinery/shuttle_manipulator
|
||||
name = "shuttle manipulator"
|
||||
desc = "I shall be telling this with a sigh\n\
|
||||
Somewhere ages and ages hence:\n\
|
||||
Two roads diverged in a wood, and I,\n\
|
||||
I took the one less traveled by,\n\
|
||||
And that has made all the difference."
|
||||
|
||||
icon = 'icons/obj/machines/dominator.dmi'
|
||||
icon_state = "dominator-blue"
|
||||
|
||||
/obj/machinery/shuttle_manipulator/process()
|
||||
return
|
||||
Reference in New Issue
Block a user