Merge branch 'master' into upstream-merge-30056

This commit is contained in:
LetterJay
2017-09-13 06:08:59 -05:00
committed by GitHub
545 changed files with 23622 additions and 13702 deletions

View File

@@ -11,7 +11,7 @@
/obj/docking_port/mobile/assault_pod/dock(obj/docking_port/stationary/S1)
..()
. = ..()
if(!istype(S1, /obj/docking_port/stationary/transit))
playsound(get_turf(src.loc), 'sound/effects/explosion1.ogg',50,1)

View File

@@ -78,7 +78,7 @@
/obj/machinery/computer/shuttle/emag_act(mob/user)
if(emagged)
return
req_access = null
req_access = list()
emagged = TRUE
to_chat(user, "<span class='notice'>You fried the consoles ID checking system.</span>")

View File

@@ -290,7 +290,7 @@
if(SHUTTLE_CALL)
if(time_left <= 0)
//move emergency shuttle to station
if(dock(SSshuttle.getDock("emergency_home")))
if(dock(SSshuttle.getDock("emergency_home")) != DOCKING_SUCCESS)
setTimer(20)
return
mode = SHUTTLE_DOCKED

View File

@@ -4,15 +4,18 @@ All ShuttleMove procs go here
/************************************Base procs************************************/
// Called on every turf in the shuttle region, return false if it doesn't want to move
/turf/proc/fromShuttleMove(turf/newT, turf_type, baseturf_type)
if(type == turf_type && baseturf == baseturf_type)
return FALSE
return TRUE
// Called on every turf in the shuttle region, returns a bitflag for allowed movements of that turf
// returns the new move_mode (based on the old)
/turf/proc/fromShuttleMove(turf/newT, turf_type, list/baseturf_cache, move_mode)
if(!(move_mode & MOVE_AREA) || (istype(src, turf_type) && baseturf_cache[baseturf]))
return move_mode
return move_mode | MOVE_TURF | MOVE_CONTENTS
// Called from the new turf before anything has been moved
// Only gets called if fromShuttleMove returns true first
/turf/proc/toShuttleMove(turf/oldT, shuttle_dir)
// returns the new move_mode (based on the old)
/turf/proc/toShuttleMove(turf/oldT, move_mode, obj/docking_port/mobile/shuttle)
var/shuttle_dir = shuttle.dir
for(var/i in contents)
var/atom/movable/thing = i
if(ismob(thing))
@@ -38,7 +41,7 @@ All ShuttleMove procs go here
else
qdel(thing)
return TRUE
return move_mode
// Called on the old turf to move the turf data
/turf/proc/onShuttleMove(turf/newT, turf_type, baseturf_type, rotation, list/movement_force, move_dir)
@@ -73,9 +76,9 @@ All ShuttleMove procs go here
/////////////////////////////////////////////////////////////////////////////////////
// Called on every atom in shuttle turf contents before anything has been moved
// Return true if it should be moved regardless of turf being moved
/atom/movable/proc/beforeShuttleMove(turf/newT, rotation)
return FALSE
// returns the new move_mode (based on the old)
/atom/movable/proc/beforeShuttleMove(turf/newT, rotation, move_mode)
return move_mode
// Called on atoms to move the atom to the new location
/atom/movable/proc/onShuttleMove(turf/newT, turf/oldT, rotation, list/movement_force, move_dir, old_dock)
@@ -102,13 +105,16 @@ All ShuttleMove procs go here
/////////////////////////////////////////////////////////////////////////////////////
// Called on areas before anything has been moved
/area/proc/beforeShuttleMove()
return TRUE
// returns the new move_mode (based on the old)
/area/proc/beforeShuttleMove(list/shuttle_areas)
if(!shuttle_areas[src])
return NONE
return MOVE_AREA
// Called on areas to move their turf between areas
/area/proc/onShuttleMove(turf/oldT, turf/newT, area/underlying_old_area)
if(newT == oldT) // In case of in place shuttle rotation shenanigans.
return
return TRUE
contents -= oldT
underlying_old_area.contents += oldT
@@ -117,7 +123,7 @@ All ShuttleMove procs go here
var/area/old_dest_area = newT.loc
parallax_movedir = old_dest_area.parallax_movedir
old_dest_area.contents -= newT
contents += newT
newT.change_area(old_dest_area, src)
@@ -160,9 +166,11 @@ All ShuttleMove procs go here
SSair.add_to_active(src, TRUE)
SSair.add_to_active(oldT, TRUE)
/************************************Area move procs************************************/
/************************************Machinery move procs************************************/
/obj/machinery/door/airlock/beforeShuttleMove(turf/newT, rotation)
/obj/machinery/door/airlock/beforeShuttleMove(turf/newT, rotation, move_mode)
. = ..()
shuttledocked = 0
for(var/obj/machinery/door/airlock/A in range(1, src))
@@ -176,11 +184,11 @@ All ShuttleMove procs go here
for(var/obj/machinery/door/airlock/A in range(1, src))
A.shuttledocked = 1
/obj/machinery/camera/beforeShuttleMove(turf/newT, rotation)
/obj/machinery/camera/beforeShuttleMove(turf/newT, rotation, move_mode)
. = ..()
GLOB.cameranet.removeCamera(src)
GLOB.cameranet.updateChunk()
return TRUE
. |= MOVE_CONTENTS
/obj/machinery/camera/afterShuttleMove(list/movement_force, shuttle_dir, shuttle_preferred_direction, move_dir)
. = ..()
@@ -207,7 +215,7 @@ All ShuttleMove procs go here
if(z == ZLEVEL_MINING) //Avoids double logging and landing on other Z-levels due to badminnery
SSblackbox.add_details("colonies_dropped", "[x]|[y]|[z]") //Number of times a base has been dropped!
/obj/machinery/gravity_generator/main/beforeShuttleMove(turf/newT, rotation)
/obj/machinery/gravity_generator/main/beforeShuttleMove(turf/newT, rotation, move_mode)
. = ..()
on = FALSE
update_list()
@@ -218,9 +226,9 @@ All ShuttleMove procs go here
on = TRUE
update_list()
/obj/machinery/thruster/beforeShuttleMove(turf/newT, rotation)
/obj/machinery/thruster/beforeShuttleMove(turf/newT, rotation, move_mode)
. = ..()
. = TRUE
. |= MOVE_CONTENTS
//Properly updates pipes on shuttle movement
/obj/machinery/atmospherics/shuttleRotate(rotation)
@@ -271,7 +279,7 @@ All ShuttleMove procs go here
var/turf/T = loc
hide(T.intact)
/obj/machinery/navbeacon/beforeShuttleMove(turf/newT, rotation)
/obj/machinery/navbeacon/beforeShuttleMove(turf/newT, rotation, move_mode)
. = ..()
GLOB.navbeacons["[z]"] -= src
GLOB.deliverybeacons -= src
@@ -333,13 +341,13 @@ All ShuttleMove procs go here
/************************************Structure move procs************************************/
/obj/structure/grille/beforeShuttleMove(turf/newT, rotation)
/obj/structure/grille/beforeShuttleMove(turf/newT, rotation, move_mode)
. = ..()
. = TRUE
. |= MOVE_CONTENTS
/obj/structure/lattice/beforeShuttleMove(turf/newT, rotation)
/obj/structure/lattice/beforeShuttleMove(turf/newT, rotation, move_mode)
. = ..()
. = TRUE
. |= MOVE_CONTENTS
/obj/structure/disposalpipe/afterShuttleMove(list/movement_force, shuttle_dir, shuttle_preferred_direction, move_dir)
. = ..()
@@ -350,6 +358,11 @@ All ShuttleMove procs go here
var/turf/T = loc
if(level==1)
hide(T.intact)
/obj/structure/shuttle/beforeShuttleMove(turf/newT, rotation, move_mode)
. = ..()
. |= MOVE_CONTENTS
/************************************Misc move procs************************************/

