Revert "12/21 modernizations from TG live"

This commit is contained in:
LetterJay
2016-12-22 22:35:44 -06:00
committed by GitHub
parent cf59ac1c3d
commit ae40d4134e
2215 changed files with 86928 additions and 707332 deletions
+244 -214
View File
@@ -8,18 +8,17 @@
//icon = 'icons/dirsquare.dmi'
icon_state = "pinonfar"
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
unacidable = 1
anchored = 1
var/id
// this should point -away- from the dockingport door, ie towards the ship
dir = NORTH
dir = NORTH//this should point -away- from the dockingport door, ie towards the ship
var/width = 0 //size of covered area, perpendicular to dir
var/height = 0 //size of covered area, parallel to dir
var/height = 0 //size of covered area, paralell 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 indestructible
//these objects are indestructable
/obj/docking_port/Destroy(force)
// unless you assert that you know what you're doing. Horrible things
// may result.
@@ -29,23 +28,19 @@
else
return QDEL_HINT_LETMELIVE
/obj/docking_port/take_damage()
return
/obj/docking_port/singularity_pull()
return
/obj/docking_port/singularity_act()
return 0
/obj/docking_port/shuttleRotate()
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 == null)
if(!_dir)
_dir = dir
if(_x == null)
if(!_x)
_x = x
if(_y == null)
if(!_y)
_y = y
//byond's sin and cos functions are inaccurate. This is faster and perfectly accurate
@@ -140,7 +135,6 @@
var/turf_type = /turf/open/space
var/area_type = /area/space
var/last_dock_time
/obj/docking_port/stationary/New()
..()
@@ -157,61 +151,38 @@
//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/area/shuttle/transit/assigned_area
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"
name = "shuttle"
icon_state = "pinonclose"
var/area/shuttle/areaInstance
var/timer //used as a timer (if you want time left to complete move, use timeLeft proc)
var/last_timer_length
var/mode = SHUTTLE_IDLE //current shuttle mode
var/callTime = 100 //time spent in transit (deciseconds). Should not be lower then 10 seconds without editing the animation of the hyperspace ripples.
var/ignitionTime = 55 // time spent "starting the engines". Also rate limits how often we try to reserve transit space if its ever full of transiting shuttles.
var/mode = SHUTTLE_IDLE //current shuttle mode (see /__DEFINES/stat.dm)
var/callTime = 150 //time spent in transit (deciseconds)
var/roundstart_move //id of port to send shuttle to at roundstart
// 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/travelDir = 0 //direction the shuttle would travel in
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
@@ -231,10 +202,6 @@
/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()
@@ -258,7 +225,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 TRUE
return 0 //0 means we can move
//this is to check if this shuttle can physically dock at dock S
/obj/docking_port/mobile/proc/canDock(obj/docking_port/stationary/S)
@@ -266,7 +233,7 @@
return SHUTTLE_NOT_A_DOCKING_PORT
if(istype(S, /obj/docking_port/stationary/transit))
return SHUTTLE_CAN_DOCK
return FALSE
if(dwidth > S.dwidth)
return SHUTTLE_DWIDTH_TOO_LARGE
@@ -291,45 +258,41 @@
// attempt to move us where we currently are, it will get weird.
return SHUTTLE_ALREADY_DOCKED
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
return FALSE
//call the shuttle to destination S
/obj/docking_port/mobile/proc/request(obj/docking_port/stationary/S)
if(!check_dock(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
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(timeLeft(1) < callTime)
setTimer(callTime)
if(world.time <= timer)
timer = world.time
else
destination = S
setTimer(callTime)
timer = world.time
if(SHUTTLE_RECALL)
if(S == destination)
setTimer(callTime - timeLeft(1))
timer = world.time - timeLeft(1)
else
destination = S
setTimer(callTime)
timer = world.time
mode = SHUTTLE_CALL
if(SHUTTLE_IDLE, SHUTTLE_IGNITING)
else
destination = S
mode = SHUTTLE_IGNITING
setTimer(ignitionTime)
mode = SHUTTLE_CALL
timer = world.time
enterTransit() //hyperspace
//recall the shuttle to where it was previously
/obj/docking_port/mobile/proc/cancel()
@@ -338,7 +301,7 @@
remove_ripples()
invertTimer()
timer = world.time - timeLeft(1)
mode = SHUTTLE_RECALL
/obj/docking_port/mobile/proc/enterTransit()
@@ -346,7 +309,7 @@
// if(!destination)
// return
var/obj/docking_port/stationary/S0 = get_docked()
var/obj/docking_port/stationary/S1 = assigned_transit
var/obj/docking_port/stationary/S1 = findTransitDock()
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"].")
@@ -355,6 +318,24 @@
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.
@@ -415,24 +396,29 @@
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)
if(S1.get_docked() == src)
remove_ripples()
return
// Crashing this ship with NO SURVIVORS
if(!force)
if(!check_dock(S1))
return -1
if(!canMove())
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())
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
var/area_type = /area/space
@@ -442,8 +428,6 @@
if(S0.area_type)
area_type = S0.area_type
var/destination_turf_type = S1.turf_type
var/list/L0 = return_ordered_turfs(x, y, z, dir, areaInstance)
var/list/L1 = return_ordered_turfs(S1.x, S1.y, S1.z, S1.dir)
@@ -458,11 +442,11 @@
if(!A0)
A0 = new area_type(null)
for(var/turf/T0 in L0)
var/area/old = T0.loc
A0.contents += T0
if (istype(S1, /obj/docking_port/stationary/transit))
areaInstance.parallax_movedir = preferred_direction
else
areaInstance.parallax_movedir = FALSE
T0.change_area(old, A0)
remove_ripples()
//move or squish anything in the way ship at destination
@@ -477,11 +461,12 @@
continue
if(T0.type != T0.baseturf) //So if there is a hole in the shuttle we don't drag along the space/asteroid/etc to wherever we are going next
T0.copyTurf(T1)
T1.baseturf = destination_turf_type
var/area/old = T1.loc
areaInstance.contents += T1
T1.change_area(old, areaInstance)
//copy over air
if(isopenturf(T1))
if(istype(T1, /turf/open))
var/turf/open/Ts1 = T1
Ts1.copy_air_with_tile(T0)
@@ -492,42 +477,110 @@
if(rotation)
T1.shuttleRotate(rotation)
//lighting stuff
T1.redraw_lighting()
SSair.remove_from_active(T1)
T1.CalculateAdjacentTurfs()
SSair.add_to_active(T1,1)
T0.ChangeTurf(turf_type)
T0.redraw_lighting()
SSair.remove_from_active(T0)
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()
return SSshuttle.getDock(roundstart_move)
var/obj/docking_port/stationary/D
D = SSshuttle.getDock(roundstart_move)
if(D)
return D
/obj/docking_port/mobile/proc/dockRoundstart()
. = dock_id(roundstart_move)
/obj/docking_port/mobile/proc/dock_id(id)
var/port = SSshuttle.getDock(id)
if(port)
. = dock(port)
else
. = null
// 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 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)
var/turf/T0 = L0[i]
var/turf/T1 = L1[i]
@@ -538,128 +591,85 @@
// The corresponding tile will not be changed, so no roadkill
for(var/atom/movable/AM in T1)
if(ismob(AM))
if(isliving(AM))
var/mob/living/M = AM
if(M.buckled)
M.buckled.unbuckle_mob(M, 1)
if(M.pulledby)
M.pulledby.stop_pulling()
M.stop_pulling()
M.visible_message("<span class='warning'>[M] is hit by \
a hyperspace ripple!</span>",
"<span class='userdanger'>You feel an immense \
crushing pressure as the space around you ripples.</span>")
if(isliving(AM) && (!(AM in hurt_mobs)))
hurt_mobs |= AM
var/mob/living/M = AM
if(M.buckled)
M.buckled.unbuckle_mob(M, 1)
if(M.pulledby)
M.pulledby.stop_pulling()
M.stop_pulling()
M.visible_message("<span class='warning'>[M] is hit by \
a hyperspace ripple[M.anchored ? "":" and is thrown clear"]!</span>",
"<span class='userdanger'>You feel an immense \
crushing pressure as the space around you ripples.</span>")
if(M.anchored)
M.gib()
else //non-living mobs shouldn't be affected by shuttles, which is why this is an else
if(istype(AM, /obj/singularity) && !istype(AM, /obj/singularity/narsie)) //it's a singularity but not a god, ignore it.
continue
if(!AM.anchored)
step(AM, dir)
else
qdel(AM)
M.Paralyse(10)
M.ex_act(2)
step(M, dir)
continue
if(!AM.anchored)
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()
check_effects()
var/timeLeft = timeLeft(1)
if(!ripples.len && (timeLeft <= SHUTTLE_RIPPLE_TIME) && ((mode == SHUTTLE_CALL) || (mode == SHUTTLE_RECALL)))
create_ripples(destination)
if(mode == SHUTTLE_IGNITING)
check_transit_zone()
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(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_effects()
if(!ripples.len)
if((mode == SHUTTLE_CALL) || (mode == SHUTTLE_RECALL))
if(timeLeft(1) <= SHUTTLE_RIPPLE_TIME)
create_ripples(destination)
var/obj/docking_port/stationary/S0 = get_docked()
if(areaInstance.parallax_movedir && istype(S0, /obj/docking_port/stationary/transit) && timeLeft(1) <= PARALLAX_LOOP_TIME)
parallax_slowdown()
/obj/docking_port/mobile/proc/parallax_slowdown()
areaInstance.parallax_movedir = FALSE
if(assigned_transit && assigned_transit.assigned_area)
assigned_transit.assigned_area.parallax_movedir = FALSE
var/list/L0 = return_ordered_turfs(x, y, z, dir, areaInstance)
for (var/thing in L0)
var/turf/T = thing
for (var/thing2 in T)
var/atom/movable/AM = thing2
if (length(AM.client_mobs_in_contents))
AM.update_parallax_contents()
/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)
timer = world.time + wait
last_timer_length = wait
/obj/docking_port/mobile/proc/modTimer(multiple)
var/time_remaining = timer - world.time
if(time_remaining < 0 || !last_timer_length)
return
time_remaining *= multiple
last_timer_length *= multiple
setTimer(time_remaining)
/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)
if(timer <= 0)
timer = world.time
timer += wait - timeLeft(1)
//returns timeLeft
/obj/docking_port/mobile/proc/timeLeft(divisor)
if(divisor <= 0)
divisor = 10
var/ds_remaining
if(!timer)
ds_remaining = callTime
else
ds_remaining = max(0, timer - world.time)
. = round(ds_remaining / divisor, 1)
return round(callTime/divisor, 1)
return max( round((timer+callTime-world.time)/divisor,1), 0 )
// 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)
@@ -695,3 +705,23 @@
dst = destination
. += " towards [dst ? dst.name : "unknown location"] ([timeLeft(600)] minutes)"
#undef DOCKING_PORT_HIGHLIGHT
/turf/proc/copyTurf(turf/T)
if(T.type != type)
var/obj/O
if(underlays.len) //we have underlays, which implies some sort of transparency, so we want to a snapshot of the previous turf as an underlay
O = new()
O.underlays.Add(T)
T.ChangeTurf(type)
if(underlays.len)
T.underlays = O.underlays
if(T.icon_state != icon_state)
T.icon_state = icon_state
if(T.icon != icon)
T.icon = icon
if(T.color != color)
T.color = color
if(T.dir != dir)
T.setDir(dir)
return T