Files
CHOMPStation2/code/modules/xenobio2/machinery/injector_computer.dm
Neerti ea6128f986 Adds Modifier System, Changes Some Ling Stuff
Adds a fairly simple system that allows adjusting various numbers like max health, incoming damage, outgoing melee damage, etc.  The nice part is that changing certain variables this way (like max health) is a lot safer than manually setting the max health var directly.
Changes a lot of short lines of code to point towards a variable's getter or setter helper instead of reading the var directly so the modifiers can work.
Endoarmor, delayed toxin sting, Enfeebling sting, and recursive adrenaline overdose now use the modifier system.
Enfeebling sting now only lasts two minutes, from five minutes, however it now also reduces the victim's melee damage by 25%/50%, and increases the damage they suffer by 10%/35%, for normal and recursive respectively.
Delayed Toxin Sting's effects are now felt all at once instead of over the course of a few minutes.
2017-04-18 21:23:59 -04:00

114 lines
3.0 KiB
Plaintext

/*
This file contains:
Manual Injector:
Manually injects chemicals into a xenobiological creature from a linked machine.
*/
/obj/machinery/computer/xenobio2
name = "injector control console"
desc = "Used to control mechanized biological injectors."
icon_keyboard = "med_key"
icon_screen = "dna"
light_color = "#315ab4"
use_power = 1
idle_power_usage = 250
active_power_usage = 500
circuit = /obj/item/weapon/circuitboard/xenobio2computer
var/obj/machinery/xenobio2/manualinjector/injector
var/transfer_amount
var/active
/obj/machinery/computer/xenobio2/Destroy()
injector.computer = null
..()
/obj/machinery/computer/xenobio2/attack_hand(mob/user)
if(..())
return 1
ui_interact(user)
/obj/machinery/computer/xenobio2/attackby(var/obj/item/W, var/mob/user)
//Did you want to link it?
if(istype(W, /obj/item/device/multitool))
var/obj/item/device/multitool/P = W
if(P.connectable)
if(istype(P.connectable, /obj/machinery/xenobio2/manualinjector))
var/obj/machinery/xenobio2/manualinjector/I = P.connectable
injector = I
I.computer = src
user << "<span class='warning'> You link the [src] to the [P.connectable]!</span>"
else
user << "<span class='warning'> You store the [src] in the [P]'s buffer!</span>"
P.connectable = src
return
..()
/obj/machinery/computer/xenobio2/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
if(!user)
return
if(!injector)
return
var/list/data = list()
data["activity"] = active
data["beaker"] = injector.beaker
if(injector.occupant)
data["occupied"] = 1
if(isxeno(injector.occupant))
var/mob/living/simple_animal/xeno/X = injector.occupant
data["compatible"] = 1
data["instability"] = 100 * (X.mut_level / X.mut_max)
else
data["compatible"] = null
if(injector.beaker)
data["reagentAmount"] = injector.beaker.reagents.total_volume
data["reagentMax"] = injector.beaker.reagents.maximum_volume
data["reagentMin"] = 0
else
data["reagentAmount"] = null
data["reagentMax"] = 1
data["reagentMin"] = 0
if(injector.occupant)
data["occupantHealth"] = injector.occupant.health
data["occupantHealthMax"] = injector.occupant.getMaxHealth()
else
data["occupantHealth"] = null
data["occupantHealthMax"] = null
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "xenobio_computer.tmpl", "Injector Control Console UI", 470, 450)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/obj/machinery/computer/xenobio2/Topic(href, href_list)
if(..())
return 1
if(href_list["inject_target"])
active = 1
spawn(5)
injector.inject_reagents()
active = 0
if(href_list["eject_occupant"])
injector.eject_xeno()
if(href_list["eject_beaker"])
injector.eject_beaker()
usr.set_machine(src)
src.add_fingerprint(usr)
/obj/item/weapon/circuitboard/xenobio2computer
name = T_BOARD("injector control console")
build_path = /obj/machinery/computer/xenobio2
origin_tech = list() //To be filled