Merge pull request #3477 from Citadel-Station-13/upstream-merge-31630

[MIRROR] Datum rev & related upgrades to base datum antag
This commit is contained in:
LetterJay
2017-10-18 07:42:54 -04:00
committed by GitHub
27 changed files with 491 additions and 380 deletions
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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
+7 -50
View File
@@ -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()
+1 -1
View File
@@ -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
+11
View File
@@ -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
+38 -198
View File
@@ -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, "<span class='userdanger'>You are a member of the revolutionaries' leadership!</span>")
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, "<span class='danger'><FONT size = 3> 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!</FONT></span>")
rev_mind.current.log_message("<font color='red'>Has been converted to the revolution!</font>", 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.", \
"<span class='userdanger'><FONT size = 3>The frame's firmware detects and deletes your neural reprogramming! You remember nothing[remove_head ? "." : " but the name of the one who flashed you."]</FONT></span>")
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!", \
"<span class='userdanger'><FONT size = 3>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...</FONT></span>")
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: <B>[100 - round((num_revs/num_survivors)*100, 0.1)]%</B>" )
var/text = "<br><font size=3><b>The head revolutionaries were:</b></font>"
for(var/datum/mind/headrev in head_revolutionaries)
for(var/datum/mind/headrev in headrevs)
text += printplayer(headrev, 1)
text += "<br>"
to_chat(world, text)
if(revolutionaries.len || istype(SSticker.mode, /datum/game_mode/revolution))
if(revs.len)
var/text = "<br><font size=3><b>The revolutionaries were:</b></font>"
for(var/datum/mind/rev in revolutionaries)
for(var/datum/mind/rev in revs)
text += printplayer(rev, 1)
text += "<br>"
to_chat(world, text)
if( head_revolutionaries.len || revolutionaries.len || istype(SSticker.mode, /datum/game_mode/revolution) )
if(revs.len || headrevs.len)
var/text = "<br><font size=3><b>The heads of staff were:</b></font>"
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)
+2 -2
View File
@@ -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
@@ -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("<span class='warning'>[target] seems to resist the implant!</span>", "<span class='warning'>You feel something interfering with your mental conditioning, but you resist it!</span>")
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, "<span class='warning'>You feel something interfering with your mental conditioning, but you resist it!</span>")