From 8c5167672273e8feae2e7b94228fe9de0b3e3c66 Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Fri, 3 Jul 2015 16:02:02 +0200 Subject: [PATCH] Uplink Items - Part III Phase III of the antag uplink additions. Currently contains proof-of-concept falsified announcements. --- code/defines/procs/announce.dm | 6 + .../items/devices/uplink_categories.dm | 3 + .../objects/items/devices/uplink_items.dm | 127 +++++++++++++++++- code/modules/admin/admin_attack_log.dm | 6 +- code/modules/admin/admin_verbs.dm | 10 +- code/modules/admin/verbs/icarus.dm | 6 +- code/modules/events/blob.dm | 7 +- code/modules/events/event.dm | 6 +- code/modules/events/event_manager.dm | 31 ++--- code/modules/events/ion_storm.dm | 2 +- code/modules/events/radiation_storm.dm | 4 + code/modules/events/spacevine.dm | 4 +- 12 files changed, 169 insertions(+), 43 deletions(-) diff --git a/code/defines/procs/announce.dm b/code/defines/procs/announce.dm index 0a64e89592..be5b468c7f 100644 --- a/code/defines/procs/announce.dm +++ b/code/defines/procs/announce.dm @@ -117,3 +117,9 @@ datum/announcement/proc/Log(message as text, message_title as text) /proc/GetNameAndAssignmentFromId(var/obj/item/weapon/card/id/I) // Format currently matches that of newscaster feeds: Registered Name (Assigned Rank) return I.assignment ? "[I.registered_name] ([I.assignment])" : I.registered_name + +/proc/level_seven_announcement() + command_announcement.Announce("Confirmed outbreak of level 7 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", new_sound = 'sound/AI/outbreak7.ogg') + +/proc/ion_storm_announcement() + command_announcement.Announce("It has come to our attention that the station passed through an ion storm. Please monitor all electronic equipment for malfunctions.", "Anomaly Alert") diff --git a/code/game/objects/items/devices/uplink_categories.dm b/code/game/objects/items/devices/uplink_categories.dm index f90c4797bc..58737e60da 100644 --- a/code/game/objects/items/devices/uplink_categories.dm +++ b/code/game/objects/items/devices/uplink_categories.dm @@ -36,5 +36,8 @@ /datum/uplink_category/hardsuit_modules name = "Hardsuit Modules" +/datum/uplink_category/announcements + name = "Announcements" + /datum/uplink_category/badassery name = "Badassery" diff --git a/code/game/objects/items/devices/uplink_items.dm b/code/game/objects/items/devices/uplink_items.dm index 9765519622..60c5a2863a 100644 --- a/code/game/objects/items/devices/uplink_items.dm +++ b/code/game/objects/items/devices/uplink_items.dm @@ -38,15 +38,31 @@ var/datum/uplink/uplink = new() ..() antag_roles = list() -/datum/uplink_item/proc/buy(var/obj/item/device/uplink/U, var/mob/user) - purchase_log(U) - var/cost = cost(U.uses) - var/goods = get_goods(U, get_turf(user)) + +/datum/uplink_item/proc/buy(var/obj/item/device/uplink/U, var/mob/user) + var/extra_args = extra_args(user) + if(!extra_args) + return + + if(!can_buy(U)) + return + + var/cost = cost(U.uses) + + var/goods = get_goods(U, get_turf(user), user, extra_args) + if(!goods) + return + + purchase_log(U) U.uses -= cost U.used_TC += cost return goods +// Any additional arguments you wish to send to the get_goods +/datum/uplink_item/proc/extra_args(var/mob/user) + return 1 + /datum/uplink_item/proc/can_buy(obj/item/device/uplink/U) if(cost(U.uses) > U.uses) return 0 @@ -90,11 +106,14 @@ datum/uplink_item/dd_SortValue() /******************************** * * -* Physical Uplink Entires * +* Physical Uplink Entries * * * ********************************/ /datum/uplink_item/item/buy(var/obj/item/device/uplink/U, var/mob/user) var/obj/item/I = ..() + if(!I) + return + if(istype(I, /list)) var/list/L = I if(L.len) I = L[1] @@ -512,6 +531,104 @@ datum/uplink_item/dd_SortValue() return "\icon[icon]" +/******************************** +* * +* Abstract Uplink Entries * +* * +********************************/ +var/image/default_abstract_uplink_icon +/datum/uplink_item/abstract/log_icon() + if(!default_abstract_uplink_icon) + default_abstract_uplink_icon = image('icons/obj/pda.dmi', "pda-syn") + + return "\icon[default_abstract_uplink_icon]" + +/**************** +* Announcements * +*****************/ +/datum/uplink_item/abstract/announcements + category = /datum/uplink_category/announcements + +/datum/uplink_item/abstract/announcements/buy(var/obj/item/device/uplink/U, var/mob/user) + . = ..() + if(.) + log_and_message_admins("has triggered a falsified [src] announcement", user) + +/datum/uplink_item/abstract/announcements/fake_centcom + item_cost = DEFAULT_TELECRYSTAL_AMOUNT / 2 + +/datum/uplink_item/abstract/announcements/fake_centcom/New() + ..() + name = "[command_name()] Update" + desc = "Causes a falsified [command_name()] Update. Triggers immediately after supplying additional data." + antag_roles = list(MODE_MERCENARY) + +/datum/uplink_item/abstract/announcements/fake_centcom/extra_args(var/mob/user) + if(!user) + return 0 + + var/subtitle = input(user, "Enter the annoncement Title.", "Annoncement Title", "Attention") as text|null + if(!subtitle) + return 0 + + var/message = input(user, "Enter the annoncement message.", "Annoncement Message") as text|null + if(!message) + return 0 + + return list("title" = subtitle, "message" = message) + +/datum/uplink_item/abstract/announcements/fake_centcom/get_goods(var/obj/item/device/uplink/U, var/loc, var/mob/user, var/list/args) + command_announcement.Announce(args.["message"], args.["title"]) + return 1 + +/datum/uplink_item/abstract/announcements/fake_cryo + name = "Cryogenic Oversight Announcement" + desc = "Causes a falsified cryogenic message. Triggers immediately after supplying additional data." + item_cost = 1 + +/datum/uplink_item/abstract/announcements/fake_cryo/extra_args(var/mob/user) + if(!user) + return 0 + + var/real_name = input(user, "Enter the name of the occupant.", "Occupant Name.", user.name) as text|null + if(!real_name) + return 0 + + var/title = input(user, "Enter the title of the occupant.", "Occupant Title.", "Assistant") as text|null + if(!title) + return 0 + + return list("name" = real_name, "title" = title) + +/datum/uplink_item/abstract/announcements/fake_cryo/get_goods(var/obj/item/device/uplink/U, var/loc, var/mob/user, var/list/args) + if(!args) + return 0 + + var/obj/item/device/radio/intercom/announce = new /obj/item/device/radio/intercom(user) + announce.autosay("[args["name"]], [args["title"]], has entered long-term storage.", "Cryogenic Oversight") + qdel(announce) + return 1 + +/datum/uplink_item/abstract/announcements/fake_ion_storm + name = "Ion Storm Announcement" + desc = "Interferes with the station's ion sensors. Triggers immediately upon investment." + item_cost = 1 + +/datum/uplink_item/abstract/announcements/fake_ion_storm/get_goods(var/obj/item/device/uplink/U, var/loc) + ion_storm_announcement() + return 1 + +/datum/uplink_item/abstract/announcements/fake_radiation + name = "Radiation Storm Announcement" + desc = "Interferes with the station's radiation sensors. Triggers immediately upon investment." + item_cost = 3 + +/datum/uplink_item/abstract/announcements/fake_radiation/get_goods(var/obj/item/device/uplink/U, var/loc) + var/datum/event_meta/EM = new(EVENT_LEVEL_MUNDANE, "Fake Radiation Storm", add_to_queue = 0) + new/datum/event/radiation_storm/syndicate(EM) + return 1 + + /**************** * Support procs * ****************/ diff --git a/code/modules/admin/admin_attack_log.dm b/code/modules/admin/admin_attack_log.dm index 72e85e1d94..967a4375da 100644 --- a/code/modules/admin/admin_attack_log.dm +++ b/code/modules/admin/admin_attack_log.dm @@ -4,7 +4,7 @@ proc/log_and_message_admins(var/message as text, var/mob/user = usr) log_admin(user ? "[key_name(user)] [message]" : "EVENT [message]") - message_admins(user ? "[key_name(user)] [message]" : "EVENT [message]") + message_admins(user ? "[key_name_admin(user)] [message]" : "EVENT [message]") proc/log_and_message_admins_many(var/list/mob/users, var/message) if(!users || !users.len) @@ -17,10 +17,6 @@ proc/log_and_message_admins_many(var/list/mob/users, var/message) log_admin("[english_list(user_keys)] [message]") message_admins("[english_list(user_keys)] [message]") -proc/admin_log_and_message_admins(var/message as text) - log_admin(usr ? "[key_name_admin(usr)] [message]" : "EVENT [message]") - message_admins(usr ? "[key_name_admin(usr)] [message]" : "EVENT [message]", 1) - proc/admin_attack_log(var/mob/attacker, var/mob/victim, var/attacker_message, var/victim_message, var/admin_message) if(victim) victim.attack_log += text("\[[time_stamp()]\] [key_name(attacker)] - [victim_message]") diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index b415a317fc..daaf33b40d 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -726,7 +726,7 @@ var/list/admin_verbs_mentor = list( var/new_name = sanitizeSafe(input(src, "Enter new name. Leave blank or as is to cancel.", "[S.real_name] - Enter new silicon name", S.real_name)) if(new_name && new_name != S.real_name) - admin_log_and_message_admins("has renamed the silicon '[S.real_name]' to '[new_name]'") + log_and_message_admins("has renamed the silicon '[S.real_name]' to '[new_name]'") S.SetName(new_name) feedback_add_details("admin_verb","RAI") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -741,7 +741,7 @@ var/list/admin_verbs_mentor = list( var/datum/nano_module/law_manager/L = new(S) L.ui_interact(usr, state = admin_state) - admin_log_and_message_admins("has opened [S]'s law manager.") + log_and_message_admins("has opened [S]'s law manager.") feedback_add_details("admin_verb","MSL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/change_human_appearance_admin() @@ -754,7 +754,7 @@ var/list/admin_verbs_mentor = list( var/mob/living/carbon/human/H = input("Select mob.", "Change Mob Appearance - Admin") as null|anything in human_mob_list if(!H) return - admin_log_and_message_admins("is altering the appearance of [H].") + log_and_message_admins("is altering the appearance of [H].") H.change_appearance(APPEARANCE_ALL, usr, usr, check_species_whitelist = 0, state = admin_state) feedback_add_details("admin_verb","CHAA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -774,10 +774,10 @@ var/list/admin_verbs_mentor = list( switch(alert("Do you wish for [H] to be allowed to select non-whitelisted races?","Alter Mob Appearance","Yes","No","Cancel")) if("Yes") - admin_log_and_message_admins("has allowed [H] to change \his appearance, without whitelisting of races.") + log_and_message_admins("has allowed [H] to change \his appearance, without whitelisting of races.") H.change_appearance(APPEARANCE_ALL, H.loc, check_species_whitelist = 0) if("No") - admin_log_and_message_admins("has allowed [H] to change \his appearance, with whitelisting of races.") + log_and_message_admins("has allowed [H] to change \his appearance, with whitelisting of races.") H.change_appearance(APPEARANCE_ALL, H.loc, check_species_whitelist = 1) feedback_add_details("admin_verb","CMAS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/admin/verbs/icarus.dm b/code/modules/admin/verbs/icarus.dm index ef322d40dd..6711c846fc 100644 --- a/code/modules/admin/verbs/icarus.dm +++ b/code/modules/admin/verbs/icarus.dm @@ -4,7 +4,7 @@ set category = "Fun" var/turf/target = get_turf(src.mob) - admin_log_and_message_admins("has fired the Icarus point defense laser at [target.x]-[target.y]-[target.z]") + log_and_message_admins("has fired the Icarus point defense laser at [target.x]-[target.y]-[target.z]") if(!src.holder) src << "Only administrators may use this command." return @@ -18,7 +18,7 @@ set category = "Fun" var/turf/target = get_turf(src.mob) - admin_log_and_message_admins("has fired the Icarus main gun projectile at [target.x]-[target.y]-[target.z]") + log_and_message_admins("has fired the Icarus main gun projectile at [target.x]-[target.y]-[target.z]") if(!src.holder) src << "Only administrators may use this command." return @@ -31,7 +31,7 @@ set desc = "Lets you chose the position of the Icarus in regards to the map." set category = "Fun" - admin_log_and_message_admins("is changing the Icarus position.") + log_and_message_admins("is changing the Icarus position.") if(!src.holder) src << "Only administrators may use this command." return diff --git a/code/modules/events/blob.dm b/code/modules/events/blob.dm index 0b1b1dbbfd..c478a28daa 100644 --- a/code/modules/events/blob.dm +++ b/code/modules/events/blob.dm @@ -4,10 +4,8 @@ var/obj/effect/blob/core/Blob - /datum/event/blob/announce() - command_announcement.Announce("Confirmed outbreak of level 7 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", new_sound = 'sound/AI/outbreak7.ogg') - + level_seven_announcement() /datum/event/blob/start() var/turf/T = pick(blobstart) @@ -18,10 +16,9 @@ for(var/i = 1; i < rand(3, 4), i++) Blob.process() - /datum/event/blob/tick() if(!Blob) kill() return if(IsMultiple(activeFor, 3)) - Blob.process() \ No newline at end of file + Blob.process() diff --git a/code/modules/events/event.dm b/code/modules/events/event.dm index 0b69dc89bb..4912b238c8 100644 --- a/code/modules/events/event.dm +++ b/code/modules/events/event.dm @@ -5,11 +5,12 @@ var/min_weight = 0 // The minimum weight that this event will have. Only used if non-zero. var/max_weight = 0 // The maximum weight that this event will have. Only use if non-zero. var/severity = 0 // The current severity of this event - var/one_shot = 0 //If true, then the event will not be re-added to the list of available events + var/one_shot = 0 // If true, then the event will not be re-added to the list of available events + var/add_to_queue= 1 // If true, add back to the queue of events upon finishing. var/list/role_weights = list() var/datum/event/event_type -/datum/event_meta/New(var/event_severity, var/event_name, var/datum/event/type, var/event_weight, var/list/job_weights, var/is_one_shot = 0, var/min_event_weight = 0, var/max_event_weight = 0) +/datum/event_meta/New(var/event_severity, var/event_name, var/datum/event/type, var/event_weight, var/list/job_weights, var/is_one_shot = 0, var/min_event_weight = 0, var/max_event_weight = 0, var/add_to_queue = 1) name = event_name severity = event_severity event_type = type @@ -17,6 +18,7 @@ weight = event_weight min_weight = min_event_weight max_weight = max_event_weight + src.add_to_queue = add_to_queue if(job_weights) role_weights = job_weights diff --git a/code/modules/events/event_manager.dm b/code/modules/events/event_manager.dm index d5b38f087b..4fca5eb3d9 100644 --- a/code/modules/events/event_manager.dm +++ b/code/modules/events/event_manager.dm @@ -41,7 +41,8 @@ // Add the event back to the list of available events var/datum/event_container/EC = event_containers[E.severity] var/datum/event_meta/EM = E.event_meta - EC.available_events += EM + if(EM.add_to_queue) + EC.available_events += EM log_debug("Event '[EM.name]' has completed at [worldtime2text()].") @@ -193,41 +194,41 @@ if(href_list["toggle_report"]) report_at_round_end = !report_at_round_end - admin_log_and_message_admins("has [report_at_round_end ? "enabled" : "disabled"] the round end event report.") + log_and_message_admins("has [report_at_round_end ? "enabled" : "disabled"] the round end event report.") else if(href_list["dec_timer"]) var/datum/event_container/EC = locate(href_list["event"]) var/decrease = 60 * (10 ** text2num(href_list["dec_timer"])) EC.next_event_time -= decrease - admin_log_and_message_admins("decreased timer for [severity_to_string[EC.severity]] events by [decrease/600] minute(s).") + log_and_message_admins("decreased timer for [severity_to_string[EC.severity]] events by [decrease/600] minute(s).") else if(href_list["inc_timer"]) var/datum/event_container/EC = locate(href_list["event"]) var/increase = 60 * (10 ** text2num(href_list["inc_timer"])) EC.next_event_time += increase - admin_log_and_message_admins("increased timer for [severity_to_string[EC.severity]] events by [increase/600] minute(s).") + log_and_message_admins("increased timer for [severity_to_string[EC.severity]] events by [increase/600] minute(s).") else if(href_list["select_event"]) var/datum/event_container/EC = locate(href_list["select_event"]) var/datum/event_meta/EM = EC.SelectEvent() if(EM) - admin_log_and_message_admins("has queued the [severity_to_string[EC.severity]] event '[EM.name]'.") + log_and_message_admins("has queued the [severity_to_string[EC.severity]] event '[EM.name]'.") else if(href_list["pause"]) var/datum/event_container/EC = locate(href_list["pause"]) EC.delayed = !EC.delayed - admin_log_and_message_admins("has [EC.delayed ? "paused" : "resumed"] countdown for [severity_to_string[EC.severity]] events.") + log_and_message_admins("has [EC.delayed ? "paused" : "resumed"] countdown for [severity_to_string[EC.severity]] events.") else if(href_list["pause_all"]) config.allow_random_events = text2num(href_list["pause_all"]) - admin_log_and_message_admins("has [config.allow_random_events ? "resumed" : "paused"] countdown for all events.") + log_and_message_admins("has [config.allow_random_events ? "resumed" : "paused"] countdown for all events.") else if(href_list["interval"]) var/delay = input("Enter delay modifier. A value less than one means events fire more often, higher than one less often.", "Set Interval Modifier") as num|null if(delay && delay > 0) var/datum/event_container/EC = locate(href_list["interval"]) EC.delay_modifier = delay - admin_log_and_message_admins("has set the interval modifier for [severity_to_string[EC.severity]] events to [EC.delay_modifier].") + log_and_message_admins("has set the interval modifier for [severity_to_string[EC.severity]] events to [EC.delay_modifier].") else if(href_list["stop"]) if(alert("Stopping an event may have unintended side-effects. Continue?","Stopping Event!","Yes","No") != "Yes") return var/datum/event/E = locate(href_list["stop"]) var/datum/event_meta/EM = E.event_meta - admin_log_and_message_admins("has stopped the [severity_to_string[EM.severity]] event '[EM.name]'.") + log_and_message_admins("has stopped the [severity_to_string[EM.severity]] event '[EM.name]'.") E.kill() else if(href_list["view_events"]) selected_event_container = locate(href_list["view_events"]) @@ -249,23 +250,23 @@ var/datum/event_meta/EM = locate(href_list["set_weight"]) EM.weight = weight if(EM != new_event) - admin_log_and_message_admins("has changed the weight of the [severity_to_string[EM.severity]] event '[EM.name]' to [EM.weight].") + log_and_message_admins("has changed the weight of the [severity_to_string[EM.severity]] event '[EM.name]' to [EM.weight].") else if(href_list["toggle_oneshot"]) var/datum/event_meta/EM = locate(href_list["toggle_oneshot"]) EM.one_shot = !EM.one_shot if(EM != new_event) - admin_log_and_message_admins("has [EM.one_shot ? "set" : "unset"] the oneshot flag for the [severity_to_string[EM.severity]] event '[EM.name]'.") + log_and_message_admins("has [EM.one_shot ? "set" : "unset"] the oneshot flag for the [severity_to_string[EM.severity]] event '[EM.name]'.") else if(href_list["toggle_enabled"]) var/datum/event_meta/EM = locate(href_list["toggle_enabled"]) EM.enabled = !EM.enabled - admin_log_and_message_admins("has [EM.enabled ? "enabled" : "disabled"] the [severity_to_string[EM.severity]] event '[EM.name]'.") + log_and_message_admins("has [EM.enabled ? "enabled" : "disabled"] the [severity_to_string[EM.severity]] event '[EM.name]'.") else if(href_list["remove"]) if(alert("This will remove the event from rotation. Continue?","Removing Event!","Yes","No") != "Yes") return var/datum/event_meta/EM = locate(href_list["remove"]) var/datum/event_container/EC = locate(href_list["EC"]) EC.available_events -= EM - admin_log_and_message_admins("has removed the [severity_to_string[EM.severity]] event '[EM.name]'.") + log_and_message_admins("has removed the [severity_to_string[EM.severity]] event '[EM.name]'.") else if(href_list["add"]) if(!new_event.name || !new_event.event_type) return @@ -273,12 +274,12 @@ return new_event.severity = selected_event_container.severity selected_event_container.available_events += new_event - admin_log_and_message_admins("has added \a [severity_to_string[new_event.severity]] event '[new_event.name]' of type [new_event.event_type] with weight [new_event.weight].") + log_and_message_admins("has added \a [severity_to_string[new_event.severity]] event '[new_event.name]' of type [new_event.event_type] with weight [new_event.weight].") new_event = new else if(href_list["clear"]) var/datum/event_container/EC = locate(href_list["clear"]) if(EC.next_event) - admin_log_and_message_admins("has dequeued the [severity_to_string[EC.severity]] event '[EC.next_event.name]'.") + log_and_message_admins("has dequeued the [severity_to_string[EC.severity]] event '[EC.next_event.name]'.") EC.next_event = null Interact(usr) diff --git a/code/modules/events/ion_storm.dm b/code/modules/events/ion_storm.dm index 7545252824..31aa5bac93 100644 --- a/code/modules/events/ion_storm.dm +++ b/code/modules/events/ion_storm.dm @@ -95,7 +95,7 @@ /datum/event/ionstorm/end() spawn(rand(5000,8000)) if(prob(50)) - command_announcement.Announce("It has come to our attention that the station passed through an ion storm. Please monitor all electronic equipment for malfunctions.", "Anomaly Alert") + ion_storm_announcement() /* /proc/IonStorm(botEmagChance = 10) diff --git a/code/modules/events/radiation_storm.dm b/code/modules/events/radiation_storm.dm index 12ec133478..7be0a5c3d2 100644 --- a/code/modules/events/radiation_storm.dm +++ b/code/modules/events/radiation_storm.dm @@ -3,6 +3,7 @@ var/const/radIntervall = 5 // Enough time between enter/leave belt for 10 hits, as per original implementation var/const/leaveBelt = 80 var/const/revokeAccess = 135 + startWhen = 2 announceWhen = 1 endWhen = revokeAccess var/postStartTicks = 0 @@ -52,3 +53,6 @@ /datum/event/radiation_storm/end() revoke_maint_all_access() + +/datum/event/radiation_storm/syndicate/radiate() + return diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index cf00e4f78b..fef2e3f6b1 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -1,11 +1,11 @@ /var/global/spacevines_spawned = 0 /datum/event/spacevine - announceWhen = 10 + announceWhen = 60 /datum/event/spacevine/start() spacevine_infestation() spacevines_spawned = 1 /datum/event/spacevine/announce() - command_announcement.Announce("Confirmed outbreak of level 7 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", new_sound = 'sound/AI/outbreak7.ogg') + level_seven_announcement()