mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 11:37:40 +01:00
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:
co-authored by
Luc
Burzah
parent
9711894427
commit
bb4e21baf6
@@ -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], ":")
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user