Files
S.P.L.U.R.T-Station-13/code/modules/reagents/chemistry/reagents.dm

124 lines
4.3 KiB
Plaintext

#define REM REAGENTS_EFFECT_MULTIPLIER
//Various reagents
//Toxin & acid reagents
//Hydroponics stuff
/datum/reagent
var/name = "Reagent"
var/id = "reagent"
var/description = ""
var/taste_description = "metaphorical salt"
var/taste_mult = 1 //how this taste compares to others. Higher values means it is more noticable
var/glass_name = "glass of ...what?" // use for specialty drinks.
var/glass_desc = "You can't really tell what this is."
var/glass_icon_state = null // Otherwise just sets the icon to a normal glass with the mixture of the reagents in the glass.
var/shot_glass_icon_state = null
var/datum/reagents/holder = null
var/reagent_state = LIQUID
var/list/data
var/current_cycle = 0
var/volume = 0
var/color = "#000000" // rgb: 0, 0, 0
var/can_synth = TRUE // can this reagent be synthesized? (for example: odysseus syringe gun)
var/metabolization_rate = REAGENTS_METABOLISM //how fast the reagent is metabolized by the mob
var/overrides_metab = 0
var/overdose_threshold = 0
var/addiction_threshold = 0
var/addiction_stage = 0
var/overdosed = 0 // You fucked up and this is now triggering its overdose effects, purge that shit quick.
var/self_consuming = FALSE
/datum/reagent/Destroy() // This should only be called by the holder, so it's already handled clearing its references
. = ..()
holder = null
/datum/reagent/proc/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message = 1, touch_protection = 0)
if(!istype(M))
return 0
if(method == VAPOR) //smoke, foam, spray
if(M.reagents)
var/modifier = CLAMP((1 - touch_protection), 0, 1)
var/amount = round(reac_volume*modifier, 0.1)
if(amount >= 0.5)
M.reagents.add_reagent(id, amount)
return 1
/datum/reagent/proc/reaction_obj(obj/O, volume)
return
/datum/reagent/proc/reaction_turf(turf/T, volume)
return
/datum/reagent/proc/on_mob_life(mob/living/M)
current_cycle++
holder.remove_reagent(src.id, metabolization_rate * M.metabolism_efficiency) //By default it slowly disappears.
return
// Called when this reagent is first added to a mob
/datum/reagent/proc/on_mob_add(mob/M)
return
// Called when this reagent is removed while inside a mob
/datum/reagent/proc/on_mob_delete(mob/M)
return
/datum/reagent/proc/on_move(mob/M)
return
// Called after add_reagents creates a new reagent.
/datum/reagent/proc/on_new(data)
return
// Called when two reagents of the same are mixing.
/datum/reagent/proc/on_merge(data)
return
/datum/reagent/proc/on_update(atom/A)
return
// Called when the reagent container is hit by an explosion
/datum/reagent/proc/on_ex_act(severity)
return
// Called if the reagent has passed the overdose threshold and is set to be triggering overdose effects
/datum/reagent/proc/overdose_process(mob/living/M)
return
/datum/reagent/proc/overdose_start(mob/living/M)
to_chat(M, "<span class='userdanger'>You feel like you took too much of [name]!</span>")
M.SendSignal(COMSIG_ADD_MOOD_EVENT, "[id]_overdose", /datum/mood_event/drugs/overdose, name)
return
/datum/reagent/proc/addiction_act_stage1(mob/living/M)
M.SendSignal(COMSIG_ADD_MOOD_EVENT, "[id]_overdose", /datum/mood_event/drugs/withdrawal_light, name)
if(prob(30))
to_chat(M, "<span class='notice'>You feel like having some [name] right about now.</span>")
return
/datum/reagent/proc/addiction_act_stage2(mob/living/M)
M.SendSignal(COMSIG_ADD_MOOD_EVENT, "[id]_overdose", /datum/mood_event/drugs/withdrawal_medium, name)
if(prob(30))
to_chat(M, "<span class='notice'>You feel like you need [name]. You just can't get enough.</span>")
return
/datum/reagent/proc/addiction_act_stage3(mob/living/M)
M.SendSignal(COMSIG_ADD_MOOD_EVENT, "[id]_overdose", /datum/mood_event/drugs/withdrawal_severe, name)
if(prob(30))
to_chat(M, "<span class='danger'>You have an intense craving for [name].</span>")
return
/datum/reagent/proc/addiction_act_stage4(mob/living/M)
M.SendSignal(COMSIG_ADD_MOOD_EVENT, "[id]_overdose", /datum/mood_event/drugs/withdrawal_critical, name)
if(prob(30))
to_chat(M, "<span class='boldannounce'>You're not feeling good at all! You really need some [name].</span>")
return
/proc/pretty_string_from_reagent_list(var/list/reagent_list)
//Convert reagent list to a printable string for logging etc
var/result = "| "
for (var/datum/reagent/R in reagent_list)
result += "[R.name], [R.volume] | "
return result