Fixes the baseturf bad arg runtime and fixes the jumpToNullSpace proc

This commit is contained in:
CitadelStationBot
2017-07-19 04:05:53 -05:00
parent c294d781b6
commit 0b7d08d5ac
9 changed files with 45 additions and 48 deletions

View File

@@ -89,13 +89,12 @@
return
//returns a new list with only atoms that are in typecache L
/proc/typecache_filter_list(list/atoms, list/typecache, reversed=FALSE)
//if reversed, return a new list with only atoms that aren't in typecache L
/proc/typecache_filter_list(list/atoms, list/typecache, reversed)
. = list()
for (var/thing in atoms)
var/atom/A = thing
if (typecache[A.type] && !reversed)
. += A
else if(reversed)
if(typecache[A.type] != reversed) //This assumes typecache[A.type] is either null or TRUE. God help you if it's FALSE
. += A
//Like typesof() or subtypesof(), but returns a typecache instead of a list

View File

@@ -248,7 +248,7 @@
if(istype(tunnel))
// Small chance to have forks in our tunnel; otherwise dig our tunnel.
if(i > 3 && prob(20))
var/turf/open/floor/plating/asteroid/airless/cave/C = tunnel.ChangeTurf(data_having_type,FALSE,TRUE)
var/turf/open/floor/plating/asteroid/airless/cave/C = tunnel.ChangeTurf(data_having_type,FALSE,FALSE,TRUE)
C.going_backwards = FALSE
C.produce_tunnel_from_data(rand(10, 15), dir)
else
@@ -274,7 +274,7 @@
SpawnFlora(T)
SpawnMonster(T)
T.ChangeTurf(turf_type,FALSE,TRUE)
T.ChangeTurf(turf_type,FALSE,FALSE,TRUE)
/turf/open/floor/plating/asteroid/airless/cave/proc/SpawnMonster(turf/T)
if(prob(30))

View File

@@ -82,7 +82,7 @@
SSblackbox.add_details("ore_mined",mineralType)
for(var/obj/effect/temp_visual/mining_overlay/M in src)
qdel(M)
ChangeTurf(turf_type, defer_change)
ChangeTurf(turf_type, FALSE, defer_change)
addtimer(CALLBACK(src, .proc/AfterChange), 1, TIMER_UNIQUE)
playsound(src, 'sound/effects/break_stone.ogg', 50, 1) //beautiful destruction
@@ -156,7 +156,7 @@
..()
if (prob(mineralChance))
var/path = pickweight(mineralSpawnChanceList)
var/turf/T = ChangeTurf(path,FALSE,TRUE)
var/turf/T = ChangeTurf(path,FALSE,FALSE,TRUE)
if(T && ismineralturf(T))
var/turf/closed/mineral/M = T
@@ -469,7 +469,7 @@
G.quality = 2
G.icon_state = "Gibtonite ore 2"
ChangeTurf(turf_type, defer_change)
ChangeTurf(turf_type, FALSE, defer_change)
addtimer(CALLBACK(src, .proc/AfterChange), 1, TIMER_UNIQUE)

View File

@@ -20,7 +20,7 @@
continue
W.connected = 1
var/turf/cur_turf = get_turf(W)
cur_turf.ChangeTurf(turf_type,FALSE,TRUE)
cur_turf.ChangeTurf(turf_type,FALSE,FALSE,TRUE)
var/turf/target_turf = get_turf(pick(river_nodes - W))
if(!target_turf)
break
@@ -49,7 +49,7 @@
cur_turf = get_step(cur_turf, cur_dir)
continue
else
var/turf/river_turf = cur_turf.ChangeTurf(turf_type,FALSE,TRUE)
var/turf/river_turf = cur_turf.ChangeTurf(turf_type,FALSE,FALSE,TRUE)
river_turf.Spread(25, 11, whitelist_area)
for(var/WP in river_nodes)
@@ -85,16 +85,16 @@
for(var/F in cardinal_turfs) //cardinal turfs are always changed but don't always spread
var/turf/T = F
if(!istype(T, logged_turf_type) && T.ChangeTurf(type,FALSE,TRUE) && prob(probability))
if(!istype(T, logged_turf_type) && T.ChangeTurf(type,FALSE,FALSE,TRUE) && prob(probability))
T.Spread(probability - prob_loss, prob_loss, whitelisted_area)
for(var/F in diagonal_turfs) //diagonal turfs only sometimes change, but will always spread if changed
var/turf/T = F
if(!istype(T, logged_turf_type) && prob(probability) && T.ChangeTurf(type,FALSE,TRUE))
if(!istype(T, logged_turf_type) && prob(probability) && T.ChangeTurf(type,FALSE,FALSE,TRUE))
T.Spread(probability - prob_loss, prob_loss, whitelisted_area)
else if(ismineralturf(T))
var/turf/closed/mineral/M = T
M.ChangeTurf(M.turf_type,FALSE,TRUE)
M.ChangeTurf(M.turf_type,FALSE,FALSE,TRUE)
#undef RANDOM_UPPER_X

View File

