diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 356eb81208f..7858d9b58ae 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -233,6 +233,10 @@ return 0 */ +///Called when a mob changes Z-level +/datum/game_mode/proc/transit_z(mob/living/player) + return + /datum/game_mode/proc/num_players() . = 0 for(var/mob/new_player/P in GLOB.player_list) diff --git a/code/game/gamemodes/revolution/revolution.dm b/code/game/gamemodes/revolution/revolution.dm index 33927dc4a22..dc4acf82aa7 100644 --- a/code/game/gamemodes/revolution/revolution.dm +++ b/code/game/gamemodes/revolution/revolution.dm @@ -19,7 +19,6 @@ recommended_enemies = 3 var/finished = 0 - var/check_counter = 0 var/max_headrevs = 3 var/list/datum/mind/heads_to_kill = list() var/list/possible_revolutionaries = list() @@ -41,14 +40,13 @@ if(GLOB.configuration.gamemode.prevent_mindshield_antags) restricted_jobs += protected_jobs - for(var/i=1 to max_headrevs) if(possible_revolutionaries.len==0) break - var/datum/mind/lenin = pick(possible_revolutionaries) - possible_revolutionaries -= lenin - head_revolutionaries += lenin - lenin.restricted_roles = restricted_jobs + var/datum/mind/new_headrev = pick(possible_revolutionaries) + possible_revolutionaries -= new_headrev + head_revolutionaries += new_headrev + new_headrev.restricted_roles = restricted_jobs if(head_revolutionaries.len < required_enemies) return FALSE @@ -62,10 +60,9 @@ var/weighted_score = min(max(round(heads.len - ((8 - sec.len) / 3)),1),max_headrevs) while(weighted_score < head_revolutionaries.len) //das vi danya - var/datum/mind/trotsky = pick(head_revolutionaries) - possible_revolutionaries += trotsky - head_revolutionaries -= trotsky - update_rev_icons_removed(trotsky) + var/datum/mind/removable_headrev = pick_n_take(head_revolutionaries) + possible_revolutionaries += removable_headrev + update_rev_icons_removed(removable_headrev) for(var/datum/mind/rev_mind in head_revolutionaries) log_game("[key_name(rev_mind)] has been selected as a head rev") @@ -81,16 +78,14 @@ SSshuttle.emergencyNoEscape = 1 ..() - -/datum/game_mode/revolution/process() - check_counter++ - if(check_counter >= 5) - if(!finished) - check_heads() +////////////////////////////////////////////////////////////////////////// +//Check if heads and head revolutionaries are still alive and on Z-level// +////////////////////////////////////////////////////////////////////////// +/datum/game_mode/revolution/transit_z(mob/living/player) + if(!finished) + var/list/heads = get_all_heads() + if(player.mind && ((player.mind in heads) || (player.mind in head_revolutionaries))) 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() @@ -115,21 +110,21 @@ ///////////////////////////////////////////////////////////////////////////////// //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)) +/datum/game_mode/proc/equip_revolutionary(mob/living/carbon/human/revolutionary) + if(!istype(revolutionary)) 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.SetSEState(GLOB.clumsyblock, FALSE) - singlemutcheck(mob, GLOB.clumsyblock, MUTCHK_FORCED) + if(revolutionary.mind) + if(revolutionary.mind.assigned_role == "Clown") + to_chat(revolutionary, "Your training has allowed you to overcome your clownish nature, allowing you to wield weapons without harming yourself.") + revolutionary.dna.SetSEState(GLOB.clumsyblock, FALSE) + singlemutcheck(revolutionary, GLOB.clumsyblock, MUTCHK_FORCED) var/datum/action/innate/toggle_clumsy/A = new - A.Grant(mob) + A.Grant(revolutionary) - var/obj/item/flash/T = new(mob) - var/obj/item/toy/crayon/spraycan/R = new(mob) - var/obj/item/clothing/glasses/hud/security/chameleon/C = new(mob) + var/obj/item/flash/T = new(revolutionary) + var/obj/item/toy/crayon/spraycan/R = new(revolutionary) + var/obj/item/clothing/glasses/hud/security/chameleon/C = new(revolutionary) var/list/slots = list ( "backpack" = slot_in_backpack, @@ -138,21 +133,21 @@ "left hand" = slot_l_hand, "right hand" = slot_r_hand, ) - var/where = mob.equip_in_one_of_slots(T, slots) - var/where2 = mob.equip_in_one_of_slots(C, slots) - mob.equip_in_one_of_slots(R,slots) + var/where = revolutionary.equip_in_one_of_slots(T, slots) + var/where2 = revolutionary.equip_in_one_of_slots(C, slots) + revolutionary.equip_in_one_of_slots(R,slots) - mob.update_icons() + revolutionary.update_icons() if(!where2) - to_chat(mob, "The Syndicate were unfortunately unable to get you a chameleon security HUD.") + to_chat(revolutionary, "The Syndicate were unfortunately unable to get you a chameleon security HUD.") else - to_chat(mob, "The chameleon security HUD in your [where2] will help you keep track of who is mindshield-implanted, and unable to be recruited.") + to_chat(revolutionary, "The chameleon security HUD in your [where2] will help you keep track of who is mindshield-implanted, and unable to be recruited.") if(!where) - to_chat(mob, "The Syndicate were unfortunately unable to get you a flash.") + to_chat(revolutionary, "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.") + to_chat(revolutionary, "The flash in your [where] will help you to persuade the crew to join your cause.") return 1 ///////////////////////////////// @@ -169,15 +164,16 @@ //////////////////////////////////////////// //Checks if new heads have joined midround// //////////////////////////////////////////// -/datum/game_mode/revolution/proc/check_heads() +/datum/game_mode/revolution/latespawn(mob/living/carbon/human/player) + ..() + var/datum/mind/player_mind = player.mind + var/static/list/real_command_positions = GLOB.command_positions.Copy() - "Nanotrasen Representative" + if(player_mind && (player_mind.assigned_role in real_command_positions)) + for(var/datum/mind/rev_mind in head_revolutionaries) + mark_for_death(rev_mind, player_mind) + 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() @@ -187,18 +183,18 @@ /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.client && khrushchev.current.stat != DEAD) - if(ROLE_REV in khrushchev.current.client.prefs.be_special) - promotable_revs += khrushchev + for(var/datum/mind/potential_new_headrev in revolutionaries) + if(potential_new_headrev.current && potential_new_headrev.current.client && potential_new_headrev.current.stat != DEAD) + if(ROLE_REV in potential_new_headrev.current.client.prefs.be_special) + promotable_revs += potential_new_headrev if(promotable_revs.len) - var/datum/mind/stalin = pick(promotable_revs) - revolutionaries -= stalin - head_revolutionaries += stalin - log_game("[key_name(stalin)] has been promoted to a head rev") - equip_revolutionary(stalin.current) - forge_revolutionary_objectives(stalin) - greet_revolutionary(stalin) + var/datum/mind/new_headrev = pick(promotable_revs) + revolutionaries -= new_headrev + head_revolutionaries += new_headrev + log_game("[key_name(new_headrev)] has been promoted to a head rev") + equip_revolutionary(new_headrev.current) + forge_revolutionary_objectives(new_headrev) + greet_revolutionary(new_headrev) ////////////////////////////////////// //Checks if the revs have won or not// @@ -231,19 +227,17 @@ //Deals with converting players to the revolution// /////////////////////////////////////////////////// /datum/game_mode/proc/add_revolutionary(datum/mind/rev_mind) + var/mob/living/carbon/human/conversion_target = rev_mind.current if(rev_mind.assigned_role in GLOB.command_positions) - return 0 - var/mob/living/carbon/human/H = rev_mind.current//Check to see if the potential rev is implanted - if(ismindshielded(H)) - return 0 + return FALSE + if(ismindshielded(conversion_target)) + return FALSE if((rev_mind in revolutionaries) || (rev_mind in head_revolutionaries)) - return 0 + return FALSE revolutionaries += rev_mind - if(iscarbon(rev_mind.current)) - var/mob/living/carbon/carbon_mob = rev_mind.current - carbon_mob.Silence(10 SECONDS) - carbon_mob.flash_eyes(1, 1) - rev_mind.current.Stun(10 SECONDS) + if(conversion_target) + conversion_target.Silence(10 SECONDS) + conversion_target.Stun(10 SECONDS) 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.create_attack_log("Has been converted to the revolution!") rev_mind.current.create_log(CONVERSION_LOG, "converted to the revolution") @@ -251,15 +245,16 @@ update_rev_icons_added(rev_mind) if(jobban_isbanned(rev_mind.current, ROLE_REV) || jobban_isbanned(rev_mind.current, ROLE_SYNDICATE)) replace_jobbanned_player(rev_mind.current, ROLE_REV) - return 1 + 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) - var/remove_head = 0 + var/remove_head = FALSE + var/mob/revolutionary = rev_mind.current if(beingborged && (rev_mind in head_revolutionaries)) head_revolutionaries -= rev_mind - remove_head = 1 + remove_head = TRUE if((rev_mind in revolutionaries) || remove_head) revolutionaries -= rev_mind @@ -267,21 +262,17 @@ rev_mind.current.create_attack_log("Has renounced the revolution!") rev_mind.current.create_log(CONVERSION_LOG, "renounced the revolution") if(beingborged) - to_chat(rev_mind.current, "The frame's firmware detects and deletes your neural reprogramming! You remember nothing[remove_head ? "." : " but the name of the one who flashed you."]") + revolutionary.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("[key_name_admin(rev_mind.current)] [ADMIN_QUE(rev_mind.current,"?")] ([ADMIN_FLW(rev_mind.current,"FLW")]) has been borged while being a [remove_head ? "leader" : " member"] of the revolution.") - else + revolutionary.visible_message( + "[rev_mind.current] looks like [rev_mind.current.p_they()] just remembered [rev_mind.current.p_their()] real allegiance!", + "You have been brainwashed! You are no longer a 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.Paralyse(10 SECONDS) - to_chat(rev_mind.current, "You have been brainwashed! You are no longer a 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...") - update_rev_icons_removed(rev_mind) - for(var/mob/living/M in view(rev_mind.current)) - if(beingborged) - to_chat(M, "The frame beeps contentedly, purging the hostile memory engram from the MMI before initalizing it.") - - else - to_chat(M, "[rev_mind.current] looks like [rev_mind.current.p_they()] just remembered [rev_mind.current.p_their()] real allegiance!") - + ///////////////////////////////////// //Adds the rev hud to a new convert// ///////////////////////////////////// @@ -306,7 +297,6 @@ for(var/datum/objective/mutiny/objective in rev_mind.objectives) if(!(objective.check_completion())) return FALSE - return TRUE ///////////////////////////// diff --git a/code/game/objects/items/devices/flash.dm b/code/game/objects/items/devices/flash.dm index 3c5374867f4..bb74827223d 100644 --- a/code/game/objects/items/devices/flash.dm +++ b/code/game/objects/items/devices/flash.dm @@ -104,7 +104,7 @@ if(targeted) if(M.flash_eyes(1, 1)) M.AdjustConfused(power) - terrible_conversion_proc(M, user) + revolution_conversion(M, user) M.drop_l_hand() M.drop_r_hand() visible_message("[user] blinds [M] with [src]!") @@ -155,29 +155,15 @@ ..() -/obj/item/flash/proc/terrible_conversion_proc(mob/M, mob/user) - if(ishuman(M) && ishuman(user) && M.stat != DEAD) - if(user.mind && (user.mind in SSticker.mode.head_revolutionaries)) - if(M.client) - if(M.stat == CONSCIOUS) - M.mind_initialize() //give them a mind datum if they don't have one. - var/resisted - if(!ismindshielded(M)) - if(user.mind in SSticker.mode.head_revolutionaries) - if(SSticker.mode.add_revolutionary(M.mind)) - 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 [src]!") - else - to_chat(user, "They must be conscious before you can convert [M.p_them()]!") - else - to_chat(user, "This mind is so vacant that it is not susceptible to influence!") - +/obj/item/flash/proc/revolution_conversion(mob/M, mob/user) + if(!ishuman(M) || !(user.mind in SSticker.mode.head_revolutionaries)) + return + if(M.stat != CONSCIOUS) + to_chat(user, "They must be conscious before you can convert [M.p_them()]!") + else if(SSticker.mode.add_revolutionary(M.mind)) + times_used-- //Flashes less likely to burn out for headrevs when used for conversion + else + to_chat(user, "This mind seems resistant to [src]!") /obj/item/flash/cyborg origin_tech = null diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 2eaa718ce33..6f7c6ec60bd 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1084,6 +1084,7 @@ /mob/living/onTransitZ(old_z,new_z) ..() update_z(new_z) + SSticker.mode.transit_z(src) /mob/living/rad_act(amount) . = ..()