From 6a365857d1e5e16adea878688690d6417ebb521a Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Tue, 2 May 2017 20:44:34 -0500 Subject: [PATCH 1/2] Should fix all of the cult/clockcult issues --- code/datums/antagonists/antag_datum.dm | 21 +++++-- code/datums/antagonists/datum_clockcult.dm | 69 ++++++++++++++++------ code/datums/antagonists/datum_cult.dm | 4 +- code/datums/antagonists/datum_cult.dm.rej | 22 ++++++- code/datums/mind.dm | 32 ++++------ 5 files changed, 103 insertions(+), 45 deletions(-) diff --git a/code/datums/antagonists/antag_datum.dm b/code/datums/antagonists/antag_datum.dm index deee1111c0..396c185961 100644 --- a/code/datums/antagonists/antag_datum.dm +++ b/code/datums/antagonists/antag_datum.dm @@ -8,13 +8,26 @@ var/can_coexist_with_others = TRUE //Whether or not the person will be able to have more than one datum var/list/typecache_datum_blacklist = list() //List of datums this type can't coexist with - /datum/antagonist/New(datum/mind/new_owner) - . = ..() typecache_datum_blacklist = typecacheof(typecache_datum_blacklist) if(new_owner) owner = new_owner +/datum/antagonist/Destroy() + if(owner) + LAZYREMOVE(owner.antag_datums, src) + owner = null + return ..() + +/datum/antagonist/proc/can_be_owned(datum/mind/new_owner) + . = TRUE + if(owner.has_antag_datum(type)) + return FALSE + for(var/i in owner.antag_datums) + var/datum/antagonist/A = i + if(is_type_in_typecache(src, A.typecache_datum_blacklist)) + return FALSE + /datum/antagonist/proc/on_body_transfer(mob/living/old_body, mob/living/new_body) remove_innate_effects(old_body) apply_innate_effects(new_body) @@ -37,7 +50,7 @@ /datum/antagonist/proc/on_removal() remove_innate_effects() if(owner) - owner.antag_datums -= src + LAZYREMOVE(owner.antag_datums, src) if(!silent && owner.current) farewell() qdel(src) @@ -46,4 +59,4 @@ return /datum/antagonist/proc/farewell() - return \ No newline at end of file + return diff --git a/code/datums/antagonists/datum_clockcult.dm b/code/datums/antagonists/datum_clockcult.dm index 3084b9ba82..b8dfa00f23 100644 --- a/code/datums/antagonists/datum_clockcult.dm +++ b/code/datums/antagonists/datum_clockcult.dm @@ -9,27 +9,52 @@ qdel(hierophant_network) return ..() +/datum/antagonist/clockcult/can_be_owned(datum/mind/new_owner) + . = ..() + if(.) + if(iscyborg(new_owner.current)) + var/mob/living/silicon/robot/R = new_owner.current + if(R.deployed) + var/mob/living/silicon/ai/AI = R.mainframe + R.undeploy() + to_chat(AI, "Anomaly Detected. Returned to core!") //The AI needs to be in its core to properly be converted + . = is_eligible_servant(new_owner.current) + if(!silent && new_owner.current) + if(issilicon(new_owner.current)) + to_chat(new_owner.current, "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 + to_chat(new_owner.current, "[iscarbon(new_owner.current) ? "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(!.) + new_owner.current.visible_message("[new_owner.current] seems to resist an unseen force!") + to_chat(new_owner.current, "And yet, you somehow push it all away.") + +/datum/antagonist/clockcult/greet() + if(!owner.current || silent) + return + owner.current.visible_message("[owner.current]'s eyes glow a blazing yellow!") + to_chat(owner.current, "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.") + /datum/antagonist/clockcult/on_gain() - if(!owner) - return var/mob/living/current = owner.current - if(!istype(current)) - return + SSticker.mode.servants_of_ratvar += owner + SSticker.mode.update_servant_icons_added(owner) if(jobban_isbanned(current, ROLE_SERVANT_OF_RATVAR)) addtimer(CALLBACK(SSticker.mode, /datum/game_mode.proc/replace_jobbaned_player, current, ROLE_SERVANT_OF_RATVAR, ROLE_SERVANT_OF_RATVAR), 0) + owner.special_role = "Servant of Ratvar" owner.current.log_message("Has been converted to the cult of Ratvar!", INDIVIDUAL_ATTACK_LOG) if(issilicon(current)) - var/mob/living/silicon/S = owner - if(iscyborg(S) && !silent) - to_chat(S, "You have been desynced from your master AI.") - to_chat(S, "In addition, your onboard camera is no longer active and you have gained additional equipment, including a limited clockwork slab.") - if(isAI(S)) - to_chat(S, "You are able to use your cameras to listen in on conversations.") - to_chat(S, "You can communicate with other servants by using the Hierophant Network action button in the upper left.") + if(iscyborg(current) && !silent) + to_chat(current, "You have been desynced from your master AI.") + to_chat(current, "In addition, your onboard camera is no longer active and you have gained additional equipment, including a limited clockwork slab.") + if(isAI(current)) + to_chat(current, "You are able to use your cameras to listen in on conversations.") + to_chat(current, "You can communicate with other servants by using the Hierophant Network action button in the upper left.") else if(isbrain(current) || isclockmob(current)) to_chat(current, "You can communicate with other servants by using the Hierophant Network action button in the upper left.") ..() - SSticker.mode.update_servant_icons_added(owner) if(istype(SSticker.mode, /datum/game_mode/clockwork_cult)) var/datum/game_mode/clockwork_cult/C = SSticker.mode C.present_tasks(owner) //Memorize the objectives @@ -47,11 +72,17 @@ var/mob/living/silicon/S = current if(iscyborg(S)) var/mob/living/silicon/robot/R = S - R.UnlinkSelf() + if(!R.shell) + R.UnlinkSelf() R.module.rebuild_modules() else if(isAI(S)) var/mob/living/silicon/ai/A = S + A.can_be_carded = FALSE A.requires_power = POWER_REQ_CLOCKCULT + var/list/AI_frame = list(mutable_appearance('icons/mob/clockwork_mobs.dmi', "aiframe")) //make the AI's cool frame + for(var/d in GLOB.cardinal) + AI_frame += image('icons/mob/clockwork_mobs.dmi', A, "eye[rand(1, 10)]", dir = d) //the eyes are randomly fast or slow + A.add_overlay(AI_frame) if(!A.lacks_power()) A.ai_restore_power() if(A.eyeobj) @@ -84,8 +115,6 @@ current.throw_alert("clockinfo", /obj/screen/alert/clockwork/infodump) if(!GLOB.clockwork_gateway_activated) current.throw_alert("scripturereq", /obj/screen/alert/clockwork/scripture_reqs) - update_slab_info() - /datum/antagonist/clockcult/remove_innate_effects(mob/living/mob_override) var/mob/living/current = owner.current @@ -102,7 +131,9 @@ var/mob/living/silicon/S = current if(isAI(S)) var/mob/living/silicon/ai/A = S + A.can_be_carded = initial(A.can_be_carded) A.requires_power = initial(A.requires_power) + A.cut_overlays() S.make_laws() S.update_icons() S.show_laws() @@ -113,14 +144,16 @@ R.module.rebuild_modules() if(temp_owner) temp_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 - update_slab_info() /datum/antagonist/clockcult/on_removal() - . = ..() + SSticker.mode.servants_of_ratvar -= owner SSticker.mode.update_servant_icons_removed(owner) if(!silent) owner.current.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.") owner.current.log_message("Has renounced the cult of Ratvar!", INDIVIDUAL_ATTACK_LOG) + owner.wipe_memory() + owner.special_role = null if(iscyborg(owner.current)) - to_chat(owner.current, "Despite your freedom from Ratvar's influence, you are still irreparably damaged and no longer possess certain functions such as AI linking.") \ No newline at end of file + to_chat(owner.current, "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/datums/antagonists/datum_cult.dm b/code/datums/antagonists/datum_cult.dm index 719f0efec0..1fe344aedd 100644 --- a/code/datums/antagonists/datum_cult.dm +++ b/code/datums/antagonists/datum_cult.dm @@ -32,9 +32,11 @@ communion.Remove(current) /datum/antagonist/cult/on_removal() - . = ..() + owner.wipe_memory() + SSticker.mode.cult -= owner SSticker.mode.update_cult_icons_removed(owner) to_chat(owner, "An unfamiliar white light flashes through your mind, cleansing the taint of the Dark One and all your memories as its servant.") owner.current.log_message("Has renounced the cult of Nar'Sie!", INDIVIDUAL_ATTACK_LOG) if(!silent) owner.current.visible_message("[owner] looks like [owner.current.p_they()] just reverted to their old faith!") + . = ..() diff --git a/code/datums/antagonists/datum_cult.dm.rej b/code/datums/antagonists/datum_cult.dm.rej index 991ad512c9..0fc846a73c 100644 --- a/code/datums/antagonists/datum_cult.dm.rej +++ b/code/datums/antagonists/datum_cult.dm.rej @@ -1,9 +1,25 @@ diff a/code/datums/antagonists/datum_cult.dm b/code/datums/antagonists/datum_cult.dm (rejected hunks) -@@ -11,6 +11,7 @@ - return +@@ -5,13 +5,20 @@ + qdel(communion) + return ..() + ++/datum/antagonist/cult/can_be_owned(datum/mind/new_owner) ++ . = ..() ++ if(.) ++ . = is_convertable_to_cult(new_owner.current) ++ + /datum/antagonist/cult/on_gain() + . = ..() +- if(!owner) +- return ++ SSticker.mode.cult += owner ++ SSticker.mode.update_cult_icons_added(owner) ++ if(istype(SSticker.mode, /datum/game_mode/cult)) ++ var/datum/game_mode/cult/C = SSticker.mode ++ C.memorize_cult_objectives(owner) if(jobban_isbanned(owner.current, ROLE_CULTIST)) addtimer(CALLBACK(SSticker.mode, /datum/game_mode.proc/replace_jobbaned_player, owner.current, ROLE_CULTIST, ROLE_CULTIST), 0) -+ SSticker.mode.update_cult_icons_added(owner) +- SSticker.mode.update_cult_icons_added(owner) owner.current.log_message("Has been converted to the cult of Nar'Sie!", INDIVIDUAL_ATTACK_LOG) /datum/antagonist/cult/apply_innate_effects(mob/living/mob_override) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 0acd33ad69..421cecc95b 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -54,7 +54,7 @@ var/linglink var/miming = 0 // Mime's vow of silence - var/list/antag_datums = list() + var/list/antag_datums var/antag_hud_icon_state = null //this mind's ANTAG_HUD should have this icon_state var/datum/atom_hud/antag/antag_hud = null //this mind's antag HUD var/datum/gang/gang_datum //Which gang this mind belongs to, if any @@ -71,6 +71,10 @@ /datum/mind/Destroy() SSticker.minds -= src + if(islist(antag_datums)) + for(var/i in antag_datums) + qdel(i) + antag_datums = null return ..() /datum/mind/proc/transfer_to(mob/new_character, var/force_key_move = 0) @@ -110,15 +114,16 @@ memory = null // Datum antag mind procs -/datum/mind/proc/add_antag_datum(datum_type, on_gain = TRUE) +/datum/mind/proc/add_antag_datum(datum_type) if(!datum_type) return - if(!can_hold_antag_datum(datum_type)) - return var/datum/antagonist/A = new datum_type(src) - antag_datums += A - if(on_gain) - A.on_gain() + if(!A.can_be_owned(src)) + qdel(A) + return + LAZYADD(antag_datums, A) + A.on_gain() + return A /datum/mind/proc/remove_antag_datum(datum_type) if(!datum_type) @@ -126,6 +131,7 @@ var/datum/antagonist/A = has_antag_datum(datum_type) if(A) A.on_removal() + return TRUE /datum/mind/proc/remove_all_antag_datums() //For the Lazy amongst us. for(var/a in antag_datums) @@ -143,18 +149,6 @@ else if(A.type == datum_type) return A -/datum/mind/proc/can_hold_antag_datum(datum_type) - if(!datum_type) - return - . = TRUE - if(has_antag_datum(datum_type)) - return FALSE - for(var/i in antag_datums) - var/datum/antagonist/A = i - if(is_type_in_typecache(A, A.typecache_datum_blacklist)) - return FALSE - - /* Removes antag type's references from a mind. objectives, uplinks, powers etc are all handled. From f333944be010f5c02a2b36a619705c34bc60c0fe Mon Sep 17 00:00:00 2001 From: LetterJay Date: Wed, 3 May 2017 09:02:19 -0500 Subject: [PATCH 2/2] le fix --- code/datums/antagonists/datum_cult.dm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/code/datums/antagonists/datum_cult.dm b/code/datums/antagonists/datum_cult.dm index 1fe344aedd..30c0aa8450 100644 --- a/code/datums/antagonists/datum_cult.dm +++ b/code/datums/antagonists/datum_cult.dm @@ -5,10 +5,18 @@ qdel(communion) return ..() +/datum/antagonist/cult/can_be_owned(datum/mind/new_owner) + . = ..() + if(.) + . = is_convertable_to_cult(new_owner.current) + /datum/antagonist/cult/on_gain() . = ..() - if(!owner) - return + SSticker.mode.cult += owner + SSticker.mode.update_cult_icons_added(owner) + if(istype(SSticker.mode, /datum/game_mode/cult)) + var/datum/game_mode/cult/C = SSticker.mode + C.memorize_cult_objectives(owner) if(jobban_isbanned(owner.current, ROLE_CULTIST)) addtimer(CALLBACK(SSticker.mode, /datum/game_mode.proc/replace_jobbaned_player, owner.current, ROLE_CULTIST, ROLE_CULTIST), 0) owner.current.log_message("Has been converted to the cult of Nar'Sie!", INDIVIDUAL_ATTACK_LOG)