This commit is contained in:
Fermi
2019-11-20 11:35:40 +00:00
parent 20fa223fc4
commit 48e1c64c8d
5 changed files with 63 additions and 15 deletions

View File

@@ -11,7 +11,8 @@
icon_state = "sleeper"
density = FALSE
state_open = TRUE
circuit = /obj/item/circuitboard/machine/sleeper
circuit = /obj/item/circuitboard/machine/reagent_sleeper
req_access = list(ACCESS_HEADS) //ONLY USED FOR RECORD DELETION RIGHT NOW.
var/emagged = FALSE
var/efficiency = 1
var/min_health = -25
@@ -29,18 +30,27 @@
/obj/machinery/reagent_sleeper/Initialize()
. = ..()
create_reagents(300, NO_REACT)
create_reagents(500, NO_REACT)
occupant_typecache = GLOB.typecache_living
update_icon()
reset_chem_buttons()
RefreshParts()
//add_inital_chems()
add_inital_chems()
/obj/machinery/reagent_sleeper/Destroy()
var/obj/item/reagent_containers/sleeper_buffer/buffer = new /obj/item/reagent_containers/sleeper_buffer(loc)
buffer.volume = reagents.maximum_volume
reagents.trans_to(buffer.reagents, reagents.total_volume)
..()
/obj/machinery/reagent_sleeper/proc/add_inital_chems()
for(var/i in available_chems)
var/datum/reagent/R = reagents.has_reagent(i)
if(!R)
return
if(R.volume < 50)
reagents.add_reagent(i, (50 - R.volume))
/obj/machinery/reagent_sleeper/RefreshParts()
var/E
for(var/obj/item/stock_parts/matter_bin/B in component_parts)
@@ -56,9 +66,10 @@
available_chems |= possible_chems[i]
reset_chem_buttons()
//Total container size 300 - 1200u
//Total container size 500 - 2000u
if(reagents)
reagents.maximum_volume = (300*E)
reagents.maximum_volume = (500*E)
/obj/machinery/reagent_sleeper/update_icon()
icon_state = initial(icon_state)
@@ -97,6 +108,12 @@
var/datum/reagent/R = pick(reagents.reagent_list)
inject_chem(R.id, occupant)
open_machine()
//Is this too much?
if(severity == EMP_HEAVY)
var/chem = pick(available_chems)
available_chems -= chem
available_chems += get_random_reagent_id()
reset_chem_buttons()
/obj/machinery/reagent_sleeper/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/reagent_containers/sleeper_buffer))
@@ -179,7 +196,7 @@
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "reagent_sleeper", name, 500, 700, master_ui, state)
ui = new(user, src, ui_key, "reagent_sleeper", name, 550, 700, master_ui, state)
ui.open()
/obj/machinery/reagent_sleeper/ui_data()
@@ -199,7 +216,7 @@
R = GLOB.chemical_reagents_list[chem]
data["synthchems"] += list(list("name" = R.name, "id" = R.id, "vol" = 0, "allowed" = chem_allowed(chem)))
for(var/datum/reagent/R in reagents.reagent_list)
data["chems"] += list(list("name" = R.name, "id" = R.id, "vol" = R.volume, "allowed" = chem_allowed(R.id)))
data["chems"] += list(list("name" = R.name, "id" = R.id, "vol" = R.volume, "purity" = R.purity, "allowed" = chem_allowed(R.id)))
data["occupant"] = list()
var/mob/living/mob_occupant = occupant
@@ -277,6 +294,16 @@
if(!is_operational())
return
reagents.add_reagent(chem_buttons[chem], 10) //other_purity = 0.75 for when the mechanics are in
if("purge")
var/obj/item/card/id/C = usr.get_active_held_item()
if(src.check_access(C))
var/chem = params["chem"]
if(!is_operational())
return
reagents.remove_reagent(chem, 10)
else
visible_message("<span class='warning'>Access Denied.</span>")
playsound(src, 'sound/machines/terminal_prompt_deny.ogg', 50, 0)
/obj/machinery/reagent_sleeper/emag_act(mob/user)
@@ -287,7 +314,7 @@
return TRUE
//trans to
/obj/machinery/reagent_sleeper/proc/inject_chem(chem, mob/user, volume)
/obj/machinery/reagent_sleeper/proc/inject_chem(chem, mob/user, volume = 10)
if(chem_allowed(chem))
reagents.trans_id_to(occupant, chem, volume)//emag effect kicks in here so that the "intended" chem is used for all checks, for extra FUUU
if(user)

