mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-09 17:13:36 +00:00
* 515 compat * double spaces * Callback documentation, aa review * spacing * NAMEOF_STATIC * big beta
30 lines
730 B
Plaintext
30 lines
730 B
Plaintext
/datum/event/wallrot/start()
|
|
INVOKE_ASYNC(src, PROC_REF(spawn_wallrot))
|
|
|
|
/datum/event/wallrot/proc/spawn_wallrot()
|
|
var/turf/simulated/wall/center = null
|
|
|
|
// 100 attempts
|
|
for(var/i in 0 to 100)
|
|
var/turf/candidate = locate(rand(1, world.maxx), rand(1, world.maxy), level_name_to_num(MAIN_STATION))
|
|
if(iswallturf(candidate))
|
|
center = candidate
|
|
break
|
|
|
|
if(!center)
|
|
return
|
|
// Make sure at least one piece of wall rots!
|
|
center.rot()
|
|
|
|
// Have a chance to rot lots of other walls.
|
|
var/rotcount = 0
|
|
var/actual_severity = severity * rand(5, 10)
|
|
for(var/turf/simulated/wall/W in range(5, center))
|
|
if(prob(50))
|
|
W.rot()
|
|
rotcount++
|
|
|
|
// Only rot up to severity walls
|
|
if(rotcount >= actual_severity)
|
|
break
|