Skip to content

Commit

Permalink
Merge pull request tgstation#18375 from ChangelingRain/gearhud
Browse files Browse the repository at this point in the history
Makes cyborg ratvar conversion work properly
  • Loading branch information
Razharas authored Jun 9, 2016
2 parents aeac71a + 790351b commit 4b7d83b
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 35 deletions.
6 changes: 3 additions & 3 deletions code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
66 changes: 44 additions & 22 deletions code/game/gamemodes/clock_cult/clock_cult.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -49,23 +67,24 @@ This file's folder contains:
if(!silent)
M << "<span class='heavy_brass'>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.</span>"
if(!is_eligible_servant(M))
M.visible_message("<span class='warning'>[M] seems to resist an unseen force!</span>", "<span class='warning'><b>And yet, you somehow push it all away.</b></span>")
return 0
else if(issilicon(M))
if(!silent)
M << "<span class='heavy_brass'>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.</span>"
if(!is_eligible_servant(M))
M.visible_message("<span class='warning'>[M] whirs as it resists an outside influence!</span>", \
"<span class='warning'><b>Corrupt data purged. Resetting cortex chip to factory defaults... complete.</b></span>")
return 0
else
if(!silent)
M << "<span class='heavy_brass'>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.</span>"
if(!is_eligible_servant(M))
M.visible_message("<span class='warning'>[M] seems to resist an unseen force!</span>", "<span class='warning'><b>And yet, you somehow push it all away.</b></span>")
if(!M.stat)
M.visible_message("<span class='warning'>[M] whirs as it resists an outside influence!</span>")
M << "<span class='warning'><b>Corrupt data purged. Resetting cortex chip to factory defaults... complete.</b></span>" //silicons have a custom fail message
return 0
else if(!silent)
M << "<span class='heavy_brass'>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.</span>"

if(!is_eligible_servant(M))
if(!silent && !M.stat)
M.visible_message("<span class='warning'>[M] seems to resist an unseen force!</span>")
M << "<span class='warning'><b>And yet, you somehow push it all away.</b></span>"
return 0

if(!silent)
M.visible_message("<span class='heavy_brass'>[M]'s eyes glow a blazing yellow!</span>", \
"<span class='heavy_brass'>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 \
Expand All @@ -82,18 +101,20 @@ This file's folder contains:
R.emagged = 1
R << "<span class='warning'><b>You have been desynced from your master AI. In addition, your onboard camera is no longer active and your safeties have been disabled.</b></span>"
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))
var/datum/game_mode/clockwork_cult/C = ticker.mode
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("<span class='big'>[M] seems to have remembered their true allegiance!</span>", \
"<span class='userdanger'>A cold, cold darkness flows through your mind, extinguishing the Justiciar's light and all of your memories as his servant.</span>")
if(!silent)
M.visible_message("<span class='big'>[M] seems to have remembered their true allegiance!</span>", \
"<span class='userdanger'>A cold, cold darkness flows through your mind, extinguishing the Justiciar's light and all of your memories as his servant.</span>")
ticker.mode.servants_of_ratvar -= M.mind
ticker.mode.update_servant_icons_removed(M.mind)
all_clockwork_mobs -= M
Expand All @@ -106,7 +127,7 @@ This file's folder contains:
var/mob/living/silicon/robot/R = S
R.emagged = initial(R.emagged)
R << "<span class='warning'>Despite your freedom from Ratvar's influence, you are still irreparably damaged and no longer possess certain functions such as AI linking.</span>"
S.laws = initial(S.laws)
S.make_laws()
S.update_icons()
S.show_laws()
return 1
Expand Down Expand Up @@ -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 << "<b>The game mode is: Clockwork Cult!</b>"
Expand All @@ -158,24 +181,23 @@ 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"
servant.restricted_roles = restricted_jobs
update_servant_icons_added(servant)
starter_servants--
return 1

/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, TRUE)
..()
return 1

Expand Down
26 changes: 17 additions & 9 deletions code/game/objects/items/robot/robot_parts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -209,22 +209,23 @@
user << "<span class='warning'>This MMI does not seem to fit!</span>"
return

var/mob/living/silicon/robot/O = new /mob/living/silicon/robot(get_turf(loc))
if(!O)
if(!user.unEquip(W))
return

if(!user.unEquip(W))
var/mob/living/silicon/robot/O = new /mob/living/silicon/robot(get_turf(loc))
if(!O)
return

if(M.hacked || M.clockwork)
aisync = 0
lawsync = 0
var/datum/ai_laws/L
if(M.clockwork)
O.laws = new/datum/ai_laws/ratvar
spawn(1)
add_servant_of_ratvar(O)
L = new/datum/ai_laws/ratvar
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
Expand All @@ -237,13 +238,20 @@
O.notify_ai(1)
if(forced_ai)
O.connected_ai = forced_ai
if(!lawsync && !M.hacked)
if(!lawsync)
O.lawupdate = 0
O.make_laws()
if(!M.hacked && !M.clockwork)
O.make_laws()

ticker.mode.remove_antag_for_borging(BM.mind)
BM.mind.transfer_to(O)

if(M.clockwork)
O.emagged = 1
O.visible_message("<span class='heavy_brass'>[M]'s eyes glow a blazing yellow!</span>", \
"<span class='warning'><b>As you serve Ratvar, your onboard camera is not active and your safeties are disabled.</b></span>")
ticker.mode.update_servant_icons_added(O.mind)

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 << "<span class='userdanger'>You have been robotized!</span>"
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/ai_core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
user << "<span class='warning'>This MMI does not seem to fit!</span>"
return

if(M.hacked)
if(M.hacked || M.clockwork)
user << "<span class='warning'>This MMI does not seem to fit!</span>"
return

Expand Down

0 comments on commit 4b7d83b

Please sign in to comment.