From 9419af4b6b5b891084e3387f9f105ac8c2eef24f Mon Sep 17 00:00:00 2001 From: ririchiyo Date: Thu, 25 Sep 2014 18:23:49 -0400 Subject: [PATCH 1/4] Fixes some of the issue with some of the diseases spawning an infinite number of items. --- code/modules/admin/admin.dm | 1 + code/modules/admin/topic.dm | 4 ++++ code/modules/virus2/disease2.dm | 34 ++++++++++++++++++++++++++++++++- code/modules/virus2/effect.dm | 26 ++++++++++++++++++------- 4 files changed, 57 insertions(+), 8 deletions(-) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 98b2a012927..3af96802351 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -743,6 +743,7 @@ var/global/floorIsLava = 0 Change all maintenance doors to engie/brig access only
Change all maintenance doors to brig access only
Remove cap on security officers
+ Custom Virus Outbreak

Coder Secrets

diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 550389aacf7..139d704a6d0 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -2582,6 +2582,10 @@ J.total_positions = -1 J.spawn_positions = -1 message_admins("[key_name_admin(usr)] has removed the cap on security officers.") + if("virus_custom") + virus2_make_custom(usr.client) + feedback_add_details("admin_secrets_fun_used", "V_C") + message_admins("[key_name_admin(usr)] has trigger a custom virus outbreak.", 1) else if(href_list["ac_view_wanted"]) //Admin newscaster Topic() stuff be here src.admincaster_screen = 18 //The ac_ prefix before the hrefs stands for AdminCaster. diff --git a/code/modules/virus2/disease2.dm b/code/modules/virus2/disease2.dm index 8505ec2a0a1..326b9c3acee 100644 --- a/code/modules/virus2/disease2.dm +++ b/code/modules/virus2/disease2.dm @@ -16,7 +16,7 @@ /datum/disease2/disease/New(var/notes="No notes.") uniqueID = rand(0,10000) - log += "
[timestamp()] CREATED - [notes]" + log += "
[timestamp()] CREATED - [notes]
" ..() /datum/disease2/disease/proc/makerandom(var/greater=0) @@ -34,6 +34,38 @@ antigen |= text2num(pick(ANTIGENS)) spreadtype = prob(70) ? "Airborne" : "Contact" +/proc/virus2_make_custom(client/C) + if(!C.holder || !istype(C)) + return 0 + if(!(C.holder.rights & R_DEBUG)) + return 0 + var/mob/living/carbon/infectedMob = input(C, "Select person to infect", "Infect Person") in (player_list) // get the selected mob + if(!istype(infectedMob)) + return // return if isn't proper mob type + var/datum/disease2/disease/D = new /datum/disease2/disease("custom_disease") //set base name + for(var/i = 1; i <= D.max_stage; i++) // run through this loop until everything is set + var/datum/disease2/effect/sympton = input(C, "Choose a sympton to add ([5-i] remaining)", "Choose a Sympton") in ((typesof(/datum/disease2/effect) - /datum/disease2/effect)) // choose a sympton from the list of them + var/datum/disease2/effectholder/holder = new /datum/disease2/effectholder(infectedMob) // create the infectedMob as a holder for it. + holder.stage = i // set the stage of this holder equal to i. + var/datum/disease2/effect/f = new sympton // initalize the new sympton + holder.effect = f // assign the new sympton to the holder + holder.chance = input(C, "Choose chance", "Chance") as num // set the chance of the sympton that can occur + D.log += "[f.name] [holder.chance]%
" + D.effects += holder // add the holder to the disease + + D.uniqueID = rand(0, 10000) + D.infectionchance = input(C, "Choose an infection rate percent", "Infection Rate") as num + + //pick random antigens for the disease to have + D.antigen |= text2num(pick(ANTIGENS)) + D.antigen |= text2num(pick(ANTIGENS)) + + D.spreadtype = input(C, "Select spread type", "Spread Type") in list("Airborne", "Contact") // select how the disease is spread + infectedMob.virus2["[D.uniqueID]"] = D // assign the disease datum to the infectedMob/ selected user. + log_admin("[infectedMob] was infected with a virus with uniqueID : [D.uniqueID] by [C.ckey]") + message_admins("[infectedMob] was infected with a virus with uniqueID : [D.uniqueID] by [C.ckey]") + return 1 + /datum/disease2/disease/proc/activate(var/mob/living/carbon/mob) if(dead) cure(mob) diff --git a/code/modules/virus2/effect.dm b/code/modules/virus2/effect.dm index e9bdb7c50f1..9a3f718f6da 100644 --- a/code/modules/virus2/effect.dm +++ b/code/modules/virus2/effect.dm @@ -490,15 +490,20 @@ - - /datum/disease2/effect/elvis name = "Elvisism" stage = 3 activate(var/mob/living/carbon/mob,var/multiplier) - // + if(!istype(mob)) + return + + var/mob/living/carbon/human/H = mob var/obj/item/clothing/glasses/virussunglasses = new /obj/item/clothing/glasses/virussunglasses - mob.equip_to_slot(virussunglasses, slot_glasses) + if(H.glasses && !istype(H.glasses, /obj/item/clothing/glasses/virussunglasses)) + mob.u_equip(H.glasses) + mob.equip_to_slot(virussunglasses, slot_glasses) + if(!slot_glasses) + mob.equip_to_slot(virussunglasses, slot_glasses) mob.confused += 10 @@ -511,7 +516,6 @@ if(istype(mob, /mob/living/carbon/human)) - var/mob/living/carbon/human/H = mob if(H.species.name == "Human" && !(H.f_style == "Pompadour")) spawn(50) H.h_style = "Pompadour" @@ -550,7 +554,11 @@ activate(var/mob/living/carbon/mob,var/multiplier) // var/obj/item/clothing/mask/gas/virusclown_hat = new /obj/item/clothing/mask/gas/virusclown_hat - mob.equip_to_slot(virusclown_hat, slot_wear_mask) + if(mob.wear_mask && !istype(mob.wear_mask, /obj/item/clothing/mask/gas/virusclown_hat)) + mob.u_equip(mob.wear_mask) + mob.equip_to_slot(virusclown_hat, slot_wear_mask) + if(!mob.wear_mask) + mob.equip_to_slot(virusclown_hat, slot_wear_mask) mob.reagents.add_reagent("psilocybin", 20) mob.say(pick("HONK!", "Honk!", "Honk.", "Honk?", "Honk!!", "Honk?!", "Honk...")) @@ -583,7 +591,11 @@ var/list/compatible_mobs = list(/mob/living/carbon/human, /mob/living/carbon/mon var/obj/item/clothing/mask/horsehead/magic/magichead = new /obj/item/clothing/mask/horsehead/magic - mob.equip_to_slot(magichead, slot_wear_mask) + if(mob.wear_mask && !istype(mob.wear_mask, /obj/item/clothing/mask/horsehead/magic)) + mob.u_equip(mob.wear_mask) + mob.equip_to_slot(magichead, slot_wear_mask) + if(!mob.wear_mask) + mob.equip_to_slot(magichead, slot_wear_mask) mob << "You feel a little horse!" From 85e94b358c0f61fcb9b21b0bb36061763a734284 Mon Sep 17 00:00:00 2001 From: ririchiyo Date: Thu, 25 Sep 2014 18:29:32 -0400 Subject: [PATCH 2/4] quick fix. --- code/modules/virus2/effect.dm | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/code/modules/virus2/effect.dm b/code/modules/virus2/effect.dm index 9a3f718f6da..de1adc8a90c 100644 --- a/code/modules/virus2/effect.dm +++ b/code/modules/virus2/effect.dm @@ -506,30 +506,23 @@ mob.equip_to_slot(virussunglasses, slot_glasses) mob.confused += 10 - - - if(pick(0,1)) mob.say(pick("Uh HUH!", "Thank you, Thank you very much...", "I ain't nothin' but a hound dog!", "Swing low, sweet chariot!")) else mob.emote("me",1,pick("curls his lip!", "gyrates his hips!", "thrusts his hips!")) - if(istype(mob, /mob/living/carbon/human)) + if(istype(H)) if(H.species.name == "Human" && !(H.f_style == "Pompadour")) spawn(50) H.h_style = "Pompadour" H.update_hair() - - if(H.species.name == "Human" && !(H.f_style == "Elvis Sideburns")) spawn(50) H.f_style = "Elvis Sideburns" H.update_hair() - - /obj/item/clothing/glasses/virussunglasses dropped(mob/user as mob) From f482ddc445ab0bf70436f3d4ce46dcc3c22e5e95 Mon Sep 17 00:00:00 2001 From: ririchiyo Date: Thu, 25 Sep 2014 18:55:15 -0400 Subject: [PATCH 3/4] quick fix to add numeric restraints and only notify admins on successful completion. --- code/modules/admin/topic.dm | 6 +++--- code/modules/virus2/disease2.dm | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 139d704a6d0..b705ebcfc6b 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -2583,9 +2583,9 @@ J.spawn_positions = -1 message_admins("[key_name_admin(usr)] has removed the cap on security officers.") if("virus_custom") - virus2_make_custom(usr.client) - feedback_add_details("admin_secrets_fun_used", "V_C") - message_admins("[key_name_admin(usr)] has trigger a custom virus outbreak.", 1) + if(virus2_make_custom(usr.client)) + feedback_add_details("admin_secrets_fun_used", "V_C") + message_admins("[key_name_admin(usr)] has trigger a custom virus outbreak.", 1) else if(href_list["ac_view_wanted"]) //Admin newscaster Topic() stuff be here src.admincaster_screen = 18 //The ac_ prefix before the hrefs stands for AdminCaster. diff --git a/code/modules/virus2/disease2.dm b/code/modules/virus2/disease2.dm index 326b9c3acee..d2b55892d8b 100644 --- a/code/modules/virus2/disease2.dm +++ b/code/modules/virus2/disease2.dm @@ -50,12 +50,15 @@ var/datum/disease2/effect/f = new sympton // initalize the new sympton holder.effect = f // assign the new sympton to the holder holder.chance = input(C, "Choose chance", "Chance") as num // set the chance of the sympton that can occur + if(holder.chance > 100 || holder.chance < 0) + return 0 D.log += "[f.name] [holder.chance]%
" D.effects += holder // add the holder to the disease D.uniqueID = rand(0, 10000) D.infectionchance = input(C, "Choose an infection rate percent", "Infection Rate") as num - + if(D.infectionchance > 100 || D.infectionchance < 0) + return 0 //pick random antigens for the disease to have D.antigen |= text2num(pick(ANTIGENS)) D.antigen |= text2num(pick(ANTIGENS)) From d20ffa4eb09599de4b99e91a3211b9acbab0236f Mon Sep 17 00:00:00 2001 From: ririchiyo Date: Thu, 25 Sep 2014 19:07:43 -0400 Subject: [PATCH 4/4] Lets hope this properly updates things. --- html/changelogs/Ririchiyo-PR-1576.yml | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 html/changelogs/Ririchiyo-PR-1576.yml diff --git a/html/changelogs/Ririchiyo-PR-1576.yml b/html/changelogs/Ririchiyo-PR-1576.yml new file mode 100644 index 00000000000..6268106e675 --- /dev/null +++ b/html/changelogs/Ririchiyo-PR-1576.yml @@ -0,0 +1,38 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscdel (general adding of nice things) +# rscadd (general deleting of nice things) +# imageadd +# imagedel +# spellcheck (typo fixes) +# experiment +# tgs (TG-ported fixes?) +################################# + +# Your name. +author: Ririchiyo + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +#delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +changes: + - rscadd: Added an add reagent verb for administrators. + - rscadd: Added a way for administrators to add custom virus2 diseases. + - bugfix: Fixed a couple of bugs with diseases where sunglasses, horse heads, and clown masks were replicating forever. + - experiment: Switched the preference system from flatfile over to an sqlite database -- expect there to be a few bugs.