Fixing things

This commit is contained in:
Thalpy
2019-11-19 16:03:33 +00:00
parent c0287cf7b5
commit bf89df7e7b
6 changed files with 24 additions and 16 deletions

View File

@@ -196,7 +196,7 @@
blood_type = R.name blood_type = R.name
else else
blood_type = blood_id blood_type = blood_id
data["occupant"]["blood"]["maxBloodVolume"] = BLOOD_VOLUME_NORMAL data["occupant"]["blood"]["maxBloodVolume"] = (BLOOD_VOLUME_NORMAL*C.blood_ratio)
data["occupant"]["blood"]["currentBloodVolume"] = C.blood_volume data["occupant"]["blood"]["currentBloodVolume"] = C.blood_volume
data["occupant"]["blood"]["dangerBloodVolume"] = BLOOD_VOLUME_SAFE data["occupant"]["blood"]["dangerBloodVolume"] = BLOOD_VOLUME_SAFE
data["occupant"]["blood"]["bloodType"] = blood_type data["occupant"]["blood"]["bloodType"] = blood_type

View File

@@ -32,11 +32,12 @@
occupant_typecache = GLOB.typecache_living occupant_typecache = GLOB.typecache_living
update_icon() update_icon()
reset_chem_buttons() reset_chem_buttons()
RefreshParts()
//add_inital_chems() //add_inital_chems()
/obj/machinery/reagent_sleeper/Destroy() /obj/machinery/reagent_sleeper/Destroy()
var/buffer = new /obj/item/reagent_containers/sleeper_buffer(loc) var/obj/item/reagent_containers/sleeper_buffer/buffer = new /obj/item/reagent_containers/sleeper_buffer(loc)
buffer.reagents = reagents reagents.trans_to(buffer.reagents, reagents.total_volume)
..() ..()
/obj/machinery/reagent_sleeper/RefreshParts() /obj/machinery/reagent_sleeper/RefreshParts()
@@ -55,7 +56,8 @@
reset_chem_buttons() reset_chem_buttons()
//Total container size 300 - 1200u //Total container size 300 - 1200u
reagents.maximum_volume = (300*E) if(reagents)
reagents.maximum_volume = (300*E)
/obj/machinery/reagent_sleeper/update_icon() /obj/machinery/reagent_sleeper/update_icon()
icon_state = initial(icon_state) icon_state = initial(icon_state)
@@ -98,7 +100,7 @@
/obj/machinery/reagent_sleeper/attackby(obj/item/I, mob/user, params) /obj/machinery/reagent_sleeper/attackby(obj/item/I, mob/user, params)
if(!istype(I, /obj/item/reagent_containers/sleeper_buffer)) if(!istype(I, /obj/item/reagent_containers/sleeper_buffer))
var/obj/item/reagent_containers/sleeper_buffer/SB = I var/obj/item/reagent_containers/sleeper_buffer/SB = I
if((SB.reagents.total_volume + reagents.total_volume) < reagents.max_volume) if((SB.reagents.total_volume + reagents.total_volume) < reagents.maximum_volume)
SB.reagents.trans_to(reagents, SB.reagents.total_volume) SB.reagents.trans_to(reagents, SB.reagents.total_volume)
visible_message("[user] places the [SB] into the [src].") visible_message("[user] places the [SB] into the [src].")
qdel(SB) qdel(SB)
@@ -166,7 +168,7 @@
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui) if(!ui)
ui = new(user, src, ui_key, "reagent_sleeper", name, 375, 650, master_ui, state) ui = new(user, src, ui_key, "reagent_sleeper", name, 400, 650, master_ui, state)
ui.open() ui.open()
/obj/machinery/reagent_sleeper/ui_data() /obj/machinery/reagent_sleeper/ui_data()
@@ -178,12 +180,15 @@
data["tot_capacity"] = reagents.maximum_volume data["tot_capacity"] = reagents.maximum_volume
data["chems"] = list() data["chems"] = list()
for(var/chem in reagents.reagent_list) for(var/chem in available_chems)
var/datum/reagent/R = GLOB.chemical_reagents_list[chem] var/datum/reagent/R = reagents.has_reagent(chem.id)
if(R.id in available_chems) if(R)
data["synthchems"] += list(list("name" = R.name, "id" = R.id, "vol" = R.volume, "allowed" = chem_allowed(chem))) data["synthchems"] += list(list("name" = R.name, "id" = R.id, "vol" = R2.volume, "allowed" = chem_allowed(chem)))
else else
data["chems"] += list(list("name" = R.name, "id" = R.id, "vol" = R.volume, "allowed" = chem_allowed(chem))) 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["occupant"] = list() data["occupant"] = list()
var/mob/living/mob_occupant = occupant var/mob/living/mob_occupant = occupant
@@ -247,12 +252,12 @@
. = TRUE . = TRUE
if("inject") if("inject")
var/chem = params["chem"] var/chem = params["chem"]
var/amount = param["volume"] var/amount = text2num(params["volume"])
if(!is_operational() || !mob_occupant) if(!is_operational() || !mob_occupant)
return return
if(mob_occupant.health < min_health && chem != "epinephrine") if(mob_occupant.health < min_health && chem != "epinephrine")
return return
if(inject_chem(chem, usr, volume)) if(inject_chem(chem, usr, amount))
. = TRUE . = TRUE
if(scrambled_chems && prob(5)) if(scrambled_chems && prob(5))
to_chat(usr, "<span class='warning'>Chemical system re-route detected, results may not be as expected!</span>") to_chat(usr, "<span class='warning'>Chemical system re-route detected, results may not be as expected!</span>")
@@ -271,7 +276,7 @@
//trans to //trans to
/obj/machinery/reagent_sleeper/proc/inject_chem(chem, mob/user, volume) /obj/machinery/reagent_sleeper/proc/inject_chem(chem, mob/user, volume)
if((chem in available_chems) && chem_allowed(chem)) if(chem_allowed(chem))
reagents.trans_id_to(occupant, chem_buttons[chem], volume)//emag effect kicks in here so that the "intended" chem is used for all checks, for extra FUUU reagents.trans_id_to(occupant, chem_buttons[chem], volume)//emag effect kicks in here so that the "intended" chem is used for all checks, for extra FUUU
if(user) if(user)
log_combat(user, occupant, "injected [chem] into", addition = "via [src]") log_combat(user, occupant, "injected [chem] into", addition = "via [src]")

