From 8626a8367533adec5f994b6ed1c7244889e7b685 Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Mon, 27 Apr 2015 10:47:45 +0200 Subject: [PATCH 1/5] Adds the camera loss event. --- baystation12.dme | 2 ++ code/__HELPERS/global_lists.dm | 3 ++ code/game/machinery/camera/camera.dm | 2 ++ code/modules/events/camera_loss.dm | 36 +++++++++++++++++++ .../modules/events/communications_blackout.dm | 4 +-- code/modules/events/event_container.dm | 3 +- 6 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 code/modules/events/camera_loss.dm diff --git a/baystation12.dme b/baystation12.dme index 30966ac0f59..825b0c92328 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -952,8 +952,10 @@ #include "code\modules\economy\Events.dm" #include "code\modules\economy\Events_Mundane.dm" #include "code\modules\economy\TradeDestinations.dm" +#include "code\modules\events\apc_loss.dm" #include "code\modules\events\blob.dm" #include "code\modules\events\brand_intelligence.dm" +#include "code\modules\events\camera_loss.dm" #include "code\modules\events\carp_migration.dm" #include "code\modules\events\comms_blackout.dm" #include "code\modules\events\communications_blackout.dm" diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index 7484d016b6c..42e1b0b63e9 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -29,6 +29,9 @@ var/global/list/playable_species = list("Human") // A list of ALL playable sp // Posters var/global/list/poster_designs = list() +// Cameras +var/list/obj/machinery/camera/world_cameras = list() + // Uplinks var/list/obj/item/device/uplink/world_uplinks = list() diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 5670ef20603..839b1aa4616 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -37,6 +37,7 @@ wires = new(src) assembly = new(src) assembly.state = 4 + world_cameras += src /* // Use this to look for cameras that have the same c_tag. for(var/obj/machinery/camera/C in cameranet.cameras) @@ -54,6 +55,7 @@ ..() /obj/machinery/camera/Destroy() + world_cameras -= src deactivate(null, 0) //kick anyone viewing out if(assembly) qdel(assembly) diff --git a/code/modules/events/camera_loss.dm b/code/modules/events/camera_loss.dm new file mode 100644 index 00000000000..d8b76c17e39 --- /dev/null +++ b/code/modules/events/camera_loss.dm @@ -0,0 +1,36 @@ +/datum/event/camera_loss/start() + var/obj/machinery/camera/C = acquire_random_camera() + if(!C) + return + + var/severity_range = 0 + switch(severity) + if(EVENT_LEVEL_MUNDANE) + severity_range = 0 + if(EVENT_LEVEL_MODERATE) + severity_range = 7 + if(EVENT_LEVEL_MAJOR) + severity_range = 15 + + for(var/obj/machinery/camera/cam in range(severity_range,C)) + if(is_valid_camera(cam)) + cam.wires.UpdateCut(CAMERA_WIRE_POWER, 0) + if(prob(5)) + cam.wires.UpdateCut(CAMERA_WIRE_ALARM, 0) + +/datum/event/camera_loss/proc/acquire_random_camera(var/remaining_attempts = 5) + if(!world_cameras.len) + return + if(!remaining_attempts) + return + + var/obj/machinery/camera/C = pick(world_cameras) + // Only return a functional camera, not installed in a silicon, and that exists somewhere players have access + + if(is_valid_camera(C)) + return C + return acquire_random_camera(remaining_attempts--) + +/datum/event/camera_loss/proc/is_valid_camera(var/obj/machinery/camera/C) + var/turf/T = get_turf(C) + return T && C.can_use() && !istype(C.loc, /mob/living/silicon) && (T.z in config.player_levels) diff --git a/code/modules/events/communications_blackout.dm b/code/modules/events/communications_blackout.dm index fabfdd33365..68f60304251 100644 --- a/code/modules/events/communications_blackout.dm +++ b/code/modules/events/communications_blackout.dm @@ -12,9 +12,9 @@ A << "
" if(prob(30)) //most of the time, we don't want an announcement, so as to allow AIs to fake blackouts. - command_announcement.Announce(alert, new_sound = sound('sound/misc/interference.ogg', volume=50)) + command_announcement.Announce(alert, new_sound = sound('sound/misc/interference.ogg', volume=25)) /datum/event/communications_blackout/start() for(var/obj/machinery/telecomms/T in telecomms_list) - T.emp_act(1) \ No newline at end of file + T.emp_act(1) diff --git a/code/modules/events/event_container.dm b/code/modules/events/event_container.dm index 900d6f76ec2..c13cee9ce11 100644 --- a/code/modules/events/event_container.dm +++ b/code/modules/events/event_container.dm @@ -128,10 +128,11 @@ var/global/list/severity_to_string = list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT // Severity level, event name, even type, base weight, role weights, one shot, min weight, max weight. Last two only used if set and non-zero new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Nothing", /datum/event/nothing, 100), new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Brand Intelligence",/datum/event/brand_intelligence,20, list(ASSIGNMENT_JANITOR = 25), 1), + new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Camera Loss", /datum/event/camera_loss, 20, list(ASSIGNMENT_ENGINEER = 10)), new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Economic News", /datum/event/economic_event, 300), + new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Lost Carp", /datum/event/carp_migration, 20, list(ASSIGNMENT_SECURITY = 10), 1), new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Money Hacker", /datum/event/money_hacker, 0, list(ASSIGNMENT_ANY = 4), 1, 10, 25), new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Money Lotto", /datum/event/money_lotto, 0, list(ASSIGNMENT_ANY = 1), 1, 5, 15), - new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Lost Carp", /datum/event/carp_migration, 20, list(ASSIGNMENT_SECURITY = 10), 1), new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Mundane News", /datum/event/mundane_news, 300), new /datum/event_meta(EVENT_LEVEL_MUNDANE, "PDA Spam", /datum/event/pda_spam, 0, list(ASSIGNMENT_ANY = 4), 0, 25, 50), new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Space Dust", /datum/event/dust , 30, list(ASSIGNMENT_ENGINEER = 5), 0, 0, 50), From ed81d9fd6385ebb70f13493c0d704bad10894390 Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Mon, 27 Apr 2015 10:48:03 +0200 Subject: [PATCH 2/5] Adds the ACP damage event. --- baystation12.dme | 4 +- code/modules/events/apc_damage.dm | 54 +++++++++++++++++++ .../{camera_loss.dm => camera_damage.dm} | 9 ++-- code/modules/events/electrical_storm.dm | 2 +- code/modules/events/event_container.dm | 3 +- 5 files changed, 63 insertions(+), 9 deletions(-) create mode 100644 code/modules/events/apc_damage.dm rename code/modules/events/{camera_loss.dm => camera_damage.dm} (79%) diff --git a/baystation12.dme b/baystation12.dme index 825b0c92328..89e38f3910d 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -952,10 +952,10 @@ #include "code\modules\economy\Events.dm" #include "code\modules\economy\Events_Mundane.dm" #include "code\modules\economy\TradeDestinations.dm" -#include "code\modules\events\apc_loss.dm" +#include "code\modules\events\apc_damage.dm" #include "code\modules\events\blob.dm" #include "code\modules\events\brand_intelligence.dm" -#include "code\modules\events\camera_loss.dm" +#include "code\modules\events\camera_damage.dm" #include "code\modules\events\carp_migration.dm" #include "code\modules\events\comms_blackout.dm" #include "code\modules\events\communications_blackout.dm" diff --git a/code/modules/events/apc_damage.dm b/code/modules/events/apc_damage.dm new file mode 100644 index 00000000000..7eecfa6aeff --- /dev/null +++ b/code/modules/events/apc_damage.dm @@ -0,0 +1,54 @@ +/datum/event/apc_damage + var/apcSelectionRange = 25 + +/datum/event/apc_damage/start() + var/obj/machinery/power/apc/A = acquire_random_apc() + + var/severity_range = 0 + switch(severity) + if(EVENT_LEVEL_MUNDANE) + severity_range = 0 + if(EVENT_LEVEL_MODERATE) + severity_range = 7 + if(EVENT_LEVEL_MAJOR) + severity_range = 15 + + for(var/obj/machinery/power/apc/apc in range(severity_range,A)) + if(is_valid_apc(apc)) + apc.emagged = 1 + apc.update_icon() + +/datum/event/apc_damage/proc/acquire_random_apc() + var/list/possibleEpicentres = list() + var/list/apcs = list() + + for(var/obj/effect/landmark/newEpicentre in landmarks_list) + if(newEpicentre.name == "lightsout") + possibleEpicentres += newEpicentre + + if(!possibleEpicentres.len) + return + + var/epicentre = pick(possibleEpicentres) + for(var/obj/machinery/power/apc/apc in range(epicentre,apcSelectionRange)) + if(is_valid_apc(apc)) + apcs += apc + // Greatly increase the chance for APCs in maintenance areas to be selected + var/area/A = get_area(apc) + if(istype(A,/area/maintenance)) + apcs += apc + apcs += apc + + if(!apcs.len) + return + + return pick(apcs) + +/datum/event/apc_damage/proc/is_valid_apc(var/obj/machinery/power/apc/apc) + // Type must be exactly a basic APC. + // This generally prevents affecting APCs in critical areas (AI core, engine room, etc.) as they often use higher capacity subtypes. + if(apc.type != /obj/machinery/power/apc) + return 0 + + var/turf/T = get_turf(apc) + return !apc.emagged && T && (T.z in config.player_levels) diff --git a/code/modules/events/camera_loss.dm b/code/modules/events/camera_damage.dm similarity index 79% rename from code/modules/events/camera_loss.dm rename to code/modules/events/camera_damage.dm index d8b76c17e39..2cbeab97908 100644 --- a/code/modules/events/camera_loss.dm +++ b/code/modules/events/camera_damage.dm @@ -1,4 +1,4 @@ -/datum/event/camera_loss/start() +/datum/event/camera_damage/start() var/obj/machinery/camera/C = acquire_random_camera() if(!C) return @@ -18,19 +18,18 @@ if(prob(5)) cam.wires.UpdateCut(CAMERA_WIRE_ALARM, 0) -/datum/event/camera_loss/proc/acquire_random_camera(var/remaining_attempts = 5) +/datum/event/camera_damage/proc/acquire_random_camera(var/remaining_attempts = 5) if(!world_cameras.len) return if(!remaining_attempts) return var/obj/machinery/camera/C = pick(world_cameras) - // Only return a functional camera, not installed in a silicon, and that exists somewhere players have access - if(is_valid_camera(C)) return C return acquire_random_camera(remaining_attempts--) -/datum/event/camera_loss/proc/is_valid_camera(var/obj/machinery/camera/C) +/datum/event/camera_damage/proc/is_valid_camera(var/obj/machinery/camera/C) + // Only return a functional camera, not installed in a silicon, and that exists somewhere players have access var/turf/T = get_turf(C) return T && C.can_use() && !istype(C.loc, /mob/living/silicon) && (T.z in config.player_levels) diff --git a/code/modules/events/electrical_storm.dm b/code/modules/events/electrical_storm.dm index 4a53cc696de..be405426873 100644 --- a/code/modules/events/electrical_storm.dm +++ b/code/modules/events/electrical_storm.dm @@ -25,4 +25,4 @@ for(var/obj/effect/landmark/epicentre in epicentreList) for(var/obj/machinery/power/apc/apc in range(epicentre,lightsoutRange)) - apc.overload_lighting() \ No newline at end of file + apc.overload_lighting() diff --git a/code/modules/events/event_container.dm b/code/modules/events/event_container.dm index c13cee9ce11..5cb256e500a 100644 --- a/code/modules/events/event_container.dm +++ b/code/modules/events/event_container.dm @@ -127,8 +127,9 @@ var/global/list/severity_to_string = list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT available_events = list( // Severity level, event name, even type, base weight, role weights, one shot, min weight, max weight. Last two only used if set and non-zero new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Nothing", /datum/event/nothing, 100), + new /datum/event_meta(EVENT_LEVEL_MUNDANE, "APC Damage", /datum/event/apc_damage, 20, list(ASSIGNMENT_ENGINEER = 10)), new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Brand Intelligence",/datum/event/brand_intelligence,20, list(ASSIGNMENT_JANITOR = 25), 1), - new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Camera Loss", /datum/event/camera_loss, 20, list(ASSIGNMENT_ENGINEER = 10)), + new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Camera Damage", /datum/event/camera_damage, 20, list(ASSIGNMENT_ENGINEER = 10)), new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Economic News", /datum/event/economic_event, 300), new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Lost Carp", /datum/event/carp_migration, 20, list(ASSIGNMENT_SECURITY = 10), 1), new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Money Hacker", /datum/event/money_hacker, 0, list(ASSIGNMENT_ANY = 4), 1, 10, 25), From a999202cfce326eb13960b7730673f06445d7b1c Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Mon, 27 Apr 2015 11:05:05 +0200 Subject: [PATCH 3/5] Changelog entry. --- html/changelogs/PsiOmegaDelta-PR-9008.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 html/changelogs/PsiOmegaDelta-PR-9008.yml diff --git a/html/changelogs/PsiOmegaDelta-PR-9008.yml b/html/changelogs/PsiOmegaDelta-PR-9008.yml new file mode 100644 index 00000000000..298f0e4d68c --- /dev/null +++ b/html/changelogs/PsiOmegaDelta-PR-9008.yml @@ -0,0 +1,4 @@ +author: PsiOmegaDelta +delete-after: True +changes: + - rscadd: "Two new events which will cause damage to APCs or cameras when triggered." From 4bddde11ae32f52eb9125ea162f7c2499799b10e Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Mon, 27 Apr 2015 11:14:31 +0200 Subject: [PATCH 4/5] Using cameranet cameras to avoid burning out things like ERT/mercenary helmet cameras and traitor spy cams. --- code/__HELPERS/global_lists.dm | 3 --- code/game/machinery/camera/camera.dm | 2 -- code/modules/events/camera_damage.dm | 4 ++-- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index 42e1b0b63e9..7484d016b6c 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -29,9 +29,6 @@ var/global/list/playable_species = list("Human") // A list of ALL playable sp // Posters var/global/list/poster_designs = list() -// Cameras -var/list/obj/machinery/camera/world_cameras = list() - // Uplinks var/list/obj/item/device/uplink/world_uplinks = list() diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 839b1aa4616..5670ef20603 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -37,7 +37,6 @@ wires = new(src) assembly = new(src) assembly.state = 4 - world_cameras += src /* // Use this to look for cameras that have the same c_tag. for(var/obj/machinery/camera/C in cameranet.cameras) @@ -55,7 +54,6 @@ ..() /obj/machinery/camera/Destroy() - world_cameras -= src deactivate(null, 0) //kick anyone viewing out if(assembly) qdel(assembly) diff --git a/code/modules/events/camera_damage.dm b/code/modules/events/camera_damage.dm index 2cbeab97908..b6cb3dea53f 100644 --- a/code/modules/events/camera_damage.dm +++ b/code/modules/events/camera_damage.dm @@ -19,12 +19,12 @@ cam.wires.UpdateCut(CAMERA_WIRE_ALARM, 0) /datum/event/camera_damage/proc/acquire_random_camera(var/remaining_attempts = 5) - if(!world_cameras.len) + if(!cameranet.cameras.len) return if(!remaining_attempts) return - var/obj/machinery/camera/C = pick(world_cameras) + var/obj/machinery/camera/C = pick(cameranet.cameras) if(is_valid_camera(C)) return C return acquire_random_camera(remaining_attempts--) From 27e91b3fa0638415f63ee2e89f0a4fcaff188dbf Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Mon, 27 Apr 2015 19:09:46 +0200 Subject: [PATCH 5/5] Cameras now have a small chance of being permanently destroyed. --- code/modules/events/camera_damage.dm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/code/modules/events/camera_damage.dm b/code/modules/events/camera_damage.dm index b6cb3dea53f..3143b9585b3 100644 --- a/code/modules/events/camera_damage.dm +++ b/code/modules/events/camera_damage.dm @@ -14,9 +14,12 @@ for(var/obj/machinery/camera/cam in range(severity_range,C)) if(is_valid_camera(cam)) - cam.wires.UpdateCut(CAMERA_WIRE_POWER, 0) - if(prob(5)) - cam.wires.UpdateCut(CAMERA_WIRE_ALARM, 0) + if(prob(2*severity)) + cam.destroy() + else + cam.wires.UpdateCut(CAMERA_WIRE_POWER, 0) + if(prob(5*severity)) + cam.wires.UpdateCut(CAMERA_WIRE_ALARM, 0) /datum/event/camera_damage/proc/acquire_random_camera(var/remaining_attempts = 5) if(!cameranet.cameras.len)