From 3ec7e8113111e81f7927f1bc3f14a9f019fa9eee Mon Sep 17 00:00:00 2001 From: Joan Lung Date: Mon, 19 Sep 2016 13:03:22 -0400 Subject: [PATCH 1/9] "A Working Datum Antagonist" --- code/datums/mind.dm | 4 + code/game/gamemodes/antag_datum.dm | 197 ++++++++++++++++++ code/game/gamemodes/clock_cult/clock_cult.dm | 151 ++------------ .../gamemodes/clock_cult/clock_structures.dm | 2 - code/game/gamemodes/game_mode.dm | 1 - code/game/objects/items/robot/robot_parts.dm | 5 +- tgstation.dme | 1 + 7 files changed, 226 insertions(+), 135 deletions(-) create mode 100644 code/game/gamemodes/antag_datum.dm diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 61c61673d11..4fac3915723 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -83,6 +83,10 @@ if(new_character.mind) //disassociate any mind currently in our new body's mind variable new_character.mind.current = null + if(istype(current) && islist(current.antag_datums)) //wow apparently current isn't always living good fucking job SOMEONE + for(var/i in current.antag_datums) + var/datum/antag_datum/D = i + D.transfer_to_new_body(new_character) var/datum/atom_hud/antag/hud_to_transfer = antag_hud//we need this because leave_hud() will clear this list leave_all_huds() //leave all the huds in the old body, so it won't get huds if somebody else enters it current = new_character //associate ourself with our new body diff --git a/code/game/gamemodes/antag_datum.dm b/code/game/gamemodes/antag_datum.dm new file mode 100644 index 00000000000..716db0fe8b7 --- /dev/null +++ b/code/game/gamemodes/antag_datum.dm @@ -0,0 +1,197 @@ +/mob/living + var/list/antag_datums + +/mob/living/proc/gain_antag_datum(datum_type) + if(!islist(antag_datums)) + antag_datums = list() + var/datum/antag_datum/D = new datum_type() + . = D.give_to_body(src) + +/mob/living/proc/has_antag_datum(type, check_subtypes) + if(!islist(antag_datums)) + return FALSE + for(var/i in antag_datums) + var/datum/antag_datum/D = i + if(check_subtypes + if(istype(D, type)) + return D + else + if(D.type == type) + return D + return FALSE + +/datum/antag_datum + var/mob/living/owner + var/some_flufftext = "yer an antag larry" + +/datum/antag_datum/Destroy() + owner = null + return ..() + +/datum/antag_datum/proc/can_be_owned(mob/living/new_body) + return new_body && !new_body.has_antag_datum(type, TRUE) + +/datum/antag_datum/proc/give_to_body(mob/living/new_body) //tries to give an antag datum to a mob. cancels out if it can't be owned by the new body + if(new_body && can_be_owned(new_body)) + new_body.antag_datums += src + owner = new_body + on_gain() + . = src //return the datum if successful + else + qdel(src) + . = FALSE + +/datum/antag_datum/proc/on_gain() //on initial gain of antag datum, do this. should only be called once per datum + apply_innate_effects() + if(some_flufftext) + owner << some_flufftext + +/datum/antag_datum/proc/apply_innate_effects() //applies innate effects to the owner, may be called multiple times due to mind transferral + //antag huds would go here if antag huds were less completely unworkable as-is + +/datum/antag_datum/proc/remove_innate_effects() //removes innate effects from the owner, may be called multiple times due to mind transferral + //also antag huds but see above antag huds a shit + +/datum/antag_datum/proc/on_remove() //totally removes the antag datum from the owner; can only be called once per owner + remove_innate_effects() + owner.antag_datums -= src + qdel(src) + +/datum/antag_datum/proc/transfer_to_new_body(mob/living/new_body) + remove_innate_effects() + if(!islist(new_body.antag_datums)) + new_body.antag_datums = list() + new_body.antag_datums += src + owner.antag_datums -= src + owner = new_body + apply_innate_effects() + +//CLOCKCULT PROOF OF CONCEPT + +/datum/antag_datum/clockcultist + var/silent_update = FALSE + some_flufftext = null + +/datum/antag_datum/clockcultist/silent + silent_update = TRUE + +/datum/antag_datum/clockcultist/can_be_owned(mob/living/new_body) + . = ..() + if(.) + . = is_eligible_servant(new_body) + +/datum/antag_datum/clockcultist/give_to_body(mob/living/new_body) + if(!silent_update) + if(iscarbon(new_body)) + new_body << "Your mind is racing! Your body feels incredibly light! Your world glows a brilliant yellow! All at once it comes to you. Ratvar, the Clockwork \ + Justiciar, lies in exile, derelict and forgotten in an unseen realm." + else if(issilicon(new_body)) + new_body << "You are unable to compute this truth. Your vision glows a brilliant yellow, and all at once it comes to you. Ratvar, the Clockwork Justiciar, lies in \ + exile, derelict and forgotten in an unseen realm." + else + new_body << "Your world glows a brilliant yellow! All at once it comes to you. Ratvar, the Clockwork Justiciar, lies in exile, derelict and forgotten in an unseen realm." + . = ..() + if(!silent_update && new_body) + if(.) + new_body.visible_message("[new_body]'s eyes glow a blazing yellow!", \ + "Assist your new companions in their righteous efforts. Your goal is theirs, and theirs yours. You serve the Clockwork Justiciar above all else. Perform his every \ + whim without hesitation.") + else + new_body.visible_message("[new_body] seems to resist an unseen force!") + new_body << "And yet, you somehow push it all away." + +/datum/antag_datum/clockcultist/on_gain() + if(ticker && ticker.mode && owner.mind) + ticker.mode.servants_of_ratvar += owner.mind + ticker.mode.update_servant_icons_added(owner.mind) + if(owner.mind) + owner.mind.special_role = "Servant of Ratvar" + owner.attack_log += "\[[time_stamp()]\] Has been converted to the cult of Ratvar!" + if(issilicon(owner)) + var/mob/living/silicon/S = owner + if(isrobot(S) && !silent_update) + S << "You have been desynced from your master AI. In addition, your onboard camera is no longer active and your safeties have been disabled." + S << "You can communicate with other servants by using the Hierophant Network action button in the upper left." + else if(isbrain(owner) || isclockmob(owner)) + owner << "You can communicate with other servants by using the Hierophant Network action button in the upper left." + ..() + +/datum/antag_datum/clockcultist/apply_innate_effects() + all_clockwork_mobs += owner + owner.faction |= "ratvar" + owner.languages_spoken |= RATVAR + owner.languages_understood |= RATVAR + owner.update_action_buttons_icon() //because a few clockcult things are action buttons and we may be wearing/holding them for whatever reason, we need to update buttons + if(issilicon(owner)) + var/mob/living/silicon/S = owner + if(isrobot(S)) + var/mob/living/silicon/robot/R = S + R.UnlinkSelf() + R.emagged = 1 + else if(isAI(S)) + var/mob/living/silicon/ai/A = S + for(var/C in A.connected_robots) + var/mob/living/silicon/robot/R = C + if(R.connected_ai == A) + R.visible_message("[R]'s eyes glow a blazing yellow!", \ + "Assist your new companions in their righteous efforts. Your goal is theirs, and theirs yours. You serve the Clockwork Justiciar above all else. Perform his every \ + whim without hesitation.") + R << "Your onboard camera is no longer active and your safeties have been disabled." + add_servant_of_ratvar(R, TRUE) + S.laws = new/datum/ai_laws/ratvar + S.laws.associate(S) + S.update_icons() + S.show_laws() + var/datum/action/innate/hierophant/H = new() + H.Grant(S) + H.title = "Silicon" + H.span_for_name = "nezbere" + else if(isbrain(owner)) + var/datum/action/innate/hierophant/H = new() + H.Grant(owner) + H.title = "Vessel" + H.span_for_name = "nezbere" + H.span_for_message = "alloy" + else if(isclockmob(owner)) + var/datum/action/innate/hierophant/H = new() + H.Grant(owner) + H.title = "Construct" + H.span_for_name = "nezbere" + owner.throw_alert("clockinfo", /obj/screen/alert/clockwork/infodump) + cache_check(owner) + +/datum/antag_datum/clockcultist/remove_innate_effects() + all_clockwork_mobs -= owner + owner.faction -= "ratvar" + owner.languages_spoken &= ~RATVAR + owner.languages_understood &= ~RATVAR + owner.update_action_buttons_icon() //because a few clockcult things are action buttons and we may be wearing/holding them, we need to update buttons + owner.clear_alert("clockinfo") + owner.clear_alert("nocache") + for(var/datum/action/innate/function_call/F in owner.actions) //Removes any bound Ratvarian spears + qdel(F) + for(var/datum/action/innate/hierophant/H in owner.actions) //Removes any communication actions + qdel(H) + if(issilicon(owner)) + var/mob/living/silicon/S = owner + if(isrobot(S)) + var/mob/living/silicon/robot/R = S + R.emagged = initial(R.emagged) + S.make_laws() + S.update_icons() + S.show_laws() + +/datum/antag_datum/clockcultist/on_remove() + if(!silent_update) + owner.visible_message("[owner] seems to have remembered their true allegiance!", \ + "A cold, cold darkness flows through your mind, extinguishing the Justiciar's light and all of your memories as his servant.") + if(ticker && ticker.mode && owner.mind) + ticker.mode.servants_of_ratvar -= owner.mind + ticker.mode.update_servant_icons_removed(owner.mind) + if(owner.mind) + owner.mind.memory = "" //Not sure if there's a better way to do this + owner.mind.special_role = null + owner.attack_log += "\[[time_stamp()]\] Has renounced the cult of Ratvar!" + if(isrobot(owner)) + owner << "Despite your freedom from Ratvar's influence, you are still irreparably damaged and no longer possess certain functions such as AI linking." + ..() diff --git a/code/game/gamemodes/clock_cult/clock_cult.dm b/code/game/gamemodes/clock_cult/clock_cult.dm index 81e00e6b877..404c3851edc 100644 --- a/code/game/gamemodes/clock_cult/clock_cult.dm +++ b/code/game/gamemodes/clock_cult/clock_cult.dm @@ -43,148 +43,41 @@ Credit where due: /////////// /proc/is_servant_of_ratvar(mob/living/M) - return M && istype(M) && M.mind && ticker && ticker.mode && (M.mind in ticker.mode.servants_of_ratvar) + return M && istype(M) && M.has_antag_datum(/datum/antag_datum/clockcultist, TRUE) /proc/is_eligible_servant(mob/living/M) if(!istype(M)) return 0 - if(!M.mind) - return 0 - if(M.mind.enslaved_to && !is_servant_of_ratvar(M.mind.enslaved_to)) - return 0 + if(M.mind) + if(M.mind.enslaved_to && !is_servant_of_ratvar(M.mind.enslaved_to)) + return 0 + if(ishuman(M)) + if(M.mind.assigned_role in list("Captain", "Chaplain")) + return 0 if(iscultist(M) || isconstruct(M)) return 0 - if(isbrain(M)) - return 1 if(ishuman(M)) - if(isloyal(M) || (M.mind.assigned_role in list("Captain", "Chaplain"))) + if(isloyal(M)) return 0 return 1 - if(isguardian(M)) - var/mob/living/simple_animal/hostile/guardian/G = M - if(is_servant_of_ratvar(G.summoner)) - return 1 //can't convert it unless the owner is converted - if(issilicon(M) || isclockmob(M) || istype(M, /mob/living/simple_animal/drone/cogscarab)) + if(isbrain(M) || isguardian(M) || issilicon(M) || isclockmob(M) || istype(M, /mob/living/simple_animal/drone/cogscarab)) return 1 return 0 -/proc/add_servant_of_ratvar(mob/M, silent = FALSE) - if(is_servant_of_ratvar(M) || !ticker || !ticker.mode) - return 0 - if(iscarbon(M)) - if(!silent) - M << "Your mind is racing! Your body feels incredibly light! Your world glows a brilliant yellow! All at once it comes to you. Ratvar, the Clockwork \ - Justiciar, lies in exile, derelict and forgotten in an unseen realm." - else if(issilicon(M)) - if(!silent) - M << "You are unable to compute this truth. Your vision glows a brilliant yellow, and all at once it comes to you. Ratvar, the Clockwork Justiciar, lies in \ - exile, derelict and forgotten in an unseen realm." - if(!is_eligible_servant(M)) - if(!M.stat) - M.visible_message("[M] whirs as it resists an outside influence!") - M << "Corrupt data purged. Resetting cortex chip to factory defaults... complete." //silicons have a custom fail message - return 0 - else if(!silent) - M << "Your world glows a brilliant yellow! All at once it comes to you. Ratvar, the Clockwork Justiciar, lies in exile, derelict and forgotten in an unseen realm." +/proc/add_servant_of_ratvar(mob/living/L, silent = FALSE) + var/update_type = /datum/antag_datum/clockcultist + if(silent) + update_type = /datum/antag_datum/clockcultist/silent + . = L.gain_antag_datum(update_type) - if(!is_eligible_servant(M)) - if(!silent && !M.stat) - M.visible_message("[M] seems to resist an unseen force!") - M << "And yet, you somehow push it all away." - return 0 - - if(!silent) - M.visible_message("[M]'s eyes glow a blazing yellow!", \ - "Assist your new companions in their righteous efforts. Your goal is theirs, and theirs yours. You serve the Clockwork Justiciar above all else. Perform his every \ - whim without hesitation.") - ticker.mode.servants_of_ratvar += M.mind - ticker.mode.update_servant_icons_added(M.mind) - all_clockwork_mobs += M - M.faction |= "ratvar" - M.mind.special_role = "Servant of Ratvar" - M.languages_spoken |= RATVAR - M.languages_understood |= RATVAR - M.update_action_buttons_icon() //because a few clockcult things are action buttons and we may be wearing/holding them for whatever reason, we need to update buttons - M.attack_log += "\[[time_stamp()]\] Has been converted to the cult of Ratvar!" - if(issilicon(M)) - var/mob/living/silicon/S = M - if(isrobot(S)) - var/mob/living/silicon/robot/R = S - R.UnlinkSelf() - R.emagged = 1 - if(!silent) - R << "You have been desynced from your master AI. In addition, your onboard camera is no longer active and your safeties have been disabled." - else if(isAI(S)) - var/mob/living/silicon/ai/A = S - for(var/C in A.connected_robots) - var/mob/living/silicon/robot/R = C - if(R.connected_ai == A) - R.visible_message("[R]'s eyes glow a blazing yellow!", \ - "Assist your new companions in their righteous efforts. Your goal is theirs, and theirs yours. You serve the Clockwork Justiciar above all else. Perform his every \ - whim without hesitation.") - R << "Your onboard camera is no longer active and your safeties have been disabled." - add_servant_of_ratvar(R, TRUE) - S.laws = new/datum/ai_laws/ratvar - S.laws.associate(S) - S.update_icons() - S.show_laws() - var/datum/action/innate/hierophant/H = new() - H.Grant(S) - H.title = "Silicon" - H.span_for_name = "nezbere" - S << "You can communicate with other servants by using the Hierophant Network action button in the upper left." - else if(isbrain(M)) - var/datum/action/innate/hierophant/H = new() - H.Grant(M) - H.title = "Vessel" - H.span_for_name = "nezbere" - H.span_for_message = "alloy" - M << "You can communicate with other servants by using the Hierophant Network action button in the upper left." - else if(isclockmob(M)) - var/datum/action/innate/hierophant/H = new() - H.Grant(M) - H.title = "Construct" - H.span_for_name = "nezbere" - M << "You can communicate with other servants by using the Hierophant Network action button in the upper left." - if(istype(ticker.mode, /datum/game_mode/clockwork_cult)) - var/datum/game_mode/clockwork_cult/C = ticker.mode - C.present_tasks(M) //Memorize the objectives - M.throw_alert("clockinfo", /obj/screen/alert/clockwork/infodump) - cache_check(M) - return 1 - -/proc/remove_servant_of_ratvar(mob/living/M, silent = FALSE) - if(!is_servant_of_ratvar(M)) //In this way, is_servant_of_ratvar() checks the existence of ticker and minds - return 0 - if(!silent) - M.visible_message("[M] seems to have remembered their true allegiance!", \ - "A cold, cold darkness flows through your mind, extinguishing the Justiciar's light and all of your memories as his servant.") - ticker.mode.servants_of_ratvar -= M.mind - ticker.mode.update_servant_icons_removed(M.mind) - all_clockwork_mobs -= M - M.faction -= "ratvar" - M.mind.memory = "" //Not sure if there's a better way to do this - M.mind.special_role = null - M.languages_spoken &= ~RATVAR - M.languages_understood &= ~RATVAR - M.update_action_buttons_icon() //because a few clockcult things are action buttons and we may be wearing/holding them, we need to update buttons - M.attack_log += "\[[time_stamp()]\] Has renounced the cult of Ratvar!" - M.clear_alert("clockinfo") - M.clear_alert("nocache") - for(var/datum/action/innate/function_call/F in M.actions) //Removes any bound Ratvarian spears - qdel(F) - for(var/datum/action/innate/hierophant/H in M.actions) //Removes any communication actions - qdel(H) - if(issilicon(M)) - var/mob/living/silicon/S = M - if(isrobot(S)) - var/mob/living/silicon/robot/R = S - R.emagged = initial(R.emagged) - R << "Despite your freedom from Ratvar's influence, you are still irreparably damaged and no longer possess certain functions such as AI linking." - S.make_laws() - S.update_icons() - S.show_laws() - return 1 +/proc/remove_servant_of_ratvar(mob/living/L, silent = FALSE) + var/datum/antag_datum/clockcultist/clock_datum = L.has_antag_datum(/datum/antag_datum/clockcultist, TRUE) + if(!clock_datum) + world << "wait shit what" + return FALSE + clock_datum.silent_update = silent + clock_datum.on_remove() + return TRUE /////////////// // GAME MODE // diff --git a/code/game/gamemodes/clock_cult/clock_structures.dm b/code/game/gamemodes/clock_cult/clock_structures.dm index a543a5d2d3b..d92048a9942 100644 --- a/code/game/gamemodes/clock_cult/clock_structures.dm +++ b/code/game/gamemodes/clock_cult/clock_structures.dm @@ -293,9 +293,7 @@ user.visible_message("[user] places [S] in [src], where it fuses to the shell.", "You place [S] in [src], fusing it to the shell.") var/mob/living/simple_animal/A = new mobtype(get_turf(src)) A.visible_message("[src][spawn_message]") - remove_servant_of_ratvar(S.brainmob, TRUE) S.brainmob.mind.transfer_to(A) - add_servant_of_ratvar(A, TRUE) user.drop_item() qdel(S) qdel(src) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index eb15b771a5b..a1cf737631b 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -540,7 +540,6 @@ ticker.mode.remove_revolutionary(newborgie, 0) ticker.mode.remove_gangster(newborgie, 0, remove_bosses=1) ticker.mode.remove_hog_follower(newborgie, 0) - remove_servant_of_ratvar(newborgie.current, TRUE) /datum/game_mode/proc/generate_station_goals() diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm index 21aab1670c9..f89954ad43a 100644 --- a/code/game/objects/items/robot/robot_parts.dm +++ b/code/game/objects/items/robot/robot_parts.dm @@ -213,11 +213,10 @@ O.make_laws() ticker.mode.remove_antag_for_borging(BM.mind) + if(!M.clockwork) + remove_servant_of_ratvar(BM, TRUE) BM.mind.transfer_to(O) - if(M.clockwork) - add_servant_of_ratvar(O) - if(O.mind && O.mind.special_role) O.mind.store_memory("As a cyborg, you must obey your silicon laws and master AI above all else. Your objectives will consider you to be dead.") O << "You have been robotized!" diff --git a/tgstation.dme b/tgstation.dme index 45351474e52..4d25b40e48f 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -283,6 +283,7 @@ #include "code\game\area\ai_monitored.dm" #include "code\game\area\areas.dm" #include "code\game\area\Space_Station_13_areas.dm" +#include "code\game\gamemodes\antag_datum.dm" #include "code\game\gamemodes\antag_hud.dm" #include "code\game\gamemodes\antag_spawner.dm" #include "code\game\gamemodes\events.dm" From 904c062e3801168c61a2d0dc02440ebae82be202 Mon Sep 17 00:00:00 2001 From: Joan Lung Date: Mon, 19 Sep 2016 13:08:39 -0400 Subject: [PATCH 2/9] it's always the ) --- code/game/gamemodes/antag_datum.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/gamemodes/antag_datum.dm b/code/game/gamemodes/antag_datum.dm index 716db0fe8b7..41250d6dcd3 100644 --- a/code/game/gamemodes/antag_datum.dm +++ b/code/game/gamemodes/antag_datum.dm @@ -12,7 +12,7 @@ return FALSE for(var/i in antag_datums) var/datum/antag_datum/D = i - if(check_subtypes + if(check_subtypes) if(istype(D, type)) return D else From 70f54198384bebb81aaa7ae6229cf8dbe8abddca Mon Sep 17 00:00:00 2001 From: Joan Lung Date: Mon, 19 Sep 2016 13:12:46 -0400 Subject: [PATCH 3/9] this is a style change --- code/datums/mind.dm | 2 +- code/game/gamemodes/antag_datum.dm | 38 ++++++++++---------- code/game/gamemodes/clock_cult/clock_cult.dm | 8 ++--- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 4fac3915723..3042113fba4 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -85,7 +85,7 @@ if(istype(current) && islist(current.antag_datums)) //wow apparently current isn't always living good fucking job SOMEONE for(var/i in current.antag_datums) - var/datum/antag_datum/D = i + var/datum/antagonist/D = i D.transfer_to_new_body(new_character) var/datum/atom_hud/antag/hud_to_transfer = antag_hud//we need this because leave_hud() will clear this list leave_all_huds() //leave all the huds in the old body, so it won't get huds if somebody else enters it diff --git a/code/game/gamemodes/antag_datum.dm b/code/game/gamemodes/antag_datum.dm index 41250d6dcd3..4929b014211 100644 --- a/code/game/gamemodes/antag_datum.dm +++ b/code/game/gamemodes/antag_datum.dm @@ -4,14 +4,14 @@ /mob/living/proc/gain_antag_datum(datum_type) if(!islist(antag_datums)) antag_datums = list() - var/datum/antag_datum/D = new datum_type() + var/datum/antagonist/D = new datum_type() . = D.give_to_body(src) /mob/living/proc/has_antag_datum(type, check_subtypes) if(!islist(antag_datums)) return FALSE for(var/i in antag_datums) - var/datum/antag_datum/D = i + var/datum/antagonist/D = i if(check_subtypes) if(istype(D, type)) return D @@ -20,18 +20,18 @@ return D return FALSE -/datum/antag_datum +/datum/antagonist var/mob/living/owner var/some_flufftext = "yer an antag larry" -/datum/antag_datum/Destroy() +/datum/antagonist/Destroy() owner = null return ..() -/datum/antag_datum/proc/can_be_owned(mob/living/new_body) +/datum/antagonist/proc/can_be_owned(mob/living/new_body) return new_body && !new_body.has_antag_datum(type, TRUE) -/datum/antag_datum/proc/give_to_body(mob/living/new_body) //tries to give an antag datum to a mob. cancels out if it can't be owned by the new body +/datum/antagonist/proc/give_to_body(mob/living/new_body) //tries to give an antag datum to a mob. cancels out if it can't be owned by the new body if(new_body && can_be_owned(new_body)) new_body.antag_datums += src owner = new_body @@ -41,23 +41,23 @@ qdel(src) . = FALSE -/datum/antag_datum/proc/on_gain() //on initial gain of antag datum, do this. should only be called once per datum +/datum/antagonist/proc/on_gain() //on initial gain of antag datum, do this. should only be called once per datum apply_innate_effects() if(some_flufftext) owner << some_flufftext -/datum/antag_datum/proc/apply_innate_effects() //applies innate effects to the owner, may be called multiple times due to mind transferral +/datum/antagonist/proc/apply_innate_effects() //applies innate effects to the owner, may be called multiple times due to mind transferral //antag huds would go here if antag huds were less completely unworkable as-is -/datum/antag_datum/proc/remove_innate_effects() //removes innate effects from the owner, may be called multiple times due to mind transferral +/datum/antagonist/proc/remove_innate_effects() //removes innate effects from the owner, may be called multiple times due to mind transferral //also antag huds but see above antag huds a shit -/datum/antag_datum/proc/on_remove() //totally removes the antag datum from the owner; can only be called once per owner +/datum/antagonist/proc/on_remove() //totally removes the antag datum from the owner; can only be called once per owner remove_innate_effects() owner.antag_datums -= src qdel(src) -/datum/antag_datum/proc/transfer_to_new_body(mob/living/new_body) +/datum/antagonist/proc/transfer_to_new_body(mob/living/new_body) remove_innate_effects() if(!islist(new_body.antag_datums)) new_body.antag_datums = list() @@ -68,19 +68,19 @@ //CLOCKCULT PROOF OF CONCEPT -/datum/antag_datum/clockcultist +/datum/antagonist/clockcultist var/silent_update = FALSE some_flufftext = null -/datum/antag_datum/clockcultist/silent +/datum/antagonist/clockcultist/silent silent_update = TRUE -/datum/antag_datum/clockcultist/can_be_owned(mob/living/new_body) +/datum/antagonist/clockcultist/can_be_owned(mob/living/new_body) . = ..() if(.) . = is_eligible_servant(new_body) -/datum/antag_datum/clockcultist/give_to_body(mob/living/new_body) +/datum/antagonist/clockcultist/give_to_body(mob/living/new_body) if(!silent_update) if(iscarbon(new_body)) new_body << "Your mind is racing! Your body feels incredibly light! Your world glows a brilliant yellow! All at once it comes to you. Ratvar, the Clockwork \ @@ -100,7 +100,7 @@ new_body.visible_message("[new_body] seems to resist an unseen force!") new_body << "And yet, you somehow push it all away." -/datum/antag_datum/clockcultist/on_gain() +/datum/antagonist/clockcultist/on_gain() if(ticker && ticker.mode && owner.mind) ticker.mode.servants_of_ratvar += owner.mind ticker.mode.update_servant_icons_added(owner.mind) @@ -116,7 +116,7 @@ owner << "You can communicate with other servants by using the Hierophant Network action button in the upper left." ..() -/datum/antag_datum/clockcultist/apply_innate_effects() +/datum/antagonist/clockcultist/apply_innate_effects() all_clockwork_mobs += owner owner.faction |= "ratvar" owner.languages_spoken |= RATVAR @@ -160,7 +160,7 @@ owner.throw_alert("clockinfo", /obj/screen/alert/clockwork/infodump) cache_check(owner) -/datum/antag_datum/clockcultist/remove_innate_effects() +/datum/antagonist/clockcultist/remove_innate_effects() all_clockwork_mobs -= owner owner.faction -= "ratvar" owner.languages_spoken &= ~RATVAR @@ -181,7 +181,7 @@ S.update_icons() S.show_laws() -/datum/antag_datum/clockcultist/on_remove() +/datum/antagonist/clockcultist/on_remove() if(!silent_update) owner.visible_message("[owner] seems to have remembered their true allegiance!", \ "A cold, cold darkness flows through your mind, extinguishing the Justiciar's light and all of your memories as his servant.") diff --git a/code/game/gamemodes/clock_cult/clock_cult.dm b/code/game/gamemodes/clock_cult/clock_cult.dm index 404c3851edc..12ddc242969 100644 --- a/code/game/gamemodes/clock_cult/clock_cult.dm +++ b/code/game/gamemodes/clock_cult/clock_cult.dm @@ -43,7 +43,7 @@ Credit where due: /////////// /proc/is_servant_of_ratvar(mob/living/M) - return M && istype(M) && M.has_antag_datum(/datum/antag_datum/clockcultist, TRUE) + return M && istype(M) && M.has_antag_datum(/datum/antagonist/clockcultist, TRUE) /proc/is_eligible_servant(mob/living/M) if(!istype(M)) @@ -65,13 +65,13 @@ Credit where due: return 0 /proc/add_servant_of_ratvar(mob/living/L, silent = FALSE) - var/update_type = /datum/antag_datum/clockcultist + var/update_type = /datum/antagonist/clockcultist if(silent) - update_type = /datum/antag_datum/clockcultist/silent + update_type = /datum/antagonist/clockcultist/silent . = L.gain_antag_datum(update_type) /proc/remove_servant_of_ratvar(mob/living/L, silent = FALSE) - var/datum/antag_datum/clockcultist/clock_datum = L.has_antag_datum(/datum/antag_datum/clockcultist, TRUE) + var/datum/antagonist/clockcultist/clock_datum = L.has_antag_datum(/datum/antagonist/clockcultist, TRUE) if(!clock_datum) world << "wait shit what" return FALSE From 64667136d55fae8f5884fd0c59abbe1c837e8778 Mon Sep 17 00:00:00 2001 From: Joan Lung Date: Mon, 19 Sep 2016 13:18:51 -0400 Subject: [PATCH 4/9] heavyweight class this is ~eh, but it's this or Another Antag Removal Proc and, god, let's not. --- code/game/objects/structures/ai_core.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/game/objects/structures/ai_core.dm b/code/game/objects/structures/ai_core.dm index 4a237f92a0d..65e588a85e4 100644 --- a/code/game/objects/structures/ai_core.dm +++ b/code/game/objects/structures/ai_core.dm @@ -156,6 +156,7 @@ return ticker.mode.remove_antag_for_borging(M.brainmob.mind) + remove_servant_of_ratvar(M, TRUE) M.loc = src brain = M user << "Added a brain." From 7e66edb2c36b399d096adfc29cdb1d1e6eff6b64 Mon Sep 17 00:00:00 2001 From: Joan Lung Date: Mon, 19 Sep 2016 13:34:58 -0400 Subject: [PATCH 5/9] this is probably a good way to go about dealing with subtypes --- code/game/gamemodes/antag_datum.dm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/code/game/gamemodes/antag_datum.dm b/code/game/gamemodes/antag_datum.dm index 4929b014211..054bf71f510 100644 --- a/code/game/gamemodes/antag_datum.dm +++ b/code/game/gamemodes/antag_datum.dm @@ -21,15 +21,20 @@ return FALSE /datum/antagonist - var/mob/living/owner + var/mob/living/owner //who's our owner and accordingly an antagonist var/some_flufftext = "yer an antag larry" + var/prevented_antag_datum_type //the type of antag datum that this datum can't coexist with; should probably be a list + +/datum/antagonist/New() + if(!prevented_antag_datum_type) + prevented_antag_datum_type = type /datum/antagonist/Destroy() owner = null return ..() /datum/antagonist/proc/can_be_owned(mob/living/new_body) - return new_body && !new_body.has_antag_datum(type, TRUE) + return new_body && !new_body.has_antag_datum(prevented_antag_datum_type, TRUE) /datum/antagonist/proc/give_to_body(mob/living/new_body) //tries to give an antag datum to a mob. cancels out if it can't be owned by the new body if(new_body && can_be_owned(new_body)) @@ -46,10 +51,10 @@ if(some_flufftext) owner << some_flufftext -/datum/antagonist/proc/apply_innate_effects() //applies innate effects to the owner, may be called multiple times due to mind transferral +/datum/antagonist/proc/apply_innate_effects() //applies innate effects to the owner, may be called multiple times due to mind transferral, but should only be called once per mob //antag huds would go here if antag huds were less completely unworkable as-is -/datum/antagonist/proc/remove_innate_effects() //removes innate effects from the owner, may be called multiple times due to mind transferral +/datum/antagonist/proc/remove_innate_effects() //removes innate effects from the owner, may be called multiple times due to mind transferral, but should only be called once per mob //also antag huds but see above antag huds a shit /datum/antagonist/proc/on_remove() //totally removes the antag datum from the owner; can only be called once per owner @@ -70,6 +75,7 @@ /datum/antagonist/clockcultist var/silent_update = FALSE + prevented_antag_datum_type = /datum/antagonist/clockcultist some_flufftext = null /datum/antagonist/clockcultist/silent From 1ec364f40045d7e5afb14022d3883613c766ff6c Mon Sep 17 00:00:00 2001 From: Joan Lung Date: Mon, 19 Sep 2016 17:29:46 -0400 Subject: [PATCH 6/9] sorting --- code/datums/antagonists/antag_datum.dm | 86 +++++++++++++++++++ .../antagonists/datum_clockcult.dm} | 73 ---------------- tgstation.dme | 3 +- 3 files changed, 88 insertions(+), 74 deletions(-) create mode 100644 code/datums/antagonists/antag_datum.dm rename code/{game/gamemodes/antag_datum.dm => datums/antagonists/datum_clockcult.dm} (71%) diff --git a/code/datums/antagonists/antag_datum.dm b/code/datums/antagonists/antag_datum.dm new file mode 100644 index 00000000000..8639bfd006e --- /dev/null +++ b/code/datums/antagonists/antag_datum.dm @@ -0,0 +1,86 @@ +//The Datum, Antagonist. Handles various antag things via a datum. +/datum/antagonist + var/mob/living/owner //who's our owner and accordingly an antagonist + var/some_flufftext = "yer an antag larry" + var/prevented_antag_datum_type //the type of antag datum that this datum can't coexist with; should probably be a list + +/datum/antagonist/New() + if(!prevented_antag_datum_type) + prevented_antag_datum_type = type + +/datum/antagonist/Destroy() + owner = null + return ..() + +/datum/antagonist/proc/can_be_owned(mob/living/new_body) + return new_body && !new_body.has_antag_datum(prevented_antag_datum_type, TRUE) + +/datum/antagonist/proc/give_to_body(mob/living/new_body) //tries to give an antag datum to a mob. cancels out if it can't be owned by the new body + if(new_body && can_be_owned(new_body)) + new_body.antag_datums += src + owner = new_body + on_gain() + . = src //return the datum if successful + else + qdel(src) + . = FALSE + +/datum/antagonist/proc/on_gain() //on initial gain of antag datum, do this. should only be called once per datum + apply_innate_effects() + if(some_flufftext) + owner << some_flufftext + +/datum/antagonist/proc/apply_innate_effects() //applies innate effects to the owner, may be called multiple times due to mind transferral, but should only be called once per mob + //antag huds would go here if antag huds were less completely unworkable as-is + +/datum/antagonist/proc/remove_innate_effects() //removes innate effects from the owner, may be called multiple times due to mind transferral, but should only be called once per mob + //also antag huds but see above antag huds a shit + +/datum/antagonist/proc/on_remove() //totally removes the antag datum from the owner; can only be called once per owner + remove_innate_effects() + owner.antag_datums -= src + qdel(src) + +/datum/antagonist/proc/transfer_to_new_body(mob/living/new_body) + remove_innate_effects() + if(!islist(new_body.antag_datums)) + new_body.antag_datums = list() + new_body.antag_datums += src + owner.antag_datums -= src + owner = new_body + apply_innate_effects() + +//mob var and helper procs/Destroy override +/mob/living + var/list/antag_datums + +/mob/living/Destroy() //TODO: merge this with the living/Destroy() in code\modules\mob\living\living.dm (currently line 29) + if(islist(antag_datums)) + for(var/i in antag_datums) + qdel(i) + antag_datums = null + return ..() + +/mob/living/proc/can_have_antag_datum(datum_type) //if we can have this specific antagonist datum; neccessary, but requires creating a new antag datum each time. + var/datum/antagonist/D = new datum_type() + . = D.can_be_owned(src) //we can't exactly cache the results, either, because conditions might change. avoid use? TODO: better proc + qdel(D) + +/mob/living/proc/gain_antag_datum(datum_type) //tries to give a mob a specific antagonist datum; returns the datum if successful. + if(!islist(antag_datums)) + antag_datums = list() + var/datum/antagonist/D = new datum_type() + . = D.give_to_body(src) + +/mob/living/proc/has_antag_datum(type, check_subtypes) //checks this mob for if it has the antagonist datum. can either check specific type or subtypes + if(!islist(antag_datums)) + return FALSE + for(var/i in antag_datums) + var/datum/antagonist/D = i + if(check_subtypes) + if(istype(D, type)) + return D //if it finds the datum, will return it so you can mess with it + else + if(D.type == type) + return D + return FALSE diff --git a/code/game/gamemodes/antag_datum.dm b/code/datums/antagonists/datum_clockcult.dm similarity index 71% rename from code/game/gamemodes/antag_datum.dm rename to code/datums/antagonists/datum_clockcult.dm index 054bf71f510..04b465ed2dc 100644 --- a/code/game/gamemodes/antag_datum.dm +++ b/code/datums/antagonists/datum_clockcult.dm @@ -1,76 +1,3 @@ -/mob/living - var/list/antag_datums - -/mob/living/proc/gain_antag_datum(datum_type) - if(!islist(antag_datums)) - antag_datums = list() - var/datum/antagonist/D = new datum_type() - . = D.give_to_body(src) - -/mob/living/proc/has_antag_datum(type, check_subtypes) - if(!islist(antag_datums)) - return FALSE - for(var/i in antag_datums) - var/datum/antagonist/D = i - if(check_subtypes) - if(istype(D, type)) - return D - else - if(D.type == type) - return D - return FALSE - -/datum/antagonist - var/mob/living/owner //who's our owner and accordingly an antagonist - var/some_flufftext = "yer an antag larry" - var/prevented_antag_datum_type //the type of antag datum that this datum can't coexist with; should probably be a list - -/datum/antagonist/New() - if(!prevented_antag_datum_type) - prevented_antag_datum_type = type - -/datum/antagonist/Destroy() - owner = null - return ..() - -/datum/antagonist/proc/can_be_owned(mob/living/new_body) - return new_body && !new_body.has_antag_datum(prevented_antag_datum_type, TRUE) - -/datum/antagonist/proc/give_to_body(mob/living/new_body) //tries to give an antag datum to a mob. cancels out if it can't be owned by the new body - if(new_body && can_be_owned(new_body)) - new_body.antag_datums += src - owner = new_body - on_gain() - . = src //return the datum if successful - else - qdel(src) - . = FALSE - -/datum/antagonist/proc/on_gain() //on initial gain of antag datum, do this. should only be called once per datum - apply_innate_effects() - if(some_flufftext) - owner << some_flufftext - -/datum/antagonist/proc/apply_innate_effects() //applies innate effects to the owner, may be called multiple times due to mind transferral, but should only be called once per mob - //antag huds would go here if antag huds were less completely unworkable as-is - -/datum/antagonist/proc/remove_innate_effects() //removes innate effects from the owner, may be called multiple times due to mind transferral, but should only be called once per mob - //also antag huds but see above antag huds a shit - -/datum/antagonist/proc/on_remove() //totally removes the antag datum from the owner; can only be called once per owner - remove_innate_effects() - owner.antag_datums -= src - qdel(src) - -/datum/antagonist/proc/transfer_to_new_body(mob/living/new_body) - remove_innate_effects() - if(!islist(new_body.antag_datums)) - new_body.antag_datums = list() - new_body.antag_datums += src - owner.antag_datums -= src - owner = new_body - apply_innate_effects() - //CLOCKCULT PROOF OF CONCEPT /datum/antagonist/clockcultist diff --git a/tgstation.dme b/tgstation.dme index 4d25b40e48f..8039b9241b0 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -187,6 +187,8 @@ #include "code\datums\ruins.dm" #include "code\datums\shuttles.dm" #include "code\datums\votablemap.dm" +#include "code\datums\antagonists\antag_datum.dm" +#include "code\datums\antagonists\datum_clockcult.dm" #include "code\datums\diseases\_disease.dm" #include "code\datums\diseases\_MobProcs.dm" #include "code\datums\diseases\anxiety.dm" @@ -283,7 +285,6 @@ #include "code\game\area\ai_monitored.dm" #include "code\game\area\areas.dm" #include "code\game\area\Space_Station_13_areas.dm" -#include "code\game\gamemodes\antag_datum.dm" #include "code\game\gamemodes\antag_hud.dm" #include "code\game\gamemodes\antag_spawner.dm" #include "code\game\gamemodes\events.dm" From 5ac7e1b68d45bf991449118f3654a89684bf4244 Mon Sep 17 00:00:00 2001 From: Joan Lung Date: Mon, 19 Sep 2016 19:44:58 -0400 Subject: [PATCH 7/9] cult too! --- code/datums/antagonists/antag_datum.dm | 3 +- code/datums/antagonists/datum_clockcult.dm | 35 ++++++----- code/datums/antagonists/datum_cult.dm | 47 +++++++++++++++ code/datums/mind.dm | 2 +- code/game/gamemodes/clock_cult/clock_cult.dm | 18 +++--- code/game/gamemodes/cult/cult.dm | 62 ++++++++------------ code/game/gamemodes/gang/gang.dm | 2 +- code/game/gamemodes/revolution/revolution.dm | 2 +- tgstation.dme | 1 + 9 files changed, 103 insertions(+), 69 deletions(-) create mode 100644 code/datums/antagonists/datum_cult.dm diff --git a/code/datums/antagonists/antag_datum.dm b/code/datums/antagonists/antag_datum.dm index 8639bfd006e..07109d242d1 100644 --- a/code/datums/antagonists/antag_datum.dm +++ b/code/datums/antagonists/antag_datum.dm @@ -3,6 +3,7 @@ var/mob/living/owner //who's our owner and accordingly an antagonist var/some_flufftext = "yer an antag larry" var/prevented_antag_datum_type //the type of antag datum that this datum can't coexist with; should probably be a list + var/silent_update = FALSE //if we suppress messages during on_gain, apply_innate_effects, remove_innate_effects, and on_remove /datum/antagonist/New() if(!prevented_antag_datum_type) @@ -27,7 +28,7 @@ /datum/antagonist/proc/on_gain() //on initial gain of antag datum, do this. should only be called once per datum apply_innate_effects() - if(some_flufftext) + if(!silent_update && some_flufftext) owner << some_flufftext /datum/antagonist/proc/apply_innate_effects() //applies innate effects to the owner, may be called multiple times due to mind transferral, but should only be called once per mob diff --git a/code/datums/antagonists/datum_clockcult.dm b/code/datums/antagonists/datum_clockcult.dm index 04b465ed2dc..4d8a473ab22 100644 --- a/code/datums/antagonists/datum_clockcult.dm +++ b/code/datums/antagonists/datum_clockcult.dm @@ -1,13 +1,17 @@ //CLOCKCULT PROOF OF CONCEPT /datum/antagonist/clockcultist - var/silent_update = FALSE prevented_antag_datum_type = /datum/antagonist/clockcultist some_flufftext = null + var/datum/action/innate/hierophant/hierophant_network = new() /datum/antagonist/clockcultist/silent silent_update = TRUE +/datum/antagonist/clockcultist/Destroy() + qdel(hierophant_network) + ..() + /datum/antagonist/clockcultist/can_be_owned(mob/living/new_body) . = ..() if(.) @@ -37,6 +41,8 @@ if(ticker && ticker.mode && owner.mind) ticker.mode.servants_of_ratvar += owner.mind ticker.mode.update_servant_icons_added(owner.mind) + if(jobban_isbanned(owner, ROLE_SERVANT_OF_RATVAR)) + addtimer(ticker.mode, "replace_jobbaned_player", 0, FALSE, owner, ROLE_SERVANT_OF_RATVAR, ROLE_SERVANT_OF_RATVAR) if(owner.mind) owner.mind.special_role = "Servant of Ratvar" owner.attack_log += "\[[time_stamp()]\] Has been converted to the cult of Ratvar!" @@ -75,23 +81,21 @@ S.laws.associate(S) S.update_icons() S.show_laws() - var/datum/action/innate/hierophant/H = new() - H.Grant(S) - H.title = "Silicon" - H.span_for_name = "nezbere" + hierophant_network.Grant(S) + hierophant_network.title = "Silicon" + hierophant_network.span_for_name = "nezbere" else if(isbrain(owner)) - var/datum/action/innate/hierophant/H = new() - H.Grant(owner) - H.title = "Vessel" - H.span_for_name = "nezbere" - H.span_for_message = "alloy" + hierophant_network.Grant(owner) + hierophant_network.title = "Vessel" + hierophant_network.span_for_name = "nezbere" + hierophant_network.span_for_message = "alloy" else if(isclockmob(owner)) - var/datum/action/innate/hierophant/H = new() - H.Grant(owner) - H.title = "Construct" - H.span_for_name = "nezbere" + hierophant_network.Grant(owner) + hierophant_network.title = "Construct" + hierophant_network.span_for_name = "nezbere" owner.throw_alert("clockinfo", /obj/screen/alert/clockwork/infodump) cache_check(owner) + ..() /datum/antagonist/clockcultist/remove_innate_effects() all_clockwork_mobs -= owner @@ -103,8 +107,6 @@ owner.clear_alert("nocache") for(var/datum/action/innate/function_call/F in owner.actions) //Removes any bound Ratvarian spears qdel(F) - for(var/datum/action/innate/hierophant/H in owner.actions) //Removes any communication actions - qdel(H) if(issilicon(owner)) var/mob/living/silicon/S = owner if(isrobot(S)) @@ -113,6 +115,7 @@ S.make_laws() S.update_icons() S.show_laws() + ..() /datum/antagonist/clockcultist/on_remove() if(!silent_update) diff --git a/code/datums/antagonists/datum_cult.dm b/code/datums/antagonists/datum_cult.dm new file mode 100644 index 00000000000..6bc2fe69381 --- /dev/null +++ b/code/datums/antagonists/datum_cult.dm @@ -0,0 +1,47 @@ +/datum/antagonist/cultist + prevented_antag_datum_type = /datum/antagonist/cultist + some_flufftext = null + var/datum/action/innate/cultcomm/communion = new() + +/datum/antagonist/cultist/Destroy() + qdel(communion) + return ..() + +/datum/antagonist/cultist/can_be_owned(mob/living/new_body) + . = ..() + if(.) + . = is_convertable_to_cult(new_body) + +/datum/antagonist/cultist/on_gain() + if(ticker && ticker.mode && owner.mind) + ticker.mode.cult += owner.mind + ticker.mode.servants_of_ratvar += owner.mind + ticker.mode.update_cult_icons_added(owner.mind) + if(jobban_isbanned(owner, ROLE_CULTIST)) + addtimer(ticker.mode, "replace_jobbaned_player", 0, FALSE, owner, ROLE_CULTIST, ROLE_CULTIST) + if(owner.mind) + owner.mind.special_role = "Cultist" + owner.attack_log += "\[[time_stamp()]\] Has been converted to the cult of Nar'Sie!" + ..() + +/datum/antagonist/cultist/apply_innate_effects() + owner.faction |= "cult" + owner.verbs += /mob/living/proc/cult_help + communion.Grant(owner) + ..() + +/datum/antagonist/cultist/remove_innate_effects() + owner.faction -= "cult" + owner.verbs -= /mob/living/proc/cult_help + ..() + +/datum/antagonist/cultist/on_remove() + if(ticker && ticker.mode && owner.mind) + ticker.mode.cult -= owner.mind + ticker.mode.update_cult_icons_removed(owner.mind) + owner << "An unfamiliar white light flashes through your mind, cleansing the taint of the Dark One and all your memories as its servant." + owner.memory = "" + owner.attack_log += "\[[time_stamp()]\] Has renounced the cult of Nar'Sie!" + if(!silent_update) + owner.visible_message("[owner] looks like they just reverted to their old faith!") + ..() diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 3042113fba4..eed2f5960c8 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -235,7 +235,7 @@ ticker.mode.add_revolutionary(src) else if(is_servant_of_ratvar(creator)) - add_servant_of_ratvar(src) + add_servant_of_ratvar(current) else if(is_nuclear_operative(creator)) make_Nuke(null, null, 0, FALSE) diff --git a/code/game/gamemodes/clock_cult/clock_cult.dm b/code/game/gamemodes/clock_cult/clock_cult.dm index 12ddc242969..69c3db97d8d 100644 --- a/code/game/gamemodes/clock_cult/clock_cult.dm +++ b/code/game/gamemodes/clock_cult/clock_cult.dm @@ -43,24 +43,21 @@ Credit where due: /////////// /proc/is_servant_of_ratvar(mob/living/M) - return M && istype(M) && M.has_antag_datum(/datum/antagonist/clockcultist, TRUE) + return istype(M) && M.has_antag_datum(/datum/antagonist/clockcultist, TRUE) /proc/is_eligible_servant(mob/living/M) if(!istype(M)) return 0 if(M.mind) + if(ishuman(M) && (M.mind.assigned_role in list("Captain", "Chaplain"))) + return 0 if(M.mind.enslaved_to && !is_servant_of_ratvar(M.mind.enslaved_to)) return 0 - if(ishuman(M)) - if(M.mind.assigned_role in list("Captain", "Chaplain")) - return 0 - if(iscultist(M) || isconstruct(M)) + else return 0 - if(ishuman(M)) - if(isloyal(M)) - return 0 - return 1 - if(isbrain(M) || isguardian(M) || issilicon(M) || isclockmob(M) || istype(M, /mob/living/simple_animal/drone/cogscarab)) + if(iscultist(M) || isconstruct(M) || isloyal(M)) + return 0 + if(ishuman(M) || isbrain(M) || isguardian(M) || issilicon(M) || isclockmob(M) || istype(M, /mob/living/simple_animal/drone/cogscarab)) return 1 return 0 @@ -73,7 +70,6 @@ Credit where due: /proc/remove_servant_of_ratvar(mob/living/L, silent = FALSE) var/datum/antagonist/clockcultist/clock_datum = L.has_antag_datum(/datum/antagonist/clockcultist, TRUE) if(!clock_datum) - world << "wait shit what" return FALSE clock_datum.silent_update = silent clock_datum.on_remove() diff --git a/code/game/gamemodes/cult/cult.dm b/code/game/gamemodes/cult/cult.dm index b80a7e692ea..7597b4b2bbb 100644 --- a/code/game/gamemodes/cult/cult.dm +++ b/code/game/gamemodes/cult/cult.dm @@ -5,7 +5,7 @@ var/list/cult_objectives = list() /proc/iscultist(mob/living/M) - return istype(M) && M.mind && ticker && ticker.mode && (M.mind in ticker.mode.cult) + return istype(M) && M.has_antag_datum(/datum/antagonist/cultist, TRUE) /proc/is_sacrifice_target(datum/mind/mind) if(ticker.mode.name == "cult") @@ -14,21 +14,20 @@ return 1 return 0 -/proc/is_convertable_to_cult(datum/mind/mind) - if(!istype(mind)) +/proc/is_convertable_to_cult(mob/living/M) + if(!istype(M)) return 0 - if(istype(mind.current, /mob/living/carbon/human) && (mind.assigned_role in list("Captain", "Chaplain"))) - return 0 - if(isloyal(mind.current)) - return 0 - if(issilicon(mind.current) || isbot(mind.current) || isdrone(mind.current)) - return 0 //can't convert machines, that's ratvar's thing - if(is_sacrifice_target(mind)) - return 0 - if(mind.enslaved_to && !iscultist(mind.enslaved_to)) - return 0 - if(is_servant_of_ratvar(mind.current)) + if(M.mind) + if(ishuman(M) && (M.mind.assigned_role in list("Captain", "Chaplain"))) + return 0 + if(is_sacrifice_target(M.mind)) + return 0 + if(M.mind.enslaved_to && !iscultist(M.mind.enslaved_to)) + return 0 + else return 0 + if(isloyal(M) || issilicon(M) || isbot(M) || isdrone(M) || is_servant_of_ratvar(M)) + return 0 //can't convert machines, shielded, or ratvar's dogs return 1 /datum/game_mode/cult @@ -159,19 +158,10 @@ /datum/game_mode/proc/add_cultist(datum/mind/cult_mind, stun) //BASE if (!istype(cult_mind)) return 0 - if(!(cult_mind in cult) && is_convertable_to_cult(cult_mind)) + if(cult_mind.current.gain_antag_datum(/datum/antagonist/cultist)) if(stun) cult_mind.current.Paralyse(5) - cult += cult_mind - cult_mind.current.faction |= "cult" - cult_mind.current.verbs += /mob/living/proc/cult_help - var/datum/action/innate/cultcomm/C = new() - C.Grant(cult_mind.current) - update_cult_icons_added(cult_mind) - cult_mind.current.attack_log += "\[[time_stamp()]\] Has been converted to the cult of Nar'Sie!" - if(jobban_isbanned(cult_mind.current, ROLE_CULTIST)) - replace_jobbaned_player(cult_mind.current, ROLE_CULTIST, ROLE_CULTIST) - return 1 + return 1 /datum/game_mode/cult/add_cultist(datum/mind/cult_mind, stun) //INHERIT @@ -181,21 +171,15 @@ /datum/game_mode/proc/remove_cultist(datum/mind/cult_mind, show_message = 1, stun) - if(cult_mind in cult) - cult -= cult_mind - cult_mind.current.faction -= "cult" - cult_mind.current.verbs -= /mob/living/proc/cult_help - for(var/datum/action/innate/cultcomm/C in cult_mind.current.actions) - qdel(C) + if(cult_mind.current) + var/datum/antagonist/cultist/cult_datum = cult_mind.current.has_antag_datum(/datum/antagonist/cultist, TRUE) + if(!cult_datum) + return FALSE + cult_datum.silent_update = show_message + cult_datum.on_remove() if(stun) cult_mind.current.Paralyse(5) - cult_mind.current << "An unfamiliar white light flashes through your mind, cleansing the taint of the Dark One and all your memories as its servant." - cult_mind.memory = "" - update_cult_icons_removed(cult_mind) - cult_mind.current.attack_log += "\[[time_stamp()]\] Has renounced the cult of Nar'Sie!" - if(show_message) - for(var/mob/M in viewers(cult_mind.current)) - M << "[cult_mind.current] looks like they just reverted to their old faith!" + return TRUE /datum/game_mode/proc/update_cult_icons_added(datum/mind/cult_mind) var/datum/atom_hud/antag/culthud = huds[ANTAG_HUD_CULT] @@ -206,12 +190,14 @@ var/datum/atom_hud/antag/culthud = huds[ANTAG_HUD_CULT] culthud.leave_hud(cult_mind.current) set_antag_hud(cult_mind.current, null) + /datum/game_mode/cult/proc/get_unconvertables() var/list/ucs = list() for(var/mob/living/carbon/human/player in player_list) if(player.mind && !is_convertable_to_cult(player.mind)) ucs += player.mind return ucs + /datum/game_mode/cult/proc/check_cult_victory() var/cult_fail = 0 if(cult_objectives.Find("survive")) diff --git a/code/game/gamemodes/gang/gang.dm b/code/game/gamemodes/gang/gang.dm index eefbf5689f1..b9f5eaebc28 100644 --- a/code/game/gamemodes/gang/gang.dm +++ b/code/game/gamemodes/gang/gang.dm @@ -177,7 +177,7 @@ var/list/gang_colors_pool = list("red","orange","yellow","green","blue","purple" gangster_mind.store_memory("You are a member of the [G.name] Gang!") G.add_gang_hud(gangster_mind) if(jobban_isbanned(gangster_mind.current, ROLE_GANG)) - replace_jobbaned_player(gangster_mind.current, ROLE_GANG, ROLE_GANG) + addtimer(src, "replace_jobbaned_player", 0, FALSE, gangster_mind.current, ROLE_GANG, ROLE_GANG) return 2 //////////////////////////////////////////////////////////////////// //Deals with players reverting to neutral (Not a gangster anymore)// diff --git a/code/game/gamemodes/revolution/revolution.dm b/code/game/gamemodes/revolution/revolution.dm index b67617ae380..901d6f986eb 100644 --- a/code/game/gamemodes/revolution/revolution.dm +++ b/code/game/gamemodes/revolution/revolution.dm @@ -253,7 +253,7 @@ rev_mind.special_role = "Revolutionary" update_rev_icons_added(rev_mind) if(jobban_isbanned(rev_mind.current, ROLE_REV)) - replace_jobbaned_player(rev_mind.current, ROLE_REV, ROLE_REV) + addtimer(src, "replace_jobbaned_player", 0, FALSE, rev_mind.current, ROLE_REV, ROLE_REV) return 1 ////////////////////////////////////////////////////////////////////////////// //Deals with players being converted from the revolution (Not a rev anymore)// // Modified to handle borged MMIs. Accepts another var if the target is being borged at the time -- Polymorph. diff --git a/tgstation.dme b/tgstation.dme index 8039b9241b0..c8e8b1e1b03 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -189,6 +189,7 @@ #include "code\datums\votablemap.dm" #include "code\datums\antagonists\antag_datum.dm" #include "code\datums\antagonists\datum_clockcult.dm" +#include "code\datums\antagonists\datum_cult.dm" #include "code\datums\diseases\_disease.dm" #include "code\datums\diseases\_MobProcs.dm" #include "code\datums\diseases\anxiety.dm" From 07caf04001f09330c2ed46de92a674447f806967 Mon Sep 17 00:00:00 2001 From: Joan Lung Date: Tue, 20 Sep 2016 08:48:14 -0400 Subject: [PATCH 8/9] LIES IN EXILE --- code/datums/antagonists/datum_clockcult.dm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/code/datums/antagonists/datum_clockcult.dm b/code/datums/antagonists/datum_clockcult.dm index 4d8a473ab22..ab777bd6484 100644 --- a/code/datums/antagonists/datum_clockcult.dm +++ b/code/datums/antagonists/datum_clockcult.dm @@ -19,14 +19,12 @@ /datum/antagonist/clockcultist/give_to_body(mob/living/new_body) if(!silent_update) - if(iscarbon(new_body)) - new_body << "Your mind is racing! Your body feels incredibly light! Your world glows a brilliant yellow! All at once it comes to you. Ratvar, the Clockwork \ - Justiciar, lies in exile, derelict and forgotten in an unseen realm." - else if(issilicon(new_body)) - new_body << "You are unable to compute this truth. Your vision glows a brilliant yellow, and all at once it comes to you. Ratvar, the Clockwork Justiciar, lies in \ - exile, derelict and forgotten in an unseen realm." + if(issilicon(new_body)) + new_body << "You are unable to compute this truth. Your vision glows a brilliant yellow, and all at once it comes to you. Ratvar, the Clockwork Justiciar, \ + lies in exile, derelict and forgotten in an unseen realm." else - new_body << "Your world glows a brilliant yellow! All at once it comes to you. Ratvar, the Clockwork Justiciar, lies in exile, derelict and forgotten in an unseen realm." + new_body << "[iscarbon(new_body) ? "Your mind is racing! Your body feels incredibly light! ":""]Your world glows a brilliant yellow! All at once it comes to you. \ + Ratvar, the Clockwork Justiciar, lies in exile, derelict and forgotten in an unseen realm." . = ..() if(!silent_update && new_body) if(.) From be6d678f34f5b7eea23a46ded6e8567de31b7bc1 Mon Sep 17 00:00:00 2001 From: Joan Lung Date: Wed, 21 Sep 2016 08:40:39 -0400 Subject: [PATCH 9/9] amoral but effective --- code/datums/antagonists/datum_clockcult.dm | 2 ++ .../living/simple_animal/friendly/drone/extra_drone_types.dm | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/code/datums/antagonists/datum_clockcult.dm b/code/datums/antagonists/datum_clockcult.dm index ab777bd6484..ad369769eb8 100644 --- a/code/datums/antagonists/datum_clockcult.dm +++ b/code/datums/antagonists/datum_clockcult.dm @@ -82,6 +82,7 @@ hierophant_network.Grant(S) hierophant_network.title = "Silicon" hierophant_network.span_for_name = "nezbere" + hierophant_network.span_for_message = "brass" else if(isbrain(owner)) hierophant_network.Grant(owner) hierophant_network.title = "Vessel" @@ -91,6 +92,7 @@ hierophant_network.Grant(owner) hierophant_network.title = "Construct" hierophant_network.span_for_name = "nezbere" + hierophant_network.span_for_message = "brass" owner.throw_alert("clockinfo", /obj/screen/alert/clockwork/infodump) cache_check(owner) ..() diff --git a/code/modules/mob/living/simple_animal/friendly/drone/extra_drone_types.dm b/code/modules/mob/living/simple_animal/friendly/drone/extra_drone_types.dm index d940daf1a5b..4500cb5ae05 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/extra_drone_types.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/extra_drone_types.dm @@ -144,4 +144,4 @@ return //we don't get hacked or give a shit about it /mob/living/simple_animal/drone/cogscarab/drone_chat(msg) - titled_hierophant_message(src, msg, "heavy_alloy") //HIEROPHANT DRONES + titled_hierophant_message(src, msg, "nezbere", "brass", "Construct") //HIEROPHANT DRONES