mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Standardizes reagent examine code
So reagents that obscure reagent examine are worth a damn, and the funny hallucination text comes up more
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
|
||||
#define REAGENT_STATE_SOLID 1
|
||||
#define REAGENT_STATE_LIQUID 2
|
||||
#define REAGENT_STATE_GAS 3
|
||||
#define FOOD_METABOLISM 0.4
|
||||
#define REAGENTS_OVERDOSE 30
|
||||
#define REM REAGENTS_EFFECT_MULTIPLIER
|
||||
|
||||
// Use in chem.flags.
|
||||
#define CHEMFLAG_DISHONORABLE 1
|
||||
#define CHEMFLAG_OBSCURING 2
|
||||
|
||||
|
||||
//Reagents
|
||||
|
||||
#define VAPORSALT "vaporsalt"
|
||||
|
||||
@@ -444,25 +444,7 @@ its easier to just keep the beam vertical.
|
||||
if(get_dist(user,src) > 3)
|
||||
to_chat(user, "<span class='info'>You can't make out the contents.</span>")
|
||||
else
|
||||
to_chat(user, "It contains:")
|
||||
if(!user.hallucinating())
|
||||
if(reagents.reagent_list.len)
|
||||
for(var/datum/reagent/R in reagents.reagent_list)
|
||||
to_chat(user, "<span class='info'>[R.volume] units of [R.name]</span>")
|
||||
else
|
||||
to_chat(user, "<span class='info'>Nothing.</span>")
|
||||
|
||||
else //Show stupid things to hallucinating mobs
|
||||
var/list/fake_reagents = list("Water", "Orange juice", "Banana juice", "Tungsten", "Chloral Hydrate", "Helium",\
|
||||
"Sea water", "Energy drink", "Gushin' Granny", "Salt", "Sugar", "something yellow", "something red", "something blue",\
|
||||
"something suspicious", "something smelly", "something sweet", "Soda", "something that reminds you of home",\
|
||||
"Chef's Special")
|
||||
for(var/i, i < rand(1,10), i++)
|
||||
var/fake_amount = rand(1,30)
|
||||
var/fake_reagent = pick(fake_reagents)
|
||||
fake_reagents -= fake_reagent
|
||||
|
||||
to_chat(user, "<span class='info'>[fake_amount] units of [fake_reagent]</span>")
|
||||
reagents.get_examine(user)
|
||||
if(on_fire)
|
||||
user.simple_message("<span class='danger'>OH SHIT! IT'S ON FIRE!</span>",\
|
||||
"<span class='info'>It's on fire, man.</span>")
|
||||
|
||||
@@ -66,12 +66,7 @@
|
||||
/obj/item/weapon/extinguisher/examine(mob/user)
|
||||
..()
|
||||
if(!is_open_container())
|
||||
to_chat(user, "It contains:")
|
||||
if(reagents && reagents.reagent_list.len)
|
||||
for(var/datum/reagent/R in reagents.reagent_list)
|
||||
to_chat(user, "<span class='info'>[R.volume] units of [R.name]</span>")
|
||||
else
|
||||
to_chat(user, "<span class='info'>Nothing</span>")
|
||||
reagents.get_examine(user)
|
||||
for(var/thing in src)
|
||||
to_chat(user, "<span class='warning'>\A [thing] is jammed into the nozzle!</span>")
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
if(beaker)
|
||||
to_chat(user, "[bicon(beaker)] There is \a [beaker] in \the [src]'s beaker port.")
|
||||
var/obj/item/weapon/reagent_containers/glass/beaker/B = beaker
|
||||
B.show_list_of_reagents(user)
|
||||
B.reagents.get_examine(user)
|
||||
to_chat(user, "<span class='info'>\The [src] is set to inject [inject_amount] units each hit.</span>")
|
||||
|
||||
/obj/item/weapon/sword/venom/Destroy()
|
||||
|
||||
@@ -13,6 +13,7 @@ var/const/INGEST = 2
|
||||
var/atom/my_atom = null
|
||||
var/last_ckey_transferred_to_this = "" //The ckey of the last player who transferred reagents into this reagent datum.
|
||||
var/chem_temp = T20C
|
||||
var/obscured = FALSE
|
||||
|
||||
/datum/reagents/New(maximum=100)
|
||||
maximum_volume = maximum
|
||||
@@ -528,12 +529,15 @@ trans_to_atmos(var/datum/gas_mixture/target, var/amount=1, var/multiplier=1, var
|
||||
/datum/reagents/proc/update_total()
|
||||
total_volume = 0
|
||||
amount_cache.len = 0
|
||||
obscured = FALSE
|
||||
for(var/datum/reagent/R in reagent_list)
|
||||
if(R.volume < R.custom_metabolism/2) //Used to be 0.1, changing this to custom_metabolism/2 to alter balance as little as possible since the default metabolism is 0.2
|
||||
del_reagent(R.id,update_totals=0)
|
||||
else
|
||||
total_volume += R.volume
|
||||
amount_cache += list(R.id = R.volume)
|
||||
if(R.flags & CHEMFLAG_OBSCURING)
|
||||
obscured = TRUE
|
||||
return 0
|
||||
|
||||
/datum/reagents/proc/clear_reagents()
|
||||
@@ -897,6 +901,35 @@ trans_to_atmos(var/datum/gas_mixture/target, var/amount=1, var/multiplier=1, var
|
||||
else
|
||||
chem_temp = max(chem_temp + temp_change, received_temperature, 0)
|
||||
handle_reactions()
|
||||
|
||||
/datum/reagents/proc/get_examine(var/mob/user, var/vis_override, var/blood_type)
|
||||
if(obscured && !vis_override)
|
||||
to_chat(user, "<span class='info'>You can't quite make out the contents.</span>")
|
||||
return
|
||||
to_chat(user, "It contains:")
|
||||
if(!user.hallucinating())
|
||||
if(reagent_list.len)
|
||||
for(var/datum/reagent/R in reagent_list)
|
||||
if(blood_type && R.id == BLOOD)
|
||||
var/type = R.data["blood_type"]
|
||||
to_chat(user, "<span class='info'>[R.volume] units of [R.name], of type [type]</span>")
|
||||
else
|
||||
to_chat(user, "<span class='info'>[R.volume] units of [R.name]</span>")
|
||||
else
|
||||
to_chat(user, "<span class='info'>Nothing.</span>")
|
||||
|
||||
else //Show stupid things to hallucinating mobs
|
||||
var/list/fake_reagents = list("Water", "Orange juice", "Banana juice", "Tungsten", "Chloral Hydrate", "Helium",\
|
||||
"Sea water", "Energy drink", "Gushin' Granny", "Salt", "Sugar", "something yellow", "something red", "something blue",\
|
||||
"something suspicious", "something smelly", "something sweet", "Soda", "something that reminds you of home",\
|
||||
"Chef's Special")
|
||||
for(var/i, i < rand(1,10), i++)
|
||||
var/fake_amount = rand(1,30)
|
||||
var/fake_reagent = pick(fake_reagents)
|
||||
fake_reagents -= fake_reagent
|
||||
|
||||
to_chat(user, "<span class='info'>[fake_amount] units of [fake_reagent]</span>")
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,3 @@
|
||||
#define REAGENT_STATE_SOLID 1
|
||||
#define REAGENT_STATE_LIQUID 2
|
||||
#define REAGENT_STATE_GAS 3
|
||||
#define FOOD_METABOLISM 0.4
|
||||
#define REAGENTS_OVERDOSE 30
|
||||
#define REM REAGENTS_EFFECT_MULTIPLIER
|
||||
|
||||
// Use in chem.flags.
|
||||
#define CHEMFLAG_DISHONORABLE 1
|
||||
|
||||
/* The reaction procs must ALWAYS set src = null, this detaches the proc from the object (the reagent)
|
||||
so that it can continue working when the reagent is deleted while the proc is still active.
|
||||
|
||||
@@ -3907,6 +3897,7 @@
|
||||
id = BLACKCOLOR
|
||||
description = "A black coloring used to dye food and drinks."
|
||||
reagent_state = REAGENT_STATE_LIQUID
|
||||
flags = CHEMFLAG_OBSCURING
|
||||
color = "#000000" //rgb: 0, 0, 0
|
||||
|
||||
/datum/reagent/frostoil
|
||||
|
||||
@@ -67,11 +67,8 @@
|
||||
/obj/item/weapon/gun/dartgun/examine(mob/user)
|
||||
..()
|
||||
if (beakers.len)
|
||||
to_chat(user, "<span class='info'>[src] contains:</span>")
|
||||
for(var/obj/item/weapon/reagent_containers/glass/beaker/B in beakers)
|
||||
if(B.reagents && B.reagents.reagent_list.len)
|
||||
for(var/datum/reagent/R in B.reagents.reagent_list)
|
||||
to_chat(user, "<span class='info'>[R.volume] units of [R.name]</span>")
|
||||
B.reagents.get_examine(user)
|
||||
|
||||
/obj/item/weapon/gun/dartgun/attackby(obj/item/I as obj, mob/user as mob)
|
||||
if(istype(I, /obj/item/weapon/dart_cartridge))
|
||||
|
||||
@@ -335,15 +335,6 @@ var/list/LOGGED_SPLASH_REAGENTS = list(FUEL, THERMITE)
|
||||
else
|
||||
return "No reagents"
|
||||
|
||||
/obj/item/weapon/reagent_containers/proc/show_list_of_reagents(mob/user) //Displays a list of the reagents to a mob, formatted for reading
|
||||
to_chat(user, "It contains:")
|
||||
if(!reagents.total_volume)
|
||||
to_chat(user, "<span class='info'>Nothing.</span>")
|
||||
else
|
||||
if(reagents.reagent_list.len)
|
||||
for(var/datum/reagent/R in reagents.reagent_list)
|
||||
to_chat(user, "<span class='info'>[R.volume] units of [R.name]</span>")
|
||||
|
||||
/obj/item/weapon/reagent_containers/proc/fits_in_iv_drip()
|
||||
return FALSE
|
||||
|
||||
|
||||
@@ -88,16 +88,7 @@
|
||||
to_chat(user, "<span class='info'>You can't make out the contents.</span>")
|
||||
return
|
||||
if(reagents)
|
||||
to_chat(user, "It contains:")
|
||||
if(reagents.reagent_list.len)
|
||||
for(var/datum/reagent/R in reagents.reagent_list)
|
||||
if (R.id == BLOOD)
|
||||
var/type = R.data["blood_type"]
|
||||
to_chat(user, "<span class='info'>[R.volume] units of [R.name], of type [type]</span>")
|
||||
else
|
||||
to_chat(user, "<span class='info'>[R.volume] units of [R.name]</span>")
|
||||
else
|
||||
to_chat(user, "<span class='info'>Nothing.</span>")
|
||||
reagents.get_examine(user, blood_type = TRUE)
|
||||
|
||||
/obj/item/weapon/reagent_containers/blood/fits_in_iv_drip()
|
||||
if (mode == BLOODPACK_NORMAL)
|
||||
|
||||
@@ -68,13 +68,8 @@
|
||||
..()
|
||||
if(beaker)
|
||||
to_chat(user, "[bicon(beaker)] There is \a [beaker] in \the [src]'s auxiliary chamber.")
|
||||
to_chat(user, "It contains:")
|
||||
var/obj/item/weapon/reagent_containers/glass/B = beaker
|
||||
if(B.reagents.reagent_list.len)
|
||||
for(var/datum/reagent/R in B.reagents.reagent_list)
|
||||
to_chat(user, "<span class='info'>[R.volume] units of [R.name]</span>")
|
||||
else
|
||||
to_chat(user, "<span class='info'>Nothing.</span>")
|
||||
B.reagents.get_examine(user)
|
||||
|
||||
/obj/item/weapon/reagent_containers/chempack/on_reagent_change()
|
||||
update_icon()
|
||||
|
||||
@@ -33,10 +33,6 @@
|
||||
gulp_size = 5
|
||||
else
|
||||
gulp_size = max(round(reagents.total_volume / 5), 5)
|
||||
if(reagents.has_reagent(BLACKCOLOR))
|
||||
viewcontents = 0
|
||||
else
|
||||
viewcontents = 1
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/drinks/proc/try_consume(mob/user)
|
||||
if(!is_open_container())
|
||||
@@ -218,13 +214,7 @@
|
||||
transfer(target, user, can_send = TRUE, can_receive = FALSE)
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/drinks/examine(mob/user)
|
||||
|
||||
if(viewcontents)
|
||||
..()
|
||||
else
|
||||
to_chat(user, "[bicon(src)] That's \a [src].")
|
||||
to_chat(user, desc)
|
||||
to_chat(user, "<span class='info'>You can't quite make out its content!</span>")
|
||||
..()
|
||||
|
||||
if(!reagents || reagents.total_volume == 0)
|
||||
to_chat(user, "<span class='info'>\The [src] is empty!</span>")
|
||||
|
||||
@@ -28,12 +28,7 @@
|
||||
|
||||
/obj/structure/reagent_dispensers/examine(mob/user)
|
||||
..()
|
||||
to_chat(user, "<span class='info'>It contains:</span>")
|
||||
if(reagents && reagents.reagent_list.len)
|
||||
for(var/datum/reagent/R in reagents.reagent_list)
|
||||
to_chat(user, "<span class='info'>[R.volume] units of [R.name]</span>")
|
||||
else
|
||||
to_chat(user, "<span class='info'>Nothing.</span>")
|
||||
reagents.get_examine(user)
|
||||
|
||||
/obj/structure/reagent_dispensers/cultify()
|
||||
new /obj/structure/reagent_dispensers/bloodkeg(get_turf(src))
|
||||
|
||||
@@ -59,12 +59,7 @@
|
||||
to_chat(user, "<span class = 'notice'>\The [src] is on.</span>")
|
||||
if(BUNSEN_OPEN)
|
||||
to_chat(user, "<span class = 'notice'>\The [src]'s fuel port is open.</span>")
|
||||
to_chat(user, "<span class='info'>It contains:</span>")
|
||||
if(reagents && reagents.reagent_list.len)
|
||||
for(var/datum/reagent/R in reagents.reagent_list)
|
||||
to_chat(user, "<span class='info'>[R.volume] units of [R.name]</span>")
|
||||
else
|
||||
to_chat(user, "<span class='info'>Nothing.</span>")
|
||||
reagents.get_examine(user)
|
||||
if(held_container)
|
||||
to_chat(user, "<span class='info'>It is holding a:</span>")
|
||||
held_container.examine(user)
|
||||
|
||||
Reference in New Issue
Block a user