// To add a rev to the list of revolutionaries, make sure it's rev (with if(ticker.mode.name == "revolution)), // then call ticker.mode:add_revolutionary(_THE_PLAYERS_MIND_) // nothing else needs to be done, as that proc will check if they are a valid target. // Just make sure the converter is a head before you call it! // To remove a rev (from brainwashing or w/e), call ticker.mode:remove_revolutionary(_THE_PLAYERS_MIND_), // this will also check they're not a head, so it can just be called freely // If the rev icons start going wrong for some reason, ticker.mode:update_all_rev_icons() can be called to correct them. // If the game somtimes isn't registering a win properly, then ticker.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" config_tag = "revolution" restricted_jobs = list("Internal Affairs Agent", "AI", "Cyborg","Captain", "Head of Personnel", "Head of Security", "Chief Engineer", "Research Director", "Chief Medical Officer") protected_jobs = list("Security Officer", "Warden", "Detective") required_players = 4 required_players_secret = 15 required_enemies = 3 recommended_enemies = 3 uplink_welcome = "AntagCorp Uplink Console:" uplink_uses = 10 var/finished = 0 var/checkwin_counter = 0 var/max_headrevs = 3 var/const/waittime_l = 600 //lower bound on time before intercept arrives (in tenths of seconds) var/const/waittime_h = 1800 //upper bound on time before intercept arrives (in tenths of seconds) /////////////////////////// //Announces the game type// /////////////////////////// /datum/game_mode/revolution/announce() world << "The current game mode is - Revolution!" world << "Some crewmembers are attempting to start a revolution!
\nRevolutionaries - Kill the Captain, HoP, HoS, CE, RD and CMO. Convert other crewmembers (excluding the heads of staff, and security officers) to your cause by flashing them. Protect your leaders.
\nPersonnel - Protect the heads of staff. Kill the leaders of the revolution, and brainwash the other revolutionaries (by beating them in the head).
" /////////////////////////////////////////////////////////////////////////////// //Gets the round setup, cancelling if there's not enough players at the start// /////////////////////////////////////////////////////////////////////////////// /datum/game_mode/revolution/pre_setup() if(config.protect_roles_from_antagonist) restricted_jobs += protected_jobs var/list/datum/mind/possible_headrevs = get_players_for_role(BE_REV) var/head_check = 0 for(var/mob/new_player/player in player_list) if(player.mind.assigned_role in command_positions) head_check = 1 break for(var/datum/mind/player in possible_headrevs) for(var/job in restricted_jobs)//Removing heads and such from the list if(player.assigned_role == job) possible_headrevs -= player for (var/i=1 to max_headrevs) if (possible_headrevs.len==0) break var/datum/mind/lenin = pick(possible_headrevs) possible_headrevs -= lenin head_revolutionaries += lenin if((head_revolutionaries.len==0)||(!head_check)) return 0 return 1 /datum/game_mode/revolution/post_setup() var/list/heads = get_living_heads() for(var/datum/mind/rev_mind in head_revolutionaries) if(!config.objectives_disabled) 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 [head_mind.name], the [head_mind.assigned_role]." rev_mind.objectives += rev_obj // equip_traitor(rev_mind.current, 1) //changing how revs get assigned their uplink so they can get PDA uplinks. --NEO // Removing revolutionary uplinks. -Pete equip_revolutionary(rev_mind.current) update_rev_icons_added(rev_mind) for(var/datum/mind/rev_mind in head_revolutionaries) greet_revolutionary(rev_mind) modePlayer += head_revolutionaries if(emergency_shuttle) emergency_shuttle.auto_recall = 1 spawn (rand(waittime_l, waittime_h)) send_intercept() ..() /datum/game_mode/revolution/process() checkwin_counter++ if(checkwin_counter >= 5) if(!finished) ticker.mode.check_win() checkwin_counter = 0 return 0 /datum/game_mode/proc/forge_revolutionary_objectives(var/datum/mind/rev_mind) if(!config.objectives_disabled) 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 [head_mind.name], the [head_mind.assigned_role]." rev_mind.objectives += rev_obj /datum/game_mode/proc/greet_revolutionary(var/datum/mind/rev_mind, var/you_are=1) rev_mind.special_role = "Head Revolutionary" if (you_are) rev_mind.current << "\blue You are a member of the revolutionaries' leadership!" show_objectives(rev_mind) ///////////////////////////////////////////////////////////////////////////////// //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") mob << "Your training has allowed you to overcome your clownish nature, allowing you to wield weapons without harming yourself." mob.mutations.Remove(CLUMSY) var/obj/item/device/flash/T = new(mob) var/list/slots = list ( "backpack" = slot_in_backpack, "left pocket" = slot_l_store, "right pocket" = slot_r_store, "left hand" = slot_l_hand, "right hand" = slot_r_hand, ) var/where = mob.equip_in_one_of_slots(T, slots) if (!where) mob << "Your employers were unfortunately unable to get you a flash." else mob << "The flash in your [where] will help you to persuade the crew to join your cause." mob.update_icons() return 1 ////////////////////////////////////// //Checks if the revs have won or not// ////////////////////////////////////// /datum/game_mode/revolution/check_win() if(check_rev_victory()) finished = 1 else if(check_heads_victory()) finished = 2 return /////////////////////////////// //Checks if the round is over// /////////////////////////////// /datum/game_mode/revolution/check_finished() if(config.continous_rounds) if(finished != 0) if(emergency_shuttle) emergency_shuttle.auto_recall = 0 return ..() if(finished != 0) return 1 else return 0 /////////////////////////////////////////////////// //Deals with converting players to the revolution// /////////////////////////////////////////////////// /datum/game_mode/proc/add_revolutionary(datum/mind/rev_mind) if(rev_mind.assigned_role in command_positions) return 0 var/mob/living/carbon/human/H = rev_mind.current//Check to see if the potential rev is implanted for(var/obj/item/weapon/implant/loyalty/L in H)//Checking that there is a loyalty implant in the contents if(L.imp_in == H)//Checking that it's actually implanted return 0 if((rev_mind in revolutionaries) || (rev_mind in head_revolutionaries)) return 0 revolutionaries += rev_mind rev_mind.current << "\red 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.special_role = "Revolutionary" show_objectives(rev_mind) update_rev_icons_added(rev_mind) return 1 ////////////////////////////////////////////////////////////////////////////// //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) if(rev_mind in revolutionaries) revolutionaries -= rev_mind rev_mind.special_role = null rev_mind.current.hud_updateflag |= 1 << SPECIALROLE_HUD if(beingborged) rev_mind.current << "\red The frame's firmware detects and deletes your neural reprogramming! You remember nothing from the moment you were flashed until now." else rev_mind.current << "\red 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) M << "The frame beeps contentedly, purging the hostile memory engram from the MMI before initalizing it." else M << "[rev_mind.current] looks like they just remembered their real allegiance!" ///////////////////////////////////////////////////////////////////////////////////////////////// //Keeps track of players having the correct icons//////////////////////////////////////////////// //CURRENTLY CONTAINS BUGS://///////////////////////////////////////////////////////////////////// //-PLAYERS THAT HAVE BEEN REVS FOR AWHILE OBTAIN THE BLUE ICON WHILE STILL NOT BEING A REV HEAD// // -Possibly caused by cloning of a standard rev///////////////////////////////////////////////// //-UNCONFIRMED: DECONVERTED REVS NOT LOSING THEIR ICON PROPERLY////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////// /datum/game_mode/proc/update_all_rev_icons() spawn(0) for(var/datum/mind/head_rev_mind in head_revolutionaries) if(head_rev_mind.current) if(head_rev_mind.current.client) for(var/image/I in head_rev_mind.current.client.images) if(I.icon_state == "rev" || I.icon_state == "rev_head") del(I) for(var/datum/mind/rev_mind in revolutionaries) if(rev_mind.current) if(rev_mind.current.client) for(var/image/I in rev_mind.current.client.images) if(I.icon_state == "rev" || I.icon_state == "rev_head") del(I) for(var/datum/mind/head_rev in head_revolutionaries) if(head_rev.current) if(head_rev.current.client) for(var/datum/mind/rev in revolutionaries) if(rev.current) var/I = image('icons/mob/mob.dmi', loc = rev.current, icon_state = "rev") head_rev.current.client.images += I for(var/datum/mind/head_rev_1 in head_revolutionaries) if(head_rev_1.current) var/I = image('icons/mob/mob.dmi', loc = head_rev_1.current, icon_state = "rev_head") head_rev.current.client.images += I for(var/datum/mind/rev in revolutionaries) if(rev.current) if(rev.current.client) for(var/datum/mind/head_rev in head_revolutionaries) if(head_rev.current) var/I = image('icons/mob/mob.dmi', loc = head_rev.current, icon_state = "rev_head") rev.current.client.images += I for(var/datum/mind/rev_1 in revolutionaries) if(rev_1.current) var/I = image('icons/mob/mob.dmi', loc = rev_1.current, icon_state = "rev") rev.current.client.images += I //////////////////////////////////////////////////// //Keeps track of converted revs icons/////////////// //Refer to above bugs. They may apply here as well// //////////////////////////////////////////////////// /datum/game_mode/proc/update_rev_icons_added(datum/mind/rev_mind) spawn(0) for(var/datum/mind/head_rev_mind in head_revolutionaries) if(head_rev_mind.current) if(head_rev_mind.current.client) var/I = image('icons/mob/mob.dmi', loc = rev_mind.current, icon_state = "rev") head_rev_mind.current.client.images += I if(rev_mind.current) if(rev_mind.current.client) var/image/J = image('icons/mob/mob.dmi', loc = head_rev_mind.current, icon_state = "rev_head") rev_mind.current.client.images += J for(var/datum/mind/rev_mind_1 in revolutionaries) if(rev_mind_1.current) if(rev_mind_1.current.client) var/I = image('icons/mob/mob.dmi', loc = rev_mind.current, icon_state = "rev") rev_mind_1.current.client.images += I if(rev_mind.current) if(rev_mind.current.client) var/image/J = image('icons/mob/mob.dmi', loc = rev_mind_1.current, icon_state = "rev") rev_mind.current.client.images += J /////////////////////////////////// //Keeps track of deconverted revs// /////////////////////////////////// /datum/game_mode/proc/update_rev_icons_removed(datum/mind/rev_mind) spawn(0) for(var/datum/mind/head_rev_mind in head_revolutionaries) if(head_rev_mind.current) if(head_rev_mind.current.client) for(var/image/I in head_rev_mind.current.client.images) if((I.icon_state == "rev" || I.icon_state == "rev_head") && I.loc == rev_mind.current) del(I) for(var/datum/mind/rev_mind_1 in revolutionaries) if(rev_mind_1.current) if(rev_mind_1.current.client) for(var/image/I in rev_mind_1.current.client.images) if((I.icon_state == "rev" || I.icon_state == "rev_head") && I.loc == rev_mind.current) del(I) if(rev_mind.current) if(rev_mind.current.client) for(var/image/I in rev_mind.current.client.images) if(I.icon_state == "rev" || I.icon_state == "rev_head") del(I) ////////////////////////// //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/objective in rev_mind.objectives) if(!(objective.check_completion())) return 0 return 1 ///////////////////////////// //Checks for a head victory// ///////////////////////////// /datum/game_mode/revolution/proc/check_heads_victory() for(var/datum/mind/rev_mind in head_revolutionaries) var/turf/T = get_turf(rev_mind.current) if((rev_mind) && (rev_mind.current) && (rev_mind.current.stat != 2) && T && (T.z in config.station_levels)) if(ishuman(rev_mind.current)) return 0 return 1 ////////////////////////////////////////////////////////////////////// //Announces the end of the game with all relavent information stated// ////////////////////////////////////////////////////////////////////// /datum/game_mode/revolution/declare_completion() if(!config.objectives_disabled) if(finished == 1) feedback_set_details("round_end_result","win - heads killed") world << "\red The heads of staff were killed or abandoned the station! The revolutionaries win!" else if(finished == 2) feedback_set_details("round_end_result","loss - rev heads killed") world << "\red The heads of staff managed to stop the revolution!" ..() return 1 /datum/game_mode/proc/auto_declare_completion_revolution() var/list/targets = list() if(head_revolutionaries.len || istype(ticker.mode,/datum/game_mode/revolution)) var/text = "The head revolutionaries were:" for(var/datum/mind/headrev in head_revolutionaries) text += "
[headrev.key] was [headrev.name] (" if(headrev.current) if(headrev.current.stat == DEAD) text += "died" else if(isNotStationLevel(headrev.current.z)) text += "fled the station" else text += "survived the revolution" if(headrev.current.real_name != headrev.name) text += " as [headrev.current.real_name]" else text += "body destroyed" text += ")" for(var/datum/objective/mutiny/objective in headrev.objectives) targets |= objective.target world << text if(revolutionaries.len || istype(ticker.mode,/datum/game_mode/revolution)) var/text = "The revolutionaries were:" for(var/datum/mind/rev in revolutionaries) text += "
[rev.key] was [rev.name] (" if(rev.current) if(rev.current.stat == DEAD) text += "died" else if(isNotStationLevel(rev.current.z)) text += "fled the station" else text += "survived the revolution" if(rev.current.real_name != rev.name) text += " as [rev.current.real_name]" else text += "body destroyed" text += ")" world << text if( head_revolutionaries.len || revolutionaries.len || istype(ticker.mode,/datum/game_mode/revolution) ) var/text = "The heads of staff were:" var/list/heads = get_all_heads() for(var/datum/mind/head in heads) var/target = (head in targets) if(target) text += "" text += "
[head.key] was [head.name] (" if(head.current) if(head.current.stat == DEAD) text += "died" else if(isNotStationLevel(head.current.z)) text += "fled the station" else text += "survived the revolution" if(head.current.real_name != head.name) text += " as [head.current.real_name]" else text += "body destroyed" text += ")" if(target) text += "
" world << text /proc/is_convertable_to_rev(datum/mind/mind) return istype(mind) && \ istype(mind.current, /mob/living/carbon/human) && \ !(mind.assigned_role in command_positions) && \ !(mind.assigned_role in list("Security Officer", "Detective", "Warden"))