mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 13:38:41 +01:00
[MIRROR] Cleans up some unused procs and makes is_blocked_turf a turf proc. (#136)
* Cleans up some unused procs and makes is_blocked_turf a turf proc. (#52482) * Cleans up some unused procs and makes is_blocked_turf a turf proc. * Update code/game/turfs/turf.dm Co-authored-by: Rohesie <rohesie@gmail.com> Co-authored-by: Rohesie <rohesie@gmail.com> * Cleans up some unused procs and makes is_blocked_turf a turf proc. Co-authored-by: ShizCalev <ShizCalev@users.noreply.github.com> Co-authored-by: Rohesie <rohesie@gmail.com>
This commit is contained in:
co-authored by
Rohesie
ShizCalev
parent
b7e1bd1973
commit
284f2de8a1
@@ -561,7 +561,7 @@
|
||||
continue
|
||||
|
||||
if (!isspaceturf(found_turf))
|
||||
if (!is_blocked_turf(found_turf))
|
||||
if (!found_turf.is_blocked_turf())
|
||||
possible_loc.Add(found_turf)
|
||||
|
||||
// Need at least one free location.
|
||||
|
||||
@@ -473,63 +473,6 @@ Turf and target are separate in case you want to teleport some distance from a t
|
||||
|
||||
return 1
|
||||
|
||||
/proc/is_blocked_turf(turf/T, exclude_mobs)
|
||||
if(T.density)
|
||||
return 1
|
||||
for(var/i in T)
|
||||
var/atom/A = i
|
||||
if(A.density && (!exclude_mobs || !ismob(A)))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/is_anchored_dense_turf(turf/T) //like the older version of the above, fails only if also anchored
|
||||
if(T.density)
|
||||
return 1
|
||||
for(var/i in T)
|
||||
var/atom/movable/A = i
|
||||
if(A.density && A.anchored)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/get_step_towards2(atom/ref , atom/trg)
|
||||
var/base_dir = get_dir(ref, get_step_towards(ref,trg))
|
||||
var/turf/temp = get_step_towards(ref,trg)
|
||||
|
||||
if(is_blocked_turf(temp))
|
||||
var/dir_alt1 = turn(base_dir, 90)
|
||||
var/dir_alt2 = turn(base_dir, -90)
|
||||
var/turf/turf_last1 = temp
|
||||
var/turf/turf_last2 = temp
|
||||
var/free_tile = null
|
||||
var/breakpoint = 0
|
||||
|
||||
while(!free_tile && breakpoint < 10)
|
||||
if(!is_blocked_turf(turf_last1))
|
||||
free_tile = turf_last1
|
||||
break
|
||||
if(!is_blocked_turf(turf_last2))
|
||||
free_tile = turf_last2
|
||||
break
|
||||
turf_last1 = get_step(turf_last1,dir_alt1)
|
||||
turf_last2 = get_step(turf_last2,dir_alt2)
|
||||
breakpoint++
|
||||
|
||||
if(!free_tile)
|
||||
return get_step(ref, base_dir)
|
||||
else
|
||||
return get_step_towards(ref,free_tile)
|
||||
|
||||
else
|
||||
return get_step(ref, base_dir)
|
||||
|
||||
//Takes: Anything that could possibly have variables and a varname to check.
|
||||
//Returns: 1 if found, 0 if not.
|
||||
/proc/hasvar(datum/A, varname)
|
||||
if(A.vars.Find(lowertext(varname)))
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
|
||||
//Repopulates sortedAreas list
|
||||
/proc/repopulate_sorted_areas()
|
||||
GLOB.sortedAreas = list()
|
||||
|
||||
@@ -640,7 +640,7 @@ SUBSYSTEM_DEF(job)
|
||||
//last hurrah
|
||||
var/list/avail = list()
|
||||
for(var/turf/T in A)
|
||||
if(!is_blocked_turf(T, TRUE))
|
||||
if(!T.is_blocked_turf(TRUE))
|
||||
avail += T
|
||||
if(avail.len)
|
||||
destination = pick(avail)
|
||||
@@ -651,7 +651,7 @@ SUBSYSTEM_DEF(job)
|
||||
var/list/arrivals_turfs = shuffle(get_area_turfs(/area/shuttle/arrival))
|
||||
if(arrivals_turfs.len)
|
||||
for(var/turf/T in arrivals_turfs)
|
||||
if(!is_blocked_turf(T, TRUE))
|
||||
if(!T.is_blocked_turf(TRUE))
|
||||
T.JoinPlayerHere(M, FALSE)
|
||||
return TRUE
|
||||
//last chance, pick ANY spot on arrivals and dump em
|
||||
|
||||
@@ -41,7 +41,7 @@ SUBSYSTEM_DEF(minor_mapping)
|
||||
for(var/z in SSmapping.levels_by_trait(ZTRAIT_STATION))
|
||||
all_turfs += block(locate(1,1,z), locate(world.maxx,world.maxy,z))
|
||||
for(var/turf/open/floor/plating/T in all_turfs)
|
||||
if(is_blocked_turf(T))
|
||||
if(T.is_blocked_turf())
|
||||
continue
|
||||
if(locate(/obj/structure/cable) in T)
|
||||
exposed_wires += T
|
||||
|
||||
@@ -172,20 +172,20 @@
|
||||
new /obj/structure/barricade/security(get_turf(src.loc))
|
||||
switch(mode)
|
||||
if(VERTICAL)
|
||||
var/target_turf = get_step(src, NORTH)
|
||||
if(!(is_blocked_turf(target_turf)))
|
||||
var/turf/target_turf = get_step(src, NORTH)
|
||||
if(!target_turf.is_blocked_turf())
|
||||
new /obj/structure/barricade/security(target_turf)
|
||||
|
||||
var/target_turf2 = get_step(src, SOUTH)
|
||||
if(!(is_blocked_turf(target_turf2)))
|
||||
var/turf/target_turf2 = get_step(src, SOUTH)
|
||||
if(!target_turf2.is_blocked_turf())
|
||||
new /obj/structure/barricade/security(target_turf2)
|
||||
if(HORIZONTAL)
|
||||
var/target_turf = get_step(src, EAST)
|
||||
if(!(is_blocked_turf(target_turf)))
|
||||
var/turf/target_turf = get_step(src, EAST)
|
||||
if(!target_turf.is_blocked_turf())
|
||||
new /obj/structure/barricade/security(target_turf)
|
||||
|
||||
var/target_turf2 = get_step(src, WEST)
|
||||
if(!(is_blocked_turf(target_turf2)))
|
||||
var/turf/target_turf2 = get_step(src, WEST)
|
||||
if(!target_turf2.is_blocked_turf())
|
||||
new /obj/structure/barricade/security(target_turf2)
|
||||
qdel(src)
|
||||
|
||||
|
||||
@@ -574,13 +574,13 @@
|
||||
if(T.density)
|
||||
if(wall_turret_direction)
|
||||
var/turf/closer = get_step(T,wall_turret_direction)
|
||||
if(istype(closer) && !is_blocked_turf(closer) && T.Adjacent(closer))
|
||||
if(istype(closer) && !closer.is_blocked_turf() && T.Adjacent(closer))
|
||||
T = closer
|
||||
else
|
||||
var/target_dir = get_dir(T,target)
|
||||
for(var/d in list(0,-45,45))
|
||||
var/turf/closer = get_step(T,turn(target_dir,d))
|
||||
if(istype(closer) && !is_blocked_turf(closer) && T.Adjacent(closer))
|
||||
if(istype(closer) && !closer.is_blocked_turf() && T.Adjacent(closer))
|
||||
T = closer
|
||||
break
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
to_chat(user, "<span class='notice'>You use [src] to deactivate [H].</span>")
|
||||
qdel(H)
|
||||
else
|
||||
if(!is_blocked_turf(T, TRUE)) //can't put holograms on a tile that has dense stuff
|
||||
if(!T.is_blocked_turf(TRUE)) //can't put holograms on a tile that has dense stuff
|
||||
if(holocreator_busy)
|
||||
to_chat(user, "<span class='notice'>[src] is busy creating a hologram.</span>")
|
||||
return
|
||||
@@ -43,7 +43,7 @@
|
||||
holocreator_busy = FALSE
|
||||
if(signs.len >= max_signs)
|
||||
return
|
||||
if(is_blocked_turf(T, TRUE)) //don't try to sneak dense stuff on our tile during the wait.
|
||||
if(T.is_blocked_turf(TRUE)) //don't try to sneak dense stuff on our tile during the wait.
|
||||
return
|
||||
H = new holosign_type(get_turf(target), src)
|
||||
to_chat(user, "<span class='notice'>You create \a [H] with [src].</span>")
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
smoke.start()
|
||||
var/list/L = list()
|
||||
for(var/turf/T in get_area_turfs(thearea.type))
|
||||
if(!is_blocked_turf(T))
|
||||
if(!T.is_blocked_turf())
|
||||
L += T
|
||||
|
||||
if(!L.len)
|
||||
|
||||
@@ -69,8 +69,8 @@
|
||||
/obj/structure/proc/do_climb(atom/movable/A)
|
||||
if(climbable)
|
||||
if(A.loc == src.loc)
|
||||
var/where_to_climb = get_step(A,dir)
|
||||
if(!(is_blocked_turf(where_to_climb)))
|
||||
var/turf/where_to_climb = get_step(A,dir)
|
||||
if(!where_to_climb.is_blocked_turf())
|
||||
A.forceMove(where_to_climb)
|
||||
return TRUE
|
||||
density = FALSE
|
||||
|
||||
@@ -136,6 +136,16 @@ GLOBAL_LIST_EMPTY(station_turfs)
|
||||
|
||||
/turf/proc/multiz_turf_new(turf/T, dir)
|
||||
|
||||
///returns if the turf has something dense inside it. if exclude_mobs is true, skips dense mobs like fat yoshi.
|
||||
/turf/proc/is_blocked_turf(exclude_mobs)
|
||||
if(density)
|
||||
return TRUE
|
||||
for(var/i in contents)
|
||||
var/atom/thing = i
|
||||
if(thing.density && (!exclude_mobs || !ismob(thing)))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
//zPassIn doesn't necessarily pass an atom!
|
||||
//direction is direction of travel of air
|
||||
/turf/proc/zPassIn(atom/movable/A, direction, turf/source)
|
||||
|
||||
@@ -489,7 +489,7 @@
|
||||
if(QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated() || !actual_selected_rune || !proximity)
|
||||
return
|
||||
var/turf/dest = get_turf(actual_selected_rune)
|
||||
if(is_blocked_turf(dest, TRUE))
|
||||
if(dest.is_blocked_turf(TRUE))
|
||||
to_chat(user, "<span class='warning'>The target rune is blocked. You cannot teleport there.</span>")
|
||||
return
|
||||
uses--
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
chant(i)
|
||||
var/list/destinations = list()
|
||||
for(var/turf/T in orange(1, owner))
|
||||
if(!is_blocked_turf(T, TRUE))
|
||||
if(!T.is_blocked_turf(TRUE))
|
||||
destinations += T
|
||||
if(!LAZYLEN(destinations))
|
||||
to_chat(owner, "<span class='warning'>You need more space to summon your cult!</span>")
|
||||
|
||||
@@ -379,7 +379,7 @@ structure_check() searches for nearby cultist structures required for the invoca
|
||||
return
|
||||
|
||||
var/turf/target = get_turf(actual_selected_rune)
|
||||
if(is_blocked_turf(target, TRUE))
|
||||
if(target.is_blocked_turf(TRUE))
|
||||
to_chat(user, "<span class='warning'>The target rune is blocked. Attempting to teleport to it would be massively unwise.</span>")
|
||||
fail_invoke()
|
||||
return
|
||||
|
||||
@@ -193,7 +193,7 @@
|
||||
|
||||
for (var/turf/possible_drop in contract.dropoff.contents)
|
||||
if (!isspaceturf(possible_drop) && !isclosedturf(possible_drop))
|
||||
if (!is_blocked_turf(possible_drop))
|
||||
if (!possible_drop.is_blocked_turf())
|
||||
possible_drop_loc.Add(possible_drop)
|
||||
|
||||
if (possible_drop_loc.len > 0)
|
||||
|
||||
@@ -185,7 +185,7 @@
|
||||
WARNING("[src] couldnt find a Quartermaster/Storage (aka cargobay) area on the station, and as such it has set the supplypod landingzone to the area it resides in.")
|
||||
landingzone = get_area(src)
|
||||
for(var/turf/open/floor/T in landingzone.contents)//uses default landing zone
|
||||
if(is_blocked_turf(T))
|
||||
if(T.is_blocked_turf())
|
||||
continue
|
||||
LAZYADD(empty_turfs, T)
|
||||
CHECK_TICK
|
||||
@@ -201,7 +201,7 @@
|
||||
if(SO.pack.cost * (0.72*MAX_EMAG_ROCKETS) <= points_to_check) // bulk discount :^)
|
||||
landingzone = GLOB.areas_by_type[pick(GLOB.the_station_areas)] //override default landing zone
|
||||
for(var/turf/open/floor/T in landingzone.contents)
|
||||
if(is_blocked_turf(T))
|
||||
if(T.is_blocked_turf())
|
||||
continue
|
||||
LAZYADD(empty_turfs, T)
|
||||
CHECK_TICK
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
for(var/place in shuttle_areas)
|
||||
var/area/shuttle/shuttle_area = place
|
||||
for(var/turf/open/floor/T in shuttle_area)
|
||||
if(is_blocked_turf(T))
|
||||
if(T.is_blocked_turf())
|
||||
continue
|
||||
empty_shuttle_turfs += T
|
||||
if(!empty_shuttle_turfs.len)
|
||||
|
||||
@@ -153,6 +153,7 @@
|
||||
SSexplosions.medturf += target
|
||||
if(EXPLODE_LIGHT)
|
||||
SSexplosions.lowturf += target
|
||||
|
||||
/datum/spacevine_mutation/aggressive_spread/on_buckle(obj/structure/spacevine/holder, mob/living/buckled)
|
||||
buckled.ex_act(severity, null, src)
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@
|
||||
|
||||
var/turf/turret_turf = get_turf(remote_eye)
|
||||
|
||||
if(is_blocked_turf(turret_turf))
|
||||
if(turret_turf.is_blocked_turf())
|
||||
to_chat(owner, "<span class='warning'>Location is obstructed by something. Please clear the location and try again.</span>")
|
||||
return
|
||||
|
||||
|
||||
@@ -1260,7 +1260,8 @@
|
||||
if(get_dist(user, beacon) <= 2) //beacon too close abort
|
||||
to_chat(user, "<span class='warning'>You are too close to the beacon to teleport to it!</span>")
|
||||
return
|
||||
if(is_blocked_turf(get_turf(beacon), TRUE))
|
||||
var/turf/beacon_turf = get_turf(beacon)
|
||||
if(beacon_turf?.is_blocked_turf(TRUE))
|
||||
to_chat(user, "<span class='warning'>The beacon is blocked by something, preventing teleportation!</span>")
|
||||
return
|
||||
if(!isturf(user.loc))
|
||||
@@ -1277,7 +1278,7 @@
|
||||
if(do_after(user, 40, target = user) && user && beacon)
|
||||
var/turf/T = get_turf(beacon)
|
||||
var/turf/source = get_turf(user)
|
||||
if(is_blocked_turf(T, TRUE))
|
||||
if(T.is_blocked_turf(TRUE))
|
||||
teleporting = FALSE
|
||||
to_chat(user, "<span class='warning'>The beacon is blocked by something, preventing teleportation!</span>")
|
||||
user.update_action_buttons_icon()
|
||||
@@ -1298,7 +1299,7 @@
|
||||
if(beacon)
|
||||
beacon.icon_state = "hierophant_tele_off"
|
||||
return
|
||||
if(is_blocked_turf(T, TRUE))
|
||||
if(T.is_blocked_turf(TRUE))
|
||||
teleporting = FALSE
|
||||
to_chat(user, "<span class='warning'>The beacon is blocked by something, preventing teleportation!</span>")
|
||||
user.update_action_buttons_icon()
|
||||
@@ -1333,7 +1334,7 @@
|
||||
|
||||
/obj/item/hierophant_club/proc/teleport_mob(turf/source, mob/M, turf/target, mob/user)
|
||||
var/turf/turf_to_teleport_to = get_step(target, get_dir(source, M)) //get position relative to caster
|
||||
if(!turf_to_teleport_to || is_blocked_turf(turf_to_teleport_to, TRUE))
|
||||
if(!turf_to_teleport_to || turf_to_teleport_to.is_blocked_turf(TRUE))
|
||||
return
|
||||
animate(M, alpha = 0, time = 2, easing = EASE_OUT) //fade out
|
||||
sleep(1)
|
||||
|
||||
@@ -497,7 +497,7 @@
|
||||
if(T)
|
||||
T.add_vomit_floor(src, VOMIT_TOXIC, purge)//toxic barf looks different || call purge when doing detoxicfication to pump more chems out of the stomach.
|
||||
T = get_step(T, dir)
|
||||
if (T != null && is_blocked_turf(T))
|
||||
if (T?.is_blocked_turf())
|
||||
break
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ Difficulty: Medium
|
||||
if(get_dist(src, O) >= MINER_DASH_RANGE && turf_dist_to_target <= self_dist_to_target && !islava(O) && !ischasm(O))
|
||||
var/valid = TRUE
|
||||
for(var/turf/T in getline(own_turf, O))
|
||||
if(is_blocked_turf(T, TRUE))
|
||||
if(T.is_blocked_turf(TRUE))
|
||||
valid = FALSE
|
||||
continue
|
||||
if(valid)
|
||||
|
||||
@@ -540,7 +540,7 @@ Difficulty: Very Hard
|
||||
var/turf/T = Stuff
|
||||
if((isspaceturf(T) || isfloorturf(T)) && NewTerrainFloors)
|
||||
var/turf/open/O = T.ChangeTurf(NewTerrainFloors, flags = CHANGETURF_INHERIT_AIR)
|
||||
if(prob(florachance) && NewFlora.len && !is_blocked_turf(O, TRUE))
|
||||
if(prob(florachance) && NewFlora.len && !O.is_blocked_turf(TRUE))
|
||||
var/atom/Picked = pick(NewFlora)
|
||||
new Picked(O)
|
||||
continue
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
playsound(src, 'sound/magic/RATTLEMEBONES.ogg', 100, TRUE)
|
||||
var/list/possiblelocations = list()
|
||||
for(var/turf/T in oview(src, 4)) //Only place the turrets on open turfs
|
||||
if(is_blocked_turf(T))
|
||||
if(T.is_blocked_turf())
|
||||
continue
|
||||
possiblelocations += T
|
||||
for(var/i in 1 to min(rand(minimum, maximum), LAZYLEN(possiblelocations))) //Makes sure aren't spawning in nullspace.
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
if(get_dist(A,B) != required_distance)
|
||||
return FALSE
|
||||
for(var/turf/T in getline(get_turf(A),get_turf(B)))
|
||||
if(is_blocked_turf(T,TRUE))
|
||||
if(T.is_blocked_turf(TRUE))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
var/list/turfs = block(locate(x-1,y-1,z),locate(x+1,y+1,z)) //NO MORE DISCS IN WINDOWS
|
||||
while(length(turfs))
|
||||
var/turf/T = pick_n_take(turfs)
|
||||
if(is_blocked_turf(T, exclude_mobs=TRUE))
|
||||
if(T.is_blocked_turf(TRUE))
|
||||
continue
|
||||
else
|
||||
dropturf = T
|
||||
|
||||
@@ -99,7 +99,7 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
|
||||
for(var/place in shuttle_areas)
|
||||
var/area/shuttle/shuttle_area = place
|
||||
for(var/turf/open/floor/T in shuttle_area)
|
||||
if(is_blocked_turf(T))
|
||||
if(T.is_blocked_turf())
|
||||
continue
|
||||
empty_turfs += T
|
||||
|
||||
|
||||
Reference in New Issue
Block a user