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.")
else if (href_list["obj_announce"])
var/obj_count = 1
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++
announce_objectives()
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()
var/list/L = current.get_contents()
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
/datum/game_mode/proc/greet_gang(datum/mind/boss_mind, you_are=1)
var/obj_count = 1
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>"
for(var/datum/objective/objective in boss_mind.objectives)
boss_mind.current << "<B>Objective #[obj_count]</B>: [objective.explanation_text]"
obj_count++
boss_mind.announce_objectives()
///////////////////////////////////////////////////////////////////////////
//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'>Use your stealth technology and equipment to incapacitate humans for your scientist to retrieve.</span>"
var/obj_count = 1
for(var/datum/objective/objective in abductor.objectives)
abductor.current << "<B>Objective #[obj_count]</B>: [objective.explanation_text]"
obj_count++
return
abductor.announce_objectives()
/datum/game_mode/abduction/proc/greet_scientist(datum/mind/abductor,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'>Use your tool and ship consoles to support the agent and retrieve human specimens.</span>"
var/obj_count = 1
for(var/datum/objective/objective in abductor.objectives)
abductor.current << "<B>Objective #[obj_count]</B>: [objective.explanation_text]"
obj_count++
return
abductor.announce_objectives()
/datum/game_mode/abduction/proc/equip_common(mob/living/carbon/human/agent,team_number)
var/radio_freq = SYND_FREQ

View File

@@ -159,11 +159,7 @@
var/datum/objective/abductee/O = new objtype()
ticker.mode.abductees += H.mind
H.mind.objectives += O
var/obj_count = 1
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++
H.mind.announce_objectives()
ticker.mode.update_abductor_icons_added(H.mind)
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)
if(you_are)
syndicate.current << "<span class='notice'>You are a [syndicate_name()] agent!</span>"
var/obj_count = 1
for(var/datum/objective/objective in syndicate.objectives)
syndicate.current << "<B>Objective #[obj_count]</B>: [objective.explanation_text]"
obj_count++
return
syndicate.announce_objectives()
/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

View File

@@ -106,14 +106,11 @@
rev_mind.objectives += rev_obj
/datum/game_mode/proc/greet_revolutionary(datum/mind/rev_mind, you_are=1)
var/obj_count = 1
update_rev_icons_added(rev_mind)
if (you_are)
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.current << "<B>Objective #[obj_count]</B>: [objective.explanation_text]"
rev_mind.special_role = "Head Revolutionary"
obj_count++
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//

View File

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

View File

@@ -118,10 +118,7 @@
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>"
var/obj_count = 1
for(var/datum/objective/objective in wizard.objectives)
wizard.current << "<B>Objective #[obj_count]</B>: [objective.explanation_text]"
obj_count++
wizard.announce_objectives()
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>"
var/obj_count = 1
for(var/datum/objective/OBJ in M.mind.objectives)
M << "<B>Objective #[obj_count]</B>: [OBJ.explanation_text]"
obj_count++
M.mind.announce_objectives()
src.updateUsrDialog()
return
/obj/machinery/syndicate_beacon/proc/selfdestruct()

View File

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

View File