View File

@@ -21,6 +21,10 @@
var/dwidth = 0 //position relative to covered area, perpendicular to dir
var/dheight = 0 //position relative to covered area, parallel to dir
var/area_type
var/turf_type
var/baseturf_type
//these objects are indestructible
/obj/docking_port/Destroy(force)
// unless you assert that you know what you're doing. Horrible things
@@ -119,6 +123,39 @@
else
. += T
/obj/docking_port/proc/return_ordered_assoc_turfs(_x, _y, _z, _dir)
if(!_dir)
_dir = dir
if(!_x)
_x = x
if(!_y)
_y = y
if(!_z)
_z = z
var/cos = 1
var/sin = 0
switch(_dir)
if(WEST)
cos = 0
sin = 1
if(SOUTH)
cos = -1
sin = 0
if(EAST)
cos = 0
sin = -1
. = list()
var/xi
var/yi
for(var/dx=0, dx<width, ++dx)
for(var/dy=0, dy<height, ++dy)
xi = _x + (dx-dwidth)*cos - (dy-dheight)*sin
yi = _y + (dy-dheight)*cos + (dx-dwidth)*sin
var/turf/T = locate(xi, yi, _z)
.[T] = NONE
#ifdef DOCKING_PORT_HIGHLIGHT
//Debug proc used to highlight bounding area
/obj/docking_port/proc/highlight(_color)
@@ -147,9 +184,12 @@
/obj/docking_port/stationary
name = "dock"
var/turf_type = /turf/open/space
var/baseturf_type = /turf/open/space
var/area_type = /area/space
turf_type = /turf/open/space
baseturf_type = /turf/open/space
area_type = /area/space
var/list/baseturf_cache
var/last_dock_time
/obj/docking_port/stationary/Initialize()
@@ -159,6 +199,7 @@
id = "[SSshuttle.stationary.len]"
if(name == "dock")
name = "dock[SSshuttle.stationary.len]"
baseturf_cache = typecacheof(baseturf_type)
#ifdef DOCKING_PORT_HIGHLIGHT
highlight("#f00")
@@ -204,7 +245,8 @@
name = "shuttle"
icon_state = "pinonclose"
var/area_type = /area/shuttle
area_type = /area/shuttle
var/list/area/shuttle/shuttle_areas
var/timer //used as a timer (if you want time left to complete move, use timeLeft proc)
@@ -376,7 +418,7 @@
var/obj/docking_port/stationary/S0 = get_docked()
var/obj/docking_port/stationary/S1 = assigned_transit
if(S1)
if(dock(S1))
if(dock(S1) != DOCKING_SUCCESS)
WARNING("shuttle \"[id]\" could not enter transit space. Docked at [S0 ? S0.id : "null"]. Transit dock [S1 ? S1.id : "null"].")
else
previous = S0
@@ -456,7 +498,7 @@
if(new_dock.get_docked() == src)
remove_ripples()
return DOCKING_COMPLETE
return DOCKING_SUCCESS
if(!force)
if(!check_dock(new_dock))
@@ -465,25 +507,36 @@
return DOCKING_IMMOBILIZED
var/obj/docking_port/stationary/old_dock = get_docked()
var/turf_type = /turf/open/space //The turf that gets placed under where the shuttle moved from
var/baseturf_type = /turf/open/space //The baseturf that the gets assigned to the turf_type above
var/area_type = /area/space //The area that gets placed under where the shuttle moved from
var/underlying_turf_type = /turf/open/space //The turf that gets placed under where the shuttle moved from
var/underlying_baseturf_type = /turf/open/space //The baseturf that the gets assigned to the turf_type above
var/underlying_area_type = /area/space //The area that gets placed under where the shuttle moved from
var/list/baseturf_cache
if(old_dock) //Dock overwrites
if(old_dock.turf_type)
turf_type = old_dock.turf_type
underlying_turf_type = old_dock.turf_type
if(old_dock.baseturf_type)
baseturf_type = old_dock.baseturf_type
underlying_baseturf_type = old_dock.baseturf_type
if(old_dock.area_type)
area_type = old_dock.area_type
underlying_area_type = old_dock.area_type
if(old_dock.baseturf_cache)
baseturf_cache = old_dock.baseturf_cache
if(!baseturf_cache)
//Don't want to call this needlessly
baseturf_cache = typecacheof(underlying_baseturf_type)
var/list/old_turfs = return_ordered_turfs(x, y, z, dir)
/**************************************************************************************************************
old_turfs is an associative list with a turf:bitflag structure
new_turfs is a standard list composed of turf instances
The bitflag contains the data for what inhabitants of that coordinate should be moved to the new location
The bitflags can be found in __DEFINES/shuttles.dm
*/
var/list/old_turfs = return_ordered_assoc_turfs(x, y, z, dir)
var/list/new_turfs = return_ordered_turfs(new_dock.x, new_dock.y, new_dock.z, new_dock.dir)
var/list/old_contents = list() //Lists of turfs to only move contents and area but not move the turf
var/list/new_contents = list() //For structures etc that act attached to the ship
/**************************************************************************************************************/
var/area/underlying_old_area = locate("[area_type]")
var/area/underlying_old_area = locate("[underlying_area_type]")
if(!underlying_old_area)
underlying_old_area = new area_type(null)
underlying_old_area = new underlying_area_type(null)
var/rotation = 0
if(new_dock.dir != dir) //Even when the dirs are the same rotation is coming out as not 0 for some reason
@@ -501,67 +554,55 @@
var/list/areas_to_move = list() //unique assoc list of areas on turfs being moved
/****************************************All beforeShuttleMove procs*****************************************/
var/index = 1
while(index <= old_turfs.len)
var/turf/oldT = old_turfs[index]
var/turf/newT = new_turfs[index]
var/area/old_area = oldT.loc
var/move_turf = TRUE //Should this turf be moved, if false remove from the turf list
if(!(shuttle_areas[old_area]))
move_turf = FALSE
if(move_turf)
move_turf = oldT.fromShuttleMove(newT, turf_type, baseturf_type) //turf
if(move_turf) //Only call toShuttleMove if the source turf is willing to move
move_turf = newT.toShuttleMove(oldT, dir) //turf
for(var/ii in 1 to oldT.contents.len)
var/atom/movable/moving_atom = oldT.contents[ii]
if(moving_atom.beforeShuttleMove(newT, rotation) && !move_turf) //atoms
old_contents += oldT
new_contents += newT
if(!move_turf)
old_turfs.Cut(index,index+1)
new_turfs.Cut(index,index+1)
continue
areas_to_move[old_area] = TRUE
var/index = 0
for(var/place in old_turfs)
index++
var/turf/oldT = place
var/turf/newT = new_turfs[index]
if(!newT || !oldT)
continue
for(var/thing in areas_to_move)
var/area/internal_area = thing
internal_area.beforeShuttleMove() //areas
var/area/old_area = oldT.loc
var/move_mode = old_area.beforeShuttleMove(shuttle_areas) //areas
if(!old_turfs.len && !old_contents.len) //This should only happen if no shuttle area has been specified
return DOCKING_AREA_EMPTY
for(var/i in 1 to oldT.contents.len)
var/atom/movable/moving_atom = oldT.contents[i]
move_mode = moving_atom.beforeShuttleMove(newT, rotation, move_mode) //atoms
move_mode = oldT.fromShuttleMove(newT, underlying_turf_type, baseturf_cache, move_mode) //turfs
move_mode = newT.toShuttleMove(oldT, move_mode , src) //turfs
if(move_mode & MOVE_AREA)
areas_to_move[old_area] = TRUE
old_turfs[place] = move_mode
/*******************************************All onShuttleMove procs******************************************/
for(var/i in 1 to old_turfs.len)
var/turf/oldT = old_turfs[i]
var/turf/newT = new_turfs[i]
if(!oldT || !newT) //This really shouldn't happen
continue
for(var/thing in oldT) //Needs to be this kind of loop in case, because of shuttle rotation shenanigans, the destination turf is the same as the source turf
var/atom/movable/moving_atom = thing
moving_atom.onShuttleMove(newT, oldT, rotation, movement_force, movement_direction, old_dock) //atoms
moved_atoms += moving_atom
oldT.onShuttleMove(newT, turf_type, baseturf_type, rotation, movement_force, movement_direction) //turfs
var/area/shuttle_area = oldT.loc
shuttle_area.onShuttleMove(oldT, newT, underlying_old_area) //areas
for(var/i in 1 to old_contents.len) //This is for moving atoms that need to move without their turf
var/turf/oldT = old_contents[i] //I'll figure out a way of merging these loops eventualy, probably
var/turf/newT = new_contents[i]
if(!oldT || !newT)
continue
for(var/thing in oldT)
var/atom/movable/moving_atom = thing
moving_atom.onShuttleMove(newT, oldT, rotation, movement_force, movement_direction) //atoms
moved_atoms += moving_atom
index = 0
for(var/place in old_turfs)
index++
var/turf/oldT = place
var/turf/newT = new_turfs[index]
var/move_mode = old_turfs[place]
if(move_mode & MOVE_CONTENTS)
for(var/thing in oldT)
var/atom/movable/moving_atom = thing
moving_atom.onShuttleMove(newT, oldT, rotation, movement_force, movement_direction, old_dock)//atoms
moved_atoms += moving_atom
if(move_mode & MOVE_TURF)
oldT.onShuttleMove(newT, underlying_turf_type, underlying_baseturf_type, rotation, movement_force, movement_direction)//turfs
if(move_mode & MOVE_AREA)
var/area/shuttle_area = oldT.loc
shuttle_area.onShuttleMove(oldT, newT, underlying_old_area) //areas
/******************************************All afterShuttleMove procs****************************************/
for(var/i in 1 to new_turfs.len)
var/turf/oldT = old_turfs[i]
var/turf/newT = new_turfs[i]
index = 0
for(var/thing in old_turfs)
index++
var/turf/oldT = thing
var/turf/newT = new_turfs[index]
newT.afterShuttleMove(oldT) //turfs
for(var/i in 1 to moved_atoms.len)
@@ -609,11 +650,11 @@
// then try again
switch(mode)
if(SHUTTLE_CALL)
if(dock(destination, preferred_direction))
if(dock(destination, preferred_direction) != DOCKING_SUCCESS)
setTimer(20)
return
if(SHUTTLE_RECALL)
if(dock(previous))
if(dock(previous) != DOCKING_SUCCESS)
setTimer(20)
return
if(SHUTTLE_IGNITING)

