diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm index 4eaadfc5896..fb369946c34 100644 --- a/code/controllers/master_controller.dm +++ b/code/controllers/master_controller.dm @@ -181,7 +181,7 @@ datum/controller/game_controller/proc/process() //EVENTS timer = world.timeofday - last_thing_processed = /datum/event + last_thing_processed = /datum/round_event events.process() events_cost = (world.timeofday - timer) / 10 diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 038c47c7545..48b023acb15 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1614,11 +1614,7 @@ else if(href_list["secretsfun"]) if(!check_rights(R_FUN)) return - - var/list/overrides = list() - if(alert(usr, "Would you like to alert the crew?", "Alert", "Yes", "No") == "No") - overrides["announceWhen"] = -1 - + var/datum/round_event/E var/ok = 0 switch(href_list["secretsfun"]) if("monkey") @@ -1647,7 +1643,7 @@ feedback_add_details("admin_secrets_fun_used","TriAI") if("gravity") alert("WIP - event unavailable") -/* new /datum/event/weightless(overrides) +/* E = new /datum/round_event/weightless() log_admin("[key_name(usr)] triggered a gravity-failure event.", 1) message_admins("\blue [key_name_admin(usr)] triggered a gravity-failure event.", 1) feedback_inc("admin_secrets_fun_used",1) @@ -1796,44 +1792,44 @@ if("wave") feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","MW") - new /datum/event/meteor_wave(overrides) + E = new /datum/round_event/meteor_wave() if("gravanomalies") feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","GA") - new /datum/event/gravitational_anomaly(overrides) + E = new /datum/round_event/gravitational_anomaly() if("timeanomalies") //dear god this code was awful :P Still needs further optimisation feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","STA") - new /datum/event/wormholes(overrides) + E = new /datum/round_event/wormholes() if("goblob") feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","BL") message_admins("[key_name_admin(usr)] has spawned blob", 1) - new /datum/event/blob(overrides) + E = new /datum/round_event/blob() if("aliens") feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","AL") message_admins("[key_name_admin(usr)] has spawned aliens", 1) - new /datum/event/alien_infestation(overrides) + E = new /datum/round_event/alien_infestation() if("alien_silent") //replaces the spawn_xeno verb feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","ALS") create_xeno() if("spiders") - new /datum/event/spider_infestation(overrides) + E = new /datum/round_event/spider_infestation() feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","SL") message_admins("[key_name_admin(usr)] has spawned spiders", 1) if("bluespaceanomaly") - new /datum/event/bluespace_anomaly(overrides) + E = new /datum/round_event/bluespace_anomaly() feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","BA") message_admins("[key_name_admin(usr)] has triggered a bluespace anomaly", 1) if("comms_blackout") - new /datum/event/communications_blackout(overrides) + E = new /datum/round_event/communications_blackout() feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","CB") message_admins("[key_name_admin(usr)] triggered a communications blackout.", 1) @@ -1841,9 +1837,9 @@ feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","SN") message_admins("[key_name_admin(usr)] has sent in a space ninja", 1) - new /datum/event/ninja(list(overrides)) + E = new /datum/round_event/ninja() if("carp") - new /datum/event/carp_migration(overrides) + E = new /datum/round_event/carp_migration() feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","C") message_admins("[key_name_admin(usr)] has spawned carp.", 1) @@ -1851,29 +1847,27 @@ feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","R") message_admins("[key_name_admin(usr)] has has irradiated the station", 1) - new /datum/event/radiation_storm(overrides) + E = new /datum/round_event/radiation_storm() if("immovable") feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","IR") message_admins("[key_name_admin(usr)] has sent an immovable rod to the station", 1) - new /datum/event/immovable_rod(overrides) + E = new /datum/round_event/immovable_rod() if("prison_break") feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","PB") message_admins("[key_name_admin(usr)] has allowed a prison break", 1) - new /datum/event/prison_break(overrides) + E = new /datum/round_event/prison_break() if("lightsout") feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","LO") message_admins("[key_name_admin(usr)] has broke a lot of lights", 1) - overrides["lightsoutAmount"]=2 - new /datum/event/electrical_storm(overrides) + E = new /datum/round_event/electrical_storm{lightsoutAmount=2}() if("blackout") feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","BO") message_admins("[key_name_admin(usr)] broke all lights", 1) - overrides["lightsoutAmount"]=0 - new /datum/event/electrical_storm(overrides) + E = new /datum/round_event/electrical_storm{lightsoutAmount=0}() if("whiteout") feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","WO") @@ -1955,10 +1949,12 @@ if("Make Your Own") AdminCreateVirus(usr.client) if("Random") - new /datum/event/disease_outbreak(overrides) + E = new /datum/round_event/disease_outbreak() if("Choose") - overrides["virus_type"] = input("Choose the virus to spread", "BIOHAZARD") as null|anything in typesof(/datum/disease) - new /datum/event/disease_outbreak(overrides) + var/virus = input("Choose the virus to spread", "BIOHAZARD") as null|anything in typesof(/datum/disease) + E = new /datum/round_event/disease_outbreak{}() + var/datum/round_event/disease_outbreak/DO = E + DO.virus_type = virus if("retardify") feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","RET") @@ -1986,17 +1982,23 @@ feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","I") message_admins("[key_name_admin(usr)] triggered an ion storm") - new /datum/event/ion_storm(overrides) + E = new /datum/round_event/ion_storm() if("spacevines") feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","K") message_admins("[key_name_admin(usr)] has spawned spacevines", 1) - new /datum/event/spacevine(overrides) + E = new /datum/round_event/spacevine() if("onlyone") feedback_inc("admin_secrets_fun_used",1) feedback_add_details("admin_secrets_fun_used","OO") usr.client.only_one() // message_admins("[key_name_admin(usr)] has triggered a battle to the death (only one)") + if(E) + E.processing = 0 + if(E.announceWhen>0) + if(alert(usr, "Would you like to alert the crew?", "Alert", "Yes", "No") == "No") + E.announceWhen = -1 + E.processing = 1 if(usr) log_admin("[key_name(usr)] used secret [href_list["secretsfun"]]") if (ok) diff --git a/code/modules/admin/verbs/one_click_antag.dm b/code/modules/admin/verbs/one_click_antag.dm index 528dbd61d4d..44757fef817 100644 --- a/code/modules/admin/verbs/one_click_antag.dm +++ b/code/modules/admin/verbs/one_click_antag.dm @@ -306,11 +306,11 @@ client/proc/one_click_antag() /datum/admins/proc/makeAliens() - new /datum/event/alien_infestation(list("spawncount"=3)) + new /datum/round_event/alien_infestation{spawncount=3}() return 1 /datum/admins/proc/makeSpaceNinja() - new /datum/event/ninja() + new /datum/round_event/ninja() return 1 /* DEATH SQUADS diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 0ed8c77b7b7..f55ed33c49b 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -192,7 +192,7 @@ proc/cmd_admin_mute(whom, mute_type, automute = 0) command_alert("Ion storm detected near the station. Please check all AI-controlled equipment for errors.", "Anomaly Alert") world << sound('sound/AI/ionstorm.ogg') - new /datum/event/ion_storm(list("botEmagChance"=0)) + new /datum/round_event/ion_storm{botEmagChance=0}() feedback_add_details("admin_verb","ION") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/events/alien_infestation.dm b/code/modules/events/alien_infestation.dm index 26d988498fa..62007bccf9b 100644 --- a/code/modules/events/alien_infestation.dm +++ b/code/modules/events/alien_infestation.dm @@ -1,32 +1,32 @@ -/datum/event_control/alien_infestation +/datum/round_event_control/alien_infestation name = "Alien Infestation" - typepath = /datum/event/alien_infestation + typepath = /datum/round_event/alien_infestation weight = 5 max_occurrences = 1 -/datum/event/alien_infestation +/datum/round_event/alien_infestation announceWhen = 400 var/spawncount = 1 var/successSpawn = 0 //So we don't make a command report if nothing gets spawned. -/datum/event/alien_infestation/setup() +/datum/round_event/alien_infestation/setup() announceWhen = rand(announceWhen, announceWhen + 50) spawncount = rand(1, 2) -/datum/event/alien_infestation/kill() +/datum/round_event/alien_infestation/kill() if(!successSpawn && control) control.occurrences-- return ..() -/datum/event/alien_infestation/announce() +/datum/round_event/alien_infestation/announce() if(successSpawn) command_alert("Unidentified lifesigns detected coming aboard [station_name()]. Secure any exterior access, including ducting and ventilation.", "Lifesign Alert") world << sound('sound/AI/aliens.ogg') -/datum/event/alien_infestation/start() +/datum/round_event/alien_infestation/start() var/list/vents = list() for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in world) if(temp_vent.loc.z == 1 && !temp_vent.welded && temp_vent.network) diff --git a/code/modules/events/blob.dm b/code/modules/events/blob.dm index c1be5626d44..fe128a0f14d 100644 --- a/code/modules/events/blob.dm +++ b/code/modules/events/blob.dm @@ -1,22 +1,22 @@ -/datum/event_control/blob +/datum/round_event_control/blob name = "Blob" - typepath = /datum/event/blob + typepath = /datum/round_event/blob weight = 5 max_occurrences = 1 -/datum/event/blob +/datum/round_event/blob announceWhen = 12 endWhen = 120 var/obj/effect/blob/core/Blob -/datum/event/blob/announce() +/datum/round_event/blob/announce() command_alert("Confirmed outbreak of level 5 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert") world << sound('sound/AI/outbreak5.ogg') -/datum/event/blob/start() +/datum/round_event/blob/start() var/turf/T = pick(blobstart) if(!T) return kill() @@ -25,7 +25,7 @@ Blob.process() -/datum/event/blob/tick() +/datum/round_event/blob/tick() if(!Blob) kill() return diff --git a/code/modules/events/bluespaceanomaly.dm b/code/modules/events/bluespaceanomaly.dm index 72f86dcba1e..e04f4349fea 100644 --- a/code/modules/events/bluespaceanomaly.dm +++ b/code/modules/events/bluespaceanomaly.dm @@ -1,16 +1,16 @@ -/datum/event_control/bluespace_anomaly +/datum/round_event_control/bluespace_anomaly name = "Bluespace Anomaly" - typepath = /datum/event/bluespace_anomaly + typepath = /datum/round_event/bluespace_anomaly weight = 5 max_occurrences = 1 -/datum/event/bluespace_anomaly +/datum/round_event/bluespace_anomaly announceWhen = 20 var/area/impact_area -/datum/event/bluespace_anomaly/setup() +/datum/round_event/bluespace_anomaly/setup() var/list/safe_areas = list( /area/turret_protected/ai, /area/turret_protected/ai_upload, @@ -37,11 +37,11 @@ impact_area = locate(pick((the_station_areas - safe_areas) + danger_areas)) //need to locate() as it's just a list of paths. -/datum/event/bluespace_anomaly/announce() +/datum/round_event/bluespace_anomaly/announce() command_alert("Bluespace anomaly detected in the vicinity of [station_name()]. [impact_area.name] has gone missing.", "Anomaly Alert") -/datum/event/bluespace_anomaly/start() +/datum/round_event/bluespace_anomaly/start() var/turf/T = pick(get_area_turfs(impact_area)) if(T) // Calculate new position (searches through beacons in world) diff --git a/code/modules/events/brand_intelligence.dm b/code/modules/events/brand_intelligence.dm index 8ebcfd98fa3..8986cf65f3c 100644 --- a/code/modules/events/brand_intelligence.dm +++ b/code/modules/events/brand_intelligence.dm @@ -1,10 +1,10 @@ -/datum/event_control/brand_intelligence +/datum/round_event_control/brand_intelligence name = "Brand Intelligence" - typepath = /datum/event/brand_intelligence + typepath = /datum/round_event/brand_intelligence weight = 5 max_occurrences = 1 -/datum/event/brand_intelligence +/datum/round_event/brand_intelligence announceWhen = 21 endWhen = 1000 //Ends when all vending machines are subverted anyway. @@ -12,11 +12,11 @@ var/obj/machinery/vending/originMachine -/datum/event/brand_intelligence/announce() +/datum/round_event/brand_intelligence/announce() command_alert("Rampant brand intelligence has been detected aboard [station_name()], please stand-by.", "Machine Learning Alert") -/datum/event/brand_intelligence/start() +/datum/round_event/brand_intelligence/start() for(var/obj/machinery/vending/V in machines) if(V.z != 1) continue vendingMachines.Add(V) @@ -31,7 +31,7 @@ originMachine.shoot_inventory = 1 -/datum/event/brand_intelligence/tick() +/datum/round_event/brand_intelligence/tick() if(!vendingMachines.len || !originMachine || originMachine.shut_up) //if every machine is infected, or if the original vending machine is missing or has it's voice switch flipped kill() return diff --git a/code/modules/events/carp_migration.dm b/code/modules/events/carp_migration.dm index 3f8377e73ed..392fc6a280e 100644 --- a/code/modules/events/carp_migration.dm +++ b/code/modules/events/carp_migration.dm @@ -1,21 +1,21 @@ -/datum/event_control/carp_migration +/datum/round_event_control/carp_migration name = "Carp Migration" - typepath = /datum/event/carp_migration + typepath = /datum/round_event/carp_migration weight = 15 earliest_start = 6000 max_occurrences = 6 -/datum/event/carp_migration +/datum/round_event/carp_migration announceWhen = 50 -/datum/event/carp_migration/setup() +/datum/round_event/carp_migration/setup() announceWhen = rand(40, 60) -/datum/event/carp_migration/announce() +/datum/round_event/carp_migration/announce() command_alert("Unknown biological entities have been detected near [station_name()], please stand-by.", "Lifesign Alert") -/datum/event/carp_migration/start() +/datum/round_event/carp_migration/start() for(var/obj/effect/landmark/C in landmarks_list) if(C.name == "carpspawn") new /mob/living/simple_animal/hostile/carp(C.loc) \ No newline at end of file diff --git a/code/modules/events/communications_blackout.dm b/code/modules/events/communications_blackout.dm index 3f2af27b9d2..37cc583a468 100644 --- a/code/modules/events/communications_blackout.dm +++ b/code/modules/events/communications_blackout.dm @@ -1,9 +1,9 @@ -/datum/event_control/communications_blackout +/datum/round_event_control/communications_blackout name = "Communications Blackout" - typepath = /datum/event/communications_blackout + typepath = /datum/round_event/communications_blackout weight = 30 -/datum/event/communications_blackout/announce() +/datum/round_event/communications_blackout/announce() var/alert = pick( "Ionospheric anomalies detected. Temporary telecommunication failure imminent. Please contact you*%fj00)`5vc-BZZT", \ "Ionospheric anomalies detected. Temporary telecommunication failu*3mga;b4;'1v¬-BZZZT", \ "Ionospheric anomalies detected. Temporary telec#MCi46:5.;@63-BZZZZT", \ @@ -20,6 +20,6 @@ command_alert(alert) -/datum/event/communications_blackout/start() +/datum/round_event/communications_blackout/start() for(var/obj/machinery/telecomms/T in telecomms_list) T.emp_act(1) \ No newline at end of file diff --git a/code/modules/events/disease_outbreak.dm b/code/modules/events/disease_outbreak.dm index 2fe23b5b140..8a33611d24f 100644 --- a/code/modules/events/disease_outbreak.dm +++ b/code/modules/events/disease_outbreak.dm @@ -1,23 +1,23 @@ -/datum/event_control/disease_outbreak +/datum/round_event_control/disease_outbreak name = "Disease Outbreak" - typepath = /datum/event/disease_outbreak + typepath = /datum/round_event/disease_outbreak max_occurrences = 1 weight = 5 -/datum/event/disease_outbreak +/datum/round_event/disease_outbreak announceWhen = 15 var/virus_type -/datum/event/disease_outbreak/announce() +/datum/round_event/disease_outbreak/announce() command_alert("Confirmed outbreak of level 7 viral biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert") world << sound('sound/AI/outbreak7.ogg') -/datum/event/disease_outbreak/setup() +/datum/round_event/disease_outbreak/setup() announceWhen = rand(15, 30) -/datum/event/disease_outbreak/start() +/datum/round_event/disease_outbreak/start() if(!virus_type) virus_type = pick(/datum/disease/dnaspread, /datum/disease/advance/flu, /datum/disease/advance/cold, /datum/disease/brainrot, /datum/disease/magnitis) diff --git a/code/modules/events/dust.dm b/code/modules/events/dust.dm index 28588a8ca3b..e1fe9543dad 100644 --- a/code/modules/events/dust.dm +++ b/code/modules/events/dust.dm @@ -1,17 +1,17 @@ -/datum/event_control/dust +/datum/round_event_control/dust name = "Minor Space Dust" - typepath = /datum/event/dust + typepath = /datum/round_event/dust weight = 600 max_occurrences = 10000 earliest_start = 0 -/datum/event/dust +/datum/round_event/dust var/qnty = 1 -/datum/event/dust/setup() +/datum/round_event/dust/setup() qnty = rand(1,5) -/datum/event/dust/start() +/datum/round_event/dust/start() while(qnty-- > 0) new /obj/effect/space_dust/weak() diff --git a/code/modules/events/electrical_storm.dm b/code/modules/events/electrical_storm.dm index e9c418839d7..dae41caea66 100644 --- a/code/modules/events/electrical_storm.dm +++ b/code/modules/events/electrical_storm.dm @@ -1,19 +1,19 @@ -/datum/event_control/electrical_storm +/datum/round_event_control/electrical_storm name = "Electrical Storm" - typepath = /datum/event/electrical_storm + typepath = /datum/round_event/electrical_storm earliest_start = 6000 weight = 40 -/datum/event/electrical_storm +/datum/round_event/electrical_storm var/lightsoutAmount = 1 var/lightsoutRange = 25 -/datum/event/electrical_storm/announce() +/datum/round_event/electrical_storm/announce() command_alert("An electrical storm has been detected in your area, please repair potential electronic overloads.", "Electrical Storm Alert") -/datum/event/electrical_storm/start() +/datum/round_event/electrical_storm/start() var/list/epicentreList = list() for(var/i=1, i <= lightsoutAmount, i++) diff --git a/code/modules/events/energetic_flux.dm b/code/modules/events/energetic_flux.dm index e0ce46c3366..d74ad5f5e60 100644 --- a/code/modules/events/energetic_flux.dm +++ b/code/modules/events/energetic_flux.dm @@ -1,16 +1,16 @@ -/datum/event_control/energetic_flux +/datum/round_event_control/energetic_flux name = "Energetic Flux" - typepath = /datum/event/energetic_flux + typepath = /datum/round_event/energetic_flux max_occurrences = 2 weight = 15 -/datum/event/energetic_flux +/datum/round_event/energetic_flux startWhen = 30 var/area/impact_area -/datum/event/energetic_flux/setup() +/datum/round_event/energetic_flux/setup() var/list/safe_areas = list( /area/turret_protected/ai, /area/turret_protected/ai_upload, @@ -37,11 +37,11 @@ impact_area = locate(pick((the_station_areas - safe_areas) + danger_areas)) //need to locate() as it's just a list of paths. -/datum/event/energetic_flux/announce() +/datum/round_event/energetic_flux/announce() command_alert("Warning! Localized hyper-energetic flux wave detected on long range scanners. Expected location of impact: [impact_area.name]. Vacate [impact_area.name].", "Anomaly Alert") -/datum/event/energetic_flux/start() +/datum/round_event/energetic_flux/start() var/turf/T = pick(get_area_turfs(impact_area)) if(T) explosion(T, -1, 2, 4, 5) \ No newline at end of file diff --git a/code/modules/events/event.dm b/code/modules/events/event.dm index 8163f47b8e5..af1a9d4d899 100644 --- a/code/modules/events/event.dm +++ b/code/modules/events/event.dm @@ -1,7 +1,7 @@ //this datum is used by the events controller to dictate how it selects events -/datum/event_control +/datum/round_event_control var/name //The name human-readable name of the event - var/typepath //The typepath of the event datum /datum/event + var/typepath //The typepath of the event datum /datum/round_event var/weight = 10 //The weight this event has in the random-selection process. //Higher weights are more likely to be picked. @@ -17,17 +17,18 @@ //anything with a (non-null) holidayID which does not match holiday, cannot run. -/datum/event_control/proc/runEvent() - if(!ispath(typepath,/datum/event)) +/datum/round_event_control/proc/runEvent() + if(!ispath(typepath,/datum/round_event)) return PROCESS_KILL - var/datum/event/E = new typepath() + var/datum/round_event/E = new typepath() E.control = src occurrences++ testing("[time2text(world.time, "hh:mm:ss")] [E.type]") -/datum/event //NOTE: Times are measured in master controller ticks! - var/datum/event_control/control +/datum/round_event //NOTE: Times are measured in master controller ticks! + var/processing = 1 + var/datum/round_event_control/control var/startWhen = 0 //When in the lifetime to call start(). var/announceWhen = 0 //When in the lifetime to call announce(). @@ -42,26 +43,26 @@ //EDIT: if there's anything you want to override within the new() call, it will not be overridden by the time this proc is called. //It will only have been overridden by the time we get to announce() start() tick() or end() (anything but setup basically). //This is really only for setting defaults which can be overridden later wehn New() finishes. -/datum/event/proc/setup() +/datum/round_event/proc/setup() return //Called when the tick is equal to the startWhen variable. //Allows you to start before announcing or vice versa. //Only called once. -/datum/event/proc/start() +/datum/round_event/proc/start() return //Called when the tick is equal to the announceWhen variable. //Allows you to announce before starting or vice versa. //Only called once. -/datum/event/proc/announce() +/datum/round_event/proc/announce() return //Called on or after the tick counter is equal to startWhen. //You can include code related to your event or add your own //time stamped events. //Called more than once. -/datum/event/proc/tick() +/datum/round_event/proc/tick() return //Called on or after the tick is equal or more than endWhen @@ -70,14 +71,17 @@ //the activeFor variable. //For example: if(activeFor == myOwnVariable + 30) doStuff() //Only called once. -/datum/event/proc/end() +/datum/round_event/proc/end() return //Do not override this proc, instead use the appropiate procs. //This proc will handle the calls to the appropiate procs. -/datum/event/proc/process() +/datum/round_event/proc/process() + if(!processing) + return + if(activeFor == startWhen) start() @@ -100,20 +104,12 @@ //Garbage collects the event by removing it from the global events list, //which should be the only place it's referenced. //Called when start(), announce() and end() has all been called. -/datum/event/proc/kill() +/datum/round_event/proc/kill() events.running -= src //Sets up the event then adds the event to the the list of running events -/datum/event/New(list/overrides) +/datum/round_event/New() setup() - - //overrides - if(istype(overrides)) - for(var/varname in overrides) - if(varname in vars) - vars[varname] = overrides[varname] - events.running += src - return ..() \ No newline at end of file diff --git a/code/modules/events/event_manager.dm b/code/modules/events/event_manager.dm index b85a1eeebe5..c11bc109001 100644 --- a/code/modules/events/event_manager.dm +++ b/code/modules/events/event_manager.dm @@ -1,8 +1,8 @@ var/datum/controller/event/events /datum/controller/event - var/list/control = list() //list of all datum/event_control. Used for selecting events based on weight and occurrences. - var/list/running = list() //list of all existing /datum/event + var/list/control = list() //list of all datum/round_event_control. Used for selecting events based on weight and occurrences. + var/list/running = list() //list of all existing /datum/round_event var/scheduled = 0 //The next world.time that a naturally occuring random event can be selected. var/frequency_lower = 3000 //5 minutes lower bound. @@ -18,8 +18,8 @@ var/datum/controller/event/events del(events) events = src - for(var/type in typesof(/datum/event_control)) - var/datum/event_control/E = new type() + for(var/type in typesof(/datum/round_event_control)) + var/datum/round_event_control/E = new type() if(!E.typepath) continue //don't want this one! leave it for the garbage collector control += E //add it to the list of all events (controls) @@ -31,7 +31,7 @@ var/datum/controller/event/events checkEvent() var/i = 1 while(i<=running.len) - var/datum/event/Event = running[i] + var/datum/round_event/Event = running[i] if(Event) Event.process() i++ @@ -54,7 +54,7 @@ var/datum/controller/event/events return var/sum_of_weights = 0 - for(var/datum/event_control/E in control) + for(var/datum/round_event_control/E in control) if(E.occurrences >= E.max_occurrences) continue if(E.earliest_start >= world.time) continue if(E.holidayID) @@ -68,7 +68,7 @@ var/datum/controller/event/events sum_of_weights = rand(0,sum_of_weights) //reusing this variable. It now represents the 'weight' we want to select - for(var/datum/event_control/E in control) + for(var/datum/round_event_control/E in control) if(E.occurrences >= E.max_occurrences) continue if(E.earliest_start >= world.time) continue if(E.holidayID) @@ -82,7 +82,7 @@ var/datum/controller/event/events return //allows a client to trigger an event (For Debugging Purposes) -/client/proc/forceEvent(var/datum/event_control/E in events.control) +/client/proc/forceEvent(var/datum/round_event_control/E in events.control) set name = "Trigger Event (Debug Only)" set category = "Debug" diff --git a/code/modules/events/gravitational_anomaly.dm b/code/modules/events/gravitational_anomaly.dm index da141890a71..a39c26561b2 100644 --- a/code/modules/events/gravitational_anomaly.dm +++ b/code/modules/events/gravitational_anomaly.dm @@ -1,28 +1,28 @@ -/datum/event_control/gravitational_anomaly +/datum/round_event_control/gravitational_anomaly name = "Gravitational Anomaly" - typepath = /datum/event/gravitational_anomaly + typepath = /datum/round_event/gravitational_anomaly max_occurrences = 5 weight = 2 -/datum/event/gravitational_anomaly +/datum/round_event/gravitational_anomaly startWhen = 10 var/obj/effect/bhole/blackhole -/datum/event/gravitational_anomaly/announce() +/datum/round_event/gravitational_anomaly/announce() command_alert("Gravitational anomalies detected on the station. There is no additional data.", "Anomaly Alert") for(var/mob/M in player_list) if(!istype(M,/mob/new_player)) M << sound('sound/AI/granomalies.ogg') -/datum/event/gravitational_anomaly/setup() +/datum/round_event/gravitational_anomaly/setup() endWhen = rand(50, 200) -/datum/event/gravitational_anomaly/start() +/datum/round_event/gravitational_anomaly/start() var/turf/T = pick(blobstart) blackhole = new /obj/effect/bhole( T.loc, 30 ) -/datum/event/gravitational_anomaly/end() +/datum/round_event/gravitational_anomaly/end() del(blackhole) diff --git a/code/modules/events/holiday/xmas.dm b/code/modules/events/holiday/xmas.dm index e50d45c8780..4785fbe560f 100644 --- a/code/modules/events/holiday/xmas.dm +++ b/code/modules/events/holiday/xmas.dm @@ -1,11 +1,11 @@ -/datum/event_control/treevenge +/datum/round_event_control/treevenge name = "Treevenge" holidayID = "Xmas" - typepath = /datum/event/treevenge + typepath = /datum/round_event/treevenge max_occurrences = 1 weight = 20 -/datum/event/treevenge/start() +/datum/round_event/treevenge/start() for(var/obj/structure/flora/tree/pine/xmas in world) var/mob/living/simple_animal/hostile/tree/evil_tree = new /mob/living/simple_animal/hostile/tree(xmas.loc) evil_tree.icon_state = xmas.icon_state @@ -15,15 +15,15 @@ del(xmas) //this is an example of a possible round-start event -/datum/event_control/presents +/datum/round_event_control/presents name = "Presents under Trees" holidayID = "Xmas" - typepath = /datum/event/presents + typepath = /datum/round_event/presents weight = -1 //forces it to be called, regardless of weight max_occurrences = 1 earliest_start = 0 -/datum/event/presents/start() +/datum/round_event/presents/start() for(var/obj/structure/flora/tree/pine/xmas in world) if(xmas.z != 1) continue for(var/turf/simulated/floor/T in orange(1,xmas)) @@ -32,7 +32,7 @@ for(var/mob/living/simple_animal/corgi/Ian/Ian in mob_list) Ian.place_on_head(new /obj/item/clothing/head/helmet/space/santahat(Ian)) -/datum/event/presents/announce() +/datum/round_event/presents/announce() command_alert("Ho Ho Ho, Merry Xmas!", "Unknown Transmission") diff --git a/code/modules/events/immovable_rod.dm b/code/modules/events/immovable_rod.dm index 355fd441e58..9c7e6fc961b 100644 --- a/code/modules/events/immovable_rod.dm +++ b/code/modules/events/immovable_rod.dm @@ -7,18 +7,18 @@ In my current plan for it, 'solid' will be defined as anything with density == 1 --NEOFite */ -/datum/event_control/immovable_rod +/datum/round_event_control/immovable_rod name = "Immovable Rod" - typepath = /datum/event/immovable_rod + typepath = /datum/round_event/immovable_rod max_occurrences = 5 -/datum/event/immovable_rod +/datum/round_event/immovable_rod announceWhen = 5 -/datum/event/immovable_rod/announce() +/datum/round_event/immovable_rod/announce() command_alert("What the fuck was that?!", "General Alert") -/datum/event/immovable_rod/start() +/datum/round_event/immovable_rod/start() var/startx = 0 var/starty = 0 var/endy = 0 diff --git a/code/modules/events/ion_storm.dm b/code/modules/events/ion_storm.dm index 9e4714a9a2e..c1160194cd2 100644 --- a/code/modules/events/ion_storm.dm +++ b/code/modules/events/ion_storm.dm @@ -1,18 +1,18 @@ -/datum/event_control/ion_storm +/datum/round_event_control/ion_storm name = "Ion Storm" - typepath = /datum/event/ion_storm + typepath = /datum/round_event/ion_storm weight = 15 -/datum/event/ion_storm +/datum/round_event/ion_storm var/botEmagChance = 10 -/datum/event/ion_storm/announce() +/datum/round_event/ion_storm/announce() if(prob(33)) command_alert("Ion storm detected near the station. Please check all AI-controlled equipment for errors.", "Anomaly Alert") world << sound('sound/AI/ionstorm.ogg') -/datum/event/ion_storm/start() +/datum/round_event/ion_storm/start() //AI laws for(var/mob/living/silicon/ai/M in living_mob_list) if(M.stat != 2 && M.see_in_dark != 0) diff --git a/code/modules/events/mass_hallucination.dm b/code/modules/events/mass_hallucination.dm index 96da3022f1d..17888250c20 100644 --- a/code/modules/events/mass_hallucination.dm +++ b/code/modules/events/mass_hallucination.dm @@ -1,9 +1,9 @@ -/datum/event_control/mass_hallucination +/datum/round_event_control/mass_hallucination name = "Mass Hallucination" - typepath = /datum/event/mass_hallucination + typepath = /datum/round_event/mass_hallucination weight = 7 max_occurrences = 2 -/datum/event/mass_hallucination/start() +/datum/round_event/mass_hallucination/start() for(var/mob/living/carbon/C in living_mob_list) C.hallucination += rand(20, 50) \ No newline at end of file diff --git a/code/modules/events/meteor_wave.dm b/code/modules/events/meteor_wave.dm index ca52fab58e2..8357f36834d 100644 --- a/code/modules/events/meteor_wave.dm +++ b/code/modules/events/meteor_wave.dm @@ -1,18 +1,18 @@ -/datum/event_control/meteor_wave +/datum/round_event_control/meteor_wave name = "Meteor Wave" - typepath = /datum/event/meteor_wave + typepath = /datum/round_event/meteor_wave weight = 5 max_occurrences = 3 -/datum/event/meteor_wave +/datum/round_event/meteor_wave startWhen = 6 endWhen = 66 -/datum/event/meteor_wave/announce() +/datum/round_event/meteor_wave/announce() command_alert("Meteors have been detected on collision course with the station.", "Meteor Alert") world << sound('sound/AI/meteors.ogg') -/datum/event/meteor_wave/tick() +/datum/round_event/meteor_wave/tick() if(IsMultiple(activeFor, 3)) spawn_meteors(5) \ No newline at end of file diff --git a/code/modules/events/ninja.dm b/code/modules/events/ninja.dm index 06a89fa282a..e827699554a 100644 --- a/code/modules/events/ninja.dm +++ b/code/modules/events/ninja.dm @@ -1,32 +1,32 @@ //Note to future generations: I didn't write this god-awful code I just ported it to the event system and tried to make it less moon-speaky. //Don't judge me D; ~Carn -/datum/event_control/ninja +/datum/round_event_control/ninja name = "Space Ninja" - typepath = /datum/event/ninja + typepath = /datum/round_event/ninja max_occurrences = 1 -/datum/event/ninja +/datum/round_event/ninja var/success_spawn = 0 var/helping_station var/key - var/turf/spawnturf + var/spawn_loc var/mission var/mob/living/carbon/human/Ninja -/datum/event/ninja/setup() +/datum/round_event/ninja/setup() helping_station = rand(0,1) -/datum/event/ninja/kill() +/datum/round_event/ninja/kill() if(!success_spawn && control) control.occurrences-- return ..() -/datum/event/ninja/start() - //selecting a spawnturf - if(!spawnturf) +/datum/round_event/ninja/start() + //selecting a spawn_loc + if(!spawn_loc) var/list/spawn_locs = list() for(var/obj/effect/landmark/L in landmarks_list) if(isturf(L.loc)) @@ -35,8 +35,8 @@ spawn_locs += L.loc if(!spawn_locs.len) return kill() - spawnturf = pick(spawn_locs) - if(!spawnturf) + spawn_loc = pick(spawn_locs) + if(!spawn_loc) return kill() //selecting a candidate player @@ -161,7 +161,7 @@ Mind.store_memory("Officially, [helping_station?"Nanotrasen":"The Syndicate"] are my employer.") //spawn the ninja and assign the candidate - Ninja = create_space_ninja(spawnturf) + Ninja = create_space_ninja(spawn_loc) Mind.transfer_to(Ninja) //initialise equipment @@ -180,7 +180,7 @@ This proc will give the ninja a directive to follow. They are not obligated to d Making this random or semi-random will probably not work without it also being incredibly silly. As such, it's hard-coded for now. No reason for it not to be, really. */ -/datum/event/ninja/proc/generate_ninja_directive() +/datum/round_event/ninja/proc/generate_ninja_directive() switch(rand(1,13)) if(1) return "The Spider Clan must not be linked to this operation. Remain as hidden and covert as possible." if(2) return "[station_name] is financed by an enemy of the Spider Clan. Cause as much structural damage as possible." @@ -330,7 +330,9 @@ ________________________________________________________________________________ if(!C) return - new /datum/event/ninja(list("key"=C.key,"mission"=mission)) + var/datum/round_event/ninja/E = new /datum/round_event/ninja() + E.key=C.key + E.mission=mission message_admins("\blue [key_name_admin(key)] has spawned [key_name_admin(C.key)] as a Space Ninja.") log_admin("[key] used Spawn Space Ninja.") @@ -339,8 +341,8 @@ ________________________________________________________________________________ //=======//NINJA CREATION PROCS//=======// -/proc/create_space_ninja(turf/spawnturf) - var/mob/living/carbon/human/new_ninja = new(spawnturf) +/proc/create_space_ninja(spawn_loc) + var/mob/living/carbon/human/new_ninja = new(spawn_loc) var/datum/preferences/A = new()//Randomize appearance for the ninja. A.real_name = "[pick(ninja_titles)] [pick(ninja_names)]" diff --git a/code/modules/events/prison_break.dm b/code/modules/events/prison_break.dm index 5e5b73027e0..99495fbc36e 100644 --- a/code/modules/events/prison_break.dm +++ b/code/modules/events/prison_break.dm @@ -1,15 +1,15 @@ -/datum/event_control/prison_break +/datum/round_event_control/prison_break name = "Prison Break" - typepath = /datum/event/prison_break + typepath = /datum/round_event/prison_break max_occurrences = 2 -/datum/event/prison_break +/datum/round_event/prison_break announceWhen = 50 endWhen = 20 var/list/area/prisonAreas = list() -/datum/event/prison_break/setup() +/datum/round_event/prison_break/setup() announceWhen = rand(50, 60) endWhen = rand(20, 30) @@ -18,7 +18,7 @@ prisonAreas += A -/datum/event/prison_break/announce() +/datum/round_event/prison_break/announce() if(prisonAreas && prisonAreas.len > 0) command_alert("Gr3y.T1d3 virus detected in [station_name()] imprisonment subroutines. Recommend station AI involvement.", "Security Alert") else @@ -26,12 +26,12 @@ kill() -/datum/event/prison_break/start() +/datum/round_event/prison_break/start() for(var/area/A in prisonAreas) for(var/obj/machinery/light/L in A) L.flicker(10) -/datum/event/prison_break/end() +/datum/round_event/prison_break/end() for(var/area/A in prisonAreas) for(var/obj/O in A) if(istype(O,/obj/machinery/power/apc)) diff --git a/code/modules/events/radiation_storm.dm b/code/modules/events/radiation_storm.dm index 919dc695c32..43005bbe783 100644 --- a/code/modules/events/radiation_storm.dm +++ b/code/modules/events/radiation_storm.dm @@ -1,18 +1,18 @@ -/datum/event_control/radiation_storm +/datum/round_event_control/radiation_storm name = "Radiation Storm" - typepath = /datum/event/radiation_storm + typepath = /datum/round_event/radiation_storm max_occurrences = 1 -/datum/event/radiation_storm +/datum/round_event/radiation_storm announceWhen = 5 -/datum/event/radiation_storm/announce() +/datum/round_event/radiation_storm/announce() command_alert("High levels of radiation detected near the station. Please report to the Med-bay if you feel strange.", "Anomaly Alert") world << sound('sound/AI/radiation.ogg') -/datum/event/radiation_storm/start() +/datum/round_event/radiation_storm/start() for(var/mob/living/carbon/C in living_mob_list) var/turf/T = get_turf(C) if(!T) continue diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index 84a54274c32..1054b43e4cd 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -1,10 +1,10 @@ -/datum/event_control/spacevine +/datum/round_event_control/spacevine name = "Spacevine" - typepath = /datum/event/spacevine + typepath = /datum/round_event/spacevine weight = 15 max_occurrences = 3 -/datum/event/spacevine/start() +/datum/round_event/spacevine/start() var/list/turfs = list() //list of all the empty floor turfs in the hallway areas for(var/area/hallway/A in world) diff --git a/code/modules/events/spider_infestation.dm b/code/modules/events/spider_infestation.dm index 3d0730992be..afac72e7401 100644 --- a/code/modules/events/spider_infestation.dm +++ b/code/modules/events/spider_infestation.dm @@ -1,25 +1,25 @@ -/datum/event_control/spider_infestation +/datum/round_event_control/spider_infestation name = "Spider Infestation" - typepath = /datum/event/spider_infestation + typepath = /datum/round_event/spider_infestation weight = 5 max_occurrences = 1 -/datum/event/spider_infestation +/datum/round_event/spider_infestation announceWhen = 400 var/spawncount = 1 -/datum/event/spider_infestation/setup() +/datum/round_event/spider_infestation/setup() announceWhen = rand(announceWhen, announceWhen + 50) spawncount = rand(5, 8) -/datum/event/spider_infestation/announce() +/datum/round_event/spider_infestation/announce() command_alert("Unidentified lifesigns detected coming aboard [station_name()]. Secure any exterior access, including ducting and ventilation.", "Lifesign Alert") world << sound('sound/AI/aliens.ogg') -/datum/event/spider_infestation/start() +/datum/round_event/spider_infestation/start() var/list/vents = list() for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in world) if(temp_vent.loc.z == 1 && !temp_vent.welded && temp_vent.network) diff --git a/code/modules/events/spontaneous_appendicitis.dm b/code/modules/events/spontaneous_appendicitis.dm index 91195872577..a55038ea1e3 100644 --- a/code/modules/events/spontaneous_appendicitis.dm +++ b/code/modules/events/spontaneous_appendicitis.dm @@ -1,11 +1,11 @@ -/datum/event_control/spontaneous_appendicitis +/datum/round_event_control/spontaneous_appendicitis name = "Spontaneous Appendicitis" - typepath = /datum/event/spontaneous_appendicitis + typepath = /datum/round_event/spontaneous_appendicitis weight = 20 max_occurrences = 4 earliest_start = 6000 -/datum/event/spontaneous_appendicitis/start() +/datum/round_event/spontaneous_appendicitis/start() for(var/mob/living/carbon/human/H in shuffle(living_mob_list)) var/foundAlready = 0 //don't infect someone that already has the virus for(var/datum/disease/D in H.viruses) diff --git a/code/modules/events/weightless.dm b/code/modules/events/weightless.dm index 1addbb97800..bc1e79f91d9 100644 --- a/code/modules/events/weightless.dm +++ b/code/modules/events/weightless.dm @@ -1,27 +1,27 @@ -/datum/event_control/weightless +/datum/round_event_control/weightless name = "Gravity Systems Failure" - typepath = /datum/event/weightless + typepath = /datum/round_event/weightless weight = 15 -/datum/event/weightless +/datum/round_event/weightless startWhen = 5 endWhen = 65 -/datum/event/weightless/setup() +/datum/round_event/weightless/setup() startWhen = rand(0,10) endWhen = rand(40,80) - var/datum/event_control/E = locate(/datum/event_control/gravitational_anomaly) in events.control - if(E) - E.weight *= 2 -/datum/event/weightless/announce() +/datum/round_event/weightless/announce() command_alert("Warning: Failsafes for the station's artificial gravity arrays have been triggered. Please be aware that if this problem recurs it may result in formation of gravitational anomalies. Nanotrasen wishes to remind you that the unauthorised formation of anomalies within Nanotrasen facilities is strictly prohibited by health and safety regulation [rand(99,9999)][pick("a","b","c")]:subclause[rand(1,20)][pick("a","b","c")].") -/datum/event/weightless/start() +/datum/round_event/weightless/start() for(var/area/A in world) A.gravitychange(0) + + if(control) + control.weight *= 2 -/datum/event/weightless/end() +/datum/round_event/weightless/end() for(var/area/A in world) A.gravitychange(1) diff --git a/code/modules/events/wormholes.dm b/code/modules/events/wormholes.dm index bab3830b71e..1648b6a44ca 100644 --- a/code/modules/events/wormholes.dm +++ b/code/modules/events/wormholes.dm @@ -1,10 +1,10 @@ -/datum/event_control/wormholes +/datum/round_event_control/wormholes name = "Wormholes" - typepath = /datum/event/wormholes + typepath = /datum/round_event/wormholes max_occurrences = 3 weight = 2 -/datum/event/wormholes +/datum/round_event/wormholes announceWhen = 10 endWhen = 60 @@ -12,24 +12,24 @@ var/shift_frequency = 3 var/number_of_wormholes = 1000 -/datum/event/wormholes/setup() +/datum/round_event/wormholes/setup() announceWhen = rand(0,20) endWhen = rand(40,80) -/datum/event/wormholes/start() +/datum/round_event/wormholes/start() for(var/i=1, i<=number_of_wormholes, i++) var/x = rand(40,world.maxx-40) var/y = rand(40,world.maxy-40) var/turf/T = locate(x, y, 1) wormholes += new /obj/effect/portal/wormhole(T, null, null, -1) -/datum/event/wormholes/announce() +/datum/round_event/wormholes/announce() command_alert("Space-time anomalies detected on the station. There is no additional data.", "Anomaly Alert") for(var/mob/M in player_list) if(!istype(M,/mob/new_player)) M << sound('sound/AI/spanomalies.ogg') -/datum/event/wormholes/tick() +/datum/round_event/wormholes/tick() if(activeFor % shift_frequency == 0) for(var/obj/effect/portal/wormhole/O in wormholes) var/x = rand(20,world.maxx-20) @@ -37,7 +37,7 @@ var/turf/T = locate(x, y, 1) if(T) O.loc = T -/datum/event/wormholes/end() +/datum/round_event/wormholes/end() portals.Remove(wormholes) for(var/obj/effect/portal/wormhole/O in wormholes) O.loc = null diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 053249dab00..342824cb235 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -245,16 +245,18 @@ i++ index = "[T.loc.name]\[[i]\]" vents[index] = temp_vent + if(!vents.len) + src << "\red There are no available vents to travel to, they could be welded." + return var/turf/startloc = loc var/obj/selection = input("Select a destination.", "Duct System") as null|anything in sortList(vents) if(!selection) return if(loc==startloc) - if(contents.len) - for(var/obj/item/carried_item in contents)//If the monkey got on objects. - if( !istype(carried_item, /obj/item/weapon/implant) && !istype(carried_item, /obj/item/clothing/mask/facehugger) )//If it's not an implant or a facehugger - src << "\red You can't be carrying items or have items equipped when vent crawling!" - return + for(var/obj/item/carried_item in contents)//If the monkey got on objects. + if( !istype(carried_item, /obj/item/weapon/implant) && !istype(carried_item, /obj/item/clothing/mask/facehugger) )//If it's not an implant or a facehugger + src << "\red You can't be carrying items or have items equipped when vent crawling!" + return var/obj/machinery/atmospherics/unary/vent_pump/target_vent = vents[selection] if(target_vent) for(var/mob/O in viewers(src, null)) diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index ba987472521..c989ebddf2f 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -210,9 +210,7 @@ x_c -= 3 var/obj/item/weapon/photo/P = new/obj/item/weapon/photo() - P.loc = user.loc - if(!user.get_inactive_hand()) - user.put_in_inactive_hand(P) + user.put_in_hands(P) var/icon/small_img = icon(temp) var/icon/ic = icon('icons/obj/items.dmi',"photo") small_img.Scale(8, 8)