From f93e28290259123ed0a4cf94bf216c4847a898d4 Mon Sep 17 00:00:00 2001 From: Aurorablade Date: Wed, 8 Nov 2017 00:36:40 -0500 Subject: [PATCH] team shit --- code/datums/antagonists/antag_datum.dm | 37 ++++++++++++++++++++++++-- code/datums/mind.dm | 17 +++++++++--- code/game/gamemodes/objectives_team.dm | 24 +++++++++++++++++ paradise.dme | 1 + 4 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 code/game/gamemodes/objectives_team.dm diff --git a/code/datums/antagonists/antag_datum.dm b/code/datums/antagonists/antag_datum.dm index 1af50313c69..6be68879603 100644 --- a/code/datums/antagonists/antag_datum.dm +++ b/code/datums/antagonists/antag_datum.dm @@ -7,6 +7,8 @@ var/global/list/antagonists = list() 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/antag_role //the antag type + var/replace_banned = TRUE //Should replace jobbaned player with ghosts if granted. /datum/antagonist/New(datum/mind/new_owner) antagonists += src @@ -23,9 +25,10 @@ var/global/list/antagonists = list() /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,35 @@ var/global/list/antagonists = list() /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.current) && replace_banned) + replace_banned_player() + +/datum/antagonist/proc/is_banned(mob/M) + if(!M) + return FALSE + . = (jobban_isbanned(M,"Syndicate") || (antag_role && jobban_isbanned(M,antag_role))) + +/datum/antagonist/proc/replace_banned_player() + set waitfor = FALSE + + var/list/mob/dead/observer/candidates = pollCandidates("Do you want to play as a [name]?", "[name]", null, antag_role, 0, 100) + 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 role 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,10 +81,17 @@ var/global/list/antagonists = list() 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() return +//Returns the team antagonist belongs to if any. +/datum/antagonist/proc/get_team() + return + /datum/antagonist/proc/farewell() return \ No newline at end of file diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 1a1f28ebc31..7d2e47cf93f 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -73,15 +73,26 @@ var/brigged_since = -1 var/suicided = FALSE - New(var/key) - src.key = key - //put this here for easier tracking ingame var/datum/money_account/initial_account //zealot_master is a reference to the mob that converted them into a zealot (for ease of investigation and such) var/mob/living/carbon/human/zealot_master = null +/datum/mind/New(var/key) + src.key = key + + +/datum/mind/Destroy() + ticker.minds -= src + if(islist(antag_datums)) + for(var/i in antag_datums) + var/datum/antagonist/antag_datum = i + if(antag_datum.delete_on_mind_deletion) + qdel(i) + antag_datums = null + return ..() + /datum/mind/proc/transfer_to(mob/living/new_character) var/datum/atom_hud/antag/hud_to_transfer = antag_hud //we need this because leave_hud() will clear this list var/mob/living/old_current = current diff --git a/code/game/gamemodes/objectives_team.dm b/code/game/gamemodes/objectives_team.dm new file mode 100644 index 00000000000..7789a167c71 --- /dev/null +++ b/code/game/gamemodes/objectives_team.dm @@ -0,0 +1,24 @@ +//A barebones antagonist team. +/datum/objective_team + var/list/datum/mind/members = list() + var/name = "team" + var/member_name = "member" + +/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/paradise.dme b/paradise.dme index 6149d7f1941..f306d93a0d0 100644 --- a/paradise.dme +++ b/paradise.dme @@ -386,6 +386,7 @@ #include "code\game\gamemodes\gameticker.dm" #include "code\game\gamemodes\intercept_report.dm" #include "code\game\gamemodes\objective.dm" +#include "code\game\gamemodes\objectives_team.dm" #include "code\game\gamemodes\scoreboard.dm" #include "code\game\gamemodes\setupgame.dm" #include "code\game\gamemodes\steal_items.dm"