@@ -197,11 +197,11 @@
qdel(L)
//wrapper for ChangeTurf()s that you want to prevent/affect without overriding ChangeTurf() itself
/turf/proc/TerraformTurf(path, defer_change = FALSE, ignore_air = FALSE, new_baseturf)
return ChangeTurf(path, defer_change, ignore_air, new_baseturf)
/turf/proc/TerraformTurf(path, new_baseturf, defer_change = FALSE, ignore_air = FALSE)
return ChangeTurf(path, new_baseturf, defer_change, ignore_air)
//Creates a new turf
/turf/proc/ChangeTurf(path, defer_change = FALSE, ignore_air = FALSE, new_baseturf)
/turf/proc/ChangeTurf(path, new_baseturf, defer_change = FALSE, ignore_air = FALSE)
if(!path)
return
if(!GLOB.use_preloader && path == type) // Don't no-op if the map loader requires it to be reconstructed
@@ -409,18 +409,18 @@
/turf/proc/empty(turf_type=/turf/open/space, baseturf_type)
// Remove all atoms except observers, landmarks, docking ports
var/turf/T0 = src
var/static/list/ignored_atoms = typecacheof(list(/turf, /mob/dead, /obj/effect/landmark, /obj/docking_port, /atom/movable/lighting_object))
var/list/allowed_contents = typecache_filter_list(T0.GetAllContents(),ignored_atoms,reversed=TRUE)
var/static/list/ignored_atoms = typecacheof(list(/mob/dead, /obj/effect/landmark, /obj/docking_port, /atom/movable/lighting_object))
var/list/allowed_contents = typecache_filter_list(GetAllContents(),ignored_atoms,reversed=TRUE)
allowed_contents -= src
for(var/i in 1 to allowed_contents.len)
var/thing = allowed_contents[i]
qdel(thing, force=TRUE)
T0.ChangeTurf(turf_type, FALSE, FALSE, baseturf_type)
var/turf/newT = ChangeTurf(turf_type, baseturf_type, FALSE, FALSE)
SSair.remove_from_active(T0)
T0.CalculateAdjacentTurfs()
SSair.add_to_active(T0,1)
SSair.remove_from_active(newT)
newT.CalculateAdjacentTurfs()
SSair.add_to_active(newT,1)
/turf/proc/is_transition_turf()
return

View File

@@ -327,7 +327,7 @@ GLOBAL_DATUM_INIT(_preloader, /dmm_suite/preloader, new)
if(crds)
if(!no_changeturf && ispath(path, /turf))
. = crds.ChangeTurf(path, TRUE)
. = crds.ChangeTurf(path, FALSE, TRUE)
else
. = create_atom(path, crds)//first preloader pass

View File

@@ -39,7 +39,7 @@
for(var/F in RANGE_TURFS(1, src))
if(ismineralturf(F))
var/turf/closed/mineral/M = F
M.ChangeTurf(M.turf_type,FALSE,TRUE)
M.ChangeTurf(M.turf_type,FALSE,FALSE,TRUE)
gps = new /obj/item/device/gps/internal(src)
/mob/living/simple_animal/hostile/spawner/lavaland/Destroy()

View File

@@ -55,7 +55,7 @@ All ShuttleMove procs go here
new_open.copy_air_with_tile(src)
//Source turf changes
ChangeTurf(turf_type, FALSE, TRUE, baseturf_type)
ChangeTurf(turf_type, baseturf_type, FALSE, TRUE)
return TRUE

View File

@@ -177,7 +177,7 @@
for(var/i in 1 to assigned_turfs.len)
var/turf/T = assigned_turfs[i]
if(T.type == turf_type)
T.ChangeTurf(/turf/open/space,new_baseturf=/turf/open/space)
T.ChangeTurf(/turf/open/space,/turf/open/space)
T.flags |= UNUSED_TRANSIT_TURF
/obj/docking_port/stationary/transit/Destroy(force=FALSE)
@@ -385,7 +385,7 @@
var/turf_type = /turf/open/space
var/baseturf_type = /turf/open/space
var/area_type = /area/space
var/underlying_area_type = /area/space
// If the shuttle is docked to a stationary port, restore its normal
// "empty" area and turf
if(current_dock)
@@ -394,28 +394,26 @@
if(current_dock.baseturf_type)
baseturf_type = current_dock.baseturf_type
if(current_dock.area_type)
area_type = current_dock.area_type
underlying_area_type = current_dock.area_type
var/list/shuttle_turfs = return_ordered_turfs(x, y, z, dir, area_type)
var/list/old_turfs = return_ordered_turfs(x, y, z, dir, area_type)
var/area/underlying_area = locate(underlying_area_type) in GLOB.sortedAreas
if(!underlying_area)
underlying_area = new underlying_area_type(null)
//remove area surrounding docking port
for(var/i in 1 to shuttle_areas.len)
var/area/shuttle_area = shuttle_areas[i]
if(shuttle_area.contents.len)
var/area/underlying_area = locate("[area_type]")
if(!underlying_area)
underlying_area = new area_type(null)
for(var/ii in shuttle_turfs)
var/turf/T = shuttle_turfs[ii]
var/area/old_area = T.loc
underlying_area.contents += T
T.change_area(old_area, underlying_area)
for(var/i in shuttle_turfs)
var/turf/T = i
if(!T)
var/i
for(i in 1 to old_turfs.len)
var/turf/oldT = old_turfs[i]
if(!oldT)
continue
T.empty(turf_type, baseturf_type)
var/area/old_area = oldT.loc
underlying_area.contents += oldT
oldT.change_area(old_area, underlying_area)
for(i in 1 to old_turfs.len)
var/turf/oldT = old_turfs[i]
if(!oldT)
continue
oldT.empty(turf_type, baseturf_type)
qdel(src, force=TRUE)