From 25d306d9fc99f503115247f042f23f36d4e124bd Mon Sep 17 00:00:00 2001 From: Ccomp5950 Date: Fri, 22 Nov 2013 01:12:56 -0600 Subject: [PATCH 1/5] Replaced role checks by loyalty implant checks --- code/datums/mind.dm | 84 ++++++++++++++----- code/modules/mob/living/carbon/human/human.dm | 6 ++ 2 files changed, 68 insertions(+), 22 deletions(-) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index f8d443f810e..f073d6e7ee3 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -123,6 +123,7 @@ datum/mind out += "Factions and special roles:
" var/list/sections = list( + "implant", "revolution", "cult", "wizard", @@ -133,19 +134,23 @@ datum/mind "malfunction", ) var/text = "" - + var/mob/living/carbon/human/H = current if (istype(current, /mob/living/carbon/human) || istype(current, /mob/living/carbon/monkey)) + /** Impanted**/ + if(H.is_loyalty_implanted(H)) + text = "Loyalty Implant:Remove|Implanted
" + else + text = "Loyalty Implant:No Implant|Implant him!
" + sections["implant"] = text /** REVOLUTION ***/ text = "revolution" if (ticker.mode.config_tag=="revolution") - text = uppertext(text) + text += uppertext(text) text = "[text]: " - if (assigned_role in command_positions) - text += "HEAD|officer|employee|headrev|rev" - else if (assigned_role in list("Security Officer", "Detective", "Warden")) - text += "head|OFFICER|employee|headre|rev" + if (H.is_loyalty_implanted(H)) + text += "LOYAL EMPLOYEE|headrev|rev" else if (src in ticker.mode.head_revolutionaries) - text = "head|officer|employee|HEADREV|rev" + text = "employee|HEADREV|rev" text += "
Flash: give" var/list/L = current.get_contents() @@ -162,9 +167,9 @@ datum/mind if (objectives.len==0) text += "
Objectives are empty! Set to kill all heads." else if (src in ticker.mode.revolutionaries) - text += "head|officer|employee|headrev|REV" + text += "employee|headrev|REV" else - text += "head|officer|EMPLOYEE|headrev|rev" + text += "EMPLOYEE|headrev|rev" sections["revolution"] = text /** CULT ***/ @@ -172,19 +177,17 @@ datum/mind if (ticker.mode.config_tag=="cult") text = uppertext(text) text = "[text]: " - if (assigned_role in command_positions) - text += "HEAD|officer|employee|cultist" - else if (assigned_role in list("Security Officer", "Detective", "Warden")) - text += "head|OFFICER|employee|cultist" + if (H.is_loyalty_implanted(H)) + text += "LOYAL EMPLOYEE|cultist" else if (src in ticker.mode.cult) - text += "head|officer|employee|CULTIST" + text += "employee|CULTIST" text += "
Give tome|amulet." /* if (objectives.len==0) text += "
Objectives are empty! Set to sacrifice and escape or summon." */ else - text += "head|officer|EMPLOYEE|cultist" + text += "EMPLOYEE|cultist" sections["cult"] = text /** WIZARD ***/ @@ -243,12 +246,16 @@ datum/mind if (ticker.mode.config_tag=="traitor" || ticker.mode.config_tag=="traitorchan") text = uppertext(text) text = "[text]: " - if (src in ticker.mode.traitors) - text += "TRAITOR|loyal" - if (objectives.len==0) - text += "
Objectives are empty! Randomize!" + if(istype(current, /mob/living/carbon/human)) + if (H.is_loyalty_implanted(H)) + text +="traitor|LOYAL EMPLOYEE" else - text += "traitor|LOYAL" + if (src in ticker.mode.traitors) + text += "TRAITOR|Employee" + if (objectives.len==0) + text += "
Objectives are empty! Randomize!" + else + text += "traitor|Employee" sections["traitor"] = text /** MONKEY ***/ @@ -496,6 +503,39 @@ datum/mind if(!istype(objective)) return objective.completed = !objective.completed + else if(href_list["implant"]) + var/mob/living/carbon/human/H = current + switch(href_list["implant"]) + if("remove") + for(var/obj/item/weapon/implant/loyalty/I in H.contents) + I.Del() + H << "\blue Your loyalty implant has been deactivated." + if("add") + H.contents.Add( new /obj/item/weapon/implant/loyalty (src) ) + H << "\red You somehow have become the recepient of a loyalty transplant, and it just activated!" + if(src in ticker.mode.revolutionaries) + special_role = null + ticker.mode.revolutionaries -= src + src << "\red The nanobots in the loyalty implant remove all thoughts about being a revolutionary. Get back to work!" + if(src in ticker.mode.head_revolutionaries) + special_role = null + ticker.mode.head_revolutionaries -=src + src << "\red The nanobots in the loyalty implant remove all thoughts about being a revolutionary. Get back to work!" + if(src in ticker.mode.cult) + ticker.mode.cult -= src + ticker.mode.update_cult_icons_removed(src) + special_role = null + var/datum/game_mode/cult/cult = ticker.mode + if (istype(cult)) + cult.memoize_cult_objectives(src) + current << "\red The nanobots in the loyalty implant remove all thoughts about being in a cult. Have a productive day!" + memory = "" + if(src in ticker.mode.traitors) + ticker.mode.traitors -= src + special_role = null + current << "\red The nanobots in the loyalty implant remove all thoughts about being a traitor to Nanotrasen. Have a nice day!" + log_admin("[key_name_admin(usr)] has de-traitor'ed [current].") + else if (href_list["revolution"]) switch(href_list["revolution"]) if("clear") @@ -762,8 +802,8 @@ datum/mind special_role = "traitor" current << "\red You are a traitor!" log_admin("[key_name_admin(usr)] has traitor'ed [current].") - if(isAI(current)) - var/mob/living/silicon/ai/A = current + if(istype(current, /mob/living/silicon)) + var/mob/living/silicon/A = current call(/datum/game_mode/proc/add_law_zero)(A) A.show_laws() diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index b896813cd56..f3d66aa3fc5 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -317,6 +317,12 @@ if(armor >= 2) return +/mob/living/carbon/human/proc/is_loyalty_implanted(mob/living/carbon/human/M) + for(var/L in M.contents) + if(istype(L, /obj/item/weapon/implant/loyalty)) + return 1 + return 0 + /mob/living/carbon/human/attack_slime(mob/living/carbon/slime/M as mob) if(M.Victim) return // can't attack while eating! From 38114c537c4f0fb95a0cca75e6dc5688bcb671f1 Mon Sep 17 00:00:00 2001 From: Ccomp5950 Date: Fri, 22 Nov 2013 12:52:25 -0600 Subject: [PATCH 2/5] Bugfix: is_loyalty_implanted() now checks to make sure the implant is actually implanted and now in your hand. implant adding via the traitor panel will also update it's location to be in the players head for autopsy as well as is_loyalty_implanted() reasons. Thanks Chinsky / alex-gh for the heads up on this. --- code/datums/mind.dm | 13 +++++++++++-- code/modules/mob/living/carbon/human/human.dm | 4 +++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index f073d6e7ee3..16bd1d3e5ae 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -508,10 +508,19 @@ datum/mind switch(href_list["implant"]) if("remove") for(var/obj/item/weapon/implant/loyalty/I in H.contents) - I.Del() + for(var/datum/organ/external/organs in H.organs) + if(I in organs.implants) + I.Del() + break H << "\blue Your loyalty implant has been deactivated." if("add") - H.contents.Add( new /obj/item/weapon/implant/loyalty (src) ) + var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H) + L.imp_in = H + L.implanted = 1 + var/datum/organ/external/affected = H.organs_by_name["head"] + affected.implants += L + L.part = affected + H << "\red You somehow have become the recepient of a loyalty transplant, and it just activated!" if(src in ticker.mode.revolutionaries) special_role = null diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index f3d66aa3fc5..7a3bb5bbf08 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -320,7 +320,9 @@ /mob/living/carbon/human/proc/is_loyalty_implanted(mob/living/carbon/human/M) for(var/L in M.contents) if(istype(L, /obj/item/weapon/implant/loyalty)) - return 1 + for(var/datum/organ/external/O in M.organs) + if(L in O.implants) + return 1 return 0 /mob/living/carbon/human/attack_slime(mob/living/carbon/slime/M as mob) From 7ea27ff5ff7823dc7c71b3b88ce1691e590ecc85 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 23 Nov 2013 17:29:41 +0100 Subject: [PATCH 3/5] Indentation fixes --- code/datums/mind.dm | 82 ++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 46 deletions(-) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 16bd1d3e5ae..f5fc2b79c28 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -241,44 +241,43 @@ datum/mind text += "operative|NANOTRASEN" sections["nuclear"] = text - /** TRAITOR ***/ - text = "traitor" - if (ticker.mode.config_tag=="traitor" || ticker.mode.config_tag=="traitorchan") - text = uppertext(text) - text = "[text]: " - if(istype(current, /mob/living/carbon/human)) - if (H.is_loyalty_implanted(H)) - text +="traitor|LOYAL EMPLOYEE" - else - if (src in ticker.mode.traitors) - text += "TRAITOR|Employee" - if (objectives.len==0) - text += "
Objectives are empty! Randomize!" - else - text += "traitor|Employee" - sections["traitor"] = text - - /** MONKEY ***/ - if (istype(current, /mob/living/carbon)) - text = "monkey" - if (ticker.mode.config_tag=="monkey") + /** TRAITOR ***/ + text = "traitor" + if (ticker.mode.config_tag=="traitor" || ticker.mode.config_tag=="traitorchan") text = uppertext(text) text = "[text]: " - if (istype(current, /mob/living/carbon/human)) - text += "healthy|infected|HUMAN|other" - else if (istype(current, /mob/living/carbon/monkey)) - var/found = 0 - for(var/datum/disease/D in current.viruses) - if(istype(D, /datum/disease/jungle_fever)) found = 1 - - if(found) - text += "healthy|INFECTED|human|other" - else - text += "HEALTHY|infected|human|other" - + if (H.is_loyalty_implanted(H)) + text +="traitor|LOYAL EMPLOYEE" else - text += "healthy|infected|human|OTHER" - sections["monkey"] = text + if (src in ticker.mode.traitors) + text += "TRAITOR|EMPLOYEE" + if (objectives.len==0) + text += "
Objectives are empty! Randomize!" + else + text += "traitor|EMPLOYEE" + sections["traitor"] = text + + /** MONKEY ***/ + if (istype(current, /mob/living/carbon)) + text = "monkey" + if (ticker.mode.config_tag=="monkey") + text = uppertext(text) + text = "[text]: " + if (istype(current, /mob/living/carbon/human)) + text += "healthy|infected|HUMAN|other" + else if (istype(current, /mob/living/carbon/monkey)) + var/found = 0 + for(var/datum/disease/D in current.viruses) + if(istype(D, /datum/disease/jungle_fever)) found = 1 + + if(found) + text += "healthy|INFECTED|human|other" + else + text += "HEALTHY|infected|human|other" + + else + text += "healthy|infected|human|OTHER" + sections["monkey"] = text /** SILICON ***/ @@ -508,19 +507,10 @@ datum/mind switch(href_list["implant"]) if("remove") for(var/obj/item/weapon/implant/loyalty/I in H.contents) - for(var/datum/organ/external/organs in H.organs) - if(I in organs.implants) - I.Del() - break + I.Del() H << "\blue Your loyalty implant has been deactivated." if("add") - var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H) - L.imp_in = H - L.implanted = 1 - var/datum/organ/external/affected = H.organs_by_name["head"] - affected.implants += L - L.part = affected - + H.contents.Add( new /obj/item/weapon/implant/loyalty (src) ) H << "\red You somehow have become the recepient of a loyalty transplant, and it just activated!" if(src in ticker.mode.revolutionaries) special_role = null From 82bc1edc2350b7b99692364964f8d64cc1f764ee Mon Sep 17 00:00:00 2001 From: Ccomp5950 Date: Fri, 22 Nov 2013 12:52:25 -0600 Subject: [PATCH 4/5] Bugfix: is_loyalty_implanted() now checks to make sure the implant is actually implanted and now in your hand. implant adding via the traitor panel will also update it's location to be in the players head for autopsy as well as is_loyalty_implanted() reasons. Thanks Chinsky / alex-gh for the heads up on this. --- code/datums/mind.dm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index f5fc2b79c28..a16a42069d6 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -507,10 +507,19 @@ datum/mind switch(href_list["implant"]) if("remove") for(var/obj/item/weapon/implant/loyalty/I in H.contents) - I.Del() + for(var/datum/organ/external/organs in H.organs) + if(I in organs.implants) + I.Del() + break H << "\blue Your loyalty implant has been deactivated." if("add") - H.contents.Add( new /obj/item/weapon/implant/loyalty (src) ) + var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H) + L.imp_in = H + L.implanted = 1 + var/datum/organ/external/affected = H.organs_by_name["head"] + affected.implants += L + L.part = affected + H << "\red You somehow have become the recepient of a loyalty transplant, and it just activated!" if(src in ticker.mode.revolutionaries) special_role = null From 87f76499ddc99110c73dfb1c0fe7e3fa2ca08ac7 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 23 Nov 2013 17:47:04 +0100 Subject: [PATCH 5/5] Delete all currently implanted loyalty implants instead of just a single one --- code/datums/mind.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index a16a42069d6..bd0c398f485 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -510,7 +510,6 @@ datum/mind for(var/datum/organ/external/organs in H.organs) if(I in organs.implants) I.Del() - break H << "\blue Your loyalty implant has been deactivated." if("add") var/obj/item/weapon/implant/loyalty/L = new/obj/item/weapon/implant/loyalty(H)