Merge remote-tracking branch 'upstream/master' into bombing-logging-and-co

This commit is contained in:
joep van der velden
2020-09-16 15:26:19 +02:00
1825 changed files with 98847 additions and 393967 deletions
+2 -19
View File
@@ -13,7 +13,6 @@
var/list/datum/reagent/addiction_list = new/list()
var/list/addiction_threshold_accumulated = new/list()
var/flags
var/list/reagents_generated_per_cycle = new/list()
/datum/reagents/New(maximum = 100, temperature_minimum, temperature_maximum)
maximum_volume = maximum
@@ -21,8 +20,6 @@
temperature_min = temperature_minimum
if(temperature_maximum)
temperature_max = temperature_maximum
if(!(flags & REAGENT_NOREACT))
START_PROCESSING(SSobj, src)
//I dislike having these here but map-objects are initialised before world/New() is called. >_>
if(!GLOB.chemical_reagents_list)
//Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
@@ -185,7 +182,7 @@
return amount
/datum/reagents/proc/set_reagent_temp(new_temp = T0C, react = TRUE)
chem_temp = Clamp(new_temp, temperature_min, temperature_max)
chem_temp = clamp(new_temp, temperature_min, temperature_max)
if(react)
temperature_react()
handle_reactions()
@@ -361,23 +358,10 @@
od_chems.Add(R.id)
return od_chems
/datum/reagents/process()
if(flags & REAGENT_NOREACT)
STOP_PROCESSING(SSobj, src)
return
for(var/thing in reagents_generated_per_cycle)
add_reagent(thing, reagents_generated_per_cycle[thing])
for(var/datum/reagent/R in reagent_list)
R.on_tick()
/datum/reagents/proc/set_reacting(react = TRUE)
if(react)
// Order is important, process() can remove from processing if
// the flag is present
flags &= ~(REAGENT_NOREACT)
START_PROCESSING(SSobj, src)
else
STOP_PROCESSING(SSobj, src)
flags |= REAGENT_NOREACT
/*
@@ -639,7 +623,7 @@
if(total_volume + amount > maximum_volume) amount = (maximum_volume - total_volume) //Doesnt fit in. Make it disappear. Shouldnt happen. Will happen.
if(amount <= 0)
return 0
chem_temp = Clamp((chem_temp * total_volume + reagtemp * amount) / (total_volume + amount), temperature_min, temperature_max) //equalize with new chems
chem_temp = clamp((chem_temp * total_volume + reagtemp * amount) / (total_volume + amount), temperature_min, temperature_max) //equalize with new chems
for(var/A in reagent_list)
@@ -906,7 +890,6 @@
/datum/reagents/Destroy()
. = ..()
STOP_PROCESSING(SSobj, src)
QDEL_LIST(reagent_list)
reagent_list = null
QDEL_LIST(addiction_list)
@@ -24,6 +24,7 @@
var/list/hacked_reagents = list("toxin")
var/hack_message = "You disable the safety safeguards, enabling the \"Mad Scientist\" mode."
var/unhack_message = "You re-enable the safety safeguards, enabling the \"NT Standard\" mode."
var/is_drink = FALSE
/obj/machinery/chem_dispenser/get_cell()
return cell
@@ -120,7 +121,6 @@
var/usedpower = cell.give(recharge_amount)
if(usedpower)
use_power(15 * recharge_amount)
SSnanoui.update_uis(src) // update all UIs attached to src
recharge_counter = 0
return
recharge_counter++
@@ -131,7 +131,6 @@
else
spawn(rand(0, 15))
stat |= NOPOWER
SSnanoui.update_uis(src) // update all UIs attached to src
/obj/machinery/chem_dispenser/ex_act(severity)
if(severity < 3)
@@ -145,19 +144,17 @@
beaker = null
overlays.Cut()
/obj/machinery/chem_dispenser/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1)
/obj/machinery/chem_dispenser/tgui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/tgui_state/state = GLOB.tgui_default_state)
// update the ui if it exists, returns null if no ui is passed/found
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, force_open)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "chem_dispenser.tmpl", ui_title, 390, 655)
// open the new ui window
ui = new(user, src, ui_key, "ChemDispenser", ui_title, 390, 655)
ui.open()
/obj/machinery/chem_dispenser/ui_data(mob/user, ui_key = "main", datum/topic_state/state = GLOB.default_state)
/obj/machinery/chem_dispenser/tgui_data(mob/user)
var/data[0]
data["glass"] = is_drink
data["amount"] = amount
data["energy"] = cell.charge ? cell.charge * powerefficiency : "0" //To prevent NaN in the UI.
data["maxEnergy"] = cell.maxcharge * powerefficiency
@@ -187,63 +184,59 @@
return data
/obj/machinery/chem_dispenser/Topic(href, href_list)
/obj/machinery/chem_dispenser/tgui_act(actions, params)
if(..())
return TRUE
return
if(stat & (NOPOWER|BROKEN))
return
if(href_list["amount"])
amount = round(text2num(href_list["amount"]), 1) // round to nearest 1
if(amount < 0) // Since the user can actually type the commands himself, some sanity checking
amount = 0
if(amount > 100)
amount = 100
if(href_list["dispense"])
if(!is_operational() || QDELETED(cell))
return
if(beaker && dispensable_reagents.Find(href_list["dispense"]))
. = TRUE
switch(actions)
if("amount")
amount = clamp(round(text2num(params["amount"]), 1), 0, 50) // round to nearest 1 and clamp to 0 - 50
if("dispense")
if(!is_operational() || QDELETED(cell))
return
if(!beaker || !dispensable_reagents.Find(params["reagent"]))
return
var/datum/reagents/R = beaker.reagents
var/free = R.maximum_volume - R.total_volume
var/actual = min(amount, (cell.charge * powerefficiency) * 10, free)
if(!cell.use(actual / powerefficiency))
atom_say("Not enough energy to complete operation!")
return
R.add_reagent(href_list["dispense"], actual)
R.add_reagent(params["reagent"], actual)
overlays.Cut()
if(!icon_beaker)
icon_beaker = image('icons/obj/chemical.dmi', src, "disp_beaker") //randomize beaker overlay position.
icon_beaker = mutable_appearance('icons/obj/chemical.dmi', "disp_beaker") //randomize beaker overlay position.
icon_beaker.pixel_x = rand(-10, 5)
overlays += icon_beaker
if(href_list["remove"])
if(beaker)
if(href_list["removeamount"])
var/amount = text2num(href_list["removeamount"])
if(isnum(amount) && (amount > 0))
var/datum/reagents/R = beaker.reagents
var/id = href_list["remove"]
R.remove_reagent(id, amount)
else if(isnum(amount) && (amount == -1)) //Isolate instead
var/datum/reagents/R = beaker.reagents
var/id = href_list["remove"]
R.isolate_reagent(id)
if(href_list["ejectBeaker"])
if(beaker)
if("remove")
var/amount = text2num(params["amount"])
if(!beaker || !amount)
return
var/datum/reagents/R = beaker.reagents
var/id = params["reagent"]
if(amount > 0)
R.remove_reagent(id, amount)
else if(amount == -1) //Isolate instead
R.isolate_reagent(id)
if("ejectBeaker")
if(!beaker)
return
beaker.forceMove(loc)
if(Adjacent(usr) && !issilicon(usr))
usr.put_in_hands(beaker)
beaker = null
overlays.Cut()
else
return FALSE
add_fingerprint(usr)
return TRUE // update UIs attached to this object
/obj/machinery/chem_dispenser/attackby(obj/item/I, mob/user, params)
if(exchange_parts(user, I))
SSnanoui.update_uis(src)
SStgui.update_uis(src)
return
if(isrobot(user))
@@ -263,9 +256,9 @@
beaker = I
I.forceMove(src)
to_chat(user, "<span class='notice'>You set [I] on the machine.</span>")
SSnanoui.update_uis(src) // update all UIs attached to src
SStgui.update_uis(src) // update all UIs attached to src
if(!icon_beaker)
icon_beaker = image('icons/obj/chemical.dmi', src, "disp_beaker") //randomize beaker overlay position.
icon_beaker = mutable_appearance('icons/obj/chemical.dmi', "disp_beaker") //randomize beaker overlay position.
icon_beaker.pixel_x = rand(-10, 5)
overlays += icon_beaker
return
@@ -299,8 +292,7 @@
to_chat(user, unhack_message)
dispensable_reagents -= hacked_reagents
hackedcheck = FALSE
SSnanoui.update_uis(src)
SStgui.update_uis(src)
/obj/machinery/chem_dispenser/screwdriver_act(mob/user, obj/item/I)
if(default_deconstruction_screwdriver(user, "[initial(icon_state)]-o", "[initial(icon_state)]", I))
@@ -321,14 +313,14 @@
return attack_hand(user)
/obj/machinery/chem_dispenser/attack_ghost(mob/user)
if(user.can_admin_interact())
return attack_hand(user)
if(stat & BROKEN)
return
tgui_interact(user)
/obj/machinery/chem_dispenser/attack_hand(mob/user)
if(stat & BROKEN)
return
ui_interact(user)
tgui_interact(user)
/obj/machinery/chem_dispenser/soda
icon_state = "soda_dispenser"
@@ -342,6 +334,7 @@
hacked_reagents = list("thirteenloko")
hack_message = "You change the mode from 'McNano' to 'Pizza King'."
unhack_message = "You change the mode from 'Pizza King' to 'McNano'."
is_drink = TRUE
/obj/machinery/chem_dispenser/soda/New()
..()
@@ -377,6 +370,7 @@
hacked_reagents = list("goldschlager", "patron", "absinthe", "ethanol", "nothing", "sake")
hack_message = "You disable the 'nanotrasen-are-cheap-bastards' lock, enabling hidden and very expensive boozes."
unhack_message = "You re-enable the 'nanotrasen-are-cheap-bastards' lock, disabling hidden and very expensive boozes."
is_drink = TRUE
/obj/machinery/chem_dispenser/beer/New()
..()
@@ -1,15 +1,19 @@
/obj/machinery/chem_heater
name = "chemical heater"
density = 1
anchored = 1
density = TRUE
anchored = TRUE
icon = 'icons/obj/chemical.dmi'
icon_state = "mixer0b"
use_power = IDLE_POWER_USE
idle_power_usage = 40
resistance_flags = FIRE_PROOF | ACID_PROOF
resistance_flags = FIRE_PROOF|ACID_PROOF
var/obj/item/reagent_containers/beaker = null
var/desired_temp = T0C
var/on = FALSE
/// Whether this should auto-eject the beaker once done heating/cooling.
var/auto_eject = FALSE
/// The higher this number, the faster reagents will heat/cool.
var/speed_increase = 0
/obj/machinery/chem_heater/New()
..()
@@ -19,35 +23,36 @@
component_parts += new /obj/item/stack/sheet/glass(null)
RefreshParts()
/obj/machinery/chem_heater/RefreshParts()
speed_increase = initial(speed_increase)
for(var/obj/item/stock_parts/micro_laser/M in component_parts)
speed_increase += 5 * (M.rating - 1)
/obj/machinery/chem_heater/process()
..()
if(stat & NOPOWER)
if(stat & (NOPOWER|BROKEN))
return
var/state_change = FALSE
if(on)
if(beaker)
if(!beaker.reagents.total_volume)
on = FALSE
SSnanoui.update_uis(src)
return
beaker.reagents.temperature_reagents(desired_temp)
beaker.reagents.temperature_reagents(desired_temp)
if(abs(beaker.reagents.chem_temp - desired_temp) <= 3)
beaker.reagents.temperature_reagents(desired_temp, max(1, 35 - speed_increase))
if(round(beaker.reagents.chem_temp) == round(desired_temp))
playsound(loc, 'sound/machines/ding.ogg', 50, 1)
on = FALSE
state_change = TRUE
if(state_change)
SSnanoui.update_uis(src)
if(auto_eject)
eject_beaker()
/obj/machinery/chem_heater/proc/eject_beaker(mob/user)
if(beaker)
beaker.forceMove(get_turf(src))
if(Adjacent(user) && !issilicon(user))
if(user && Adjacent(user) && !issilicon(user))
user.put_in_hands(beaker)
beaker = null
icon_state = "mixer0b"
on = FALSE
SSnanoui.update_uis(src)
SStgui.update_uis(src)
/obj/machinery/chem_heater/power_change()
if(powered())
@@ -55,7 +60,6 @@
else
spawn(rand(0, 15))
stat |= NOPOWER
SSnanoui.update_uis(src)
/obj/machinery/chem_heater/attackby(obj/item/I, mob/user)
if(isrobot(user))
@@ -71,7 +75,7 @@
I.forceMove(src)
to_chat(user, "<span class='notice'>You add the beaker to the machine!</span>")
icon_state = "mixer1b"
SSnanoui.update_uis(src)
SStgui.update_uis(src)
return
if(exchange_parts(user, I))
@@ -95,62 +99,62 @@
default_deconstruction_crowbar(user, I)
/obj/machinery/chem_heater/attack_hand(mob/user)
ui_interact(user)
tgui_interact(user)
/obj/machinery/chem_heater/attack_ghost(mob/user)
if(user.can_admin_interact())
return attack_hand(user)
tgui_interact(user)
/obj/machinery/chem_heater/attack_ai(mob/user)
add_hiddenprint(user)
return attack_hand(user)
/obj/machinery/chem_heater/Topic(href, href_list)
/obj/machinery/chem_heater/tgui_act(action, params)
if(..())
return FALSE
return
if(stat & (NOPOWER|BROKEN))
return
if(href_list["toggle_on"])
if(!beaker.reagents.total_volume)
return FALSE
on = !on
. = 1
if(href_list["adjust_temperature"])
var/val = href_list["adjust_temperature"]
if(isnum(val))
desired_temp = Clamp(desired_temp+val, 0, 1000)
else if(val == "input")
var/target = input("Please input the target temperature", name) as num
desired_temp = Clamp(target, 0, 1000)
. = TRUE
switch(action)
if("toggle_on")
on = !on
if("adjust_temperature")
desired_temp = clamp(text2num(params["target"]), 0, 1000)
if("eject_beaker")
eject_beaker(usr)
. = FALSE
if("toggle_autoeject")
auto_eject = !auto_eject
else
return FALSE
. = 1
add_fingerprint(usr)
if(href_list["eject_beaker"])
eject_beaker(usr)
. = 0 //updated in eject_beaker() already
/obj/machinery/chem_heater/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null)
/obj/machinery/chem_heater/tgui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/tgui_state/state = GLOB.tgui_default_state)
if(user.stat || user.restrained())
return
// update the ui if it exists, returns null if no ui is passed/found
ui = SSnanoui.try_update_ui(user, src, ui_key, ui)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "chem_heater.tmpl", "ChemHeater", 350, 270)
ui = new(user, src, ui_key, "ChemHeater", "Chemical Heater", 350, 270, master_ui, state)
ui.open()
/obj/machinery/chem_heater/ui_data(mob/user, ui_key = "main", datum/topic_state/state = GLOB.default_state)
/obj/machinery/chem_heater/tgui_data(mob/user)
var/data[0]
var/cur_temp = beaker ? beaker.reagents.chem_temp : null
data["targetTemp"] = desired_temp
data["targetTempReached"] = FALSE
data["autoEject"] = auto_eject
data["isActive"] = on
data["isBeakerLoaded"] = beaker ? 1 : 0
data["isBeakerLoaded"] = beaker ? TRUE : FALSE
data["currentTemp"] = beaker ? beaker.reagents.chem_temp : null
data["currentTemp"] = cur_temp
data["beakerCurrentVolume"] = beaker ? beaker.reagents.total_volume : null
data["beakerMaxVolume"] = beaker ? beaker.volume : null
if(cur_temp)
data["targetTempReached"] = round(cur_temp) == round(desired_temp)
//copy-pasted from chem dispenser
var/beakerContents[0]
if(beaker)
@@ -1,3 +1,9 @@
#define MAX_PILL_SPRITE 20 //max icon state of the pill sprites
#define MAX_MULTI_AMOUNT 20 // Max number of pills/patches that can be made at once
#define MAX_UNITS_PER_PILL 100 // Max amount of units in a pill
#define MAX_UNITS_PER_PATCH 30 // Max amount of units in a patch
#define MAX_CUSTOM_NAME_LEN 64 // Max length of a custom pill/condiment/whatever
/obj/machinery/chem_master
name = "\improper ChemMaster 3000"
density = TRUE
@@ -14,10 +20,12 @@
var/useramount = 30 // Last used amount
var/pillamount = 10
var/patchamount = 10
var/bottlesprite = "bottle"
var/pillsprite = "1"
var/bottlesprite = 1
var/pillsprite = 1
var/client/has_sprites = list()
var/printing = FALSE
var/static/list/pill_bottle_wrappers
var/static/list/bottle_styles
/obj/machinery/chem_master/New()
..()
@@ -94,7 +102,7 @@
beaker = I
I.forceMove(src)
to_chat(user, "<span class='notice'>You add the beaker to the machine!</span>")
SSnanoui.update_uis(src)
SStgui.update_uis(src)
update_icon()
else if(istype(I, /obj/item/storage/pill_bottle))
@@ -109,14 +117,10 @@
loaded_pill_bottle = I
I.forceMove(src)
to_chat(user, "<span class='notice'>You add [I] into the dispenser slot!</span>")
SSnanoui.update_uis(src)
SStgui.update_uis(src)
else
return ..()
/obj/machinery/chem_master/crowbar_act(mob/user, obj/item/I)
if(!panel_open)
return
@@ -142,319 +146,127 @@
power_change()
return TRUE
/obj/machinery/chem_master/Topic(href, href_list)
/obj/machinery/chem_master/tgui_act(action, params, datum/tgui/ui, datum/tgui_state/state)
if(..())
return
if(stat & (NOPOWER|BROKEN))
return
if(tgui_act_modal(action, params, ui, state))
return TRUE
add_fingerprint(usr)
usr.set_machine(src)
if(href_list["ejectp"])
if(loaded_pill_bottle)
loaded_pill_bottle.forceMove(loc)
loaded_pill_bottle = null
else if(href_list["change_pillbottle"])
if(loaded_pill_bottle)
var/list/wrappers = list("Default wrapper", "Red wrapper", "Green wrapper", "Pale green wrapper", "Blue wrapper", "Light blue wrapper", "Teal wrapper", "Yellow wrapper", "Orange wrapper", "Pink wrapper", "Brown wrapper")
var/chosen = input(usr, "Select a pillbottle wrapper", "Pillbottle wrapper", wrappers[1]) as null|anything in wrappers
if(!chosen)
. = TRUE
switch(action)
if("toggle")
mode = !mode
if("ejectp")
if(loaded_pill_bottle)
loaded_pill_bottle.forceMove(loc)
loaded_pill_bottle = null
if("print")
if(printing || condi)
return
var/color
switch(chosen)
if("Default wrapper")
loaded_pill_bottle.cut_overlays()
return
if("Red wrapper")
color = COLOR_RED
if("Green wrapper")
color = COLOR_GREEN
if("Pink wrapper")
color = COLOR_PINK
if("Teal wrapper")
color = COLOR_TEAL
if("Blue wrapper")
color = COLOR_BLUE
if("Brown wrapper")
color = COLOR_MAROON
if("Light blue wrapper")
color = COLOR_CYAN_BLUE
if("Yellow wrapper")
color = COLOR_YELLOW
if("Pale green wrapper")
color = COLOR_PALE_BTL_GREEN
if("Orange wrapper")
color = COLOR_ORANGE
loaded_pill_bottle.wrapper_color = color;
loaded_pill_bottle.apply_wrap();
else if(href_list["close"])
usr << browse(null, "window=chem_master")
onclose(usr, "chem_master")
usr.unset_machine()
return
if(href_list["print_p"])
if(!printing)
var/idx = text2num(params["idx"]) || 0
var/from_beaker = text2num(params["beaker"]) || FALSE
var/reagent_list = from_beaker ? beaker.reagents.reagent_list : reagents.reagent_list
if(idx < 1 || idx > length(reagent_list))
return
var/datum/reagent/R = reagent_list[idx]
printing = TRUE
visible_message("<span class='notice'>[src] rattles and prints out a sheet of paper.</span>")
playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, 1)
var/obj/item/paper/P = new /obj/item/paper(loc)
P.info = "<CENTER><B>Chemical Analysis</B></CENTER><BR>"
P.info = "<center><b>Chemical Analysis</b></center><br>"
P.info += "<b>Time of analysis:</b> [station_time_timestamp()]<br><br>"
P.info += "<b>Chemical name:</b> [href_list["name"]]<br>"
if(href_list["name"] == "Blood")
var/datum/reagents/R = beaker.reagents
var/datum/reagent/blood/G
for(var/datum/reagent/F in R.reagent_list)
if(F.name == href_list["name"])
G = F
break
var/B = G.data["blood_type"]
var/C = G.data["blood_DNA"]
P.info += "<b>Description:</b><br>Blood Type: [B]<br>DNA: [C]"
P.info += "<b>Chemical name:</b> [R.name]<br>"
if(istype(R, /datum/reagent/blood))
var/datum/reagent/blood/B = R
P.info += "<b>Description:</b> N/A<br><b>Blood Type:</b> [B.data["blood_type"]]<br><b>DNA:</b> [B.data["blood_DNA"]]"
else
P.info += "<b>Description:</b> [href_list["desc"]]"
P.info += "<b>Description:</b> [R.description]"
P.info += "<br><br><b>Notes:</b><br>"
P.name = "Chemical Analysis - [href_list["name"]]"
printing = FALSE
P.name = "Chemical Analysis - [R.name]"
spawn(50)
printing = FALSE
else
. = FALSE
if(beaker)
var/datum/reagents/R = beaker.reagents
if(href_list["analyze"])
var/dat = ""
if(!condi)
if(href_list["name"] == "Blood")
var/datum/reagent/blood/G
for(var/datum/reagent/F in R.reagent_list)
if(F.name == href_list["name"])
G = F
break
var/A = G.name
var/B = G.data["blood_type"]
var/C = G.data["blood_DNA"]
dat += "<TITLE>Chemmaster 3000</TITLE>Chemical infos:<BR><BR>Name:<BR>[A]<BR><BR>Description:<BR>Blood Type: [B]<br>DNA: [C]"
else
dat += "<TITLE>Chemmaster 3000</TITLE>Chemical infos:<BR><BR>Name:<BR>[href_list["name"]]<BR><BR>Description:<BR>[href_list["desc"]]"
dat += "<BR><BR><A href='?src=[UID()];print_p=1;desc=[href_list["desc"]];name=[href_list["name"]]'>(Print Analysis)</A><BR>"
dat += "<A href='?src=[UID()];main=1'>(Back)</A>"
if(. || !beaker)
return
. = TRUE
var/datum/reagents/R = beaker.reagents
switch(action)
if("add")
var/id = params["id"]
var/amount = text2num(params["amount"])
if(!id || !amount)
return
R.trans_id_to(src, id, amount)
if("remove")
var/id = params["id"]
var/amount = text2num(params["amount"])
if(!id || !amount)
return
if(mode)
reagents.trans_id_to(beaker, id, amount)
else
dat += "<TITLE>Condimaster 3000</TITLE>Condiment infos:<BR><BR>Name:<BR>[href_list["name"]]<BR><BR>Description:<BR>[href_list["desc"]]<BR><BR><BR><A href='?src=[UID()];main=1'>(Back)</A>"
usr << browse(dat, "window=chem_master;size=575x500")
return
else if(href_list["add"])
if(href_list["amount"])
var/id = href_list["add"]
var/amount = text2num(href_list["amount"])
R.trans_id_to(src, id, amount)
else if(href_list["addcustom"])
var/id = href_list["addcustom"]
useramount = input("Select the amount to transfer.", 30, useramount) as num
useramount = isgoodnumber(useramount)
Topic(null, list("amount" = "[useramount]", "add" = "[id]"))
else if(href_list["remove"])
if(href_list["amount"])
var/id = href_list["remove"]
var/amount = text2num(href_list["amount"])
if(mode)
reagents.trans_id_to(beaker, id, amount)
else
reagents.remove_reagent(id, amount)
else if(href_list["removecustom"])
var/id = href_list["removecustom"]
useramount = input("Select the amount to transfer.", 30, useramount) as num
useramount = isgoodnumber(useramount)
Topic(null, list("amount" = "[useramount]", "remove" = "[id]"))
else if(href_list["toggle"])
mode = !mode
else if(href_list["main"])
attack_hand(usr)
return
else if(href_list["eject"])
if(beaker)
beaker.forceMove(get_turf(src))
if(Adjacent(usr) && !issilicon(usr))
usr.put_in_hands(beaker)
beaker = null
reagents.clear_reagents()
update_icon()
else if(href_list["createpill"] || href_list["createpill_multiple"])
if(!condi)
var/count = 1
if(href_list["createpill_multiple"])
count = input("Select the number of pills to make.", 10, pillamount) as num|null
if(count == null)
return
count = isgoodnumber(count)
if(count > 20)
count = 20 //Pevent people from creating huge stacks of pills easily. Maybe move the number to defines?
if(count <= 0)
return
var/amount_per_pill = reagents.total_volume / count
if(amount_per_pill > 100)
amount_per_pill = 100
var/name = clean_input("Name:","Name your pill!","[reagents.get_master_reagent_name()] ([amount_per_pill]u)")
if(!name)
return
name = reject_bad_text(name)
while(count--)
if(reagents.total_volume <= 0)
to_chat(usr, "<span class='notice'>Not enough reagents to create these pills!</span>")
return
var/obj/item/reagent_containers/food/pill/P = new/obj/item/reagent_containers/food/pill(loc)
if(!name)
name = reagents.get_master_reagent_name()
P.name = "[name] pill"
P.pixel_x = rand(-7, 7) //random position
P.pixel_y = rand(-7, 7)
P.icon_state = "pill"+pillsprite
reagents.trans_to(P, amount_per_pill)
if(loaded_pill_bottle && loaded_pill_bottle.type == /obj/item/storage/pill_bottle)
if(loaded_pill_bottle.contents.len < loaded_pill_bottle.storage_slots)
P.forceMove(loaded_pill_bottle)
updateUsrDialog()
else
var/name = clean_input("Name:", "Name your bag!", reagents.get_master_reagent_name())
if(!name)
return
name = reject_bad_text(name)
var/obj/item/reagent_containers/food/condiment/pack/P = new/obj/item/reagent_containers/food/condiment/pack(loc)
if(!name) name = reagents.get_master_reagent_name()
P.originalname = name
P.name = "[name] pack"
P.desc = "A small condiment pack. The label says it contains [name]."
reagents.trans_to(P, 10)
else if(href_list["createpatch"] || href_list["createpatch_multiple"])
if(!condi)
var/count = 1
if(href_list["createpatch_multiple"])
count = input("Select the number of patches to make.", 10, patchamount) as num|null
if(count == null)
return
count = isgoodnumber(count)
if(!count || count <= 0)
return
if(count > 20)
count = 20 //Pevent people from creating huge stacks of patches easily. Maybe move the number to defines?
var/amount_per_patch = reagents.total_volume/count
if(amount_per_patch > 30)
amount_per_patch = 30
var/name = clean_input("Name:", "Name your patch!", "[reagents.get_master_reagent_name()] ([amount_per_patch]u)")
if(!name)
return
name = reject_bad_text(name)
var/is_medical_patch = chemical_safety_check(reagents)
while(count--)
var/obj/item/reagent_containers/food/pill/patch/P = new/obj/item/reagent_containers/food/pill/patch(loc)
if(!name) name = reagents.get_master_reagent_name()
P.name = "[name] patch"
P.pixel_x = rand(-7, 7) //random position
P.pixel_y = rand(-7, 7)
reagents.trans_to(P,amount_per_patch)
if(is_medical_patch)
P.instant_application = TRUE
P.icon_state = "bandaid_med"
if(loaded_pill_bottle && loaded_pill_bottle.type == /obj/item/storage/pill_bottle/patch_pack)
if(loaded_pill_bottle.contents.len < loaded_pill_bottle.storage_slots)
P.forceMove(loaded_pill_bottle)
updateUsrDialog()
else if(href_list["createbottle"])
if(!condi)
var/name = clean_input("Name:", "Name your bottle!", reagents.get_master_reagent_name())
if(!name)
return
name = reject_bad_text(name)
var/obj/item/reagent_containers/glass/bottle/reagent/P = new/obj/item/reagent_containers/glass/bottle/reagent(loc)
if(!name)
name = reagents.get_master_reagent_name()
P.name = "[name] bottle"
P.pixel_x = rand(-7, 7) //random position
P.pixel_y = rand(-7, 7)
P.icon_state = bottlesprite
reagents.trans_to(P, 50)
else
var/obj/item/reagent_containers/food/condiment/P = new/obj/item/reagent_containers/food/condiment(loc)
reagents.trans_to(P, 50)
else if(href_list["change_pill"])
#define MAX_PILL_SPRITE 20 //max icon state of the pill sprites
var/dat = "<table>"
var/j = 0
for(var/i = 1 to MAX_PILL_SPRITE)
j++
if(j == 1)
dat += "<tr>"
dat += "<td><a href=\"?src=[UID()]&pill_sprite=[i]\"><img src=\"pill[i].png\" /></a></td>"
if(j == 5)
dat += "</tr>"
j = 0
dat += "</table>"
usr << browse(dat, "window=chem_master_iconsel;size=225x193")
return
else if(href_list["change_bottle"])
var/dat = "<table>"
var/j = 0
for(var/i in list("bottle", "small_bottle", "wide_bottle", "round_bottle", "reagent_bottle"))
j++
if(j == 1)
dat += "<tr>"
dat += "<td><a href=\"?src=[UID()]&bottle_sprite=[i]\"><img src=\"[i].png\" /></a></td>"
if(j == 5)
dat += "</tr>"
j = 0
dat += "</table>"
usr << browse(dat, "window=chem_master_iconsel;size=225x193")
return
else if(href_list["pill_sprite"])
pillsprite = href_list["pill_sprite"]
usr << browse(null, "window=chem_master_iconsel")
else if(href_list["bottle_sprite"])
bottlesprite = href_list["bottle_sprite"]
usr << browse(null, "window=chem_master_iconsel")
SSnanoui.update_uis(src)
reagents.remove_reagent(id, amount)
if("eject")
if(!beaker)
return
beaker.forceMove(get_turf(src))
if(Adjacent(usr) && !issilicon(usr))
usr.put_in_hands(beaker)
beaker = null
reagents.clear_reagents()
update_icon()
if("create_condi_bottle")
if(!condi || !reagents.total_volume)
return
var/obj/item/reagent_containers/food/condiment/P = new(loc)
reagents.trans_to(P, 50)
else
return FALSE
/obj/machinery/chem_master/attack_ai(mob/user)
return attack_hand(user)
/obj/machinery/chem_master/attack_ghost(mob/user)
if(user.can_admin_interact())
return attack_hand(user)
tgui_interact(user)
/obj/machinery/chem_master/attack_hand(mob/user)
if(..())
return TRUE
ui_interact(user)
tgui_interact(user)
/obj/machinery/chem_master/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = TRUE)
/obj/machinery/chem_master/tgui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/tgui_state/state = GLOB.tgui_default_state)
var/datum/asset/chem_master/assets = get_asset_datum(/datum/asset/chem_master)
assets.send(user)
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, force_open)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "chem_master.tmpl", name, 575, 500)
ui = new(user, src, ui_key, "ChemMaster", name, 575, 500)
ui.open()
/obj/machinery/chem_master/ui_data(mob/user, ui_key = "main", datum/topic_state/state = GLOB.default_state)
/obj/machinery/chem_master/tgui_data(mob/user)
var/data[0]
data["condi"] = condi
data["loaded_pill_bottle"] = (loaded_pill_bottle ? 1 : 0)
data["loaded_pill_bottle"] = loaded_pill_bottle ? TRUE : FALSE
if(loaded_pill_bottle)
data["loaded_pill_bottle_name"] = loaded_pill_bottle.name
data["loaded_pill_bottle_contents_len"] = loaded_pill_bottle.contents.len
data["loaded_pill_bottle_storage_slots"] = loaded_pill_bottle.storage_slots
data["beaker"] = (beaker ? 1 : 0)
data["beaker"] = beaker ? TRUE : FALSE
if(beaker)
var/list/beaker_reagents_list = list()
data["beaker_reagents"] = beaker_reagents_list
@@ -464,13 +276,255 @@
data["buffer_reagents"] = buffer_reagents_list
for(var/datum/reagent/R in reagents.reagent_list)
buffer_reagents_list[++buffer_reagents_list.len] = list("name" = R.name, "volume" = R.volume, "id" = R.id, "description" = R.description)
else
data["beaker_reagents"] = list()
data["buffer_reagents"] = list()
data["pillsprite"] = pillsprite
data["bottlesprite"] = bottlesprite
data["mode"] = mode
data["printing"] = printing
// Transfer modal information if there is one
data["modal"] = tgui_modal_data(src)
return data
/**
* Called in tgui_act() to process modal actions
*
* Arguments:
* * action - The action passed by tgui
* * params - The params passed by tgui
*/
/obj/machinery/chem_master/proc/tgui_act_modal(action, params, datum/tgui/ui, datum/tgui_state/state)
. = TRUE
var/id = params["id"] // The modal's ID
var/list/arguments = istext(params["arguments"]) ? json_decode(params["arguments"]) : params["arguments"]
switch(tgui_modal_act(src, action, params))
if(TGUI_MODAL_OPEN)
switch(id)
if("analyze")
var/idx = text2num(arguments["idx"]) || 0
var/from_beaker = text2num(arguments["beaker"]) || FALSE
var/reagent_list = from_beaker ? beaker.reagents.reagent_list : reagents.reagent_list
if(idx < 1 || idx > length(reagent_list))
return
var/datum/reagent/R = reagent_list[idx]
var/list/result = list("idx" = idx, "name" = R.name, "desc" = R.description)
if(!condi && istype(R, /datum/reagent/blood))
var/datum/reagent/blood/B = R
result["blood_type"] = B.data["blood_type"]
result["blood_dna"] = B.data["blood_DNA"]
arguments["analysis"] = result
tgui_modal_message(src, id, "", null, arguments)
if("change_pill_bottle_style")
if(!loaded_pill_bottle)
return
if(!pill_bottle_wrappers)
pill_bottle_wrappers = list(
"CLEAR" = "Default",
COLOR_RED = "Red",
COLOR_GREEN = "Green",
COLOR_PALE_BTL_GREEN = "Pale green",
COLOR_BLUE = "Blue",
COLOR_CYAN_BLUE = "Light blue",
COLOR_TEAL = "Teal",
COLOR_YELLOW = "Yellow",
COLOR_ORANGE = "Orange",
COLOR_PINK = "Pink",
COLOR_MAROON = "Brown"
)
var/current = pill_bottle_wrappers[loaded_pill_bottle.wrapper_color] || "Default"
tgui_modal_choice(src, id, "Please select a pill bottle wrapper:", null, arguments, current, pill_bottle_wrappers)
if("addcustom")
if(!beaker || !beaker.reagents.total_volume)
return
tgui_modal_input(src, id, "Please enter the amount to transfer to buffer:", null, arguments, useramount)
if("removecustom")
if(!reagents.total_volume)
return
tgui_modal_input(src, id, "Please enter the amount to transfer to [mode ? "beaker" : "disposal"]:", null, arguments, useramount)
if("create_condi_pack")
if(!condi || !reagents.total_volume)
return
tgui_modal_input(src, id, "Please name your new condiment pack:", null, arguments, reagents.get_master_reagent_name(), MAX_CUSTOM_NAME_LEN)
if("create_pill")
if(condi || !reagents.total_volume)
return
var/num = round(text2num(arguments["num"] || 1))
if(!num)
return
arguments["num"] = num
var/amount_per_pill = clamp(reagents.total_volume / num, 0, MAX_UNITS_PER_PILL)
var/default_name = "[reagents.get_master_reagent_name()] ([amount_per_pill]u)"
var/pills_text = num == 1 ? "new pill" : "[num] new pills"
tgui_modal_input(src, id, "Please name your [pills_text]:", null, arguments, default_name, MAX_CUSTOM_NAME_LEN)
if("create_pill_multiple")
if(condi || !reagents.total_volume)
return
tgui_modal_input(src, id, "Please enter the amount of pills to make (max [MAX_MULTI_AMOUNT] at a time):", null, arguments, pillamount, 5)
if("change_pill_style")
var/list/choices = list()
for(var/i = 1 to MAX_PILL_SPRITE)
choices += "pill[i].png"
tgui_modal_bento(src, id, "Please select the new style for pills:", null, arguments, pillsprite, choices)
if("create_patch")
if(condi || !reagents.total_volume)
return
var/num = round(text2num(arguments["num"] || 1))
if(!num)
return
arguments["num"] = num
var/amount_per_patch = clamp(reagents.total_volume / num, 0, MAX_UNITS_PER_PATCH)
var/default_name = "[reagents.get_master_reagent_name()] ([amount_per_patch]u)"
var/patches_text = num == 1 ? "new patch" : "[num] new patches"
tgui_modal_input(src, id, "Please name your [patches_text]:", null, arguments, default_name, MAX_CUSTOM_NAME_LEN)
if("create_patch_multiple")
if(condi || !reagents.total_volume)
return
tgui_modal_input(src, id, "Please enter the amount of patches to make (max [MAX_MULTI_AMOUNT] at a time):", null, arguments, pillamount, 5)
if("create_bottle")
if(condi || !reagents.total_volume)
return
tgui_modal_input(src, id, "Please name your bottle:", null, arguments, reagents.get_master_reagent_name(), MAX_CUSTOM_NAME_LEN)
if("change_bottle_style")
if(!bottle_styles)
bottle_styles = list("bottle", "small_bottle", "wide_bottle", "round_bottle", "reagent_bottle")
var/list/bottle_styles_png = list()
for(var/style in bottle_styles)
bottle_styles_png += "[style].png"
tgui_modal_bento(src, id, "Please select the new style for bottles:", null, arguments, bottlesprite, bottle_styles_png)
else
return FALSE
if(TGUI_MODAL_ANSWER)
var/answer = params["answer"]
switch(id)
if("change_pill_bottle_style")
if(!pill_bottle_wrappers || !loaded_pill_bottle) // wat?
return
var/color = "CLEAR"
for(var/col in pill_bottle_wrappers)
var/col_name = pill_bottle_wrappers[col]
if(col_name == answer)
color = col
break
if(length(color) && color != "CLEAR")
loaded_pill_bottle.wrapper_color = color
loaded_pill_bottle.apply_wrap()
else
loaded_pill_bottle.wrapper_color = null
loaded_pill_bottle.cut_overlays()
if("addcustom")
var/amount = isgoodnumber(text2num(answer))
if(!amount || !arguments["id"])
return
tgui_act("add", list("id" = arguments["id"], "amount" = amount), ui, state)
if("removecustom")
var/amount = isgoodnumber(text2num(answer))
if(!amount || !arguments["id"])
return
tgui_act("remove", list("id" = arguments["id"], "amount" = amount), ui, state)
if("create_condi_pack")
if(!condi || !reagents.total_volume)
return
if(!length(answer))
answer = reagents.get_master_reagent_name()
var/obj/item/reagent_containers/food/condiment/pack/P = new(loc)
P.originalname = answer
P.name = "[answer] pack"
P.desc = "A small condiment pack. The label says it contains [answer]."
reagents.trans_to(P, 10)
if("create_pill")
if(condi || !reagents.total_volume)
return
var/count = clamp(round(text2num(arguments["num"]) || 0), 0, MAX_MULTI_AMOUNT)
if(!count)
return
if(!length(answer))
answer = reagents.get_master_reagent_name()
var/amount_per_pill = clamp(reagents.total_volume / count, 0, MAX_UNITS_PER_PILL)
while(count--)
if(reagents.total_volume <= 0)
to_chat(usr, "<span class='notice'>Not enough reagents to create these pills!</span>")
return
var/obj/item/reagent_containers/food/pill/P = new(loc)
P.name = "[answer] pill"
P.pixel_x = rand(-7, 7) // Random position
P.pixel_y = rand(-7, 7)
P.icon_state = "pill[pillsprite]"
reagents.trans_to(P, amount_per_pill)
// Load the pills in the bottle if there's one loaded
if(istype(loaded_pill_bottle) && length(loaded_pill_bottle.contents) < loaded_pill_bottle.storage_slots)
P.forceMove(loaded_pill_bottle)
if("create_pill_multiple")
if(condi || !reagents.total_volume)
return
tgui_act("modal_open", list("id" = "create_pill", "arguments" = list("num" = answer)), ui, state)
if("change_pill_style")
var/new_style = clamp(text2num(answer) || 0, 0, MAX_PILL_SPRITE)
if(!new_style)
return
pillsprite = new_style
if("create_patch")
if(condi || !reagents.total_volume)
return
var/count = clamp(round(text2num(arguments["num"]) || 0), 0, MAX_MULTI_AMOUNT)
if(!count)
return
if(!length(answer))
answer = reagents.get_master_reagent_name()
var/amount_per_patch = clamp(reagents.total_volume / count, 0, MAX_UNITS_PER_PATCH)
var/is_medical_patch = chemical_safety_check(reagents)
while(count--)
if(reagents.total_volume <= 0)
to_chat(usr, "<span class='notice'>Not enough reagents to create these patches!</span>")
return
var/obj/item/reagent_containers/food/pill/patch/P = new(loc)
P.name = "[answer] patch"
P.pixel_x = rand(-7, 7) // random position
P.pixel_y = rand(-7, 7)
reagents.trans_to(P, amount_per_patch)
if(is_medical_patch)
P.instant_application = TRUE
P.icon_state = "bandaid_med"
// Load the patches in the bottle if there's one loaded
if(istype(loaded_pill_bottle, /obj/item/storage/pill_bottle/patch_pack) && length(loaded_pill_bottle.contents) < loaded_pill_bottle.storage_slots)
P.forceMove(loaded_pill_bottle)
if("create_patch_multiple")
if(condi || !reagents.total_volume)
return
tgui_act("modal_open", list("id" = "create_patch", "arguments" = list("num" = answer)), ui, state)
if("create_bottle")
if(condi || !reagents.total_volume)
return
if(!length(answer))
answer = reagents.get_master_reagent_name()
var/obj/item/reagent_containers/glass/bottle/reagent/P = new(loc)
P.name = "[answer] bottle"
P.pixel_x = rand(-7, 7) // random position
P.pixel_y = rand(-7, 7)
P.icon_state = length(bottle_styles) && bottle_styles[bottlesprite] || "bottle"
reagents.trans_to(P, 50)
if("change_bottle_style")
if(!bottle_styles)
return
var/new_sprite = text2num(answer) || 1
if(new_sprite < 1 || new_sprite > length(bottle_styles))
return
bottlesprite = new_sprite
else
return FALSE
else
return FALSE
/obj/machinery/chem_master/proc/isgoodnumber(num)
if(isnum(num))
if(num > 200)
@@ -481,7 +535,7 @@
num = round(num)
return num
else
return 0
return FALSE
/obj/machinery/chem_master/proc/chemical_safety_check(datum/reagents/R)
var/all_safe = TRUE
@@ -503,3 +557,9 @@
component_parts += new /obj/item/reagent_containers/glass/beaker(null)
component_parts += new /obj/item/reagent_containers/glass/beaker(null)
RefreshParts()
#undef MAX_PILL_SPRITE
#undef MAX_MULTI_AMOUNT
#undef MAX_UNITS_PER_PILL
#undef MAX_UNITS_PER_PATCH
#undef MAX_CUSTOM_NAME_LEN
+4 -2
View File
@@ -120,8 +120,10 @@
return
// Called every time reagent containers process.
/datum/reagent/proc/on_tick(data)
return
/datum/reagent/process()
if(!holder || holder.flags & REAGENT_NOREACT)
return FALSE
return TRUE
// Called when the reagent container is hit by an explosion
/datum/reagent/proc/on_ex_act(severity)
@@ -18,18 +18,18 @@
/datum/reagent/consumable/ethanol/reaction_obj(obj/O, volume)
if(istype(O,/obj/item/paper))
if(istype(O,/obj/item/paper/contract/infernal))
to_chat(usr, "The solution ignites on contact with the [O].")
O.visible_message("<span class='warning'>The solution ignites on contact with [O].</span>")
else
var/obj/item/paper/paperaffected = O
paperaffected.clearpaper()
to_chat(usr, "The solution melts away the ink on the paper.")
paperaffected.visible_message("<span class='notice'>The solution melts away the ink on the paper.</span>")
if(istype(O,/obj/item/book))
if(volume >= 5)
var/obj/item/book/affectedbook = O
affectedbook.dat = null
to_chat(usr, "The solution melts away the ink on the book.")
affectedbook.visible_message("<span class='notice'>The solution melts away the ink on the book.</span>")
else
to_chat(usr, "It wasn't enough...")
O.visible_message("<span class='warning'>It wasn't enough...</span>")
/datum/reagent/consumable/ethanol/reaction_mob(mob/living/M, method=REAGENT_TOUCH, volume)//Splashing people with ethanol isn't quite as good as fuel.
if(method == REAGENT_TOUCH)
@@ -1190,12 +1190,12 @@
taste_description = "motor oil"
/datum/reagent/consumable/ethanol/synthanol/on_mob_life(mob/living/M)
metabolization_rate = REAGENTS_METABOLISM
if(!(M.dna.species.reagent_tag & PROCESS_SYN))
holder.remove_reagent(id, 3.6) //gets removed from organics very fast
metabolization_rate += 3.6 //gets removed from organics very fast
if(prob(25))
holder.remove_reagent(id, 15)
metabolization_rate += 15
M.fakevomit()
return ..()
/datum/reagent/consumable/ethanol/synthanol/reaction_mob(mob/living/M, method=REAGENT_TOUCH, volume)
@@ -125,7 +125,7 @@
/datum/reagent/blob/proc/reagent_vortex(mob/living/M, setting_type, volume)
var/turf/pull = get_turf(M)
var/range_power = Clamp(round(volume/5, 1), 1, 5)
var/range_power = clamp(round(volume/5, 1), 1, 5)
for(var/atom/movable/X in range(range_power,pull))
if(istype(X, /obj/effect))
continue
@@ -543,7 +543,7 @@
M.AdjustConfused(-5)
update_flags |= M.SetWeakened(0, FALSE)
if(volume >= 70 && prob(25))
if(M.reagents.has_reagent("thc") <= 20)
if(M.reagents.get_reagent_amount("thc") <= 20)
M.Drowsy(10)
if(prob(25))
update_flags |= M.adjustBruteLoss(-2, FALSE)
@@ -173,6 +173,29 @@
metabolization_rate = 0.2
taste_description = "antibiotics"
/datum/reagent/medicine/spaceacillin/on_mob_life(mob/living/M)
var/list/organs_list = list()
if(iscarbon(M))
var/mob/living/carbon/C = M
organs_list += C.internal_organs
if(ishuman(M))
var/mob/living/carbon/human/H = M
organs_list += H.bodyparts
for(var/X in organs_list)
var/obj/item/organ/O = X
if(O.germ_level < INFECTION_LEVEL_ONE)
O.germ_level = 0 //cure instantly
else if(O.germ_level < INFECTION_LEVEL_TWO)
O.germ_level = max(M.germ_level - 25, 0) //at germ_level == 500, this should cure the infection in 34 seconds
else
O.germ_level = max(M.germ_level - 10, 0) // at germ_level == 1000, this will cure the infection in 1 minutes, 14 seconds
organs_list.Cut()
M.germ_level = max(M.germ_level - 20, 0) // Reduces the mobs germ level, too
return ..()
/datum/reagent/medicine/silver_sulfadiazine
name = "Silver Sulfadiazine"
id = "silver_sulfadiazine"
@@ -826,7 +849,7 @@
/datum/reagent/medicine/stimulants
name = "Stimulants"
id = "stimulants"
description = "Increases run speed and eliminates stuns, can heal minor damage. If overdosed it will deal toxin damage and stun."
description = "An illegal compound that dramatically enhances the body's performance and healing capabilities."
color = "#C8A5DC"
harmless = FALSE
can_synth = FALSE
@@ -863,7 +886,7 @@
/datum/reagent/medicine/stimulative_agent
name = "Stimulative Agent"
id = "stimulative_agent"
description = "An illegal compound that dramatically enhances the body's performance and healing capabilities."
description = "Increases run speed and eliminates stuns, can heal minor damage. If overdosed it will deal toxin damage and be less effective for healing stamina."
color = "#C8A5DC"
metabolization_rate = 0.5 * REAGENTS_METABOLISM
overdose_threshold = 60
@@ -450,21 +450,18 @@
var/mob/living/carbon/C = holder.my_atom
if(!istype(C))
return
var/mind_type = FALSE
if(C.mind)
if(C.mind.assigned_role == "Clown" || C.mind.assigned_role == SPECIAL_ROLE_HONKSQUAD)
mind_type = "Clown"
to_chat(C, "<span class='notice'>Whatever that was, it feels great!</span>")
else if(C.mind.assigned_role == "Mime")
mind_type = "Mime"
to_chat(C, "<span class='warning'>You feel nauseous.</span>")
C.AdjustDizzy(volume)
else
to_chat(C, "<span class='warning'>Something doesn't feel right...</span>")
C.AdjustDizzy(volume)
C.AddComponent(/datum/component/jestosterone, mind_type)
ADD_TRAIT(C, TRAIT_JESTER, id)
C.AddComponent(/datum/component/squeak, null, null, null, null, null, TRUE)
C.AddComponent(/datum/component/waddling)
C.AddElement(/datum/element/waddling)
/datum/reagent/jestosterone/on_mob_life(mob/living/carbon/M)
if(!istype(M))
@@ -472,8 +469,7 @@
var/update_flags = STATUS_UPDATE_NONE
if(prob(10))
M.emote("giggle")
GET_COMPONENT_FROM(jestosterone_component, /datum/component/jestosterone, M)
if(jestosterone_component.mind_type == "Clown")
if(M?.mind.assigned_role == "Clown" || M?.mind.assigned_role == SPECIAL_ROLE_HONKSQUAD)
update_flags |= M.adjustBruteLoss(-1.5 * REAGENTS_EFFECT_MULTIPLIER) //Screw those pesky clown beatings!
else
M.AdjustDizzy(10, 0, 500)
@@ -493,18 +489,15 @@
"Your legs feel like jelly.",
"You feel like telling a pun.")
to_chat(M, "<span class='warning'>[pick(clown_message)]</span>")
if(jestosterone_component.mind_type == "Mime")
if(M?.mind.assigned_role == "Mime")
update_flags |= M.adjustToxLoss(1.5 * REAGENTS_EFFECT_MULTIPLIER)
return ..() | update_flags
/datum/reagent/jestosterone/on_mob_delete(mob/living/M)
..()
GET_COMPONENT_FROM(remove_fun, /datum/component/jestosterone, M)
GET_COMPONENT_FROM(squeaking, /datum/component/squeak, M)
GET_COMPONENT_FROM(waddling, /datum/component/waddling, M)
remove_fun.Destroy()
squeaking.Destroy()
waddling.Destroy()
REMOVE_TRAIT(M, TRAIT_JESTER, id)
qdel(M.GetComponent(/datum/component/squeak))
M.RemoveElement(/datum/element/waddling)
/datum/reagent/royal_bee_jelly
name = "royal bee jelly"
@@ -333,19 +333,26 @@
process_flags = ORGANIC | SYNTHETIC
taste_description = "bitterness"
/datum/reagent/cryostylane/on_new(data)
..()
START_PROCESSING(SSprocessing, src)
/datum/reagent/cryostylane/Destroy()
STOP_PROCESSING(SSprocessing, src)
return ..()
/datum/reagent/cryostylane/on_mob_life(mob/living/M) //TODO: code freezing into an ice cube
if(M.reagents.has_reagent("oxygen"))
M.reagents.remove_reagent("oxygen", 1)
M.bodytemperature -= 30
return ..()
/datum/reagent/cryostylane/on_tick()
if(holder.has_reagent("oxygen"))
holder.remove_reagent("oxygen", 2)
holder.remove_reagent("cryostylane", 2)
holder.temperature_reagents(holder.chem_temp - 200)
holder.temperature_reagents(holder.chem_temp - 200)
..()
/datum/reagent/cryostylane/process()
if(..())
if(holder.has_reagent("oxygen"))
holder.remove_reagent("oxygen", 2)
holder.remove_reagent("cryostylane", 2)
holder.temperature_reagents(holder.chem_temp - 200)
/datum/reagent/cryostylane/reaction_mob(mob/living/M, method = REAGENT_TOUCH, volume)
if(method == REAGENT_TOUCH)
@@ -368,19 +375,26 @@
process_flags = ORGANIC | SYNTHETIC
taste_description = "bitterness"
/datum/reagent/pyrosium/on_new(data)
..()
START_PROCESSING(SSprocessing, src)
/datum/reagent/pyrosium/Destroy()
STOP_PROCESSING(SSprocessing, src)
return ..()
/datum/reagent/pyrosium/on_mob_life(mob/living/M)
if(M.reagents.has_reagent("oxygen"))
M.reagents.remove_reagent("oxygen", 1)
M.bodytemperature += 30
return ..()
/datum/reagent/pyrosium/on_tick()
if(holder.has_reagent("oxygen"))
holder.remove_reagent("oxygen", 2)
holder.remove_reagent("pyrosium", 2)
holder.temperature_reagents(holder.chem_temp + 200)
holder.temperature_reagents(holder.chem_temp + 200)
..()
/datum/reagent/pyrosium/process()
if(..())
if(holder.has_reagent("oxygen"))
holder.remove_reagent("oxygen", 2)
holder.remove_reagent("pyrosium", 2)
holder.temperature_reagents(holder.chem_temp + 200)
/datum/reagent/firefighting_foam
name = "Firefighting foam"
@@ -192,6 +192,14 @@
color = "#7DFF00"
taste_description = "slime"
/datum/reagent/stable_mutagen/on_new(data)
..()
START_PROCESSING(SSprocessing, src)
/datum/reagent/stable_mutagen/Destroy()
STOP_PROCESSING(SSprocessing, src)
return ..()
/datum/reagent/stable_mutagen/on_mob_life(mob/living/M)
if(!ishuman(M) || !M.dna)
return
@@ -212,42 +220,11 @@
return ..()
/datum/reagent/stable_mutagen/on_tick()
var/datum/reagent/blood/B = locate() in holder.reagent_list
if(B && islist(B.data) && !data)
data = B.data.Copy()
..()
/datum/reagent/romerol
name = "romerol"
// the REAL zombie powder
id = "romerol"
description = "Romerol is a highly experimental bioterror agent \
which causes dormant nodules to be etched into the grey matter of \
the subject. These nodules only become active upon death of the \
host, upon which, the secondary structures activate and take control \
of the host body."
color = "#123524" // RGB (18, 53, 36)
metabolization_rate = INFINITY
can_synth = FALSE
taste_description = "CAAAARL"
/datum/reagent/romerol/reaction_mob(mob/living/carbon/human/H, method = REAGENT_TOUCH, volume)
if(!istype(H))
return
// Silently add the zombie infection organ to be activated upon death
if(!H.get_organ_slot("zombie_infection"))
var/obj/item/organ/internal/zombie_infection/nodamage/ZI = new()
ZI.insert(H)
..()
/datum/reagent/romerol/on_mob_life(mob/living/M)
if(ishuman(M))
var/mob/living/carbon/human/H = M
if(!H.get_organ_slot("zombie_infection"))
var/obj/item/organ/internal/zombie_infection/nodamage/ZI = new()
ZI.insert(H)
return ..()
/datum/reagent/stable_mutagen/process()
if(..())
var/datum/reagent/blood/B = locate() in holder.reagent_list
if(B && islist(B.data) && !data)
data = B.data.Copy()
/datum/reagent/uranium
name ="Uranium"
@@ -1260,6 +1237,7 @@
description = "An advanced corruptive toxin produced by something terrible."
reagent_state = LIQUID
color = "#5EFF3B" //RGB: 94, 255, 59
can_synth = FALSE
taste_description = "decay"
/datum/reagent/gluttonytoxin/reaction_mob(mob/living/L, method=REAGENT_TOUCH, reac_volume)
@@ -83,37 +83,7 @@
M.adjustToxLoss(rand(5, 10))
/datum/reagent/space_cleaner/reaction_mob(mob/living/M, method=REAGENT_TOUCH, volume)
if(iscarbon(M))
var/mob/living/carbon/C = M
if(ishuman(M))
var/mob/living/carbon/human/H = M
if(H.lip_style)
H.lip_style = null
H.update_body()
if(C.r_hand)
C.r_hand.clean_blood()
if(C.l_hand)
C.l_hand.clean_blood()
if(C.wear_mask)
if(C.wear_mask.clean_blood())
C.update_inv_wear_mask()
if(ishuman(M))
var/mob/living/carbon/human/H = C
if(H.head)
if(H.head.clean_blood())
H.update_inv_head()
if(H.wear_suit)
if(H.wear_suit.clean_blood())
H.update_inv_wear_suit()
else if(H.w_uniform)
if(H.w_uniform.clean_blood())
H.update_inv_w_uniform()
if(H.shoes)
if(H.shoes.clean_blood())
H.update_inv_shoes()
M.clean_blood()
..()
M.clean_blood()
/datum/reagent/blood
data = list("donor"=null,"viruses"=null,"blood_DNA"=null,"blood_type"=null,"blood_colour"="#A10808","resistances"=null,"trace_chem"=null,"mind"=null,"ckey"=null,"gender"=null,"real_name"=null,"cloneable"=null,"factions"=null, "dna" = null)
@@ -56,7 +56,6 @@
/datum/chemical_reaction/nitroglycerin
name = "Nitroglycerin"
id = "nitroglycerin"
result = "nitroglycerin"
required_reagents = list("glycerol" = 1, "facid" = 1, "sacid" = 1)
result_amount = 2
@@ -38,7 +38,7 @@
/datum/chemical_reaction/slimemonkey/on_reaction(datum/reagents/holder)
feedback_add_details("slime_cores_used","[type]")
for(var/i = 1, i <= 3, i++)
var /obj/item/reagent_containers/food/snacks/monkeycube/M = new /obj/item/reagent_containers/food/snacks/monkeycube
var/obj/item/reagent_containers/food/snacks/monkeycube/M = new /obj/item/reagent_containers/food/snacks/monkeycube
M.forceMove(get_turf(holder.my_atom))
//Green
+3 -2
View File
@@ -61,8 +61,9 @@ obj/item/reagent_containers/proc/add_initial_reagents()
update_icon()
return
/obj/item/reagent_containers/afterattack(obj/target, mob/user , flag)
return
/obj/item/reagent_containers/attack(mob/M, mob/user, def_zone)
if(user.a_intent == INTENT_HARM)
return ..()
/obj/item/reagent_containers/wash(mob/user, atom/source)
if(is_open_container())
@@ -5,6 +5,7 @@
icon_state = "mender"
item_state = "mender"
volume = 200
possible_transfer_amounts = null
resistance_flags = ACID_PROOF
container_type = REFILLABLE | AMOUNT_VISIBLE
temperature_min = 270
@@ -21,6 +22,9 @@
ignore_flags = TRUE
to_chat(user, "<span class='warning'>You short out the safeties on [src].</span>")
/obj/item/reagent_containers/applicator/set_APTFT()
set hidden = TRUE
/obj/item/reagent_containers/applicator/on_reagent_change()
if(!emagged)
var/found_forbidden_reagent = FALSE
@@ -93,6 +97,20 @@
playsound(get_turf(src), pick('sound/goonstation/items/mender.ogg', 'sound/goonstation/items/mender2.ogg'), 50, 1)
/obj/item/reagent_containers/applicator/verb/empty()
set name = "Empty Applicator"
set category = "Object"
set src in usr
if(usr.incapacitated())
return
if(alert(usr, "Are you sure you want to empty [src]?", "Empty Applicator:", "Yes", "No") != "Yes")
return
if(!usr.incapacitated() && isturf(usr.loc) && loc == usr)
to_chat(usr, "<span class='notice'>You empty [src] onto the floor.</span>")
reagents.reaction(usr.loc)
reagents.clear_reagents()
/obj/item/reagent_containers/applicator/brute
name = "brute auto-mender"
list_reagents = list("styptic_powder" = 200)
@@ -104,3 +122,6 @@
/obj/item/reagent_containers/applicator/dual
name = "dual auto-mender"
list_reagents = list("synthflesh" = 200)
/obj/item/reagent_containers/applicator/dual/syndi // It magically goes through hardsuits. Don't ask how.
ignore_flags = TRUE
@@ -47,7 +47,7 @@
/obj/item/reagent_containers/borghypo/process() //Every [recharge_time] seconds, recharge some reagents for the cyborg
charge_tick++
if(charge_tick < recharge_time)
if(charge_tick < recharge_time)
return FALSE
charge_tick = 0
@@ -97,9 +97,7 @@
var/contained = injected.name
var/trans = R.trans_to(M, amount_per_transfer_from_this)
add_attack_logs(user, M, "Injected with [name] containing [contained], transfered [trans] units", injected.harmless ? ATKLOG_ALMOSTALL : null)
M.LAssailant = user
to_chat(user, "<span class='notice'>[trans] units injected. [R.total_volume] units remaining.</span>")
return
/obj/item/reagent_containers/borghypo/attack_self(mob/user)
playsound(loc, 'sound/effects/pop.ogg', 50, 0) //Change the mode
@@ -126,4 +124,9 @@
if(empty)
. += "<span class='notice'>It is currently empty. Allow some time for the internal syntheszier to produce more.</span>"
/obj/item/reagent_containers/borghypo/basic
name = "Basic Medical Hypospray"
desc = "A very basic medical hypospray, capable of providing simple medical treatment in emergencies."
reagent_ids = list("salglu_solution", "epinephrine")
#undef BORGHYPO_REFILL_VALUE
@@ -12,11 +12,6 @@
container_type = OPENCONTAINER
volume = 30
/obj/item/reagent_containers/glass/bottle/romerol
name = "romerol bottle"
desc = "A small bottle of Romerol. The REAL zombie powder."
list_reagents = list("romerol" = 30)
/obj/item/reagent_containers/glass/bottle/on_reagent_change()
update_icon()
@@ -47,6 +42,13 @@
var/image/lid = image(icon, src, "lid_bottle")
overlays += lid
/obj/item/reagent_containers/glass/bottle/decompile_act(obj/item/matter_decompiler/C, mob/user)
if(!reagents.total_volume)
C.stored_comms["glass"] += 3
qdel(src)
return TRUE
return ..()
/obj/item/reagent_containers/glass/bottle/toxin
name = "toxin bottle"
desc = "A small bottle containing toxic compounds."
@@ -14,38 +14,7 @@
container_type = OPENCONTAINER
has_lid = TRUE
resistance_flags = ACID_PROOF
var/label_text = ""
// the fucking asshole who designed this can go die in a fire - Iamgoofball
var/list/can_be_placed_into = list(
/obj/machinery/chem_master/,
/obj/machinery/chem_heater/,
/obj/machinery/chem_dispenser/,
/obj/machinery/reagentgrinder,
/obj/structure/table,
/obj/structure/closet,
/obj/structure/sink,
/obj/structure/toilet,
/obj/item/storage,
/obj/machinery/atmospherics/unary/cryo_cell,
/obj/machinery/dna_scannernew,
/obj/item/grenade/chem_grenade,
/mob/living/simple_animal/bot/medbot,
/obj/item/storage/secure/safe,
/obj/machinery/iv_drip,
/obj/machinery/computer/pandemic,
/obj/machinery/disposal,
/mob/living/simple_animal/cow,
/mob/living/simple_animal/hostile/retaliate/goat,
/obj/machinery/sleeper,
/obj/machinery/smartfridge/,
/obj/machinery/biogenerator,
/obj/machinery/hydroponics,
/obj/machinery/constructable_frame,
/obj/machinery/icemachine,
/obj/item/bombcore/chemical,
/obj/machinery/vending,
/obj/machinery/fishtank)
/obj/item/reagent_containers/glass/New()
..()
@@ -74,14 +43,13 @@
M.visible_message("<span class='danger'>[user] splashes the contents of [src] onto [M]!</span>", \
"<span class='userdanger'>[user] splashes the contents of [src] onto [M]!</span>")
add_attack_logs(user, M, "Splashed with [name] containing [contained]", !!M.ckey ? null : ATKLOG_ALL)
if(!iscarbon(user))
M.LAssailant = null
else
M.LAssailant = user
reagents.reaction(M, REAGENT_TOUCH)
reagents.clear_reagents()
else
if(!iscarbon(M)) // Non-carbons can't process reagents
to_chat(user, "<span class='warning'>You cannot find a way to feed [M].</span>")
return
if(M != user)
M.visible_message("<span class='danger'>[user] attempts to feed something to [M].</span>", \
"<span class='userdanger'>[user] attempts to feed something to you.</span>")
@@ -98,56 +66,44 @@
reagents.reaction(M, REAGENT_INGEST, fraction)
addtimer(CALLBACK(reagents, /datum/reagents.proc/trans_to, M, 5), 5)
playsound(M.loc,'sound/items/drink.ogg', rand(10,50), 1)
else
return ..()
/obj/item/reagent_containers/glass/afterattack(obj/target, mob/user, proximity)
if(!proximity)
if((!proximity) || !check_allowed_items(target,target_self = TRUE))
return
if(!is_open_container())
return
for(var/type in can_be_placed_into)
if(istype(target, type))
if(target.is_refillable()) //Something like a glass. Player probably wants to transfer TO it.
if(!reagents.total_volume)
to_chat(user, "<span class='warning'>[src] is empty!</span>")
return
if(istype(target, /obj/structure/reagent_dispensers)) //A dispenser. Transfer FROM it TO us.
if(target.reagents && !target.reagents.total_volume)
if(target.reagents.holder_full())
to_chat(user, "<span class='warning'>[target] is full.</span>")
return
var/trans = reagents.trans_to(target, amount_per_transfer_from_this)
to_chat(user, "<span class='notice'>You transfer [trans] unit\s of the solution to [target].</span>")
else if(target.is_drainable()) //A dispenser. Transfer FROM it TO us.
if(!target.reagents.total_volume)
to_chat(user, "<span class='warning'>[target] is empty and can't be refilled!</span>")
return
if(reagents.total_volume >= reagents.maximum_volume)
to_chat(user, "<span class='notice'>[src] is full.</span>")
if(reagents.holder_full())
to_chat(user, "<span class='warning'>[src] is full.</span>")
return
var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this)
to_chat(user, "<span class='notice'>You fill [src] with [trans] unit\s of the contents of [target].</span>")
else if(target.is_refillable() && is_drainable()) //Something like a glass. Player probably wants to transfer TO it.
if(!reagents.total_volume)
to_chat(user, "<span class='warning'>[src] is empty.</span>")
return
if(target.reagents.total_volume >= target.reagents.maximum_volume)
to_chat(user, "<span class='warning'>[target] is full.</span>")
return
var/trans = reagents.trans_to(target, amount_per_transfer_from_this)
to_chat(user, "<span class='notice'>You transfer [trans] units of the solution to [target].</span>")
else if(istype(target, /obj/item/reagent_containers/glass) && !target.is_open_container())
to_chat(user, "<span class='warning'>You cannot fill [target] while it is sealed.</span>")
return
else if(istype(target, /obj/effect/decal)) //stops splashing while scooping up fluids
return
else if(reagents.total_volume && user.a_intent == INTENT_HARM)
user.visible_message("<span class='danger'>[user] splashes the contents of [src] onto [target]!</span>", \
"<span class='notice'>You splash the contents of [src] onto [target].</span>")
reagents.reaction(target, REAGENT_TOUCH)
reagents.clear_reagents()
else if(reagents.total_volume)
if(user.a_intent == INTENT_HARM)
user.visible_message("<span class='danger'>[user] splashes the contents of [src] onto [target]!</span>", \
"<span class='notice'>You splash the contents of [src] onto [target].</span>")
reagents.reaction(target, REAGENT_TOUCH)
reagents.clear_reagents()
/obj/item/reagent_containers/glass/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/pen) || istype(I, /obj/item/flashlight/pen))
@@ -20,7 +20,7 @@
if(M.eat(src, user))
user.drop_item()
forceMove(M)
M.processing_patches += src
LAZYADD(M.processing_patches, src)
return TRUE
return FALSE
@@ -24,6 +24,9 @@
mode = SYRINGE_INJECT
update_icon()
/obj/item/reagent_containers/syringe/set_APTFT()
set hidden = TRUE
/obj/item/reagent_containers/syringe/on_reagent_change()
update_icon()
@@ -149,7 +152,7 @@
cut_overlays()
var/rounded_vol
if(reagents && reagents.total_volume)
rounded_vol = Clamp(round((reagents.total_volume / volume * 15), 5), 1, 15)
rounded_vol = clamp(round((reagents.total_volume / volume * 15), 5), 1, 15)
var/image/filling_overlay = mutable_appearance('icons/obj/reagentfillings.dmi', "syringe[rounded_vol]")
filling_overlay.icon += mix_color_from_reagents(reagents.reagent_list)
add_overlay(filling_overlay)