Datumizes Wishgranter

This commit is contained in:
Fox McCloud
2018-05-20 15:48:29 -04:00
parent a49fcfd53f
commit c46cd7835b
10 changed files with 128 additions and 57 deletions
@@ -0,0 +1,137 @@
GLOBAL_LIST_EMPTY(antagonists)
/datum/antagonist
var/name = "Antagonist"
var/roundend_category = "other antagonists" //Section of roundend report, datums with same category will be displayed together, also default header for the section
var/show_in_roundend = TRUE //Set to false to hide the antagonists from roundend report
var/datum/mind/owner //Mind that owns this datum
var/silent = FALSE //Silent will prevent the gain/lose texts to show
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.
var/list/objectives = list()
var/antag_memory = ""//These will be removed with antag datum
/datum/antagonist/New()
GLOB.antagonists += src
typecache_datum_blacklist = typecacheof(typecache_datum_blacklist)
/datum/antagonist/Destroy()
GLOB.antagonists -= src
if(owner)
LAZYREMOVE(owner.antag_datums, src)
owner = null
return ..()
/datum/antagonist/proc/can_be_owned(datum/mind/new_owner)
. = TRUE
var/datum/mind/tested = new_owner || owner
if(tested.has_antag_datum(type))
return FALSE
for(var/i in tested.antag_datums)
var/datum/antagonist/A = i
if(is_type_in_typecache(src, A.typecache_datum_blacklist))
return FALSE
//This will be called in add_antag_datum before owner assignment.
//Should return antag datum without owner.
/datum/antagonist/proc/specialization(datum/mind/new_owner)
return src
/datum/antagonist/proc/on_body_transfer(mob/living/old_body, mob/living/new_body)
remove_innate_effects(old_body)
apply_innate_effects(new_body)
//This handles the application of antag huds/special abilities
/datum/antagonist/proc/apply_innate_effects(mob/living/mob_override)
return
//This handles the removal of antag huds/special abilities
/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/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, ROLE_SYNDICATE) || (job_rank && jobban_isbanned(M, job_rank)))
/datum/antagonist/proc/replace_banned_player()
set waitfor = FALSE
var/list/mob/dead/observer/candidates = pollCandidates("Do you want to play as a [name]?", job_rank, TRUE, 50)
if(LAZYLEN(candidates))
var/mob/dead/observer/C = 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(C)] has taken control of ([key_name_admin(owner.current)]) to replace a jobbaned player.")
owner.current.ghostize(0)
owner.current.key = C.key
/datum/antagonist/proc/on_removal()
remove_innate_effects()
if(owner)
LAZYREMOVE(owner.antag_datums, src)
if(!silent && owner.current)
farewell()
owner.objectives -= objectives
var/datum/team/team = get_team()
if(team)
team.remove_member(owner)
qdel(src)
/datum/antagonist/proc/greet()
return
/datum/antagonist/proc/farewell()
return
//Returns the team antagonist belongs to if any.
/datum/antagonist/proc/get_team()
return
//Individual roundend report
/datum/antagonist/proc/roundend_report()
var/list/report = list()
if(!owner)
CRASH("antagonist datum without owner")
report += printplayer(owner)
var/objectives_complete = TRUE
if(owner.objectives.len)
report += printobjectives(owner)
for(var/datum/objective/objective in owner.objectives)
if(!objective.check_completion())
objectives_complete = FALSE
break
if(owner.objectives.len == 0 || objectives_complete)
report += "<span class='greentext big'>The [name] was successful!</span>"
else
report += "<span class='redtext big'>The [name] has failed!</span>"
return report.Join("<br>")
//Displayed at the start of roundend_category section, default to roundend_category header
/datum/antagonist/proc/roundend_report_header()
return "<span class='header'>The [roundend_category] were:</span><br>"
//Displayed at the end of roundend_category section
/datum/antagonist/proc/roundend_report_footer()
return
@@ -0,0 +1,19 @@
//Returns MINDS of the assigned antags of given type/subtypes
/proc/get_antag_minds(antag_type, specific = FALSE)
. = list()
for(var/datum/antagonist/A in GLOB.antagonists)
if(!A.owner)
continue
if(!antag_type || !specific && istype(A, antag_type) || specific && A.type == antag_type)
. += A.owner
//Get all teams [of type team_type]
/proc/get_all_teams(team_type)
. = list()
for(var/V in GLOB.antagonists)
var/datum/antagonist/A = V
if(!A.owner)
continue
var/datum/team/T = A.get_team()
if(!team_type || istype(T, team_type))
. |= T
@@ -0,0 +1,90 @@
/datum/atom_hud/antag
hud_icons = list(SPECIALROLE_HUD,NATIONS_HUD)
var/self_visible = TRUE
/datum/atom_hud/antag/hidden
self_visible = FALSE
/datum/atom_hud/antag/proc/join_hud(mob/M, slave)
//sees_hud should be set to 0 if the mob does not get to see it's own hud type.
if(!istype(M))
CRASH("join_hud(): [M] ([M.type]) is not a mob!")
if(M.mind.antag_hud && !slave) //note: please let this runtime if a mob has no mind, as mindless mobs shouldn't be getting antagged
M.mind.antag_hud.leave_hud(M)
add_to_hud(M)
if(self_visible)
add_hud_to(M)
M.mind.antag_hud = src
/datum/atom_hud/antag/proc/leave_hud(mob/M)
if(!M)
return
if(!istype(M))
CRASH("leave_hud(): [M] ([M.type]) is not a mob!")
remove_from_hud(M)
remove_hud_from(M)
if(M.mind)
M.mind.antag_hud = null
//GAME_MODE PROCS
//called to set a mob's antag icon state
/proc/set_antag_hud(mob/M, new_icon_state)
if(!istype(M))
CRASH("set_antag_hud(): [M] ([M.type]) is not a mob!")
var/image/holder = M.hud_list[SPECIALROLE_HUD]
if(holder)
holder.icon_state = new_icon_state
if(M.mind || new_icon_state) //in mindless mobs, only null is acceptable, otherwise we're antagging a mindless mob, meaning we should runtime
M.mind.antag_hud_icon_state = new_icon_state
//Nations Icons
/proc/set_nations_hud(mob/M, new_icon_state)
if(!istype(M))
CRASH("set_antag_hud(): [M] ([M.type]) is not a mob!")
var/image/holder = M.hud_list[NATIONS_HUD]
if(holder)
holder.icon_state = new_icon_state
if(M.mind || new_icon_state) //in mindless mobs, only null is acceptable, otherwise we're antagging a mindless mob, meaning we should runtime
M.mind.antag_hud_icon_state = new_icon_state
//MIND PROCS
//these are called by mind.transfer_to()
/datum/mind/proc/transfer_antag_huds(datum/atom_hud/antag/newhud)
leave_all_huds()
set_antag_hud(current, antag_hud_icon_state)
if(newhud)
newhud.join_hud(current)
/datum/mind/proc/leave_all_huds()
for(var/datum/atom_hud/antag/hud in huds)
if(current in hud.hudusers)
hud.leave_hud(current)
for(var/datum/atom_hud/data/hud in huds)
if(current in hud.hudusers)
hud.remove_hud_from(current)
///Master Servent Datum Sytems,Based on TG Gang system//
/datum/mindslaves
var/name = "ERROR"
var/list/datum/mind/masters = list()
var/list/datum/mind/serv = list()
var/datum/atom_hud/antag/thrallhud
var/icontype
/datum/mindslaves/New(loc,mastername)
name = mastername
thrallhud = new()
/datum/mindslaves/proc/add_serv_hud(datum/mind/serv_mind, icon)
thrallhud.join_hud(serv_mind.current, 1)
icontype = "hud[icon]"
set_antag_hud(serv_mind.current, icontype)
/datum/mindslaves/proc/leave_serv_hud(datum/mind/free_mind)
thrallhud.leave_hud(free_mind.current)
set_antag_hud(free_mind.current, null)
@@ -0,0 +1,138 @@
/obj/item/antag_spawner
throw_speed = 1
throw_range = 5
w_class = WEIGHT_CLASS_TINY
var/used = FALSE
/obj/item/antag_spawner/proc/spawn_antag(client/C, turf/T, type = "")
return
/obj/item/antag_spawner/proc/equip_antag(mob/target)
return
/obj/item/antag_spawner/borg_tele
name = "syndicate cyborg teleporter"
desc = "A single-use teleporter used to deploy a Syndicate Cyborg on the field."
icon = 'icons/obj/device.dmi'
icon_state = "locator"
var/checking = FALSE
var/TC_cost = 0
var/borg_to_spawn
var/list/possible_types = list("Assault", "Medical")
/obj/item/antag_spawner/borg_tele/attack_self(mob/user)
if(used)
to_chat(user, "<span class='warning'>[src] is out of power!</span>")
return
if(!(user.mind in ticker.mode.syndicates))
to_chat(user, "<span class='danger'>AUTHENTICATION FAILURE. ACCESS DENIED.</span>")
return FALSE
if(checking)
to_chat(user, "<span class='warning'>[src] is already checking for possible borgs.</span>")
return
borg_to_spawn = input("What type of borg would you like to teleport?", "Cyborg Type", type) as null|anything in possible_types
if(!borg_to_spawn || checking || used)
return
checking = TRUE
to_chat(user, "<span class='notice'>The device is now checking for possible borgs.</span>")
var/list/borg_candidates = pollCandidates("Do you want to play as a Syndicate [borg_to_spawn] borg?", ROLE_OPERATIVE, 1)
if(borg_candidates.len > 0 && !used)
checking = FALSE
used = TRUE
var/mob/M = pick(borg_candidates)
var/client/C = M.client
spawn_antag(C, get_turf(src.loc), "syndieborg")
else
checking = FALSE
to_chat(user, "<span class='notice'>Unable to connect to Syndicate command. Please wait and try again later or use the teleporter on your uplink to get your points refunded.</span>")
return
/obj/item/antag_spawner/borg_tele/spawn_antag(client/C, turf/T, type = "")
if(!borg_to_spawn) //If there's no type at all, let it still be used but don't do anything
used = FALSE
return
var/datum/effect_system/spark_spread/S = new /datum/effect_system/spark_spread
S.set_up(4, 1, src)
S.start()
var/mob/living/silicon/robot/R
switch(borg_to_spawn)
if("Medical")
R = new /mob/living/silicon/robot/syndicate/medical(T)
else
R = new /mob/living/silicon/robot/syndicate(T) //Assault borg by default
R.key = C.key
ticker.mode.syndicates += R.mind
ticker.mode.update_synd_icons_added(R.mind)
R.mind.special_role = SPECIAL_ROLE_NUKEOPS
R.faction = list("syndicate")
/obj/item/antag_spawner/slaughter_demon //Warning edgiest item in the game
name = "vial of blood"
desc = "A magically infused bottle of blood, distilled from countless murder victims. Used in unholy rituals to attract horrifying creatures."
icon = 'icons/obj/wizard.dmi'
icon_state = "vial"
var/shatter_msg = "<span class='notice'>You shatter the bottle, no \
turning back now!</span>"
var/veil_msg = "<span class='warning'>You sense a dark presence lurking \
just beyond the veil...</span>"
var/objective_verb = "Kill"
var/mob/living/demon_type = /mob/living/simple_animal/slaughter
/obj/item/antag_spawner/slaughter_demon/attack_self(mob/user)
if(level_blocks_magic(user.z))//this is to make sure the wizard does NOT summon a demon from the Den..
to_chat(user, "<span class='notice'>You should probably wait until you reach the station.</span>")
return
if(used)
to_chat(user, "<span class='notice'>This bottle already has a broken seal.</span>")
return
used = TRUE
to_chat(user, "<span class='notice'>You break the seal on the bottle, calling upon the dire spirits of the underworld...</span>")
var/list/candidates = pollCandidates("Do you want to play as a slaughter demon summoned by [user.real_name]?", ROLE_DEMON, 1, 100)
if(candidates.len > 0)
var/mob/C = pick(candidates)
spawn_antag(C, get_turf(src.loc), initial(demon_type.name), user)
to_chat(user, "[shatter_msg]")
to_chat(user, "[veil_msg]")
playsound(user.loc, 'sound/effects/Glassbr1.ogg', 100, 1)
qdel(src)
else
used = FALSE
to_chat(user, "<span class='notice'>The demons do not respond to your summon. Perhaps you should try again later.</span>")
/obj/item/antag_spawner/slaughter_demon/spawn_antag(client/C, turf/T, type = "", mob/user)
var /obj/effect/dummy/slaughter/holder = new /obj/effect/dummy/slaughter(T)
var/mob/living/simple_animal/slaughter/S = new demon_type(holder)
S.vialspawned = TRUE
S.holder = holder
S.key = C.key
S.mind.assigned_role = S.name
S.mind.special_role = S.name
ticker.mode.traitors += S.mind
var/datum/objective/assassinate/KillDaWiz = new /datum/objective/assassinate
KillDaWiz.owner = S.mind
KillDaWiz.target = user.mind
KillDaWiz.explanation_text = "[objective_verb] [user.real_name], the one who was foolish enough to summon you."
S.mind.objectives += KillDaWiz
var/datum/objective/KillDaCrew = new /datum/objective
KillDaCrew.owner = S.mind
KillDaCrew.explanation_text = "[objective_verb] everyone else while you're at it."
S.mind.objectives += KillDaCrew
S.mind.objectives += KillDaCrew
to_chat(S, "<B>Objective #[1]</B>: [KillDaWiz.explanation_text]")
to_chat(S, "<B>Objective #[2]</B>: [KillDaCrew.explanation_text]")
/obj/item/antag_spawner/slaughter_demon/laughter
name = "vial of tickles"
desc = "A magically infused bottle of clown love, distilled from \
countless hugging attacks. Used in funny rituals to attract \
adorable creatures."
color = "#FF69B4" // HOT PINK
veil_msg = "<span class='warning'>You sense an adorable presence \
lurking just beyond the veil...</span>"
objective_verb = "Hug and Tickle"
demon_type = /mob/living/simple_animal/slaughter/laughter
@@ -0,0 +1,24 @@
//A barebones antagonist team.
/datum/team
var/list/datum/mind/members = list()
var/name = "team"
var/member_name = "member"
var/list/objectives = list() //common objectives, these won't be added or removed automatically, subtypes handle this, this is here for bookkeeping purposes.
/datum/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)
/datum/team/proc/is_solo()
return members.len == 1
/datum/team/proc/add_member(datum/mind/new_member)
members |= new_member
/datum/team/proc/remove_member(datum/mind/member)
members -= member
@@ -0,0 +1,81 @@
/datum/antagonist/wishgranter
name = "Wishgranter Avatar"
/datum/antagonist/wishgranter/proc/forge_objectives()
var/datum/objective/hijack/hijack = new
hijack.owner = owner
objectives += hijack
owner.objectives |= objectives
/datum/antagonist/wishgranter/on_gain()
owner.special_role = "Avatar of the Wish Granter"
forge_objectives()
. = ..()
give_powers()
/datum/antagonist/wishgranter/greet()
to_chat(owner.current, "<B>Your inhibitions are swept away, the bonds of loyalty broken, you are free to murder as you please!</B>")
owner.announce_objectives()
/datum/antagonist/wishgranter/proc/give_powers()
var/mob/living/carbon/human/H = owner.current
if(!istype(H))
return
H.ignore_gene_stability = TRUE
H.dna.SetSEState(HULKBLOCK, TRUE)
genemutcheck(H, HULKBLOCK, null, MUTCHK_FORCED)
H.dna.SetSEState(XRAYBLOCK, TRUE)
genemutcheck(H, XRAYBLOCK, null, MUTCHK_FORCED)
H.dna.SetSEState(FIREBLOCK, TRUE)
genemutcheck(H, FIREBLOCK, null, MUTCHK_FORCED)
H.dna.SetSEState(COLDBLOCK, TRUE)
genemutcheck(H, COLDBLOCK, null, MUTCHK_FORCED)
H.dna.SetSEState(TELEBLOCK, TRUE)
genemutcheck(H, TELEBLOCK, null, MUTCHK_FORCED)
H.dna.SetSEState(INCREASERUNBLOCK, TRUE)
genemutcheck(H, INCREASERUNBLOCK, null, MUTCHK_FORCED)
H.dna.SetSEState(BREATHLESSBLOCK, TRUE)
genemutcheck(H, BREATHLESSBLOCK, null, MUTCHK_FORCED)
H.dna.SetSEState(REGENERATEBLOCK, TRUE)
genemutcheck(H, REGENERATEBLOCK, null, MUTCHK_FORCED)
H.dna.SetSEState(SHOCKIMMUNITYBLOCK, TRUE)
genemutcheck(H, SHOCKIMMUNITYBLOCK, null, MUTCHK_FORCED)
H.dna.SetSEState(SMALLSIZEBLOCK, TRUE)
genemutcheck(H, SMALLSIZEBLOCK, null, MUTCHK_FORCED)
H.dna.SetSEState(SOBERBLOCK, TRUE)
genemutcheck(H, SOBERBLOCK, null, MUTCHK_FORCED)
H.dna.SetSEState(PSYRESISTBLOCK, TRUE)
genemutcheck(H, PSYRESISTBLOCK, null, MUTCHK_FORCED)
H.dna.SetSEState(SHADOWBLOCK, TRUE)
genemutcheck(H, SHADOWBLOCK, null, MUTCHK_FORCED)
H.dna.SetSEState(CRYOBLOCK, TRUE)
genemutcheck(H, CRYOBLOCK, null, MUTCHK_FORCED)
H.dna.SetSEState(EATBLOCK, TRUE)
genemutcheck(H, EATBLOCK, null, MUTCHK_FORCED)
H.dna.SetSEState(JUMPBLOCK, TRUE)
genemutcheck(H, JUMPBLOCK, null, MUTCHK_FORCED)
H.dna.SetSEState(SUPERFARTBLOCK, TRUE)
genemutcheck(H, SUPERFARTBLOCK, null, MUTCHK_FORCED)
H.dna.SetSEState(IMMOLATEBLOCK, TRUE)
genemutcheck(H, IMMOLATEBLOCK, null, MUTCHK_FORCED)
H.mutations.Add(LASER)
H.update_mutations()
H.update_body()