fix two vermin infestation issues (#28181)

* fix two vermin infestation issues

* Update code/modules/events/infestation.dm

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>

---------

Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
This commit is contained in:
warriorstar-orion
2025-02-02 02:54:43 +00:00
committed by GitHub
co-authored by Luc Burzah
parent 9711894427
commit bb4e21baf6
2 changed files with 20 additions and 16 deletions
-6
View File
@@ -1562,12 +1562,6 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
if(areas)
. |= T.loc
/proc/turf_clear(turf/T)
for(var/atom/A in T)
if(A.simulated)
return FALSE
return TRUE
/proc/screen_loc2turf(scr_loc, turf/origin)
var/tX = splittext(scr_loc, ",")
var/tY = splittext(tX[2], ":")
+20 -10
View File
@@ -27,17 +27,27 @@
/datum/event/infestation/start()
var/list/turf/simulated/floor/turfs = list()
spawn_area_type = pick(spawn_areas)
for(var/areapath in typesof(spawn_area_type))
var/area/A = locate(areapath)
if(!A)
log_debug("Failed to locate area for infestation event!")
kill()
return
for(var/turf/simulated/floor/F in A.contents)
if(turf_clear(F))
turfs += F
// shuffle in place so we don't have do that dance where we make a copy of
// the list, then pick and take, then do some conditional logic to make sure
// there's still areas to choose from, etc etc, it's a small list, it's cheap
shuffle_inplace(spawn_areas)
for(var/spawn_area in spawn_areas)
for(var/area_type in typesof(spawn_area))
var/area/destination = locate(area_type)
if(!destination)
continue
for(var/turf/simulated/floor/F in destination.contents)
if(!is_blocked_turf(F))
turfs += F
if(length(turfs))
spawn_area_type = area_type
spawn_on_turfs(turfs)
return
log_debug("Failed to locate area for infestation event!")
kill()
/datum/event/infestation/proc/spawn_on_turfs(list/turfs)
var/list/spawn_types = list()
var/max_number
vermin = rand(0, 2)