Fix runtimes in Lavaland river procgen. (#26606)

* Fix runtimes in Lavaland river procgen.

* fucking what, sanity check

* add back attempt bailout
This commit is contained in:
warriorstar-orion
2024-08-30 09:27:54 -04:00
committed by GitHub
parent a74f9574bc
commit 1de5df28bb
+16 -12
View File
@@ -67,21 +67,25 @@
var/detouring = 0
var/cur_dir = get_dir(cur_turf, target_turf)
while(cur_turf != target_turf)
if(detouring) //randomly snake around a bit
if(prob(21))
detouring = 0
cur_dir = get_dir(cur_turf, target_turf)
else if(prob(20))
detouring = 1
if(prob(50))
cur_dir = turn(cur_dir, 45)
var/attempts = 100
do
if(detouring) //randomly snake around a bit
if(prob(20))
detouring = 0
cur_dir = get_dir(cur_turf, target_turf)
else if(prob(20))
detouring = 1
if(prob(50))
cur_dir = turn(cur_dir, 45)
else
cur_dir = turn(cur_dir, -45)
else
cur_dir = turn(cur_dir, -45)
else
cur_dir = get_dir(cur_turf, target_turf)
cur_dir = get_dir(cur_turf, target_turf)
// we may veer off the map entirely, returning a null turf; if so, go back and try again
while(get_step(cur_turf, cur_dir) == null && attempts-- > 0)
cur_turf = get_step(cur_turf, cur_dir)
if(isnull(cur_turf)) //This might be the fuck up. Kill the loop if this happens
if(isnull(cur_turf))
stack_trace("Encountered a null turf in river loop, target turf was [target_turf], x=[target_turf.x], y=[target_turf.y].")
break
var/area/new_area = get_area(cur_turf)