diff --git a/code/modules/events/grubinfestation_vr.dm b/code/modules/events/grubinfestation_vr.dm index 6ef35901b0..647b59117e 100644 --- a/code/modules/events/grubinfestation_vr.dm +++ b/code/modules/events/grubinfestation_vr.dm @@ -1,19 +1,16 @@ /datum/event/grub_infestation announceWhen = 90 + endWhen = 200 var/spawncount = 1 - + var/list/vents = list() + var/list/grubs = list() + var/give_positions = 0 /datum/event/grub_infestation/setup() announceWhen = rand(announceWhen, announceWhen + 60) + spawncount = rand(4 * severity, 6 * severity) //grub larva only have a 50% chance to grow big and strong - sent_spiders_to_station = 0 -/datum/event/grub_infestation/announce() - command_announcement.Announce("Solargrubs detected coming aboard [station_name()]. Please clear them out before this starts to affect productivity. All crew efforts are appreciated and encouraged.", "Lifesign Alert", new_sound = 'sound/AI/aliens.ogg') - - -/datum/event/grub_infestation/start() - var/list/vents = list() for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in machines) if(istype(get_area(temp_vent), /area/crew_quarters/sleep)) continue @@ -21,8 +18,30 @@ if(temp_vent.network.normal_members.len > 50) vents += temp_vent +/datum/event/grub_infestation/announce() + command_announcement.Announce("Solargrubs detected coming aboard [station_name()]. Please clear them out before this starts to affect productivity. All crew efforts are appreciated and encouraged.", "Lifesign Alert", new_sound = 'sound/AI/aliens.ogg') + +/datum/event/grub_infestation/start() while((spawncount >= 1) && vents.len) var/obj/vent = pick(vents) new /mob/living/simple_animal/solargrub_larva(get_turf(vent)) vents -= vent spawncount-- + vents.Cut() + +/datum/event/grub_infestation/end() + var/list/area_names = list() + for(var/grub in grubs) + var/mob/living/G = grub + if(!G || G.stat == DEAD) + continue + var/area/grub_area = get_area(G) + if(!grub_area) //Huh, really? + if(!get_turf(G)) //No turf either? + qdel(G) //Must have been nullspaced + continue + area_names |= grub_area.name + if(area_names.len) + var/english_list = english_list(area_names) + command_announcement.Announce("Sensors have narrowed down remaining active solargrubs to the followng areas: [english_list]", "Lifesign Alert", new_sound = 'sound/AI/aliens.ogg') + grubs.Cut() \ No newline at end of file