mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 02:16:05 +00:00
Actually fixes multi-z infinite loops (#32470)
* Testing removal of multi-z cap variables in lieue of other system * Line not needed * Neither is this * More cleanup * Fixed cause of not being able to initialise server with infinite loops of multi-z * Linter hates these, plus unnecessary anyways * Cutting down icon update code, still works Co-authored-by: kanef <kanef9x@protonmail.com>
This commit is contained in:
@@ -77,10 +77,6 @@
|
|||||||
var/cargo_forwarding_on_roundstart = 0
|
var/cargo_forwarding_on_roundstart = 0
|
||||||
var/cargo_forwarding_amount_override = 0
|
var/cargo_forwarding_amount_override = 0
|
||||||
|
|
||||||
|
|
||||||
var/multiz_render_cap = 8 //how far down open spaces will render
|
|
||||||
var/multiz_bottom_cap = 16 //how far down open spaces will detect for a bottom
|
|
||||||
|
|
||||||
// BSQL things
|
// BSQL things
|
||||||
var/bsql_debug = 0
|
var/bsql_debug = 0
|
||||||
var/async_query_timeout = 10
|
var/async_query_timeout = 10
|
||||||
@@ -584,11 +580,6 @@
|
|||||||
bsql_thread_limit = text2num(value)
|
bsql_thread_limit = text2num(value)
|
||||||
|
|
||||||
|
|
||||||
if("multiz_render_cap")
|
|
||||||
multiz_render_cap = text2num(value)
|
|
||||||
if("multiz_bottom_cap")
|
|
||||||
multiz_bottom_cap = text2num(value)
|
|
||||||
|
|
||||||
if("media_base_url")
|
if("media_base_url")
|
||||||
media_base_url = value
|
media_base_url = value
|
||||||
if("media_secret_key")
|
if("media_secret_key")
|
||||||
|
|||||||
@@ -26,71 +26,24 @@
|
|||||||
if(!isturf(loc))
|
if(!isturf(loc))
|
||||||
return
|
return
|
||||||
|
|
||||||
var/turf/below = GetBelow(src)
|
if(!check_below())
|
||||||
if(!below)
|
|
||||||
return
|
|
||||||
|
|
||||||
var/turf/bottom = null
|
|
||||||
var/depth = 0
|
|
||||||
for(bottom = GetBelow(src); isopenspace(bottom); bottom = GetBelow(bottom))
|
|
||||||
depth++
|
|
||||||
if(depth > config.multiz_bottom_cap) // To stop getting caught on this in infinite loops
|
|
||||||
break
|
|
||||||
|
|
||||||
if(istype(bottom,/turf/space))
|
|
||||||
return
|
|
||||||
|
|
||||||
var/turf/T = loc
|
|
||||||
if(!T.CanZPass(src, DOWN) || !below.CanZPass(src, DOWN))
|
|
||||||
return
|
|
||||||
|
|
||||||
var/obj/structure/stairs/down_stairs = locate(/obj/structure/stairs) in below
|
|
||||||
// Detect stairs below and traverse down them.
|
|
||||||
if(down_stairs && down_stairs.dir == GetOppositeDir(dir))
|
|
||||||
Move(below)
|
|
||||||
if(isliving(src))
|
|
||||||
var/mob/living/L = src
|
|
||||||
if(L.pulling)
|
|
||||||
L.pulling.Move(below)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
var/gravity = get_gravity()
|
var/gravity = get_gravity()
|
||||||
// No gravity in space, apparently.
|
// No gravity in space, apparently.
|
||||||
if(!gravity) //Polaris uses a proc, has_gravity(), for this
|
if(!gravity) //Polaris uses a proc, has_gravity(), for this
|
||||||
return
|
return
|
||||||
|
|
||||||
fall_lock = TRUE
|
fall_lock = TRUE
|
||||||
spawn(4 / gravity) // Now we use a delay of 4 ticks divided by the gravity.
|
spawn(4 / gravity) // Now we use a delay of 4 ticks divided by the gravity.
|
||||||
fall_lock = FALSE
|
fall_lock = FALSE
|
||||||
|
|
||||||
|
var/turf/below = check_below()
|
||||||
// We're in a new loc most likely, so check all this again
|
// We're in a new loc most likely, so check all this again
|
||||||
below = GetBelow(src)
|
|
||||||
if(!below)
|
if(!below)
|
||||||
return
|
return
|
||||||
|
|
||||||
bottom = null
|
if(!get_gravity())
|
||||||
depth = 0
|
|
||||||
for(bottom = GetBelow(src); isopenspace(bottom); bottom = GetBelow(bottom))
|
|
||||||
depth++
|
|
||||||
if(depth > config.multiz_bottom_cap) // To stop getting caught on this in infinite loops
|
|
||||||
break
|
|
||||||
|
|
||||||
if(istype(bottom,/turf/space))
|
|
||||||
return
|
|
||||||
T = loc
|
|
||||||
if(!T.CanZPass(src, DOWN) || !below.CanZPass(src, DOWN))
|
|
||||||
return
|
|
||||||
|
|
||||||
down_stairs = locate(/obj/structure/stairs) in below
|
|
||||||
if(down_stairs && down_stairs.dir == GetOppositeDir(dir))
|
|
||||||
Move(below)
|
|
||||||
if(isliving(src))
|
|
||||||
var/mob/living/L = src
|
|
||||||
if(L.pulling)
|
|
||||||
L.pulling.Move(below)
|
|
||||||
return
|
|
||||||
|
|
||||||
gravity = get_gravity()
|
|
||||||
if(!gravity)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
/*if(throwing) This was causing odd behavior where things wouldn't stop.
|
/*if(throwing) This was causing odd behavior where things wouldn't stop.
|
||||||
@@ -108,6 +61,37 @@
|
|||||||
if(is_client_moving) M.client.moving = 0
|
if(is_client_moving) M.client.moving = 0
|
||||||
// TODO - handle fall on damage!
|
// TODO - handle fall on damage!
|
||||||
|
|
||||||
|
/atom/movable/proc/check_below()
|
||||||
|
var/turf/below = GetBelow(src)
|
||||||
|
if(!below)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
var/turf/bottom = null
|
||||||
|
var/list/checked_belows = list()
|
||||||
|
for(bottom = GetBelow(src); isopenspace(bottom); bottom = GetBelow(bottom))
|
||||||
|
if(bottom.z in checked_belows) // To stop getting caught on this in infinite loops
|
||||||
|
break
|
||||||
|
checked_belows.Add(bottom.z)
|
||||||
|
|
||||||
|
if(istype(bottom,/turf/space))
|
||||||
|
return 0
|
||||||
|
|
||||||
|
var/turf/T = loc
|
||||||
|
if(!T.CanZPass(src, DOWN) || !below.CanZPass(src, DOWN))
|
||||||
|
return 0
|
||||||
|
|
||||||
|
var/obj/structure/stairs/down_stairs = locate(/obj/structure/stairs) in below
|
||||||
|
// Detect stairs below and traverse down them.
|
||||||
|
if(down_stairs && down_stairs.dir == GetOppositeDir(dir))
|
||||||
|
Move(below)
|
||||||
|
if(isliving(src))
|
||||||
|
var/mob/living/L = src
|
||||||
|
if(L.pulling)
|
||||||
|
L.pulling.Move(below)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
return below
|
||||||
|
|
||||||
//For children to override
|
//For children to override
|
||||||
/atom/movable/proc/can_fall()
|
/atom/movable/proc/can_fall()
|
||||||
if(anchored)
|
if(anchored)
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
plane = OPENSPACE_PLANE_START
|
plane = OPENSPACE_PLANE_START
|
||||||
//pathweight = 100000 //For lack of pathweights, mobdropping meta inc
|
//pathweight = 100000 //For lack of pathweights, mobdropping meta inc
|
||||||
dynamic_lighting = 0 // Someday lets do proper lighting z-transfer. Until then we are leaving this off so it looks nicer.
|
dynamic_lighting = 0 // Someday lets do proper lighting z-transfer. Until then we are leaving this off so it looks nicer.
|
||||||
|
|
||||||
var/turf/below
|
var/turf/below
|
||||||
|
|
||||||
/turf/simulated/open/post_change()
|
/turf/simulated/open/post_change()
|
||||||
@@ -83,7 +82,11 @@ var/static/list/no_spacemove_turfs = list(/turf/simulated/wall,/turf/unsimulated
|
|||||||
/turf/simulated/open/examine(mob/user, distance, infix, suffix)
|
/turf/simulated/open/examine(mob/user, distance, infix, suffix)
|
||||||
if(..(user, 2))
|
if(..(user, 2))
|
||||||
var/depth = 1
|
var/depth = 1
|
||||||
for(var/T = GetBelow(src); isopenspace(T); T = GetBelow(T))
|
var/list/checked_belows = list()
|
||||||
|
for(var/turf/T = GetBelow(src); isopenspace(T); T = GetBelow(T))
|
||||||
|
if(T.z in checked_belows) // To stop getting caught on this in infinite loops
|
||||||
|
to_chat(user, "It looks bottomless.")
|
||||||
|
return
|
||||||
depth += 1
|
depth += 1
|
||||||
to_chat(user, "It is about [depth] levels deep.")
|
to_chat(user, "It is about [depth] levels deep.")
|
||||||
|
|
||||||
@@ -96,16 +99,19 @@ var/static/list/no_spacemove_turfs = list(/turf/simulated/wall,/turf/unsimulated
|
|||||||
plane = OPEN_OVERLAY_PLANE
|
plane = OPEN_OVERLAY_PLANE
|
||||||
|
|
||||||
/turf/simulated/open/update_icon()
|
/turf/simulated/open/update_icon()
|
||||||
|
make_openspace_view()
|
||||||
|
|
||||||
|
/turf/simulated/proc/make_openspace_view()
|
||||||
var/alpha_to_subtract = 127
|
var/alpha_to_subtract = 127
|
||||||
overlays.Cut()
|
overlays.Cut()
|
||||||
vis_contents.Cut()
|
vis_contents.Cut()
|
||||||
var/turf/bottom
|
var/turf/bottom
|
||||||
var/depth = 0
|
var/list/checked_belows = list()
|
||||||
for(bottom = GetBelow(src); isopenspace(bottom); bottom = GetBelow(bottom))
|
for(bottom = GetBelow(src); isopenspace(bottom); bottom = GetBelow(bottom))
|
||||||
alpha_to_subtract /= 2
|
alpha_to_subtract /= 2
|
||||||
depth++
|
if(bottom.z in checked_belows) // To stop getting caught on this in infinite loops
|
||||||
if(depth > config.multiz_render_cap) // To stop getting caught on this in infinite loops
|
return // Don't even render anything
|
||||||
break
|
checked_belows.Add(bottom.z)
|
||||||
|
|
||||||
if(!bottom || bottom == src)
|
if(!bottom || bottom == src)
|
||||||
return
|
return
|
||||||
@@ -115,6 +121,8 @@ var/static/list/no_spacemove_turfs = list(/turf/simulated/wall,/turf/unsimulated
|
|||||||
vis_contents += bottom
|
vis_contents += bottom
|
||||||
if(!istype(bottom,/turf/space)) // Space below us
|
if(!istype(bottom,/turf/space)) // Space below us
|
||||||
vis_contents.Add(overimage)
|
vis_contents.Add(overimage)
|
||||||
|
return 1
|
||||||
|
return 0
|
||||||
|
|
||||||
/turf/simulated/open/ChangeTurf(var/turf/N, var/tell_universe=1, var/force_lighting_update = 0, var/allow = 1)
|
/turf/simulated/open/ChangeTurf(var/turf/N, var/tell_universe=1, var/force_lighting_update = 0, var/allow = 1)
|
||||||
overlays.Cut()
|
overlays.Cut()
|
||||||
@@ -201,25 +209,7 @@ var/static/list/no_spacemove_turfs = list(/turf/simulated/wall,/turf/unsimulated
|
|||||||
/turf/simulated/floor/glass/update_icon()
|
/turf/simulated/floor/glass/update_icon()
|
||||||
..()
|
..()
|
||||||
if(get_base_turf(src.z) == /turf/simulated/open)
|
if(get_base_turf(src.z) == /turf/simulated/open)
|
||||||
var/alpha_to_subtract = 127
|
if(make_openspace_view()) // Space below us
|
||||||
vis_contents.Cut()
|
|
||||||
overlays.Cut()
|
|
||||||
var/turf/bottom
|
|
||||||
var/depth = 0
|
|
||||||
for(bottom = GetBelow(src); isopenspace(bottom); bottom = GetBelow(bottom))
|
|
||||||
alpha_to_subtract /= 2
|
|
||||||
depth++
|
|
||||||
if(depth > config.multiz_render_cap) // To stop getting caught on this in infinite loops
|
|
||||||
break
|
|
||||||
|
|
||||||
if(!bottom || bottom == src)
|
|
||||||
return
|
|
||||||
var/obj/effect/open_overlay/overimage = new /obj/effect/open_overlay
|
|
||||||
overimage.alpha = 255 - alpha_to_subtract
|
|
||||||
overimage.color = rgb(0,0,0,overimage.alpha)
|
|
||||||
vis_contents += bottom
|
|
||||||
if(!istype(bottom,/turf/space)) // Space below us
|
|
||||||
vis_contents.Add(overimage)
|
|
||||||
icon_state = "" // Remove any previous space stuff, if any
|
icon_state = "" // Remove any previous space stuff, if any
|
||||||
else
|
else
|
||||||
// We space background now, forget the vis contentsing of it
|
// We space background now, forget the vis contentsing of it
|
||||||
|
|||||||
@@ -371,10 +371,4 @@ BLOCKING_QUERY_TIMEOUT 5
|
|||||||
BSQL_THREAD_LIMIT 50
|
BSQL_THREAD_LIMIT 50
|
||||||
|
|
||||||
## Uncomment to enable verbose BSQL communication logs
|
## Uncomment to enable verbose BSQL communication logs
|
||||||
#BSQL_DEBUG
|
#BSQL_DEBUG
|
||||||
|
|
||||||
## The maximum number of z-levels rendered above or below in multi-z
|
|
||||||
MULTIZ_RENDER_CAP 8
|
|
||||||
|
|
||||||
## The maximum number of z-levels checked below in multi-z
|
|
||||||
MULTIZ_BOTTOM_CAP 16
|
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
name = "ground floor"
|
name = "ground floor"
|
||||||
movementJammed = 1
|
movementJammed = 1
|
||||||
z_above = 3
|
z_above = 3
|
||||||
|
z_below = 5
|
||||||
|
|
||||||
/datum/zLevel/second
|
/datum/zLevel/second
|
||||||
name = "second floor"
|
name = "second floor"
|
||||||
@@ -23,6 +24,7 @@
|
|||||||
/datum/zLevel/third
|
/datum/zLevel/third
|
||||||
name = "third floor"
|
name = "third floor"
|
||||||
movementJammed = 1
|
movementJammed = 1
|
||||||
|
z_above = 2
|
||||||
z_below = 4
|
z_below = 4
|
||||||
|
|
||||||
/datum/map/active
|
/datum/map/active
|
||||||
|
|||||||
@@ -90,6 +90,13 @@
|
|||||||
/obj/structure/closet/emcloset,
|
/obj/structure/closet/emcloset,
|
||||||
/turf/simulated/floor,
|
/turf/simulated/floor,
|
||||||
/area/gateway)
|
/area/gateway)
|
||||||
|
"fA" = (
|
||||||
|
/obj/structure/window/reinforced{
|
||||||
|
dir = 1
|
||||||
|
},
|
||||||
|
/obj/structure/stairs/west,
|
||||||
|
/turf/simulated/floor,
|
||||||
|
/area/crew_quarters/bar)
|
||||||
"fL" = (
|
"fL" = (
|
||||||
/turf/portal{
|
/turf/portal{
|
||||||
teleport_x = -1;
|
teleport_x = -1;
|
||||||
@@ -9039,10 +9046,10 @@ aa
|
|||||||
aa
|
aa
|
||||||
aa
|
aa
|
||||||
ag
|
ag
|
||||||
bi
|
uv
|
||||||
bi
|
uv
|
||||||
bi
|
uv
|
||||||
bi
|
uv
|
||||||
ag
|
ag
|
||||||
aa
|
aa
|
||||||
aa
|
aa
|
||||||
@@ -9105,10 +9112,10 @@ aa
|
|||||||
aa
|
aa
|
||||||
aa
|
aa
|
||||||
ag
|
ag
|
||||||
bi
|
uv
|
||||||
bi
|
uv
|
||||||
bi
|
uv
|
||||||
bi
|
uv
|
||||||
ag
|
ag
|
||||||
aa
|
aa
|
||||||
aa
|
aa
|
||||||
@@ -9171,10 +9178,10 @@ aa
|
|||||||
aa
|
aa
|
||||||
aa
|
aa
|
||||||
ag
|
ag
|
||||||
bi
|
uv
|
||||||
bi
|
uv
|
||||||
bi
|
uv
|
||||||
bi
|
uv
|
||||||
ag
|
ag
|
||||||
aa
|
aa
|
||||||
aa
|
aa
|
||||||
@@ -21717,7 +21724,7 @@ ag
|
|||||||
uv
|
uv
|
||||||
uv
|
uv
|
||||||
uv
|
uv
|
||||||
HZ
|
fA
|
||||||
ag
|
ag
|
||||||
aa
|
aa
|
||||||
aa
|
aa
|
||||||
|
|||||||
Reference in New Issue
Block a user