View File

@@ -215,23 +215,37 @@
/obj/effect/forcefield/luxury_shuttle
var/threshold = 500
var/static/list/approved_passengers = list()
var/static/list/check_times = list()
/obj/effect/forcefield/luxury_shuttle/CanPass(atom/movable/mover, turf/target)
if(mover in approved_passengers)
return 1
return TRUE
if(!isliving(mover)) //No stowaways
return 0
return FALSE
return FALSE
#define LUXURY_MESSAGE_COOLDOWN 100
/obj/effect/forcefield/luxury_shuttle/CollidedWith(atom/movable/AM)
if(!isliving(AM))
return ..()
if(check_times[AM] && check_times[AM] > world.time) //Let's not spam the message
return ..()
check_times[AM] = world.time + LUXURY_MESSAGE_COOLDOWN
var/total_cash = 0
var/list/counted_money = list()
for(var/obj/item/coin/C in mover.GetAllContents())
for(var/obj/item/coin/C in AM.GetAllContents())
total_cash += C.value
counted_money += C
if(total_cash >= threshold)
break
for(var/obj/item/stack/spacecash/S in mover.GetAllContents())
for(var/obj/item/stack/spacecash/S in AM.GetAllContents())
total_cash += S.value * S.amount
counted_money += S
if(total_cash >= threshold)
@@ -241,12 +255,13 @@
for(var/obj/I in counted_money)
qdel(I)
to_chat(mover, "Thank you for your payment! Please enjoy your flight.")
approved_passengers += mover
return 1
to_chat(AM, "Thank you for your payment! Please enjoy your flight.")
approved_passengers += AM
check_times -= AM
return
else
to_chat(mover, "You don't have enough money to enter the main shuttle. You'll have to fly coach.")
return 0
to_chat(AM, "<span class='warning'>You don't have enough money to enter the main shuttle. You'll have to fly coach.</span>")
return ..()
/mob/living/simple_animal/hostile/bear/fightpit
name = "fight pit bear"

View File

@@ -67,7 +67,8 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
/obj/docking_port/mobile/supply/dock()
if(getDockedId() == "supply_away") // Buy when we leave home.
buy()
if(..()) // Fly/enter transit.
. = ..() // Fly/enter transit.
if(. != DOCKING_SUCCESS)
return
if(getDockedId() == "supply_away") // Sell when we get home
sell()