View File

@@ -7,6 +7,15 @@
/obj/item/stack/cable_coil = 1,
/obj/item/stack/sheet/glass = 2)
/obj/item/circuitboard/machine/reagent_sleeper
name = "Reagent Sleeper (Machine Board)"
build_path = /obj/machinery/reagent_sleeper
req_components = list(
/obj/item/stock_parts/matter_bin = 1,
/obj/item/stock_parts/manipulator = 1,
/obj/item/stack/cable_coil = 1,
/obj/item/stack/sheet/glass = 2)
/obj/item/circuitboard/machine/vr_sleeper
name = "VR Sleeper (Machine Board)"
build_path = /obj/machinery/vr_sleeper
@@ -991,4 +1000,4 @@
/obj/item/stack/sheet/glass = 2,
/obj/item/stock_parts/capacitor = 1,
/obj/item/stack/cable_coil = 5,
/obj/item/reagent_containers/glass/beaker = 6) //So it can hold lots of chems
/obj/item/reagent_containers/glass/beaker = 6) //So it can hold lots of chems

View File

@@ -26,6 +26,14 @@
departmental_flags = DEPARTMENTAL_FLAG_MEDICAL | DEPARTMENTAL_FLAG_ENGINEERING
category = list ("Medical Machinery")
/datum/design/board/reagent_sleeper
name = "Machine Design (Reagent Sleeper Board)"
desc = "The circuit board for a reagent sleeper."
id = "reagent_sleeper"
build_path = /obj/item/circuitboard/machine/reagent_sleeper
departmental_flags = DEPARTMENTAL_FLAG_MEDICAL | DEPARTMENTAL_FLAG_ENGINEERING
category = list ("Medical Machinery")
/datum/design/board/cryotube
name = "Machine Design (Cryotube Board)"
desc = "The circuit board for a cryotube."

File diff suppressed because one or more lines are too long

View File

@@ -46,19 +46,23 @@
</ui-section>
<ui-section label='Synthesize'>
{{#each data.synthchems}}
<ui-button action='synth' params='{"chem": "{{id}}"}'>{{name}}</ui-button>
<ui-button grid action='synth' params='{"chem": "{{id}}"}'>{{name}}</ui-button>
{{/each}}
</ui-section>
<ui-section label='Inject'>
{{#each data.chems}}
<span>{{name}}: {{vol}}u</span>
<span><b>{{name}}</b>: {{vol}}u</span>
{{#if data.efficiency >= 4}}
<span>Purity: {{purity}}</span>
{{/if}}
{{#if data.efficiency >= 3}}
<ui-button state='{{data.occupied && allowed ? null : "disabled"}}' action='inject' params='{"chem": "{{id}}", "volume": 1}'>1</ui-button>
{{/if}}
{{#if adata.efficiency >= 2}}
<ui-button state='{{data.occupied && allowed ? null : "disabled"}}' action='inject' params='{"chem": "{{id}}", "volume": 5}'>5</ui-button>
{{/if}}
<ui-button state='{{data.occupied && allowed ? null : "disabled"}}' action='inject' params='{"chem": "{{id}}", "volume": 10}'>10</ui-button><br/>
<ui-button state='{{data.occupied && allowed ? null : "disabled"}}' action='inject' params='{"chem": "{{id}}", "volume": 10}'>10</ui-button>
<ui-button state='{{data.occupied && allowed ? null : "disabled"}}' action='purge' params='{"chem": "{{id}}"}'>Purge</ui-button><br/>
{{/each}}
</ui-section>
<ui-section label='Capacity'>