Implant chair refactor (#19272)

Removes some copypasta
Refactors implant chairs. Adds some fun variations.
This commit is contained in:
AnturK
2016-07-13 02:59:06 +02:00
committed by oranges
parent 71da2aba13
commit 523a2b29fe
18 changed files with 236 additions and 194 deletions

View File

@@ -1319,14 +1319,18 @@
log_admin("[key_name(usr)] attempted to give [current] an uplink.") log_admin("[key_name(usr)] attempted to give [current] an uplink.")
else if (href_list["obj_announce"]) else if (href_list["obj_announce"])
var/obj_count = 1 announce_objectives()
current << "<span class='notice'>Your current objectives:</span>"
for(var/datum/objective/objective in objectives)
current << "<B>Objective #[obj_count]</B>: [objective.explanation_text]"
obj_count++
edit_memory() edit_memory()
/datum/mind/proc/announce_objectives()
var/obj_count = 1
current << "<span class='notice'>Your current objectives:</span>"
for(var/objective in objectives)
var/datum/objective/O = objective
current << "<B>Objective #[obj_count]</B>: [O.explanation_text]"
obj_count++
/datum/mind/proc/find_syndicate_uplink() /datum/mind/proc/find_syndicate_uplink()
var/list/L = current.get_contents() var/list/L = current.get_contents()
for (var/obj/item/I in L) for (var/obj/item/I in L)

View File

@@ -94,12 +94,9 @@ var/list/gang_colors_pool = list("red","orange","yellow","green","blue","purple"
boss_mind.objectives += rival_obj boss_mind.objectives += rival_obj
/datum/game_mode/proc/greet_gang(datum/mind/boss_mind, you_are=1) /datum/game_mode/proc/greet_gang(datum/mind/boss_mind, you_are=1)
var/obj_count = 1
if (you_are) if (you_are)
boss_mind.current << "<FONT size=3 color=red><B>You are the Boss of the [boss_mind.gang_datum.name] Gang!</B></FONT>" boss_mind.current << "<FONT size=3 color=red><B>You are the Boss of the [boss_mind.gang_datum.name] Gang!</B></FONT>"
for(var/datum/objective/objective in boss_mind.objectives) boss_mind.announce_objectives()
boss_mind.current << "<B>Objective #[obj_count]</B>: [objective.explanation_text]"
obj_count++
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
//This equips the bosses with their gear, and makes the clown not clumsy// //This equips the bosses with their gear, and makes the clown not clumsy//

View File

@@ -187,11 +187,7 @@
abductor.current << "<span class='notice'>With the help of your teammate, kidnap and experiment on station crew members!</span>" abductor.current << "<span class='notice'>With the help of your teammate, kidnap and experiment on station crew members!</span>"
abductor.current << "<span class='notice'>Use your stealth technology and equipment to incapacitate humans for your scientist to retrieve.</span>" abductor.current << "<span class='notice'>Use your stealth technology and equipment to incapacitate humans for your scientist to retrieve.</span>"
var/obj_count = 1 abductor.announce_objectives()
for(var/datum/objective/objective in abductor.objectives)
abductor.current << "<B>Objective #[obj_count]</B>: [objective.explanation_text]"
obj_count++
return
/datum/game_mode/abduction/proc/greet_scientist(datum/mind/abductor,team_number) /datum/game_mode/abduction/proc/greet_scientist(datum/mind/abductor,team_number)
abductor.objectives += team_objectives[team_number] abductor.objectives += team_objectives[team_number]
@@ -201,11 +197,7 @@
abductor.current << "<span class='notice'>With the help of your teammate, kidnap and experiment on station crew members!</span>" abductor.current << "<span class='notice'>With the help of your teammate, kidnap and experiment on station crew members!</span>"
abductor.current << "<span class='notice'>Use your tool and ship consoles to support the agent and retrieve human specimens.</span>" abductor.current << "<span class='notice'>Use your tool and ship consoles to support the agent and retrieve human specimens.</span>"
var/obj_count = 1 abductor.announce_objectives()
for(var/datum/objective/objective in abductor.objectives)
abductor.current << "<B>Objective #[obj_count]</B>: [objective.explanation_text]"
obj_count++
return
/datum/game_mode/abduction/proc/equip_common(mob/living/carbon/human/agent,team_number) /datum/game_mode/abduction/proc/equip_common(mob/living/carbon/human/agent,team_number)
var/radio_freq = SYND_FREQ var/radio_freq = SYND_FREQ

View File

@@ -159,11 +159,7 @@
var/datum/objective/abductee/O = new objtype() var/datum/objective/abductee/O = new objtype()
ticker.mode.abductees += H.mind ticker.mode.abductees += H.mind
H.mind.objectives += O H.mind.objectives += O
var/obj_count = 1 H.mind.announce_objectives()
H << "<span class='notice'>Your current objectives:</span>"
for(var/datum/objective/objective in H.mind.objectives)
H << "<B>Objective #[obj_count]</B>: [objective.explanation_text]"
obj_count++
ticker.mode.update_abductor_icons_added(H.mind) ticker.mode.update_abductor_icons_added(H.mind)
for(var/obj/item/organ/gland/G in H.internal_organs) for(var/obj/item/organ/gland/G in H.internal_organs)

View File

@@ -147,11 +147,7 @@
/datum/game_mode/proc/greet_syndicate(datum/mind/syndicate, you_are=1) /datum/game_mode/proc/greet_syndicate(datum/mind/syndicate, you_are=1)
if(you_are) if(you_are)
syndicate.current << "<span class='notice'>You are a [syndicate_name()] agent!</span>" syndicate.current << "<span class='notice'>You are a [syndicate_name()] agent!</span>"
var/obj_count = 1 syndicate.announce_objectives()
for(var/datum/objective/objective in syndicate.objectives)
syndicate.current << "<B>Objective #[obj_count]</B>: [objective.explanation_text]"
obj_count++
return
/datum/game_mode/proc/equip_syndicate(mob/living/carbon/human/synd_mob, telecrystals = TRUE) /datum/game_mode/proc/equip_syndicate(mob/living/carbon/human/synd_mob, telecrystals = TRUE)
synd_mob.set_species(/datum/species/human) //Plasamen burn up otherwise, and lizards are vulnerable to asimov AIs synd_mob.set_species(/datum/species/human) //Plasamen burn up otherwise, and lizards are vulnerable to asimov AIs

View File

@@ -106,14 +106,11 @@
rev_mind.objectives += rev_obj rev_mind.objectives += rev_obj
/datum/game_mode/proc/greet_revolutionary(datum/mind/rev_mind, you_are=1) /datum/game_mode/proc/greet_revolutionary(datum/mind/rev_mind, you_are=1)
var/obj_count = 1
update_rev_icons_added(rev_mind) update_rev_icons_added(rev_mind)
if (you_are) if (you_are)
rev_mind.current << "<span class='userdanger'>You are a member of the revolutionaries' leadership!</span>" rev_mind.current << "<span class='userdanger'>You are a member of the revolutionaries' leadership!</span>"
for(var/datum/objective/objective in rev_mind.objectives) rev_mind.special_role = "Head Revolutionary"
rev_mind.current << "<B>Objective #[obj_count]</B>: [objective.explanation_text]" rev_mind.announce_objectives()
rev_mind.special_role = "Head Revolutionary"
obj_count++
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
//This are equips the rev heads with their gear, and makes the clown not clumsy// //This are equips the rev heads with their gear, and makes the clown not clumsy//

View File

@@ -195,10 +195,7 @@
/datum/game_mode/proc/greet_traitor(datum/mind/traitor) /datum/game_mode/proc/greet_traitor(datum/mind/traitor)
traitor.current << "<B><font size=3 color=red>You are the [traitor_name].</font></B>" traitor.current << "<B><font size=3 color=red>You are the [traitor_name].</font></B>"
var/obj_count = 1 traitor.announce_objectives()
for(var/datum/objective/objective in traitor.objectives)
traitor.current << "<B>Objective #[obj_count]</B>: [objective.explanation_text]"
obj_count++
return return

View File

@@ -118,10 +118,7 @@
wizard.current << "<span class='boldannounce'>You are the Space Wizard!</span>" wizard.current << "<span class='boldannounce'>You are the Space Wizard!</span>"
wizard.current << "<B>The Space Wizards Federation has given you the following tasks:</B>" wizard.current << "<B>The Space Wizards Federation has given you the following tasks:</B>"
var/obj_count = 1 wizard.announce_objectives()
for(var/datum/objective/objective in wizard.objectives)
wizard.current << "<B>Objective #[obj_count]</B>: [objective.explanation_text]"
obj_count++
return return

View File

@@ -87,13 +87,9 @@
M << "<B>You have joined the ranks of the Syndicate and become a traitor to the station!</B>" M << "<B>You have joined the ranks of the Syndicate and become a traitor to the station!</B>"
var/obj_count = 1 M.mind.announce_objectives()
for(var/datum/objective/OBJ in M.mind.objectives)
M << "<B>Objective #[obj_count]</B>: [OBJ.explanation_text]"
obj_count++
src.updateUsrDialog() src.updateUsrDialog()
return
/obj/machinery/syndicate_beacon/proc/selfdestruct() /obj/machinery/syndicate_beacon/proc/selfdestruct()

View File

@@ -46,11 +46,8 @@
hijack.owner = user.mind hijack.owner = user.mind
user.mind.objectives += hijack user.mind.objectives += hijack
var/obj_count = 1 user.mind.announce_objectives()
for(var/datum/objective/OBJ in user.mind.objectives)
user << "<B>Objective #[obj_count]</B>: [OBJ.explanation_text]"
obj_count++
user << "You have a very bad feeling about this." user << "You have a very bad feeling about this."
return return

View File

@@ -7,141 +7,186 @@
icon_state = "implantchair" icon_state = "implantchair"
density = 1 density = 1
opacity = 0 opacity = 0
anchored = 1 anchored = TRUE
var/ready = 1 var/ready = TRUE
var/malfunction = 0 var/replenishing = FALSE
var/list/obj/item/weapon/implant/mindshield/implant_list = list()
var/ready_implants = 5
var/max_implants = 5 var/max_implants = 5
var/injection_cooldown = 600 var/injection_cooldown = 600
var/replenish_cooldown = 6000 var/replenish_cooldown = 6000
var/replenishing = 0 var/implant_type = /obj/item/weapon/implant/mindshield
var/injecting = 0 var/auto_inject = FALSE
var/auto_replenish = TRUE
/obj/machinery/implantchair/proc var/special = FALSE
go_out() var/special_name = "special function"
put_mob(mob/living/carbon/M)
implant(var/mob/M)
add_implants()
/obj/machinery/implantchair/New() /obj/machinery/implantchair/New()
..() ..()
add_implants() open_machine()
update_icon()
/obj/machinery/implantchair/attack_hand(mob/user) /obj/machinery/implantchair/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
user.set_machine(src) datum/tgui/master_ui = null, datum/ui_state/state = notcontained_state)
var/health_text = ""
if(src.occupant)
if(src.occupant.health <= -100)
health_text = "<FONT color=red>Dead</FONT>"
else if(src.occupant.health < 0)
health_text = "<FONT color=red>[round(src.occupant.health,0.1)]</FONT>"
else
health_text = "[round(src.occupant.health,0.1)]"
var/dat ="<B>Implanter Status</B><BR>" ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
dat +="<B>Current occupant:</B> [src.occupant ? "<BR>Name: [src.occupant]<BR>Health: [health_text]<BR>" : "<FONT color=red>None</FONT>"]<BR>" ui = new(user, src, ui_key, "implantchair", name, 375, 280, master_ui, state)
dat += "<B>Implants:</B> [src.implant_list.len ? "[implant_list.len]" : "<A href='?src=\ref[src];replenish=1'>Replenish</A>"]<BR>" ui.open()
if(src.occupant)
dat += "[src.ready ? "<A href='?src=\ref[src];implant=1'>Implant</A>" : "Recharging"]<BR>"
user.set_machine(src)
user << browse(dat, "window=implant")
onclose(user, "implant")
/obj/machinery/implantchair/Topic(href, href_list) /obj/machinery/implantchair/ui_data()
var/list/data = list()
data["occupied"] = occupant ? 1 : 0
data["open"] = state_open
data["occupant"] = list()
if(occupant)
data["occupant"]["name"] = occupant.name
data["occupant"]["stat"] = occupant.stat
data["special_name"] = special ? special_name : null
data["ready_implants"] = ready_implants
data["ready"] = ready
data["replenishing"] = replenishing
return data
/obj/machinery/implantchair/ui_act(action, params)
if(..()) if(..())
return return
if(href_list["implant"]) switch(action)
if(src.occupant) if("door")
injecting = 1 if(state_open)
go_out() close_machine()
ready = 0 else
spawn(injection_cooldown) open_machine()
ready = 1 . = TRUE
if("implant")
implant(occupant,usr)
. = TRUE
if(href_list["replenish"]) /obj/machinery/implantchair/proc/implant(mob/living/carbon/M,mob/user)
ready = 0 if (!istype(M))
spawn(replenish_cooldown)
add_implants()
ready = 1
updateUsrDialog()
/obj/machinery/implantchair/go_out(mob/M)
if(!occupant)
return return
if(M == occupant) // so that the guy inside can't eject himself -Agouri if(!ready_implants || !ready)
return return
occupant.loc = loc if(implant_action(M,user))
occupant.reset_perspective(null) ready_implants--
if(injecting) if(!replenishing && auto_replenish)
implant(src.occupant) replenishing = TRUE
injecting = 0 addtimer(src,"replenish",replenish_cooldown)
occupant = null if(injection_cooldown > 0)
icon_state = "implantchair" ready = FALSE
return addtimer(src,"set_ready",injection_cooldown)
else
playsound(get_turf(src), 'sound/machines/buzz-sigh.ogg', 25, 1)
update_icon()
/obj/machinery/implantchair/proc/implant_action(mob/living/carbon/M)
var/obj/item/weapon/implant/I = new implant_type
if(I.implant(M))
visible_message("<span class='warning'>[M] has been implanted by the [name].</span>")
return 1
/obj/machinery/implantchair/put_mob(mob/living/carbon/M) /obj/machinery/implantchair/update_icon()
if(!iscarbon(M)) icon_state = initial(icon_state)
usr << "<span class='warning'>The [src.name] cannot hold this!</span>" if(state_open)
icon_state += "_open"
if(occupant)
icon_state += "_occupied"
if(ready)
add_overlay("ready")
else
cut_overlays()
/obj/machinery/implantchair/proc/replenish()
if(ready_implants < max_implants)
ready_implants++
if(ready_implants < max_implants)
addtimer(src,"replenish",replenish_cooldown)
else
replenishing = FALSE
/obj/machinery/implantchair/proc/set_ready()
ready = TRUE
update_icon()
/obj/machinery/implantchair/container_resist()
var/mob/living/user = usr
if(state_open)
return return
if(src.occupant) user.changeNext_move(CLICK_CD_BREAKOUT)
usr << "<span class='warning'>The [src.name] is already occupied!</span>" user.last_special = world.time + CLICK_CD_BREAKOUT
user << "<span class='notice'>You lean on the back of [src] and start pushing the door open... (this will take about about a minute.)</span>"
audible_message("<span class='italics'>You hear a metallic creaking from [src]!</span>",hearing_distance = 2)
if(do_after(user, 600, target = src))
if(!user || user.stat != CONSCIOUS || user.loc != src || state_open)
return
visible_message("<span class='warning'>[user] successfully broke out of [src]!</span>")
user << "<span class='notice'>You successfully break out of [src]!</span>"
open_machine()
/obj/machinery/implantchair/relaymove(mob/user)
container_resist()
/obj/machinery/implantchair/MouseDrop_T(mob/target, mob/user)
if(user.stat || user.lying || !Adjacent(user) || !user.Adjacent(target) || !iscarbon(target) || !user.IsAdvancedToolUser())
return return
M.stop_pulling() close_machine(target)
M.loc = src
M.reset_perspective(src) /obj/machinery/implantchair/close_machine(mob/user)
src.occupant = M if((isnull(user) || istype(user)) && state_open)
src.add_fingerprint(usr) ..(user)
icon_state = "implantchair_on" if(auto_inject && ready && ready_implants > 0)
implant(user,null)
/obj/machinery/implantchair/genepurge
name = "Genetic purifier"
desc = "Used to purge human genome of foreign influences"
special = TRUE
special_name = "Purge genome"
injection_cooldown = 0
replenish_cooldown = 300
/obj/machinery/implantchair/genepurge/implant_action(mob/living/carbon/human/H,mob/user)
if(!istype(H))
return 0
H.set_species(/datum/species/human, 1)//lizards go home
purrbation_remove(H)//remove cats
H.dna.remove_all_mutations()//hulks out
return 1 return 1
/obj/machinery/implantchair/implant(mob/M) /obj/machinery/implantchair/brainwash
if (!istype(M, /mob/living/carbon)) name = "Neural Imprinter"
return desc = "Used to <s>indoctrinate</s> rehabilitate hardened recidivists."
if(!implant_list.len) special_name = "Imprint"
return injection_cooldown = 3000
for(var/obj/item/weapon/implant/mindshield/imp in implant_list) auto_inject = FALSE
if(!imp) auto_replenish = FALSE
continue special = TRUE
if(istype(imp, /obj/item/weapon/implant/mindshield)) var/objective = "Obey the law. Praise Nanotrasen."
M.visible_message("<span class='warning'>[M] has been implanted by the [src.name].</span>") var/custom = FALSE
if(imp.implant(M)) /obj/machinery/implantchair/brainwash/implant_action(mob/living/carbon/C,mob/user)
implant_list -= imp if(!istype(C) || !C.mind)
break return 0
return if(custom)
if(!user || !user.Adjacent(src))
return 0
objective = stripped_input(usr,"What order do you want to imprint on [C]?","Enter the order","",120)
message_admins("[key_name_admin(user)] set brainwash machine objective to '[objective]'.")
log_game("[key_name_admin(user)] set brainwash machine objective to '[objective]'.")
var/datum/objective/custom_objective = new/datum/objective(objective)
custom_objective.owner = C.mind
C.mind.objectives += custom_objective
C.mind.announce_objectives()
message_admins("[key_name_admin(user)] brainwashed [key_name_admin(C)] with objective '[objective]'.")
log_game("[key_name_admin(user)] brainwashed [key_name_admin(C)] with objective '[objective]'.")
return 1
/obj/machinery/implantchair/add_implants()
for(var/i=0, i<src.max_implants, i++)
var/obj/item/weapon/implant/mindshield/I = new /obj/item/weapon/implant/mindshield(src)
implant_list += I
return
/obj/machinery/implantchair/verb/get_out()
set name = "Eject occupant"
set category = "Object"
set src in oview(1)
if(usr.stat != 0)
return
src.go_out(usr)
add_fingerprint(usr)
return
/obj/machinery/implantchair/verb/move_inside()
set name = "Move Inside"
set category = "Object"
set src in oview(1)
if(usr.stat != 0 || stat & (NOPOWER|BROKEN))
return
put_mob(usr)
return

View File

@@ -20,10 +20,7 @@
H.mind.objectives += hijack_objective H.mind.objectives += hijack_objective
H << "<B>You are the traitor.</B>" H << "<B>You are the traitor.</B>"
var/obj_count = 1 H.mind.announce_objectives()
for(var/datum/objective/OBJ in H.mind.objectives)
H << "<B>Objective #[obj_count]</B>: [OBJ.explanation_text]"
obj_count++
for (var/obj/item/I in H) for (var/obj/item/I in H)
if (istype(I, /obj/item/weapon/implant)) if (istype(I, /obj/item/weapon/implant))
@@ -67,10 +64,7 @@
H.mind.objectives += hijack_objective H.mind.objectives += hijack_objective
H << "<B>You are the multiverse summoner. Activate your blade to summon copies of yourself from another universe to fight by your side.</B>" H << "<B>You are the multiverse summoner. Activate your blade to summon copies of yourself from another universe to fight by your side.</B>"
var/obj_count = 1 H.mind.announce_objectives()
for(var/datum/objective/OBJ in H.mind.objectives)
H << "<B>Objective #[obj_count]</B>: [OBJ.explanation_text]"
obj_count++
var/obj/item/slot_item_ID = H.get_item_by_slot(slot_wear_id) var/obj/item/slot_item_ID = H.get_item_by_slot(slot_wear_id)
qdel(slot_item_ID) qdel(slot_item_ID)

View File

@@ -100,10 +100,7 @@
hijack.owner = user.mind hijack.owner = user.mind
user.mind.objectives += hijack user.mind.objectives += hijack
user << "<B>Your inhibitions are swept away, the bonds of loyalty broken, you are free to murder as you please!</B>" user << "<B>Your inhibitions are swept away, the bonds of loyalty broken, you are free to murder as you please!</B>"
var/obj_count = 1 user.mind.announce_objectives()
for(var/datum/objective/OBJ in user.mind.objectives)
user << "<B>Objective #[obj_count]</B>: [OBJ.explanation_text]"
obj_count++
user.set_species(/datum/species/shadow) user.set_species(/datum/species/shadow)
if("Peace") if("Peace")
user << "<B>Whatever alien sentience that the Wish Granter possesses is satisfied with your wish. There is a distant wailing as the last of the Faithless begin to die, then silence.</B>" user << "<B>Whatever alien sentience that the Wish Granter possesses is satisfied with your wish. There is a distant wailing as the last of the Faithless begin to die, then silence.</B>"

View File

@@ -24,10 +24,7 @@
H.mind.objectives += survive H.mind.objectives += survive
H.attack_log += "\[[time_stamp()]\] <font color='red'>Was made into a survivalist, and trusts no one!</font>" H.attack_log += "\[[time_stamp()]\] <font color='red'>Was made into a survivalist, and trusts no one!</font>"
H << "<B>You are the survivalist! Your own safety matters above all else, and the only way to ensure your safety is to stockpile weapons! Grab as many guns as possible, by any means necessary. Kill anyone who gets in your way.</B>" H << "<B>You are the survivalist! Your own safety matters above all else, and the only way to ensure your safety is to stockpile weapons! Grab as many guns as possible, by any means necessary. Kill anyone who gets in your way.</B>"
var/obj_count = 1 H.mind.announce_objectives()
for(var/datum/objective/OBJ in H.mind.objectives)
H << "<B>Objective #[obj_count]</B>: [OBJ.explanation_text]"
obj_count++
var/randomizeguns = pick(gunslist) var/randomizeguns = pick(gunslist)
var/randomizemagic = pick(magiclist) var/randomizemagic = pick(magiclist)
var/randomizemagicspecial = pick(magicspeciallist) var/randomizemagicspecial = pick(magicspeciallist)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,40 @@
<script>
component.exports = {
computed: {
occupantStatState () {
switch (this.get('data.occupant.stat')) {
case 0: return 'good'
case 1: return 'average'
default: return 'bad'
}
}
}
}
</script>
<ui-display title='Occupant'>
<ui-section label='Occupant'>
<span>{{data.occupant.name ? data.occupant.name : "No Occupant"}}</span>
</ui-section>
{{#if data.occupied}}
<ui-section label='State'>
<span class='{{occupantStatState}}'>{{data.occupant.stat == 0 ? "Conscious" : data.occupant.stat == 1 ? "Unconcious" : "Dead"}}</span>
</ui-section>
{{/if}}
</ui-display>
<ui-display title='Controls'>
<ui-section label='Door'>
<ui-button icon='{{data.open ? "unlock" : "lock"}}' action='door'>{{data.open ? "Open" : "Closed"}}</ui-button>
</ui-section>
<ui-section label='Uses'>
{{ data.ready_implants }}
{{#if data.replenishing}}
<span class='fa fa-cog fa-spin'/>
{{/if}}
</ui-section>
<ui-section label='Activate'>
<ui-button state='{{data.occupied && data.ready_implants > 0 && data.ready ? null : "disabled"}}' action='implant'>
{{ data.ready ? (data.special_name ? data.special_name : "Implant") : "Recharging"}}
</ui-button><br/>
</ui-section>
</ui-display>