diff --git a/code/datums/mind.dm b/code/datums/mind.dm index b17189be121..a57bb20ea69 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -1043,12 +1043,12 @@ else if(href_list["clockcult"]) switch(href_list["clockcult"]) if("clear") - remove_servant_of_ratvar(current) + remove_servant_of_ratvar(current, TRUE) message_admins("[key_name_admin(usr)] has removed clockwork servant status from [current].") log_admin("[key_name(usr)] has removed clockwork servant status from [current].") if("servant") - if(!(src in ticker.mode.servants_of_ratvar)) - add_servant_of_ratvar(current) + if(!is_servant_of_ratvar(current)) + add_servant_of_ratvar(current, TRUE) message_admins("[key_name_admin(usr)] has made [current] into a servant of Ratvar.") log_admin("[key_name(usr)] has made [current] into a servant of Ratvar.") if("slab") diff --git a/code/game/gamemodes/clock_cult/clock_cult.dm b/code/game/gamemodes/clock_cult/clock_cult.dm index 86340e1dfbb..0507d26ce79 100644 --- a/code/game/gamemodes/clock_cult/clock_cult.dm +++ b/code/game/gamemodes/clock_cult/clock_cult.dm @@ -36,11 +36,29 @@ This file's folder contains: // PROCS // /////////// -/proc/is_servant_of_ratvar(mob/M) +/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) -/proc/is_eligible_servant(mob/M) - return M && istype(M) && M.mind && !iscultist(M) && !isconstruct(M) && !isloyal(M) +/proc/is_eligible_servant(mob/living/M) + if(!istype(M)) + return 0 + if(!M.mind) + return 0 + if(ishuman(M) && (M.mind.assigned_role in list("Captain", "Chaplain"))) + return 0 + if(iscultist(M)) + return 0 + if(isconstruct(M)) + return 0 + if(isguardian(M)) + var/mob/living/simple_animal/hostile/guardian/G = M + if(!is_servant_of_ratvar(G.summoner)) + return 0 //can't convert it unless the owner is converted + if(isloyal(M)) + return 0 + if(M.mind.enslaved_to) + return 0 + return 1 /proc/add_servant_of_ratvar(mob/M, silent = FALSE) if(is_servant_of_ratvar(M) || !ticker || !ticker.mode) @@ -49,23 +67,24 @@ This file's folder contains: 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." - if(!is_eligible_servant(M)) - M.visible_message("[M] seems to resist an unseen force!", "And yet, you somehow push it all away.") - return 0 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)) - M.visible_message("[M] whirs as it resists an outside influence!", \ - "Corrupt data purged. Resetting cortex chip to factory defaults... complete.") - 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." - if(!is_eligible_servant(M)) - M.visible_message("[M] seems to resist an unseen force!", "And yet, you somehow push it all away.") + 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." + + 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 \ @@ -82,6 +101,7 @@ This file's folder contains: R.emagged = 1 R << "You have been desynced from your master AI. In addition, your onboard camera is no longer active and your safeties have been disabled." S.laws = new/datum/ai_laws/ratvar + S.laws.associate(S) S.update_icons() S.show_laws() if(istype(ticker.mode, /datum/game_mode/clockwork_cult)) @@ -89,11 +109,12 @@ This file's folder contains: C.present_tasks(M) //Memorize the objectives return 1 -/proc/remove_servant_of_ratvar(mob/M) +/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 - 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.") + 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 @@ -106,7 +127,7 @@ This file's folder contains: 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.laws = initial(S.laws) + S.make_laws() S.update_icons() S.show_laws() return 1 @@ -143,6 +164,8 @@ This file's folder contains: recommended_enemies = 4 enemy_minimum_age = 14 protected_jobs = list("AI", "Cyborg", "Security Officer", "Warden", "Detective", "Head of Security", "Captain") //Silicons can eventually be converted + restricted_jobs = list("Chaplain", "Captain") + var/servants_to_serve = list() /datum/game_mode/clockwork_cult/announce() world << "The game mode is: Clockwork Cult!" @@ -158,7 +181,7 @@ This file's folder contains: var/starter_servants = max(1, round(num_players() / 10)) //Guaranteed one cultist - otherwise, about one cultist for every ten players while(starter_servants) var/datum/mind/servant = pick(antag_candidates) - servants_of_ratvar += servant + servants_to_serve += servant antag_candidates -= servant modePlayer += servant servant.special_role = "Servant of Ratvar" @@ -169,13 +192,13 @@ This file's folder contains: /datum/game_mode/clockwork_cult/post_setup() forge_clock_objectives() - for(var/S in servants_of_ratvar) + for(var/S in servants_to_serve) var/datum/mind/servant = S log_game("[servant.key] was made an initial servant of Ratvar") var/mob/living/L = servant.current greet_servant(L) equip_servant(L) - present_tasks(L) + add_servant_of_ratvar(L) ..() return 1 diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index a7c0407d0e8..bced896741e 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -536,3 +536,4 @@ 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, TRUE) diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm index 8b505b4fda5..50f8095051b 100644 --- a/code/game/objects/items/robot/robot_parts.dm +++ b/code/game/objects/items/robot/robot_parts.dm @@ -219,12 +219,15 @@ if(M.hacked || M.clockwork) aisync = 0 lawsync = 0 + var/datum/ai_laws/L if(M.clockwork) - O.laws = new/datum/ai_laws/ratvar + L = new/datum/ai_laws/ratvar spawn(1) add_servant_of_ratvar(O) else - O.laws = new/datum/ai_laws/syndicate_override + L = new/datum/ai_laws/syndicate_override + O.laws = L + L.associate(O) O.invisibility = 0 //Transfer debug settings to new mob diff --git a/code/game/objects/structures/ai_core.dm b/code/game/objects/structures/ai_core.dm index e08900cdc30..05361b5a7df 100644 --- a/code/game/objects/structures/ai_core.dm +++ b/code/game/objects/structures/ai_core.dm @@ -144,7 +144,7 @@ user << "This MMI does not seem to fit!" return - if(M.hacked) + if(M.hacked || M.clockwork) user << "This MMI does not seem to fit!" return