@@ -7,141 +7,186 @@
icon_state = "implantchair"
density = 1
opacity = 0
anchored = 1
anchored = TRUE
var/ready = 1
var/malfunction = 0
var/list/obj/item/weapon/implant/mindshield/implant_list = list()
var/ready = TRUE
var/replenishing = FALSE
var/ready_implants = 5
var/max_implants = 5
var/injection_cooldown = 600
var/replenish_cooldown = 6000
var/replenishing = 0
var/injecting = 0
/obj/machinery/implantchair/proc
go_out()
put_mob(mob/living/carbon/M)
implant(var/mob/M)
add_implants()
var/implant_type = /obj/item/weapon/implant/mindshield
var/auto_inject = FALSE
var/auto_replenish = TRUE
var/special = FALSE
var/special_name = "special function"
/obj/machinery/implantchair/New()
..()
add_implants()
open_machine()
update_icon()
/obj/machinery/implantchair/attack_hand(mob/user)
user.set_machine(src)
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)]"
/obj/machinery/implantchair/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
datum/tgui/master_ui = null, datum/ui_state/state = notcontained_state)
var/dat ="<B>Implanter Status</B><BR>"
dat +="<B>Current occupant:</B> [src.occupant ? "<BR>Name: [src.occupant]<BR>Health: [health_text]<BR>" : "<FONT color=red>None</FONT>"]<BR>"
dat += "<B>Implants:</B> [src.implant_list.len ? "[implant_list.len]" : "<A href='?src=\ref[src];replenish=1'>Replenish</A>"]<BR>"
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")
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "implantchair", name, 375, 280, master_ui, state)
ui.open()
/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(..())
return
if(href_list["implant"])
if(src.occupant)
injecting = 1
go_out()
ready = 0
spawn(injection_cooldown)
ready = 1
switch(action)
if("door")
if(state_open)
close_machine()
else
open_machine()
. = TRUE
if("implant")
implant(occupant,usr)
. = TRUE
if(href_list["replenish"])
ready = 0
spawn(replenish_cooldown)
add_implants()
ready = 1
updateUsrDialog()
/obj/machinery/implantchair/go_out(mob/M)
if(!occupant)
/obj/machinery/implantchair/proc/implant(mob/living/carbon/M,mob/user)
if (!istype(M))
return
if(M == occupant) // so that the guy inside can't eject himself -Agouri
if(!ready_implants || !ready)
return
occupant.loc = loc
occupant.reset_perspective(null)
if(injecting)
implant(src.occupant)
injecting = 0
occupant = null
icon_state = "implantchair"
return
if(implant_action(M,user))
ready_implants--
if(!replenishing && auto_replenish)
replenishing = TRUE
addtimer(src,"replenish",replenish_cooldown)
if(injection_cooldown > 0)
ready = FALSE
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)
if(!iscarbon(M))
usr << "<span class='warning'>The [src.name] cannot hold this!</span>"
/obj/machinery/implantchair/update_icon()
icon_state = initial(icon_state)
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
if(src.occupant)
usr << "<span class='warning'>The [src.name] is already occupied!</span>"
user.changeNext_move(CLICK_CD_BREAKOUT)
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
M.stop_pulling()
M.loc = src
M.reset_perspective(src)
src.occupant = M
src.add_fingerprint(usr)
icon_state = "implantchair_on"
close_machine(target)
/obj/machinery/implantchair/close_machine(mob/user)
if((isnull(user) || istype(user)) && state_open)
..(user)
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
/obj/machinery/implantchair/implant(mob/M)
if (!istype(M, /mob/living/carbon))
return
if(!implant_list.len)
return
for(var/obj/item/weapon/implant/mindshield/imp in implant_list)
if(!imp)
continue
if(istype(imp, /obj/item/weapon/implant/mindshield))
M.visible_message("<span class='warning'>[M] has been implanted by the [src.name].</span>")
/obj/machinery/implantchair/brainwash
name = "Neural Imprinter"
desc = "Used to <s>indoctrinate</s> rehabilitate hardened recidivists."
special_name = "Imprint"
injection_cooldown = 3000
auto_inject = FALSE
auto_replenish = FALSE
special = TRUE
var/objective = "Obey the law. Praise Nanotrasen."
var/custom = FALSE
if(imp.implant(M))
implant_list -= imp
break
return
/obj/machinery/implantchair/brainwash/implant_action(mob/living/carbon/C,mob/user)
if(!istype(C) || !C.mind)
return 0
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 << "<B>You are the traitor.</B>"
var/obj_count = 1
for(var/datum/objective/OBJ in H.mind.objectives)
H << "<B>Objective #[obj_count]</B>: [OBJ.explanation_text]"
obj_count++
H.mind.announce_objectives()
for (var/obj/item/I in H)
if (istype(I, /obj/item/weapon/implant))
@@ -67,10 +64,7 @@
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>"
var/obj_count = 1
for(var/datum/objective/OBJ in H.mind.objectives)
H << "<B>Objective #[obj_count]</B>: [OBJ.explanation_text]"
obj_count++
H.mind.announce_objectives()
var/obj/item/slot_item_ID = H.get_item_by_slot(slot_wear_id)
qdel(slot_item_ID)

View File

@@ -100,10 +100,7 @@
hijack.owner = user.mind
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>"
var/obj_count = 1
for(var/datum/objective/OBJ in user.mind.objectives)
user << "<B>Objective #[obj_count]</B>: [OBJ.explanation_text]"
obj_count++
user.mind.announce_objectives()
user.set_species(/datum/species/shadow)
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>"

View File

@@ -24,10 +24,7 @@
H.mind.objectives += survive
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>"
var/obj_count = 1
for(var/datum/objective/OBJ in H.mind.objectives)
H << "<B>Objective #[obj_count]</B>: [OBJ.explanation_text]"
obj_count++
H.mind.announce_objectives()
var/randomizeguns = pick(gunslist)
var/randomizemagic = pick(magiclist)
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>