mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-26 10:02:28 +00:00
Small chemistry changes (#3525)
Beakers now show a message if they have solids inside Added an accuracy rating to containers. Containers will only tell you how many units of chemicals there are according to how accurate they are.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
var/amount_per_transfer_from_this = 5
|
||||
var/possible_transfer_amounts = list(5,10,15,25,30)
|
||||
var/volume = 30
|
||||
var/accuracy = 1
|
||||
|
||||
/obj/item/weapon/reagent_containers/verb/set_APTFT() //set amount_per_transfer_from_this
|
||||
set name = "Set transfer amount"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
amount_per_transfer_from_this = 10
|
||||
possible_transfer_amounts = list(5,10,15,25,30,60)
|
||||
volume = 60
|
||||
accuracy = 0.1
|
||||
w_class = 2
|
||||
flags = OPENCONTAINER
|
||||
unacidable = 1 //glass doesn't dissolve in acid
|
||||
@@ -46,72 +47,75 @@
|
||||
/obj/item/weapon/storage/part_replacer
|
||||
)
|
||||
|
||||
Initialize()
|
||||
. = ..()
|
||||
base_name = name
|
||||
/obj/item/weapon/reagent_containers/glass/Initialize()
|
||||
. = ..()
|
||||
base_name = name
|
||||
|
||||
examine(var/mob/user)
|
||||
if(!..(user, 2))
|
||||
/obj/item/weapon/reagent_containers/glass/examine(var/mob/user)
|
||||
if(!..(user, 2))
|
||||
return
|
||||
if(reagents && reagents.reagent_list.len)
|
||||
user << "<span class='notice'>It contains [round(reagents.total_volume, accuracy)] units of liquid.</span>"
|
||||
for(var/datum/reagent/T in reagents.reagent_list)
|
||||
if(T.reagent_state == SOLID)
|
||||
user << "<span class='notice'>You see something solid in the beaker.</span>"
|
||||
break // to stop multiple messages of this
|
||||
else
|
||||
user << "<span class='notice'>It is empty.</span>"
|
||||
if(!is_open_container())
|
||||
user << "<span class='notice'>Airtight lid seals it completely.</span>"
|
||||
|
||||
/obj/item/weapon/reagent_containers/glass/attack_self()
|
||||
..()
|
||||
if(is_open_container())
|
||||
usr << "<span class = 'notice'>You put the lid on \the [src].</span>"
|
||||
flags ^= OPENCONTAINER
|
||||
else
|
||||
usr << "<span class = 'notice'>You take the lid off \the [src].</span>"
|
||||
flags |= OPENCONTAINER
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/reagent_containers/glass/AltClick(var/mob/user)
|
||||
set_APTFT()
|
||||
|
||||
/obj/item/weapon/reagent_containers/glass/afterattack(var/obj/target, var/mob/user, var/flag)
|
||||
if(!is_open_container() || !flag)
|
||||
return
|
||||
|
||||
for(var/type in can_be_placed_into)
|
||||
if(istype(target, type))
|
||||
return
|
||||
if(reagents && reagents.reagent_list.len)
|
||||
user << "<span class='notice'>It contains [reagents.total_volume] units of liquid.</span>"
|
||||
|
||||
if(standard_splash_mob(user, target))
|
||||
return
|
||||
if(standard_dispenser_refill(user, target))
|
||||
return
|
||||
if(standard_pour_into(user, target))
|
||||
return
|
||||
|
||||
if(reagents.total_volume)
|
||||
user << "<span class='notice'>You splash the solution onto [target].</span>"
|
||||
reagents.splash(target, reagents.total_volume)
|
||||
return
|
||||
|
||||
/obj/item/weapon/reagent_containers/glass/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W,/obj/item/weapon/storage/part_replacer))
|
||||
if(!reagents || !reagents.total_volume)
|
||||
return ..()
|
||||
if(istype(W, /obj/item/weapon/pen) || istype(W, /obj/item/device/flashlight/pen))
|
||||
var/tmp_label = sanitizeSafe(input(user, "Enter a label for [name]", "Label", label_text), MAX_NAME_LEN)
|
||||
if(length(tmp_label) > 10)
|
||||
user << "<span class='notice'>The label can be at most 10 characters long.</span>"
|
||||
else
|
||||
user << "<span class='notice'>It is empty.</span>"
|
||||
if(!is_open_container())
|
||||
user << "<span class='notice'>Airtight lid seals it completely.</span>"
|
||||
user << "<span class='notice'>You set the label to \"[tmp_label]\".</span>"
|
||||
label_text = tmp_label
|
||||
update_name_label()
|
||||
|
||||
attack_self()
|
||||
..()
|
||||
if(is_open_container())
|
||||
usr << "<span class = 'notice'>You put the lid on \the [src].</span>"
|
||||
flags ^= OPENCONTAINER
|
||||
else
|
||||
usr << "<span class = 'notice'>You take the lid off \the [src].</span>"
|
||||
flags |= OPENCONTAINER
|
||||
update_icon()
|
||||
|
||||
AltClick(var/mob/user)
|
||||
set_APTFT()
|
||||
|
||||
afterattack(var/obj/target, var/mob/user, var/flag)
|
||||
|
||||
if(!is_open_container() || !flag)
|
||||
return
|
||||
|
||||
for(var/type in can_be_placed_into)
|
||||
if(istype(target, type))
|
||||
return
|
||||
|
||||
if(standard_splash_mob(user, target))
|
||||
return
|
||||
if(standard_dispenser_refill(user, target))
|
||||
return
|
||||
if(standard_pour_into(user, target))
|
||||
return
|
||||
|
||||
if(reagents.total_volume)
|
||||
user << "<span class='notice'>You splash the solution onto [target].</span>"
|
||||
reagents.splash(target, reagents.total_volume)
|
||||
return
|
||||
|
||||
attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W,/obj/item/weapon/storage/part_replacer))
|
||||
if(!reagents || !reagents.total_volume)
|
||||
return ..()
|
||||
if(istype(W, /obj/item/weapon/pen) || istype(W, /obj/item/device/flashlight/pen))
|
||||
var/tmp_label = sanitizeSafe(input(user, "Enter a label for [name]", "Label", label_text), MAX_NAME_LEN)
|
||||
if(length(tmp_label) > 10)
|
||||
user << "<span class='notice'>The label can be at most 10 characters long.</span>"
|
||||
else
|
||||
user << "<span class='notice'>You set the label to \"[tmp_label]\".</span>"
|
||||
label_text = tmp_label
|
||||
update_name_label()
|
||||
|
||||
proc/update_name_label()
|
||||
if(label_text == "")
|
||||
name = base_name
|
||||
else
|
||||
name = "[base_name] ([label_text])"
|
||||
/obj/item/weapon/reagent_containers/glass/proc/update_name_label()
|
||||
if(label_text == "")
|
||||
name = base_name
|
||||
else
|
||||
name = "[base_name] ([label_text])"
|
||||
|
||||
/obj/item/weapon/reagent_containers/glass/beaker
|
||||
name = "beaker"
|
||||
@@ -121,46 +125,46 @@
|
||||
item_state = "beaker"
|
||||
matter = list("glass" = 500)
|
||||
|
||||
Initialize()
|
||||
. = ..()
|
||||
desc += " Can hold up to [volume] units."
|
||||
|
||||
on_reagent_change()
|
||||
update_icon()
|
||||
|
||||
pickup(mob/user)
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
dropped(mob/user)
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
attack_hand()
|
||||
..()
|
||||
update_icon()
|
||||
/obj/item/weapon/reagent_containers/glass/beaker/Initialize()
|
||||
. = ..()
|
||||
desc += " Can hold up to [volume] units."
|
||||
|
||||
/obj/item/weapon/reagent_containers/glass/beaker/on_reagent_change()
|
||||
update_icon()
|
||||
cut_overlays()
|
||||
|
||||
if(reagents.total_volume)
|
||||
var/image/filling = image('icons/obj/reagentfillings.dmi', src, "[icon_state]10")
|
||||
/obj/item/weapon/reagent_containers/glass/beaker/pickup(mob/user)
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
var/percent = round((reagents.total_volume / volume) * 100)
|
||||
switch(percent)
|
||||
if(0 to 9) filling.icon_state = "[icon_state]-10"
|
||||
if(10 to 24) filling.icon_state = "[icon_state]10"
|
||||
if(25 to 49) filling.icon_state = "[icon_state]25"
|
||||
if(50 to 74) filling.icon_state = "[icon_state]50"
|
||||
if(75 to 79) filling.icon_state = "[icon_state]75"
|
||||
if(80 to 90) filling.icon_state = "[icon_state]80"
|
||||
if(91 to INFINITY) filling.icon_state = "[icon_state]100"
|
||||
/obj/item/weapon/reagent_containers/glass/beaker/dropped(mob/user)
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
filling.color = reagents.get_color()
|
||||
add_overlay(filling)
|
||||
/obj/item/weapon/reagent_containers/glass/beaker/attack_hand()
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
if (!is_open_container())
|
||||
add_overlay("lid_[initial(icon_state)]")
|
||||
/obj/item/weapon/reagent_containers/glass/beaker/update_icon()
|
||||
cut_overlays()
|
||||
|
||||
if(reagents.total_volume)
|
||||
var/image/filling = image('icons/obj/reagentfillings.dmi', src, "[icon_state]10")
|
||||
|
||||
var/percent = round((reagents.total_volume / volume) * 100)
|
||||
switch(percent)
|
||||
if(0 to 9) filling.icon_state = "[icon_state]-10"
|
||||
if(10 to 24) filling.icon_state = "[icon_state]10"
|
||||
if(25 to 49) filling.icon_state = "[icon_state]25"
|
||||
if(50 to 74) filling.icon_state = "[icon_state]50"
|
||||
if(75 to 79) filling.icon_state = "[icon_state]75"
|
||||
if(80 to 90) filling.icon_state = "[icon_state]80"
|
||||
if(91 to INFINITY) filling.icon_state = "[icon_state]100"
|
||||
|
||||
filling.color = reagents.get_color()
|
||||
add_overlay(filling)
|
||||
|
||||
if (!is_open_container())
|
||||
add_overlay("lid_[initial(icon_state)]")
|
||||
|
||||
/obj/item/weapon/reagent_containers/glass/beaker/large
|
||||
name = "large beaker"
|
||||
@@ -202,16 +206,16 @@
|
||||
flags = OPENCONTAINER
|
||||
|
||||
/obj/item/weapon/reagent_containers/glass/beaker/cryoxadone
|
||||
Initialize()
|
||||
. = ..()
|
||||
reagents.add_reagent("cryoxadone", 30)
|
||||
update_icon()
|
||||
/obj/item/weapon/reagent_containers/glass/beaker/cryoxadone/Initialize()
|
||||
. = ..()
|
||||
reagents.add_reagent("cryoxadone", 30)
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/reagent_containers/glass/beaker/sulphuric
|
||||
Initialize()
|
||||
. = ..()
|
||||
reagents.add_reagent("sacid", 60)
|
||||
update_icon()
|
||||
/obj/item/weapon/reagent_containers/glass/beaker/sulphuric/Initialize()
|
||||
. = ..()
|
||||
reagents.add_reagent("sacid", 60)
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/reagent_containers/glass/bucket
|
||||
desc = "It's a bucket."
|
||||
@@ -219,6 +223,7 @@
|
||||
icon = 'icons/obj/janitor.dmi'
|
||||
icon_state = "bucket"
|
||||
item_state = "bucket"
|
||||
accuracy = 1
|
||||
matter = list(DEFAULT_WALL_MATERIAL = 200)
|
||||
w_class = 3.0
|
||||
amount_per_transfer_from_this = 20
|
||||
@@ -228,7 +233,6 @@
|
||||
unacidable = 0
|
||||
|
||||
/obj/item/weapon/reagent_containers/glass/bucket/attackby(var/obj/D, mob/user as mob)
|
||||
|
||||
if(isprox(D))
|
||||
user << "You add [D] to [src]."
|
||||
qdel(D)
|
||||
@@ -250,36 +254,4 @@
|
||||
/obj/item/weapon/reagent_containers/glass/bucket/update_icon()
|
||||
cut_overlays()
|
||||
if (!is_open_container())
|
||||
add_overlay("lid_[initial(icon_state)]")
|
||||
|
||||
/*
|
||||
/obj/item/weapon/reagent_containers/glass/blender_jug
|
||||
name = "Blender Jug"
|
||||
desc = "A blender jug, part of a blender."
|
||||
icon = 'icons/obj/kitchen.dmi'
|
||||
icon_state = "blender_jug_e"
|
||||
volume = 100
|
||||
|
||||
on_reagent_change()
|
||||
switch(src.reagents.total_volume)
|
||||
if(0)
|
||||
icon_state = "blender_jug_e"
|
||||
if(1 to 75)
|
||||
icon_state = "blender_jug_h"
|
||||
if(76 to 100)
|
||||
icon_state = "blender_jug_f"
|
||||
|
||||
/obj/item/weapon/reagent_containers/glass/canister //not used apparantly
|
||||
desc = "It's a canister. Mainly used for transporting fuel."
|
||||
name = "canister"
|
||||
icon = 'icons/obj/tank.dmi'
|
||||
icon_state = "canister"
|
||||
item_state = "canister"
|
||||
m_amt = 300
|
||||
g_amt = 0
|
||||
w_class = 4.0
|
||||
|
||||
amount_per_transfer_from_this = 20
|
||||
possible_transfer_amounts = list(10,20,30,60)
|
||||
volume = 120
|
||||
*/
|
||||
add_overlay("lid_[initial(icon_state)]")
|
||||
Reference in New Issue
Block a user