View File

@@ -2,6 +2,7 @@
/obj/item/reagent_containers/sleeper_buffer /obj/item/reagent_containers/sleeper_buffer
name = "Sleeper buffer container" name = "Sleeper buffer container"
desc = "A closed container for insertion in the Medical Sleepers." desc = "A closed container for insertion in the Medical Sleepers."
icon_state = "sleeper_buffer"
volume = 1200 volume = 1200
reagent_flags = NO_REACT reagent_flags = NO_REACT
spillable = TRUE spillable = TRUE

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

@@ -625,6 +625,7 @@
#include "code\game\machinery\newscaster.dm" #include "code\game\machinery\newscaster.dm"
#include "code\game\machinery\PDApainter.dm" #include "code\game\machinery\PDApainter.dm"
#include "code\game\machinery\quantum_pad.dm" #include "code\game\machinery\quantum_pad.dm"
#include "code\game\machinery\reagent_sleeper.dm"
#include "code\game\machinery\recharger.dm" #include "code\game\machinery\recharger.dm"
#include "code\game\machinery\rechargestation.dm" #include "code\game\machinery\rechargestation.dm"
#include "code\game\machinery\recycler.dm" #include "code\game\machinery\recycler.dm"
@@ -2620,6 +2621,7 @@
#include "code\modules\reagents\reagent_containers\patch.dm" #include "code\modules\reagents\reagent_containers\patch.dm"
#include "code\modules\reagents\reagent_containers\pill.dm" #include "code\modules\reagents\reagent_containers\pill.dm"
#include "code\modules\reagents\reagent_containers\rags.dm" #include "code\modules\reagents\reagent_containers\rags.dm"
#include "code\modules\reagents\reagent_containers\sleeper_buffer.dm"
#include "code\modules\reagents\reagent_containers\spray.dm" #include "code\modules\reagents\reagent_containers\spray.dm"
#include "code\modules\reagents\reagent_containers\syringes.dm" #include "code\modules\reagents\reagent_containers\syringes.dm"
#include "code\modules\recycling\conveyor2.dm" #include "code\modules\recycling\conveyor2.dm"

View File

@@ -46,7 +46,7 @@
</ui-section> </ui-section>
<ui-section label='Inject'> <ui-section label='Inject'>
{{#each data.synthchems}} {{#each data.synthchems}}
<span>{{name}}: {{vol}} </span> <span>{{name}}: {{vol}}u</span>
{{#if data.efficiency >= 3}} {{#if data.efficiency >= 3}}
<ui-button icon='transfer' state='{{data.occupied && allowed ? null : "disabled"}}' action='inject' params='{"chem": "{{id}}", "volume": 1}'>1</ui-button> <ui-button icon='transfer' state='{{data.occupied && allowed ? null : "disabled"}}' action='inject' params='{"chem": "{{id}}", "volume": 1}'>1</ui-button>
{{/if}} {{/if}}
@@ -57,7 +57,7 @@
<ui-button icon='flask' state='{{data.occupied && allowed ? null : "disabled"}}' action='synth' params='{"chem": "{{id}}"}'>Synthesize</ui-button><br/> <ui-button icon='flask' state='{{data.occupied && allowed ? null : "disabled"}}' action='synth' params='{"chem": "{{id}}"}'>Synthesize</ui-button><br/>
{{/each}} {{/each}}
{{#each data.chems}} {{#each data.chems}}
<span>{{name}}: {{vol}} </span> <span>{{name}}: {{vol}}u</span>
{{#if data.efficiency >= 3}} {{#if data.efficiency >= 3}}
<ui-button icon='transfer' state='{{data.occupied && allowed ? null : "disabled"}}' action='inject' params='{"chem": "{{id}}", "volume": 1}'>1</ui-button> <ui-button icon='transfer' state='{{data.occupied && allowed ? null : "disabled"}}' action='inject' params='{"chem": "{{id}}", "volume": 1}'>1</ui-button>
{{/if}} {{/if}}