diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index 1eb6c75cc5..fa6ca7e26b 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -567,3 +567,41 @@ SUBSYSTEM_DEF(job) var/msg = "Unable to send mob [M] to late join!" message_admins(msg) CRASH(msg) + + +/////////////////////////////////// +//Keeps track of all living heads// +/////////////////////////////////// +/datum/controller/subsystem/job/proc/get_living_heads() + . = list() + for(var/mob/living/carbon/human/player in GLOB.mob_list) + if(player.stat != DEAD && player.mind && (player.mind.assigned_role in GLOB.command_positions)) + . |= player.mind + + +//////////////////////////// +//Keeps track of all heads// +//////////////////////////// +/datum/controller/subsystem/job/proc/get_all_heads() + . = list() + for(var/mob/player in GLOB.mob_list) + if(player.mind && (player.mind.assigned_role in GLOB.command_positions)) + . |= player.mind + +////////////////////////////////////////////// +//Keeps track of all living security members// +////////////////////////////////////////////// +/datum/controller/subsystem/job/proc/get_living_sec() + . = list() + for(var/mob/living/carbon/human/player in GLOB.mob_list) + if(player.stat != DEAD && player.mind && (player.mind.assigned_role in GLOB.security_positions)) + . |= player.mind + +//////////////////////////////////////// +//Keeps track of all security members// +//////////////////////////////////////// +/datum/controller/subsystem/job/proc/get_all_sec() + . = list() + for(var/mob/living/carbon/human/player in GLOB.mob_list) + if(player.mind && (player.mind.assigned_role in GLOB.security_positions)) + . |= player.mind \ No newline at end of file diff --git a/code/controllers/subsystem/pai.dm b/code/controllers/subsystem/pai.dm index 2a1a04e21d..07797d0677 100644 --- a/code/controllers/subsystem/pai.dm +++ b/code/controllers/subsystem/pai.dm @@ -28,7 +28,6 @@ SUBSYSTEM_DEF(pai) card.setPersonality(pai) SSticker.mode.update_cult_icons_removed(card.pai.mind) - SSticker.mode.update_rev_icons_removed(card.pai.mind) candidates -= candidate usr << browse(null, "window=findPai") diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 8f36661ca4..4b198d1e80 100755 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -12,6 +12,7 @@ SUBSYSTEM_DEF(ticker) var/force_ending = 0 //Round was ended by admin intervention // If true, there is no lobby phase, the game starts immediately. var/start_immediately = FALSE + var/setup_done = FALSE //All game setup done including mode post setup and var/hide_mode = 0 var/datum/game_mode/mode = null @@ -331,6 +332,7 @@ SUBSYSTEM_DEF(ticker) var/list/adm = get_admin_counts() var/list/allmins = adm["present"] send2irc("Server", "Round [GLOB.round_id ? "#[GLOB.round_id]:" : "of"] [hide_mode ? "secret":"[mode.name]"] has started[allmins.len ? ".":" with no active admins online!"]") + setup_done = TRUE /datum/controller/subsystem/ticker/proc/OnRoundstart(datum/callback/cb) if(!HasRoundStarted()) diff --git a/code/datums/antagonists/datum_abductor.dm b/code/datums/antagonists/abductor.dm similarity index 88% rename from code/datums/antagonists/datum_abductor.dm rename to code/datums/antagonists/abductor.dm index 81329928b3..b800d6d59d 100644 --- a/code/datums/antagonists/datum_abductor.dm +++ b/code/datums/antagonists/abductor.dm @@ -18,9 +18,15 @@ landmark_type = /obj/effect/landmark/abductor/scientist greet_text = "Use your stealth technology and equipment to incapacitate humans for your scientist to retrieve." -/datum/antagonist/abductor/New(datum/mind/new_owner, datum/objective_team/abductor_team/T) - team = T - return ..() +/datum/antagonist/abductor/create_team(datum/objective_team/abductor_team/new_team) + if(!new_team) + return + if(!istype(new_team)) + stack_trace("Wrong team type passed to [type] initialization.") + team = new_team + +/datum/antagonist/abductor/get_team() + return team /datum/antagonist/abductor/on_gain() SSticker.mode.abductors += owner @@ -31,7 +37,6 @@ /datum/antagonist/abductor/on_removal() SSticker.mode.abductors -= owner - team.members -= owner owner.objectives -= team.objectives if(owner.current) to_chat(owner.current,"You are no longer the [owner.special_role]!") diff --git a/code/datums/antagonists/antag_datum.dm b/code/datums/antagonists/antag_datum.dm index 7e500c2e4a..5092b3c82f 100644 --- a/code/datums/antagonists/antag_datum.dm +++ b/code/datums/antagonists/antag_datum.dm @@ -7,6 +7,8 @@ GLOBAL_LIST_EMPTY(antagonists) 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 var/delete_on_mind_deletion = TRUE + var/job_rank + var/replace_banned = TRUE //Should replace jobbaned player with ghosts if granted. /datum/antagonist/New(datum/mind/new_owner) GLOB.antagonists += src @@ -23,9 +25,10 @@ GLOBAL_LIST_EMPTY(antagonists) /datum/antagonist/proc/can_be_owned(datum/mind/new_owner) . = TRUE - if(owner.has_antag_datum(type)) + var/datum/mind/tested = new_owner || owner + if(tested.has_antag_datum(type)) return FALSE - for(var/i in owner.antag_datums) + for(var/i in tested.antag_datums) var/datum/antagonist/A = i if(is_type_in_typecache(src, A.typecache_datum_blacklist)) return FALSE @@ -42,12 +45,39 @@ GLOBAL_LIST_EMPTY(antagonists) /datum/antagonist/proc/remove_innate_effects(mob/living/mob_override) return +//Assign default team and creates one for one of a kind team antagonists +/datum/antagonist/proc/create_team(datum/objective_team/team) + return + //Proc called when the datum is given to a mind. /datum/antagonist/proc/on_gain() if(owner && owner.current) if(!silent) greet() apply_innate_effects() + if(is_banned(owner) && replace_banned) + replace_banned_player() + +/datum/antagonist/proc/is_banned(datum/mind/M) + if(!M) + return FALSE + if(jobban_isbanned(M,"Syndicate")) + return TRUE + if(job_rank && jobban_isbanned(M,job_rank)) + return TRUE + return FALSE + +/datum/antagonist/proc/replace_banned_player() + set waitfor = FALSE + + var/list/mob/dead/observer/candidates = pollCandidatesForMob("Do you want to play as a [name]?", "[name]", null, job_rank, 50, owner.current) + var/mob/dead/observer/theghost = null + if(candidates.len) + theghost = pick(candidates) + to_chat(owner, "Your mob has been taken over by a ghost! Appeal your job ban if you want to avoid this in the future!") + message_admins("[key_name_admin(theghost)] has taken control of ([key_name_admin(owner.current)]) to replace a jobbaned player.") + owner.current.ghostize(0) + owner.current.key = theghost.key /datum/antagonist/proc/on_removal() remove_innate_effects() @@ -55,6 +85,9 @@ GLOBAL_LIST_EMPTY(antagonists) LAZYREMOVE(owner.antag_datums, src) if(!silent && owner.current) farewell() + var/datum/objective_team/team = get_team() + if(team) + team.remove_member(owner) qdel(src) /datum/antagonist/proc/greet() @@ -62,3 +95,14 @@ GLOBAL_LIST_EMPTY(antagonists) /datum/antagonist/proc/farewell() return + +//Returns the team antagonist belongs to if any. +/datum/antagonist/proc/get_team() + return + +//Should probably be on ticker or job ss ? +/proc/get_antagonists(antag_type,specific = FALSE) + . = list() + for(var/datum/antagonist/A in GLOB.antagonists) + if(!specific && istype(A,antag_type) || specific && A.type == antag_type) + . += A.owner \ No newline at end of file diff --git a/code/datums/antagonists/datum_brother.dm b/code/datums/antagonists/brother.dm similarity index 83% rename from code/datums/antagonists/datum_brother.dm rename to code/datums/antagonists/brother.dm index 1f799b1bf8..731a70d2af 100644 --- a/code/datums/antagonists/datum_brother.dm +++ b/code/datums/antagonists/brother.dm @@ -3,20 +3,27 @@ var/special_role = "blood brother" var/datum/objective_team/brother_team/team -/datum/antagonist/brother/New(datum/mind/new_owner, datum/objective_team/brother_team/T) - team = T +/datum/antagonist/brother/New(datum/mind/new_owner) return ..() +/datum/antagonist/brother/create_team(datum/objective_team/brother_team/new_team) + if(!new_team) + return + if(!istype(new_team)) + stack_trace("Wrong team type passed to [type] initialization.") + team = new_team + +/datum/antagonist/brother/get_team() + return team + /datum/antagonist/brother/on_gain() SSticker.mode.brothers += owner - owner.special_role = special_role owner.objectives += team.objectives finalize_brother() return ..() /datum/antagonist/brother/on_removal() SSticker.mode.brothers -= owner - team.members -= owner owner.objectives -= team.objectives if(owner.current) to_chat(owner.current,"You are no longer the [special_role]!") diff --git a/code/datums/antagonists/datum_clockcult.dm b/code/datums/antagonists/clockcult.dm similarity index 97% rename from code/datums/antagonists/datum_clockcult.dm rename to code/datums/antagonists/clockcult.dm index 09309a184a..8cc1c9e9a7 100644 --- a/code/datums/antagonists/datum_clockcult.dm +++ b/code/datums/antagonists/clockcult.dm @@ -1,6 +1,8 @@ //CLOCKCULT PROOF OF CONCEPT /datum/antagonist/clockcult + name = "Clock Cultist" var/datum/action/innate/hierophant/hierophant_network = new() + job_rank = ROLE_SERVANT_OF_RATVAR /datum/antagonist/clockcult/silent silent = TRUE @@ -47,8 +49,6 @@ var/mob/living/current = owner.current 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)) diff --git a/code/datums/antagonists/datum_cult.dm b/code/datums/antagonists/cult.dm similarity index 97% rename from code/datums/antagonists/datum_cult.dm rename to code/datums/antagonists/cult.dm index 37dce88691..f5dbc1c829 100644 --- a/code/datums/antagonists/datum_cult.dm +++ b/code/datums/antagonists/cult.dm @@ -1,8 +1,10 @@ #define SUMMON_POSSIBILITIES 3 /datum/antagonist/cult + name = "Cultist" var/datum/action/innate/cult/comm/communion = new var/datum/action/innate/cult/mastervote/vote = new + job_rank = ROLE_CULTIST /datum/antagonist/cult/Destroy() QDEL_NULL(communion) @@ -73,8 +75,6 @@ add_objectives() SSticker.mode.cult += owner // Only add after they've been given objectives cult_memorization(owner) - if(jobban_isbanned(current, ROLE_CULTIST)) - addtimer(CALLBACK(SSticker.mode, /datum/game_mode.proc/replace_jobbaned_player, current, ROLE_CULTIST, ROLE_CULTIST), 0) SSticker.mode.update_cult_icons_added(owner) current.log_message("Has been converted to the cult of Nar'Sie!", INDIVIDUAL_ATTACK_LOG) if(GLOB.blood_target && GLOB.blood_target_image && current.client) diff --git a/code/datums/antagonists/datum_internal_affairs.dm b/code/datums/antagonists/internal_affairs.dm similarity index 100% rename from code/datums/antagonists/datum_internal_affairs.dm rename to code/datums/antagonists/internal_affairs.dm diff --git a/code/datums/antagonists/revolution.dm b/code/datums/antagonists/revolution.dm new file mode 100644 index 0000000000..79fae52a1d --- /dev/null +++ b/code/datums/antagonists/revolution.dm @@ -0,0 +1,229 @@ +//How often to check for promotion possibility +#define HEAD_UPDATE_PERIOD 300 + +/datum/antagonist/rev + name = "Revolutionary" + job_rank = ROLE_REV + var/hud_type = "rev" + var/datum/objective_team/revolution/rev_team + +/datum/antagonist/rev/can_be_owned(datum/mind/new_owner) + . = ..() + if(new_owner.assigned_role in GLOB.command_positions) + return FALSE + if(new_owner.unconvertable) + return FALSE + +/datum/antagonist/rev/apply_innate_effects(mob/living/mob_override) + var/mob/living/M = mob_override || owner.current + update_rev_icons_added(M) + +/datum/antagonist/rev/remove_innate_effects(mob/living/mob_override) + var/mob/living/M = mob_override || owner.current + update_rev_icons_removed(M) + +/datum/antagonist/rev/proc/equip_rev() + return + +/datum/antagonist/rev/New() + . = ..() + +/datum/antagonist/rev/on_gain() + . = ..() + create_objectives() + equip_rev() + owner.current.log_message("Has been converted to the revolution!", INDIVIDUAL_ATTACK_LOG) + +/datum/antagonist/rev/on_removal() + remove_objectives() + . = ..() + +/datum/antagonist/rev/greet() + to_chat(owner, " You are now a revolutionary! Help your cause. Do not harm your fellow freedom fighters. You can identify your comrades by the red \"R\" icons, and your leaders by the blue \"R\" icons. Help them kill the heads to win the revolution!") + owner.announce_objectives() + +/datum/antagonist/rev/create_team(datum/objective_team/revolution/new_team) + if(!new_team) + //For now only one revolution at a time + for(var/datum/antagonist/rev/head/H in GLOB.antagonists) + if(H.rev_team) + rev_team = H.rev_team + return + rev_team = new /datum/objective_team/revolution + rev_team.update_objectives() + rev_team.update_heads() + return + if(!istype(new_team)) + stack_trace("Wrong team type passed to [type] initialization.") + rev_team = new_team + +/datum/antagonist/rev/get_team() + return rev_team + +/datum/antagonist/rev/proc/create_objectives() + owner.objectives |= rev_team.objectives + +/datum/antagonist/rev/proc/remove_objectives() + owner.objectives -= rev_team.objectives + +//Bump up to head_rev +/datum/antagonist/rev/proc/promote() + var/old_team = rev_team + var/datum/mind/old_owner = owner + silent = TRUE + owner.remove_antag_datum(/datum/antagonist/rev) + var/datum/antagonist/rev/head/new_revhead = new(old_owner) + new_revhead.silent = TRUE + old_owner.add_antag_datum(new_revhead,old_team) + new_revhead.silent = FALSE + to_chat(old_owner, "You have proved your devotion to revolution! You are a head revolutionary now!") + + +/datum/antagonist/rev/head + name = "Head Revolutionary" + hud_type = "rev_head" + var/remove_clumsy = FALSE + var/give_flash = FALSE + var/give_hud = FALSE + +/datum/antagonist/rev/proc/update_rev_icons_added(mob/living/M) + var/datum/atom_hud/antag/revhud = GLOB.huds[ANTAG_HUD_REV] + revhud.join_hud(M) + set_antag_hud(M,hud_type) + +/datum/antagonist/rev/proc/update_rev_icons_removed(mob/living/M) + var/datum/atom_hud/antag/revhud = GLOB.huds[ANTAG_HUD_REV] + revhud.leave_hud(M) + set_antag_hud(M, null) + +/datum/antagonist/rev/proc/can_be_converted(mob/living/candidate) + if(!candidate.mind) + return FALSE + if(!can_be_owned(candidate.mind)) + return FALSE + var/mob/living/carbon/C = candidate //Check to see if the potential rev is implanted + if(!istype(C)) //Can't convert simple animals + return FALSE + if(C.isloyal()) + return FALSE + return TRUE + +/datum/antagonist/rev/proc/add_revolutionary(datum/mind/rev_mind,stun = TRUE) + if(!can_be_converted(rev_mind.current)) + return FALSE + if(stun) + if(iscarbon(rev_mind.current)) + var/mob/living/carbon/carbon_mob = rev_mind.current + carbon_mob.silent = max(carbon_mob.silent, 5) + carbon_mob.flash_act(1, 1) + rev_mind.current.Stun(100) + rev_mind.add_antag_datum(/datum/antagonist/rev,rev_team) + rev_mind.special_role = "Revolutionary" + return TRUE + +/datum/antagonist/rev/head/proc/demote() + var/datum/mind/old_owner = owner + var/old_team = rev_team + silent = TRUE + owner.remove_antag_datum(/datum/antagonist/rev/head) + var/datum/antagonist/rev/new_rev = new /datum/antagonist/rev(old_owner) + new_rev.silent = TRUE + old_owner.add_antag_datum(new_rev,old_team) + new_rev.silent = FALSE + to_chat(old_owner, "Revolution has been disappointed of your leader traits! You are a regular revolutionary now!") + +/datum/antagonist/rev/farewell() + if(ishuman(owner.current)) + owner.current.visible_message("[owner.current] looks like they just remembered their real allegiance!", \ + "You are no longer a brainwashed revolutionary! Your memory is hazy from the time you were a rebel...the only thing you remember is the name of the one who brainwashed you...") + else if(issilicon(owner.current)) + owner.current.visible_message("The frame beeps contentedly, purging the hostile memory engram from the MMI before initalizing it.", \ + "The frame's firmware detects and deletes your neural reprogramming! You remember nothing but the name of the one who flashed you.") + +/datum/antagonist/rev/proc/remove_revolutionary(borged, deconverter) + log_attack("[owner.current] (Key: [key_name(owner.current)]) has been deconverted from the revolution by [deconverter] (Key: [key_name(deconverter)])!") + if(borged) + message_admins("[ADMIN_LOOKUPFLW(owner.current)] has been borged while being a [name]") + owner.special_role = null + if(iscarbon(owner.current)) + var/mob/living/carbon/C = owner.current + C.Unconscious(100) + owner.remove_antag_datum(type) + +/datum/antagonist/rev/head/remove_revolutionary(borged,deconverter) + if(!borged) + return + . = ..() + +/datum/antagonist/rev/head/equip_rev() + var/mob/living/carbon/human/H = owner.current + if(!istype(H)) + return + + if(remove_clumsy && owner.assigned_role == "Clown") + to_chat(owner, "Your training has allowed you to overcome your clownish nature, allowing you to wield weapons without harming yourself.") + H.dna.remove_mutation(CLOWNMUT) + + if(give_flash) + var/obj/item/device/assembly/flash/T = new(H) + var/list/slots = list ( + "backpack" = slot_in_backpack, + "left pocket" = slot_l_store, + "right pocket" = slot_r_store + ) + var/where = H.equip_in_one_of_slots(T, slots) + if (!where) + to_chat(H, "The Syndicate were unfortunately unable to get you a flash.") + else + to_chat(H, "The flash in your [where] will help you to persuade the crew to join your cause.") + + if(give_hud) + var/obj/item/organ/cyberimp/eyes/hud/security/syndicate/S = new(H) + S.Insert(H, special = FALSE, drop_if_replaced = FALSE) + to_chat(H, "Your eyes have been implanted with a cybernetic security HUD which will help you keep track of who is mindshield-implanted, and therefore unable to be recruited.") + +/datum/objective_team/revolution + name = "Revolution" + var/list/objectives = list() + var/max_headrevs = 3 + +/datum/objective_team/revolution/proc/update_objectives(initial = FALSE) + var/untracked_heads = SSjob.get_all_heads() + for(var/datum/objective/mutiny/O in objectives) + untracked_heads -= O.target + for(var/datum/mind/M in untracked_heads) + var/datum/objective/mutiny/new_target = new() + new_target.team = src + new_target.target = M + new_target.update_explanation_text() + objectives += new_target + for(var/datum/mind/M in members) + M.objectives |= objectives + + addtimer(CALLBACK(src,.proc/update_objectives),HEAD_UPDATE_PERIOD,TIMER_UNIQUE) + +/datum/objective_team/revolution/proc/head_revolutionaries() + . = list() + for(var/datum/mind/M in members) + if(M.has_antag_datum(/datum/antagonist/rev/head)) + . += M + +/datum/objective_team/revolution/proc/update_heads() + if(SSticker.HasRoundStarted()) + var/list/datum/mind/head_revolutionaries = head_revolutionaries() + var/list/datum/mind/heads = SSjob.get_all_heads() + var/list/sec = SSjob.get_all_sec() + + if(head_revolutionaries.len < max_headrevs && head_revolutionaries.len < round(heads.len - ((8 - sec.len) / 3))) + var/list/datum/mind/non_heads = members - head_revolutionaries + var/list/datum/mind/promotable = list() + for(var/datum/mind/khrushchev in non_heads) + if(khrushchev.current && !khrushchev.current.incapacitated() && !khrushchev.current.restrained() && khrushchev.current.client && khrushchev.current.stat != DEAD) + if(ROLE_REV in khrushchev.current.client.prefs.be_special) + promotable += khrushchev + if(promotable.len) + var/datum/mind/new_leader = pick(promotable) + var/datum/antagonist/rev/rev = new_leader.has_antag_datum(/datum/antagonist/rev) + rev.promote() + + addtimer(CALLBACK(src,.proc/update_heads),HEAD_UPDATE_PERIOD,TIMER_UNIQUE) \ No newline at end of file diff --git a/code/datums/antagonists/wizard.dm b/code/datums/antagonists/wizard.dm index e1d0bd8f1f..253322b43d 100644 --- a/code/datums/antagonists/wizard.dm +++ b/code/datums/antagonists/wizard.dm @@ -5,6 +5,7 @@ /datum/antagonist/wizard name = "Space Wizard" + job_rank = ROLE_WIZARD var/give_objectives = TRUE var/strip = TRUE //strip before equipping var/allow_rename = TRUE @@ -32,6 +33,16 @@ /datum/antagonist/wizard/proc/unregister() SSticker.mode.wizards -= src +/datum/antagonist/wizard/create_team(datum/objective_team/wizard/new_team) + if(!new_team) + return + if(!istype(new_team)) + stack_trace("Wrong team type passed to [type] initialization.") + wiz_team = new_team + +/datum/antagonist/wizard/get_team() + return wiz_team + /datum/objective_team/wizard name = "wizard team" @@ -99,6 +110,8 @@ /datum/antagonist/wizard/on_removal() unregister() + for(var/objective in objectives) + owner.objectives -= objective owner.RemoveAllSpells() // TODO keep track which spells are wizard spells which innate stuff return ..() diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 2f45067b0c..319a235587 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -147,6 +147,10 @@ qdel(A) return LAZYADD(antag_datums, A) + A.create_team(team) + var/datum/objective_team/antag_team = A.get_team() + if(antag_team) + antag_team.add_member(src) A.on_gain() return A @@ -227,15 +231,9 @@ remove_antag_equip() /datum/mind/proc/remove_rev() - if(src in SSticker.mode.revolutionaries) - SSticker.mode.revolutionaries -= src - SSticker.mode.update_rev_icons_removed(src) - if(src in SSticker.mode.head_revolutionaries) - SSticker.mode.head_revolutionaries -= src - SSticker.mode.update_rev_icons_removed(src) + var/datum/antagonist/rev/rev = has_antag_datum(/datum/antagonist/rev) + remove_antag_datum(rev.type) special_role = null - remove_objectives() - remove_antag_equip() /datum/mind/proc/remove_antag_equip() var/list/Mob_Contents = current.get_contents() @@ -258,7 +256,6 @@ SSticker.mode.update_changeling_icons_removed(src) SSticker.mode.update_traitor_icons_removed(src) SSticker.mode.update_cult_icons_removed(src) - SSticker.mode.update_rev_icons_removed(src) /datum/mind/proc/equip_traitor(var/employer = "The Syndicate", var/silent = FALSE) if(!current) @@ -333,8 +330,9 @@ if(iscultist(creator)) SSticker.mode.add_cultist(src) - else if(is_revolutionary_in_general(creator)) - SSticker.mode.add_revolutionary(src) + else if(is_revolutionary(creator)) + var/datum/antagonist/rev/converter = creator.mind.has_antag_datum(/datum/antagonist/rev) + converter.add_revolutionary(src,FALSE) else if(is_servant_of_ratvar(creator)) add_servant_of_ratvar(current) @@ -549,9 +547,10 @@ text = "[text]: " if (assigned_role in GLOB.command_positions) text += "HEAD | not mindshielded | employee | headrev | rev" - else if (src in SSticker.mode.head_revolutionaries) + else if (has_antag_datum(/datum/antagonist/rev/head)) + var/datum/antagonist/rev/head = has_antag_datum(/datum/antagonist/rev/head) var/last_healthy_headrev = TRUE - for(var/datum/mind/I in SSticker.mode.head_revolutionaries) + for(var/datum/mind/I in head.rev_team.head_revolutionaries()) if(I == src) continue var/mob/M = I.current @@ -576,7 +575,7 @@ text += "
Objectives are empty! Set to kill all heads." else if(current.isloyal()) text += "head | MINDSHIELDED | employee | headrev | rev" - else if (src in SSticker.mode.revolutionaries) + else if (has_antag_datum(/datum/antagonist/rev)) text += "head | not mindshielded | employee | headrev | REV" else text += "head | not mindshielded | EMPLOYEE | headrev | rev" @@ -721,8 +720,7 @@ out += sections[i]+"
" - if(((src in SSticker.mode.head_revolutionaries) || (src in SSticker.mode.traitors) || (src in SSticker.mode.syndicates)) && ishuman(current)) - + if(((src in SSticker.mode.traitors) || (src in SSticker.mode.syndicates)) && ishuman(current)) text = "Uplink: give" var/obj/item/device/uplink/U = find_syndicate_uplink() if(U) @@ -938,57 +936,41 @@ switch(href_list["revolution"]) if("clear") remove_rev() - to_chat(current, "You have been brainwashed! You are no longer a revolutionary!") message_admins("[key_name_admin(usr)] has de-rev'ed [current].") log_admin("[key_name(usr)] has de-rev'ed [current].") if("rev") - if(src in SSticker.mode.head_revolutionaries) - SSticker.mode.head_revolutionaries -= src - SSticker.mode.update_rev_icons_removed(src) - to_chat(current, "Revolution has been disappointed of your leader traits! You are a regular revolutionary now!") - else if(!(src in SSticker.mode.revolutionaries)) - to_chat(current, " You are now a revolutionary! Help your cause. Do not harm your fellow freedom fighters. You can identify your comrades by the red \"R\" icons, and your leaders by the blue \"R\" icons. Help them kill the heads to win the revolution!") + if(has_antag_datum(/datum/antagonist/rev/head)) + var/datum/antagonist/rev/head/head = has_antag_datum(/datum/antagonist/rev/head) + head.demote() + else if(!has_antag_datum(/datum/antagonist/rev)) + add_antag_datum(/datum/antagonist/rev) + special_role = "Revolutionary" + message_admins("[key_name_admin(usr)] has rev'ed [current].") + log_admin("[key_name(usr)] has rev'ed [current].") else return - SSticker.mode.revolutionaries += src - SSticker.mode.update_rev_icons_added(src) - special_role = "Revolutionary" - message_admins("[key_name_admin(usr)] has rev'ed [current].") - log_admin("[key_name(usr)] has rev'ed [current].") - + if("headrev") - if(src in SSticker.mode.revolutionaries) - SSticker.mode.revolutionaries -= src - SSticker.mode.update_rev_icons_removed(src) - to_chat(current, "You have proved your devotion to revoltion! Yea are a head revolutionary now!") - else if(!(src in SSticker.mode.head_revolutionaries)) + if(has_antag_datum(/datum/antagonist/rev)) + var/datum/antagonist/rev/rev = has_antag_datum(/datum/antagonist/rev) + rev.promote() + else if(!has_antag_datum(/datum/antagonist/rev/head)) + //what about the team here. + var/datum/antagonist/rev/head/new_head = new /datum/antagonist/rev/head(src) + new_head.give_flash = TRUE + new_head.give_hud = TRUE + new_head.remove_clumsy = TRUE + add_antag_datum(new_head) to_chat(current, "You are a member of the revolutionaries' leadership now!") else return - if (SSticker.mode.head_revolutionaries.len>0) - // copy targets - var/datum/mind/valid_head = locate() in SSticker.mode.head_revolutionaries - if (valid_head) - for (var/datum/objective/mutiny/O in valid_head.objectives) - var/datum/objective/mutiny/rev_obj = new - rev_obj.owner = src - rev_obj.target = O.target - rev_obj.explanation_text = "Assassinate [O.target.name], the [O.target.assigned_role]." - objectives += rev_obj - SSticker.mode.greet_revolutionary(src,0) - SSticker.mode.head_revolutionaries += src - SSticker.mode.update_rev_icons_added(src) special_role = "Head Revolutionary" message_admins("[key_name_admin(usr)] has head-rev'ed [current].") log_admin("[key_name(usr)] has head-rev'ed [current].") - if("autoobjectives") - SSticker.mode.forge_revolutionary_objectives(src) - SSticker.mode.greet_revolutionary(src,0) - to_chat(usr, "The objectives for revolution have been generated and shown to [key]") - if("flash") - if (!SSticker.mode.equip_revolutionary(current)) + var/datum/antagonist/rev/head/head = has_antag_datum(/datum/antagonist/rev/head) + if(!head.equip_rev()) to_chat(usr, "Spawning flash failed!") if("takeflash") @@ -1447,31 +1429,12 @@ to_chat(H, "Spawning an amulet from your Master failed.") /datum/mind/proc/make_Rev() - if (SSticker.mode.head_revolutionaries.len>0) - // copy targets - var/datum/mind/valid_head = locate() in SSticker.mode.head_revolutionaries - if (valid_head) - for (var/datum/objective/mutiny/O in valid_head.objectives) - var/datum/objective/mutiny/rev_obj = new - rev_obj.owner = src - rev_obj.target = O.target - rev_obj.explanation_text = "Assassinate [O.target.current.real_name], the [O.target.assigned_role]." - objectives += rev_obj - SSticker.mode.greet_revolutionary(src,0) - SSticker.mode.head_revolutionaries += src - SSticker.mode.update_rev_icons_added(src) + var/datum/antagonist/rev/head/head = new(src) + head.give_flash = TRUE + head.give_hud = TRUE + add_antag_datum(head) special_role = "Head Revolutionary" - SSticker.mode.forge_revolutionary_objectives(src) - SSticker.mode.greet_revolutionary(src,0) - - var/list/L = current.get_contents() - var/obj/item/device/assembly/flash/flash = locate() in L - qdel(flash) - take_uplink() - var/fail = 0 - fail |= !SSticker.mode.equip_revolutionary(current) - /datum/mind/proc/AddSpell(obj/effect/proc_holder/spell/S) spell_list += S S.action.Grant(current) diff --git a/code/game/gamemodes/antag_spawner.dm b/code/game/gamemodes/antag_spawner.dm index 8b33863381..ad989eb2fb 100644 --- a/code/game/gamemodes/antag_spawner.dm +++ b/code/game/gamemodes/antag_spawner.dm @@ -80,7 +80,7 @@ app.wiz_team = master_antag.wiz_team app.master = wizard app.school = school - master_antag.wiz_team.members += app_mind + master_antag.wiz_team.add_member(app_mind) app_mind.add_antag_datum(app) //TODO Kill these if possible app_mind.assigned_role = "Apprentice" diff --git a/code/game/gamemodes/brother/traitor_bro.dm b/code/game/gamemodes/brother/traitor_bro.dm index ca2c858310..ff83a3764c 100644 --- a/code/game/gamemodes/brother/traitor_bro.dm +++ b/code/game/gamemodes/brother/traitor_bro.dm @@ -79,7 +79,7 @@ var/datum/mind/bro = pick(possible_brothers) possible_brothers -= bro antag_candidates -= bro - team.members += bro + team.add_member(bro) bro.restricted_roles = restricted_jobs log_game("[bro.key] (ckey) has been selected as a Brother") pre_brother_teams += team diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 1bf8eadb2f..694255702a 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -184,6 +184,8 @@ /datum/game_mode/proc/check_finished(force_ending) //to be called by SSticker + if(!SSticker.setup_done) + return FALSE if(replacementmode && round_converted == 2) return replacementmode.check_finished() if(SSshuttle.emergency && (SSshuttle.emergency.mode == SHUTTLE_ENDGAME)) @@ -196,7 +198,7 @@ if(!continuous_sanity_checked) //make sure we have antags to be checking in the first place for(var/mob/Player in GLOB.mob_list) if(Player.mind) - if(Player.mind.special_role) + if(Player.mind.special_role || LAZYLEN(Player.mind.antag_datums)) continuous_sanity_checked = 1 return 0 if(!continuous_sanity_checked) @@ -212,7 +214,7 @@ for(var/mob/Player in GLOB.living_mob_list) if(Player.mind && Player.stat != DEAD && !isnewplayer(Player) &&!isbrain(Player) && Player.client) - if(Player.mind.special_role) //Someone's still antaging! + if(Player.mind.special_role || LAZYLEN(Player.mind.antag_datums)) //Someone's still antaging! living_antag_player = Player return 0 @@ -392,43 +394,6 @@ if(P.client && P.ready == PLAYER_READY_TO_PLAY) . ++ -/////////////////////////////////// -//Keeps track of all living heads// -/////////////////////////////////// -/datum/game_mode/proc/get_living_heads() - . = list() - for(var/mob/living/carbon/human/player in GLOB.mob_list) - if(player.stat != DEAD && player.mind && (player.mind.assigned_role in GLOB.command_positions)) - . |= player.mind - - -//////////////////////////// -//Keeps track of all heads// -//////////////////////////// -/datum/game_mode/proc/get_all_heads() - . = list() - for(var/mob/player in GLOB.mob_list) - if(player.mind && (player.mind.assigned_role in GLOB.command_positions)) - . |= player.mind - -////////////////////////////////////////////// -//Keeps track of all living security members// -////////////////////////////////////////////// -/datum/game_mode/proc/get_living_sec() - . = list() - for(var/mob/living/carbon/human/player in GLOB.mob_list) - if(player.stat != DEAD && player.mind && (player.mind.assigned_role in GLOB.security_positions)) - . |= player.mind - -//////////////////////////////////////// -//Keeps track of all security members// -//////////////////////////////////////// -/datum/game_mode/proc/get_all_sec() - . = list() - for(var/mob/living/carbon/human/player in GLOB.mob_list) - if(player.mind && (player.mind.assigned_role in GLOB.security_positions)) - . |= player.mind - ////////////////////////// //Reports player logouts// ////////////////////////// @@ -529,19 +494,11 @@ return max(0, enemy_minimum_age - C.player_age) -/datum/game_mode/proc/replace_jobbaned_player(mob/living/M, role_type, pref) - var/list/mob/dead/observer/candidates = pollCandidatesForMob("Do you want to play as a [role_type]?", "[role_type]", null, pref, 50, M) - var/mob/dead/observer/theghost = null - if(candidates.len) - theghost = pick(candidates) - to_chat(M, "Your mob has been taken over by a ghost! Appeal your job ban if you want to avoid this in the future!") - message_admins("[key_name_admin(theghost)] has taken control of ([key_name_admin(M)]) to replace a jobbaned player.") - M.ghostize(0) - M.key = theghost.key - /datum/game_mode/proc/remove_antag_for_borging(datum/mind/newborgie) SSticker.mode.remove_cultist(newborgie, 0, 0) - SSticker.mode.remove_revolutionary(newborgie, 0) + var/datum/antagonist/rev/rev = newborgie.has_antag_datum(/datum/antagonist/rev) + if(rev) + rev.remove_revolutionary(TRUE) /datum/game_mode/proc/generate_station_goals() var/list/possible = list() diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm index effe2212a7..e4fca6c240 100644 --- a/code/game/gamemodes/objective.dm +++ b/code/game/gamemodes/objective.dm @@ -711,7 +711,7 @@ GLOBAL_LIST_EMPTY(possible_items_special) var/needed_heads = rand(min_lings,GLOB.command_positions.len) needed_heads = min(SSticker.mode.changelings.len,needed_heads) - var/list/heads = SSticker.mode.get_living_heads() + var/list/heads = SSjob.get_living_heads() for(var/datum/mind/head in heads) if(head in SSticker.mode.changelings) //Looking at you HoP. continue diff --git a/code/game/gamemodes/objective_team.dm b/code/game/gamemodes/objective_team.dm index ba6b2546ca..7789a167c7 100644 --- a/code/game/gamemodes/objective_team.dm +++ b/code/game/gamemodes/objective_team.dm @@ -7,7 +7,18 @@ /datum/objective_team/New(starting_members) . = ..() if(starting_members) + if(islist(starting_members)) + for(var/datum/mind/M in starting_members) + add_member(M) + else + add_member(starting_members) members += starting_members /datum/objective_team/proc/is_solo() return members.len == 1 + +/datum/objective_team/proc/add_member(datum/mind/new_member) + members |= new_member + +/datum/objective_team/proc/remove_member(datum/mind/member) + members -= member \ No newline at end of file diff --git a/code/game/gamemodes/revolution/revolution.dm b/code/game/gamemodes/revolution/revolution.dm index ce5d2b7f4b..c2ce2a2d78 100644 --- a/code/game/gamemodes/revolution/revolution.dm +++ b/code/game/gamemodes/revolution/revolution.dm @@ -6,9 +6,6 @@ // this will also check they're not a head, so it can just be called freely // If the game somtimes isn't registering a win properly, then SSticker.mode.check_win() isn't being called somewhere. -/datum/game_mode - var/list/datum/mind/head_revolutionaries = list() - var/list/datum/mind/revolutionaries = list() /datum/game_mode/revolution name = "revolution" @@ -29,7 +26,8 @@ var/finished = 0 var/check_counter = 0 var/max_headrevs = 3 - var/list/datum/mind/heads_to_kill = list() + var/datum/objective_team/revolution/revolution + var/list/datum/mind/headrev_candidates = list() /////////////////////////// //Announces the game type// @@ -55,23 +53,22 @@ break var/datum/mind/lenin = pick(antag_candidates) antag_candidates -= lenin - head_revolutionaries += lenin + headrev_candidates += lenin lenin.restricted_roles = restricted_jobs - if(head_revolutionaries.len < required_enemies) + if(headrev_candidates.len < required_enemies) return FALSE return TRUE /datum/game_mode/revolution/post_setup() - var/list/heads = get_living_heads() - var/list/sec = get_living_sec() + var/list/heads = SSjob.get_living_heads() + var/list/sec = SSjob.get_living_sec() var/weighted_score = min(max(round(heads.len - ((8 - sec.len) / 3)),1),max_headrevs) - - for(var/datum/mind/rev_mind in head_revolutionaries) //People with return to lobby may still be in the lobby. Let's pick someone else in that case. + for(var/datum/mind/rev_mind in headrev_candidates) //People with return to lobby may still be in the lobby. Let's pick someone else in that case. if(isnewplayer(rev_mind.current)) - head_revolutionaries -= rev_mind + headrev_candidates -= rev_mind var/list/newcandidates = shuffle(antag_candidates) if(newcandidates.len == 0) continue @@ -87,24 +84,27 @@ antag_candidates += lenin //Let's let them keep antag chance for other antags continue - head_revolutionaries += lenin + headrev_candidates += lenin break - while(weighted_score < head_revolutionaries.len) //das vi danya - var/datum/mind/trotsky = pick(head_revolutionaries) + while(weighted_score < headrev_candidates.len) //das vi danya + var/datum/mind/trotsky = pick(headrev_candidates) antag_candidates += trotsky - head_revolutionaries -= trotsky - update_rev_icons_removed(trotsky) + headrev_candidates -= trotsky - for(var/datum/mind/rev_mind in head_revolutionaries) + revolution = new() + + for(var/datum/mind/rev_mind in headrev_candidates) log_game("[rev_mind.key] (ckey) has been selected as a head rev") - for(var/datum/mind/head_mind in heads) - mark_for_death(rev_mind, head_mind) + var/datum/antagonist/rev/head/new_head = new(rev_mind) + new_head.give_flash = TRUE + new_head.give_hud = TRUE + new_head.remove_clumsy = TRUE + rev_mind.add_antag_datum(new_head,revolution) - addtimer(CALLBACK(src, .proc/equip_revolutionary, rev_mind.current), rand(10, 100)) + revolution.update_objectives() + revolution.update_heads() - for(var/datum/mind/rev_mind in head_revolutionaries) - greet_revolutionary(rev_mind) SSshuttle.registerHostileEnvironment(src) ..() @@ -113,104 +113,10 @@ check_counter++ if(check_counter >= 5) if(!finished) - check_heads() SSticker.mode.check_win() check_counter = 0 return FALSE - -/datum/game_mode/proc/forge_revolutionary_objectives(datum/mind/rev_mind) - var/list/heads = get_living_heads() - for(var/datum/mind/head_mind in heads) - var/datum/objective/mutiny/rev_obj = new - rev_obj.owner = rev_mind - rev_obj.target = head_mind - rev_obj.explanation_text = "Assassinate or exile [head_mind.name], the [head_mind.assigned_role]." - rev_mind.objectives += rev_obj - -/datum/game_mode/proc/greet_revolutionary(datum/mind/rev_mind, you_are=1) - update_rev_icons_added(rev_mind) - if (you_are) - to_chat(rev_mind.current, "You are a member of the revolutionaries' leadership!") - rev_mind.special_role = "Head Revolutionary" - rev_mind.announce_objectives() - -///////////////////////////////////////////////////////////////////////////////// -//This are equips the rev heads with their gear, and makes the clown not clumsy// -///////////////////////////////////////////////////////////////////////////////// -/datum/game_mode/proc/equip_revolutionary(mob/living/carbon/human/mob) - if(!istype(mob)) - return - - if (mob.mind) - if (mob.mind.assigned_role == "Clown") - to_chat(mob, "Your training has allowed you to overcome your clownish nature, allowing you to wield weapons without harming yourself.") - mob.dna.remove_mutation(CLOWNMUT) - - - var/obj/item/device/assembly/flash/T = new(mob) - var/obj/item/organ/cyberimp/eyes/hud/security/syndicate/S = new(mob) - - var/list/slots = list ( - "backpack" = slot_in_backpack, - "left pocket" = slot_l_store, - "right pocket" = slot_r_store - ) - var/where = mob.equip_in_one_of_slots(T, slots) - S.Insert(mob, special = FALSE, drop_if_replaced = FALSE) - to_chat(mob, "Your eyes have been implanted with a cybernetic security HUD which will help you keep track of who is mindshield-implanted, and therefore unable to be recruited.") - - if (!where) - to_chat(mob, "The Syndicate were unfortunately unable to get you a flash.") - else - to_chat(mob, "The flash in your [where] will help you to persuade the crew to join your cause.") - return TRUE - -///////////////////////////////// -//Gives head revs their targets// -///////////////////////////////// -/datum/game_mode/revolution/proc/mark_for_death(datum/mind/rev_mind, datum/mind/head_mind) - var/datum/objective/mutiny/rev_obj = new - rev_obj.owner = rev_mind - rev_obj.target = head_mind - rev_obj.explanation_text = "Assassinate [head_mind.name], the [head_mind.assigned_role]." - rev_mind.objectives += rev_obj - heads_to_kill += head_mind - -//////////////////////////////////////////// -//Checks if new heads have joined midround// -//////////////////////////////////////////// -/datum/game_mode/revolution/proc/check_heads() - var/list/heads = get_all_heads() - var/list/sec = get_all_sec() - if(heads_to_kill.len < heads.len) - var/list/new_heads = heads - heads_to_kill - for(var/datum/mind/head_mind in new_heads) - for(var/datum/mind/rev_mind in head_revolutionaries) - mark_for_death(rev_mind, head_mind) - - if(head_revolutionaries.len < max_headrevs && head_revolutionaries.len < round(heads.len - ((8 - sec.len) / 3))) - latejoin_headrev() - -/////////////////////////////// -//Adds a new headrev midround// -/////////////////////////////// -/datum/game_mode/revolution/proc/latejoin_headrev() - if(revolutionaries) //Head Revs are not in this list - var/list/promotable_revs = list() - for(var/datum/mind/khrushchev in revolutionaries) - if(khrushchev.current && !khrushchev.current.incapacitated() && !khrushchev.current.restrained() && khrushchev.current.client && khrushchev.current.stat != DEAD) - if(ROLE_REV in khrushchev.current.client.prefs.be_special) - promotable_revs += khrushchev - if(promotable_revs.len) - var/datum/mind/stalin = pick(promotable_revs) - revolutionaries -= stalin - head_revolutionaries += stalin - log_game("[stalin.key] (ckey) has been promoted to a head rev") - equip_revolutionary(stalin.current) - forge_revolutionary_objectives(stalin) - greet_revolutionary(stalin) - ////////////////////////////////////// //Checks if the revs have won or not// ////////////////////////////////////// @@ -238,93 +144,25 @@ //Deals with converting players to the revolution// /////////////////////////////////////////////////// /proc/is_revolutionary(mob/M) - return M && istype(M) && M.mind && SSticker && SSticker.mode && M.mind in SSticker.mode.revolutionaries + return M && istype(M) && M.mind && M.mind.has_antag_datum(/datum/antagonist/rev) /proc/is_head_revolutionary(mob/M) - return M && istype(M) && M.mind && SSticker && SSticker.mode && M.mind in SSticker.mode.head_revolutionaries - -/proc/is_revolutionary_in_general(mob/M) - return is_revolutionary(M) || is_head_revolutionary(M) - -/datum/game_mode/proc/add_revolutionary(datum/mind/rev_mind) - if(rev_mind.assigned_role in GLOB.command_positions) - return FALSE - var/mob/living/carbon/human/H = rev_mind.current//Check to see if the potential rev is implanted - if(H.isloyal()) - return FALSE - if((rev_mind in revolutionaries) || (rev_mind in head_revolutionaries)) - return FALSE - if(rev_mind.unconvertable) - return FALSE - revolutionaries += rev_mind - if(iscarbon(rev_mind.current)) - var/mob/living/carbon/carbon_mob = rev_mind.current - carbon_mob.silent = max(carbon_mob.silent, 5) - carbon_mob.flash_act(1, 1) - rev_mind.current.Stun(100) - to_chat(rev_mind.current, " You are now a revolutionary! Help your cause. Do not harm your fellow freedom fighters. You can identify your comrades by the red \"R\" icons, and your leaders by the blue \"R\" icons. Help them kill the heads to win the revolution!") - rev_mind.current.log_message("Has been converted to the revolution!", INDIVIDUAL_ATTACK_LOG) - rev_mind.special_role = "Revolutionary" - update_rev_icons_added(rev_mind) - if(jobban_isbanned(rev_mind.current, ROLE_REV)) - INVOKE_ASYNC(src, .proc/replace_jobbaned_player, rev_mind.current, ROLE_REV, ROLE_REV) - return TRUE -////////////////////////////////////////////////////////////////////////////// -//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. -////////////////////////////////////////////////////////////////////////////// -/datum/game_mode/proc/remove_revolutionary(datum/mind/rev_mind , beingborged, deconverter) - var/remove_head = 0 - if(beingborged && (rev_mind in head_revolutionaries)) - head_revolutionaries -= rev_mind - remove_head = 1 - - if((rev_mind in revolutionaries) || remove_head) - revolutionaries -= rev_mind - rev_mind.special_role = null - log_attack("[rev_mind.current] (Key: [key_name(rev_mind.current)]) has been deconverted from the revolution by [deconverter] (Key: [key_name(deconverter)])!") - - if(beingborged) - rev_mind.current.visible_message("The frame beeps contentedly, purging the hostile memory engram from the MMI before initalizing it.", \ - "The frame's firmware detects and deletes your neural reprogramming! You remember nothing[remove_head ? "." : " but the name of the one who flashed you."]") - message_admins("[ADMIN_LOOKUPFLW(rev_mind.current)] has been borged while being a [remove_head ? "leader" : " member"] of the revolution.") - else - rev_mind.current.visible_message("[rev_mind.current] looks like they just remembered their real allegiance!", \ - "You are no longer a brainwashed revolutionary! Your memory is hazy from the time you were a rebel...the only thing you remember is the name of the one who brainwashed you...") - rev_mind.current.Unconscious(100) - update_rev_icons_removed(rev_mind) - -///////////////////////////////////// -//Adds the rev hud to a new convert// -///////////////////////////////////// -/datum/game_mode/proc/update_rev_icons_added(datum/mind/rev_mind) - var/datum/atom_hud/antag/revhud = GLOB.huds[ANTAG_HUD_REV] - revhud.join_hud(rev_mind.current) - set_antag_hud(rev_mind.current, ((rev_mind in head_revolutionaries) ? "rev_head" : "rev")) - -///////////////////////////////////////// -//Removes the hud from deconverted revs// -///////////////////////////////////////// -/datum/game_mode/proc/update_rev_icons_removed(datum/mind/rev_mind) - var/datum/atom_hud/antag/revhud = GLOB.huds[ANTAG_HUD_REV] - revhud.leave_hud(rev_mind.current) - set_antag_hud(rev_mind.current, null) + return M && istype(M) && M.mind && M.mind.has_antag_datum(/datum/antagonist/rev/head) ////////////////////////// //Checks for rev victory// ////////////////////////// /datum/game_mode/revolution/proc/check_rev_victory() - for(var/datum/mind/rev_mind in head_revolutionaries) - for(var/datum/objective/mutiny/objective in rev_mind.objectives) - if(!(objective.check_completion())) - return FALSE - - return TRUE + for(var/datum/objective/mutiny/objective in revolution.objectives) + if(!(objective.check_completion())) + return FALSE + return TRUE ///////////////////////////// //Checks for a head victory// ///////////////////////////// /datum/game_mode/revolution/proc/check_heads_victory() - for(var/datum/mind/rev_mind in head_revolutionaries) + for(var/datum/mind/rev_mind in revolution.head_revolutionaries()) var/turf/T = get_turf(rev_mind.current) if(!considered_afk(rev_mind) && considered_alive(rev_mind) && (T.z in GLOB.station_z_levels)) if(ishuman(rev_mind.current)) @@ -351,33 +189,35 @@ /datum/game_mode/proc/auto_declare_completion_revolution() var/list/targets = list() - if(head_revolutionaries.len || istype(SSticker.mode, /datum/game_mode/revolution)) + var/list/datum/mind/headrevs = get_antagonists(/datum/antagonist/rev/head) + var/list/datum/mind/revs = get_antagonists(/datum/antagonist/rev,TRUE) + if(headrevs.len) var/num_revs = 0 var/num_survivors = 0 for(var/mob/living/carbon/survivor in GLOB.living_mob_list) if(survivor.ckey) num_survivors++ if(survivor.mind) - if((survivor.mind in head_revolutionaries) || (survivor.mind in revolutionaries)) + if(is_revolutionary(survivor)) num_revs++ if(num_survivors) to_chat(world, "[GLOB.TAB]Command's Approval Rating: [100 - round((num_revs/num_survivors)*100, 0.1)]%" ) var/text = "
The head revolutionaries were:" - for(var/datum/mind/headrev in head_revolutionaries) + for(var/datum/mind/headrev in headrevs) text += printplayer(headrev, 1) text += "
" to_chat(world, text) - if(revolutionaries.len || istype(SSticker.mode, /datum/game_mode/revolution)) + if(revs.len) var/text = "
The revolutionaries were:" - for(var/datum/mind/rev in revolutionaries) + for(var/datum/mind/rev in revs) text += printplayer(rev, 1) text += "
" to_chat(world, text) - if( head_revolutionaries.len || revolutionaries.len || istype(SSticker.mode, /datum/game_mode/revolution) ) + if(revs.len || headrevs.len) var/text = "
The heads of staff were:" - var/list/heads = get_all_heads() + var/list/heads = SSjob.get_all_heads() for(var/datum/mind/head in heads) var/target = (head in targets) if(target) diff --git a/code/game/objects/items/grenades/plastic.dm b/code/game/objects/items/grenades/plastic.dm index e2a8be7936..4b7c8985a6 100644 --- a/code/game/objects/items/grenades/plastic.dm +++ b/code/game/objects/items/grenades/plastic.dm @@ -137,7 +137,7 @@ message_say = "FOR THE HIVE!" else if(role == "cultist") message_say = "FOR NAR-SIE!" - else if(role == "revolutionary" || role == "head revolutionary") + else if(is_revolutionary(user)) message_say = "VIVA LA REVOLUTION!" user.say(message_say) explosion(user,0,2,0) //Cheap explosion imitation because putting prime() here causes runtimes @@ -183,7 +183,7 @@ message_say = "FOR THE HIVE!" else if(role == "cultist") message_say = "FOR NAR-SIE!" - else if(role == "revolutionary" || role == "head revolutionary") + else if(is_revolutionary(user)) message_say = "VIVA LA REVOLUTION!" user.say(message_say) target = user diff --git a/code/game/objects/items/implants/implant_loyality.dm b/code/game/objects/items/implants/implant_loyality.dm index ffaebf5a63..1edc0dc93c 100644 --- a/code/game/objects/items/implants/implant_loyality.dm +++ b/code/game/objects/items/implants/implant_loyality.dm @@ -19,14 +19,18 @@ /obj/item/implant/mindshield/implant(mob/living/target, mob/user, silent = 0) if(..()) - if((target.mind in (SSticker.mode.head_revolutionaries)) || target.mind.unconvertable) + if(!target.mind) + return TRUE + if(target.mind.has_antag_datum(/datum/antagonist/rev/head) || target.mind.unconvertable) if(!silent) target.visible_message("[target] seems to resist the implant!", "You feel something interfering with your mental conditioning, but you resist it!") removed(target, 1) qdel(src) return FALSE - if(target.mind in SSticker.mode.revolutionaries) - SSticker.mode.remove_revolutionary(target.mind, FALSE, user) + + var/datum/antagonist/rev/rev = target.mind.has_antag_datum(/datum/antagonist/rev) + if(rev) + rev.remove_revolutionary(FALSE, user) if(!silent) if(target.mind in SSticker.mode.cult) to_chat(target, "You feel something interfering with your mental conditioning, but you resist it!") diff --git a/code/modules/admin/player_panel.dm b/code/modules/admin/player_panel.dm index 95f4bd55c7..f40b85f7d7 100644 --- a/code/modules/admin/player_panel.dm +++ b/code/modules/admin/player_panel.dm @@ -410,9 +410,10 @@ dat += "in [disk_loc.loc] at ([disk_loc.x], [disk_loc.y], [disk_loc.z])" dat += "" - if(SSticker.mode.head_revolutionaries.len || SSticker.mode.revolutionaries.len) + var/list/revs = get_antagonists(/datum/antagonist/rev) + if(revs.len > 0) dat += "
" - for(var/datum/mind/N in SSticker.mode.head_revolutionaries) + for(var/datum/mind/N in get_antagonists(/datum/antagonist/rev/head)) var/mob/M = N.current if(!M) dat += "" @@ -421,14 +422,14 @@ dat += "" dat += "" dat += "" - for(var/datum/mind/N in SSticker.mode.revolutionaries) + for(var/datum/mind/N in get_antagonists(/datum/antagonist/rev,TRUE)) var/mob/M = N.current if(M) dat += "" dat += "" dat += "" dat += "
Revolutionaries
[N.name]([N.key])Head Revolutionary body destroyed!
[M.real_name] (Leader)[M.client ? "" : " (No Client)"][M.stat == DEAD ? " (DEAD)" : ""]PMFLW
[M.real_name][M.client ? "" : " (No Client)"][M.stat == DEAD ? " (DEAD)" : ""]PMFLW
" - for(var/datum/mind/N in SSticker.mode.get_living_heads()) + for(var/datum/mind/N in SSjob.get_living_heads()) var/mob/M = N.current if(M) dat += "" diff --git a/code/modules/assembly/flash.dm b/code/modules/assembly/flash.dm index 2dd7b71cc5..3a36b4cdd0 100644 --- a/code/modules/assembly/flash.dm +++ b/code/modules/assembly/flash.dm @@ -146,27 +146,20 @@ /obj/item/device/assembly/flash/proc/terrible_conversion_proc(mob/living/carbon/human/H, mob/user) if(istype(H) && ishuman(user) && H.stat != DEAD) - if(user.mind && (user.mind in SSticker.mode.head_revolutionaries)) - if(H.client) - if(H.stat == CONSCIOUS) - H.mind_initialize() //give them a mind datum if they don't have one. - var/resisted - if(!H.isloyal()) - if(user.mind in SSticker.mode.head_revolutionaries) - if(SSticker.mode.add_revolutionary(H.mind)) - H.Stun(60) - times_used -- //Flashes less likely to burn out for headrevs when used for conversion - else - resisted = 1 - else - resisted = 1 - - if(resisted) - to_chat(user, "This mind seems resistant to the flash!") - else - to_chat(user, "They must be conscious before you can convert them!") - else + if(user.mind) + var/datum/antagonist/rev/head/converter = user.mind.has_antag_datum(/datum/antagonist/rev/head) + if(!converter) + return + if(!H.client) to_chat(user, "This mind is so vacant that it is not susceptible to influence!") + return + if(H.stat != CONSCIOUS) + to_chat(user, "They must be conscious before you can convert them!") + return + if(converter.add_revolutionary(H.mind)) + times_used -- //Flashes less likely to burn out for headrevs when used for conversion + else + to_chat(user, "This mind seems resistant to the flash!") /obj/item/device/assembly/flash/cyborg diff --git a/code/modules/mining/mine_items.dm b/code/modules/mining/mine_items.dm index 38381ae9c5..9625a47cf8 100644 --- a/code/modules/mining/mine_items.dm +++ b/code/modules/mining/mine_items.dm @@ -70,7 +70,7 @@ req_access = list(ACCESS_MINING) // should slow the ashwalkers down. /obj/machinery/computer/shuttle/mining/attack_hand(mob/user) - if((user.z in GLOB.station_z_levels) && user.mind && (user.mind in SSticker.mode.head_revolutionaries) && !(user.mind in dumb_rev_heads)) + if((user.z in GLOB.station_z_levels) && user.mind && is_head_revolutionary(user) && !(user.mind in dumb_rev_heads)) to_chat(user, "You get a feeling that leaving the station might be a REALLY dumb idea...") dumb_rev_heads += user.mind return diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 10b2436f7c..41e6754493 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1479,7 +1479,9 @@ H.adjust_blurriness(10) if(prob(I.force + ((100 - H.health)/2)) && H != user) - SSticker.mode.remove_revolutionary(H.mind, FALSE, user) + var/datum/antagonist/rev/rev = H.mind.has_antag_datum(/datum/antagonist/rev) + if(rev) + rev.remove_revolutionary(FALSE, user) if(bloody) //Apply blood if(H.wear_mask) diff --git a/code/modules/mob/living/silicon/login.dm b/code/modules/mob/living/silicon/login.dm index f95949b824..82c1435344 100644 --- a/code/modules/mob/living/silicon/login.dm +++ b/code/modules/mob/living/silicon/login.dm @@ -1,5 +1,7 @@ /mob/living/silicon/Login() if(mind && SSticker.mode) SSticker.mode.remove_cultist(mind, 0, 0) - SSticker.mode.remove_revolutionary(mind, TRUE) + var/datum/antagonist/rev/rev = mind.has_antag_datum(/datum/antagonist/rev) + if(rev) + rev.remove_revolutionary(TRUE) ..() diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 9447b32daa..a605d5e479 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -356,7 +356,7 @@ It's fairly easy to fix if dealing with single letters but not so much with comp if(M.mind && M.mind.special_role)//If they have a mind and special role, they are some type of traitor or antagonist. switch(SSticker.mode.config_tag) if("revolution") - if((M.mind in SSticker.mode.head_revolutionaries) || (M.mind in SSticker.mode.revolutionaries)) + if(is_revolutionary(M)) return 2 if("cult") if(M.mind in SSticker.mode.cult) diff --git a/tgstation.dme b/tgstation.dme index 4ebf07eafa..903f4878c8 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -299,15 +299,16 @@ #include "code\datums\world_topic.dm" #include "code\datums\actions\flightsuit.dm" #include "code\datums\actions\ninja.dm" +#include "code\datums\antagonists\abductor.dm" #include "code\datums\antagonists\antag_datum.dm" -#include "code\datums\antagonists\datum_abductor.dm" -#include "code\datums\antagonists\datum_brother.dm" -#include "code\datums\antagonists\datum_clockcult.dm" -#include "code\datums\antagonists\datum_cult.dm" -#include "code\datums\antagonists\datum_internal_affairs.dm" +#include "code\datums\antagonists\brother.dm" +#include "code\datums\antagonists\clockcult.dm" +#include "code\datums\antagonists\cult.dm" #include "code\datums\antagonists\datum_traitor.dm" #include "code\datums\antagonists\devil.dm" +#include "code\datums\antagonists\internal_affairs.dm" #include "code\datums\antagonists\ninja.dm" +#include "code\datums\antagonists\revolution.dm" #include "code\datums\antagonists\wizard.dm" #include "code\datums\components\_component.dm" #include "code\datums\components\archaeology.dm"
Target(s)Location
[M.real_name][M.client ? "" : " (No Client)"][M.stat == DEAD ? " (DEAD)" : ""]