mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Fix reagent handling, magic numbers, other errors.
This commit is contained in:
@@ -34,3 +34,5 @@
|
||||
#define issilicon(A) istype(A, /mob/living/silicon)
|
||||
|
||||
#define isslime(A) istype(A, /mob/living/carbon/slime)
|
||||
|
||||
#define isxeno(A) istype(A, /mob/living/simple_animal/xeno)
|
||||
|
||||
@@ -383,6 +383,10 @@
|
||||
if(type == CHEM_TOUCH)
|
||||
var/datum/reagents/R = C.touching
|
||||
return trans_to_holder(R, amount, multiplier, copy)
|
||||
else if(isxeno(target))
|
||||
var/mob/living/simple_animal/xeno/X = target
|
||||
var/datum/reagents/R = X.reagents
|
||||
return trans_to_holder(R, amount, multiplier, copy)
|
||||
else
|
||||
var/datum/reagents/R = new /datum/reagents(amount)
|
||||
. = trans_to_holder(R, amount, multiplier, copy)
|
||||
|
||||
@@ -13,33 +13,37 @@
|
||||
|
||||
//Definitions for traits.
|
||||
|
||||
#define TRAIT_XENO_COLOR "color"
|
||||
#define TRAIT_XENO_CHEMISTRY "chems"
|
||||
#define TRAIT_XENO_CHEMVOL "chem_vol"
|
||||
#define TRAIT_XENO_HEALTH "health"
|
||||
#define TRAIT_XENO_HUNGER "hunger"
|
||||
#define TRAIT_XENO_STARVEDAMAGE "starvedamage"
|
||||
#define TRAIT_XENO_EATS "eats"
|
||||
#define TRAIT_XENO_CHROMATIC "chrom"
|
||||
#define TRAIT_XENO_HOSTILE "hostile"
|
||||
#define TRAIT_XENO_BIOLUMESCENT "biolum"
|
||||
#define TRAIT_XENO_BIO_COLOR "biocolor"
|
||||
#define TRAIT_XENO_GLOW_STRENGTH "biostrength"
|
||||
#define TRAIT_XENO_GLOW_RANGE "biorange"
|
||||
#define TRAIT_XENO_TOXIC_CHEMS "tox_chems"
|
||||
#define TRAIT_XENO_NUTRITIONAL_CHEMS "nutr_chems"
|
||||
#define TRAIT_XENO_HEALING_CHEMS "heal_chems"
|
||||
#define TRAIT_XENO_MUTATING_CHEMS "mut_chems"
|
||||
#define TRAIT_XENO_SPEED "speed"
|
||||
#define TRAIT_XENO_COLDRES "cold_resistance"
|
||||
#define TRAIT_XENO_HEATRES "heat_resistance"
|
||||
#define TRAIT_XENO_LEARNCHANCE "learn_chance"
|
||||
#define TRAIT_XENO_CANLEARN "can_learn"
|
||||
#define TRAIT_XENO_SPEAKCHANCE "speak_chance"
|
||||
#define TRAIT_XENO_CANSPEAK "can_speak"
|
||||
#define TRAIT_XENO_STRENGTH "melee_strength"
|
||||
#define TRAIT_XENO_STR_RANGE "melee_range"
|
||||
#define TRAIT_XENO_COLOR "color"
|
||||
#define TRAIT_XENO_CHEMISTRY "chems"
|
||||
#define TRAIT_XENO_CHEMVOL "chem_vol"
|
||||
#define TRAIT_XENO_HEALTH "health"
|
||||
#define TRAIT_XENO_HUNGER "hunger"
|
||||
#define TRAIT_XENO_STARVEDAMAGE "starvedamage"
|
||||
#define TRAIT_XENO_EATS "eats"
|
||||
#define TRAIT_XENO_CHROMATIC "chrom"
|
||||
#define TRAIT_XENO_HOSTILE "hostile"
|
||||
#define TRAIT_XENO_BIOLUMESCENT "biolum"
|
||||
#define TRAIT_XENO_BIO_COLOR "biocolor"
|
||||
#define TRAIT_XENO_GLOW_STRENGTH "biostrength"
|
||||
#define TRAIT_XENO_GLOW_RANGE "biorange"
|
||||
#define TRAIT_XENO_TOXIC_CHEMS "tox_chems"
|
||||
#define TRAIT_XENO_NUTRITIONAL_CHEMS "nutr_chems"
|
||||
#define TRAIT_XENO_HEALING_CHEMS "heal_chems"
|
||||
#define TRAIT_XENO_MUTATING_CHEMS "mut_chems"
|
||||
#define TRAIT_XENO_SPEED "speed"
|
||||
#define TRAIT_XENO_COLDRES "cold_resistance"
|
||||
#define TRAIT_XENO_HEATRES "heat_resistance"
|
||||
#define TRAIT_XENO_LEARNCHANCE "learn_chance"
|
||||
#define TRAIT_XENO_CANLEARN "can_learn"
|
||||
#define TRAIT_XENO_SPEAKCHANCE "speak_chance"
|
||||
#define TRAIT_XENO_CANSPEAK "can_speak"
|
||||
#define TRAIT_XENO_STRENGTH "melee_strength"
|
||||
#define TRAIT_XENO_STR_RANGE "melee_range"
|
||||
|
||||
//Maleability defines.
|
||||
#define MAX_MALEABLE 2
|
||||
#define MINOR_MALEABLE 1
|
||||
#define MIN_MALEABLE 0
|
||||
|
||||
var/global/list/xenoChemList = list("mutationtoxin",
|
||||
"psilocybin",
|
||||
@@ -73,10 +77,7 @@ var/global/list/xenoChemList = list("mutationtoxin",
|
||||
|
||||
/datum/xeno/traits
|
||||
var/list/traits = list()
|
||||
var/list/tox_chems
|
||||
var/list/nutr_chems
|
||||
var/list/heal_chems
|
||||
var/list/mut_chems
|
||||
var/list/chemlist = list()
|
||||
var/obj/chems
|
||||
|
||||
/datum/xeno/traits/proc/set_trait(var/trait, var/newval)
|
||||
@@ -86,7 +87,7 @@ var/global/list/xenoChemList = list("mutationtoxin",
|
||||
/datum/xeno/traits/New()
|
||||
..()
|
||||
set_trait(TRAIT_XENO_COLOR, "#CACACA")
|
||||
set_trait(TRAIT_XENO_CHEMVOL, 10)
|
||||
set_trait(TRAIT_XENO_CHEMVOL, 100)
|
||||
set_trait(TRAIT_XENO_HEALTH, 20)
|
||||
set_trait(TRAIT_XENO_HUNGER, 2)
|
||||
set_trait(TRAIT_XENO_STARVEDAMAGE, 0)
|
||||
@@ -102,7 +103,7 @@ var/global/list/xenoChemList = list("mutationtoxin",
|
||||
set_trait(TRAIT_XENO_HEATRES, 20)
|
||||
set_trait(TRAIT_XENO_LEARNCHANCE, 100)
|
||||
set_trait(TRAIT_XENO_CANLEARN, 1)
|
||||
set_trait(TRAIT_XENO_SPEAKCHANCE, 10)
|
||||
set_trait(TRAIT_XENO_SPEAKCHANCE, 1)
|
||||
set_trait(TRAIT_XENO_CANSPEAK, 1)
|
||||
set_trait(TRAIT_XENO_STRENGTH, 0)
|
||||
set_trait(TRAIT_XENO_STR_RANGE, 0)
|
||||
|
||||
@@ -8,7 +8,7 @@ Slime specific procs go here.
|
||||
/mob/living/simple_animal/xeno/slime/RandomizeTraits()
|
||||
traitdat.traits[TRAIT_XENO_COLDRES] = rand(30,270)
|
||||
traitdat.traits[TRAIT_XENO_HEATRES] = rand(30,270)
|
||||
traitdat.traits[TRAIT_XENO_CHEMVOL] = round(rand(0,40)) //Wow, a slime core with the capacity to hold 2/3rd's a beaker's worth of chemicals.
|
||||
traitdat.traits[TRAIT_XENO_CHEMVOL] = round(rand(20,40)) //Wow, a slime core with the capacity to hold 2/3rd's a beaker's worth of chemicals.
|
||||
traitdat.traits[TRAIT_XENO_HEALTH] = round(rand(50, 75))
|
||||
traitdat.traits[TRAIT_XENO_HUNGER] = rand(1, 20)
|
||||
traitdat.traits[TRAIT_XENO_STARVEDAMAGE] = rand(1, 4)
|
||||
@@ -98,7 +98,7 @@ Slime specific procs go here.
|
||||
return
|
||||
if(reagents.total_volume <= 0)
|
||||
return
|
||||
if(reagents["docilitytoxin"]) //Toxin that makes them docile? Good for quelling angry mobs.
|
||||
/*if(reagents.has_reagent("docilitytoxin")) //Toxin that makes them docile? Good for quelling angry mobs.
|
||||
hostile = 0
|
||||
traitdat.traits[TRAIT_XENO_HOSTILE] = 0
|
||||
..()
|
||||
traitdat.traits[TRAIT_XENO_HOSTILE] = 0*/
|
||||
..()
|
||||
@@ -24,7 +24,7 @@ Slime definitions, Life and New live here.
|
||||
|
||||
var/emote_on = null
|
||||
|
||||
maleable = 2
|
||||
maleable = MAX_MALEABLE
|
||||
|
||||
//Slimes can speak all of the languages, oh no!
|
||||
universal_speak = 1
|
||||
@@ -44,38 +44,38 @@ Slime definitions, Life and New live here.
|
||||
//Overlay information
|
||||
var/overlay = 1 // 1 = normal lighting, 0 = shiny, 2 = too shiny, -1 = no overlay
|
||||
|
||||
chemreact = list( "nutriment" = list("nutr" = 5),
|
||||
"radium" = list("toxic" = 3, "mut" = 10),
|
||||
"mutagen" = list("nutr" = 4, "mut" = 20),
|
||||
"water" = list("nutr" = -1),
|
||||
"milk" = list("nutr" = 3),
|
||||
"sacid" = list("toxic" = 10),
|
||||
"pacid" = list("toxic" = 20),
|
||||
"chlorine" = list("toxic" = 5),
|
||||
"ammonia" = list("toxic" = 5),
|
||||
"sodawater" = list("toxic" = 1, "nutr" = -1),
|
||||
"beer" = list("nutr" = 6),
|
||||
"diethylamine" = list("nutr" = 9),
|
||||
"sugar" = list("toxic" = 4, "nutr" = 2),
|
||||
"eznutrient" = list("nutr" = 8),
|
||||
"cryoxadone" = list("toxic" = 4),
|
||||
"flourine" = list("toxic" = 1),
|
||||
"robustharvest" = list("nutr" = 15),
|
||||
"glucose" = list("nutr" = 5),
|
||||
"blood" = list("nutr" = 7.5, "toxic" = 0.5, "mut" = 4.5),
|
||||
"fuel" = list("toxic" = 4),
|
||||
"toxin" = list("toxic" = 5),
|
||||
"carpotoxin" = list("toxic" = 10, "mut" = 15),
|
||||
"phoron" = list("toxic" = 15, "mut" = 0.3),
|
||||
"cyanide" = list("toxic" = 35),
|
||||
"slimejelly" = list("nutr" = 5),
|
||||
"amutationtoxin" = list("toxic" = 1, "heal" = 15, "mut" = 30),
|
||||
"mutationtoxin" = list("toxic" = 1, "heal" = 10, "mut" = 15),
|
||||
"gold" = list("heal" = 3, "nutr" = 7, "mut" = 3),
|
||||
"uranium" = list("heal" = 3, "toxic" = 7, "mut" = 12),
|
||||
"glycerol" = list("nutr" = 6),
|
||||
"woodpulp" = list("heal" = 1, "nutr" = 7),
|
||||
"docilitytoxin" = list("nutr" = 3) )
|
||||
chemreact = list( "nutriment" = list("nutr" = 0.5),
|
||||
"radium" = list("toxic" = 0.3, "mut" = 1),
|
||||
"mutagen" = list("nutr" = 0.4, "mut" = 2),
|
||||
"water" = list("nutr" = -0.1),
|
||||
"milk" = list("nutr" = 0.3),
|
||||
"sacid" = list("toxic" = 1),
|
||||
"pacid" = list("toxic" = 2),
|
||||
"chlorine" = list("toxic" = 0.5),
|
||||
"ammonia" = list("toxic" = 0.5),
|
||||
"sodawater" = list("toxic" = 0.1, "nutr" = -0.1),
|
||||
"beer" = list("nutr" = 0.6),
|
||||
"diethylamine" = list("nutr" = 0.9),
|
||||
"sugar" = list("toxic" = 0.4, "nutr" = 0.2),
|
||||
"eznutrient" = list("nutr" = 0.8),
|
||||
"cryoxadone" = list("toxic" = 0.4),
|
||||
"flourine" = list("toxic" = 0.1),
|
||||
"robustharvest" = list("nutr" = 1.5),
|
||||
"glucose" = list("nutr" = 0.5),
|
||||
"blood" = list("nutr" = 0.75, "toxic" = 0.05, "mut" = 0.45),
|
||||
"fuel" = list("toxic" = 0.4),
|
||||
"toxin" = list("toxic" = 0.5),
|
||||
"carpotoxin" = list("toxic" = 1, "mut" = 1.5),
|
||||
"phoron" = list("toxic" = 1.5, "mut" = 0.03),
|
||||
"cyanide" = list("toxic" = 3.5),
|
||||
"slimejelly" = list("nutr" = 0.5),
|
||||
"amutationtoxin" = list("toxic" = 0.1, "heal" = 1.5, "mut" = 3),
|
||||
"mutationtoxin" = list("toxic" = 0.1, "heal" = 1, "mut" = 1.5),
|
||||
"gold" = list("heal" = 0.3, "nutr" = 0.7, "mut" = 0.3),
|
||||
"uranium" = list("heal" = 0.3, "toxic" = 0.7, "mut" = 1.2),
|
||||
"glycerol" = list("nutr" = 0.6),
|
||||
"woodpulp" = list("heal" = 0.1, "nutr" = 0.7),
|
||||
"docilitytoxin" = list("nutr" = 0.3) )
|
||||
|
||||
/mob/living/simple_animal/xeno/slime/New()
|
||||
..()
|
||||
|
||||
@@ -8,12 +8,15 @@ Procs for copying speech, if applicable
|
||||
Procs for targeting
|
||||
*/
|
||||
/mob/living/simple_animal/xeno/proc/ProcessTraits()
|
||||
if(maleable >= 2)
|
||||
if(maleable >= MAX_MALEABLE)
|
||||
maxHealth = traitdat.traits[TRAIT_XENO_HEALTH]
|
||||
health = maxHealth
|
||||
chemlist = traitdat.chemreact
|
||||
if(traitdat.chemlist.len) //Let's make sure that this has a length.
|
||||
chemreact = traitdat.chemlist
|
||||
else
|
||||
traitdat.chemlist = chemreact
|
||||
chromatic = traitdat.traits[TRAIT_XENO_CHROMATIC]
|
||||
if(maleable >= 1)
|
||||
if(maleable >= MINOR_MALEABLE)
|
||||
if(colored)
|
||||
color = traitdat.traits[TRAIT_XENO_COLOR]
|
||||
speed = traitdat.traits[TRAIT_XENO_SPEED]
|
||||
@@ -26,7 +29,7 @@ Procs for targeting
|
||||
set_light(traitdat.traits[TRAIT_XENO_GLOW_RANGE], traitdat.traits[TRAIT_XENO_GLOW_STRENGTH], traitdat.traits[TRAIT_XENO_BIO_COLOR])
|
||||
else
|
||||
set_light(0, 0, "#000000") //Should kill any light that shouldn't be there.
|
||||
if(chromatic)
|
||||
if(!(chromatic))
|
||||
hostile = 0 //No. No laser-reflecting hostile creatures. Bad.
|
||||
else
|
||||
hostile = traitdat.traits[TRAIT_XENO_HOSTILE]
|
||||
@@ -53,17 +56,17 @@ Procs for targeting
|
||||
|
||||
//Let's handle some chemical smoke, for scientific smoke bomb purposes.
|
||||
for(var/obj/effect/effect/smoke/chem/smoke in view(1, src))
|
||||
if(smoke.reagents.total_volume)
|
||||
smoke.reagents.trans_to_mob(src, 10, CHEM_BLOOD, copy = 1)
|
||||
if(smoke.reagents.total_volume)
|
||||
smoke.reagents.trans_to_mob(src, 10, CHEM_BLOOD, copy = 1)
|
||||
|
||||
reagents.trans_to(temp_chem_holder, min(reagents.total_volume,rand(1,4)))
|
||||
reagents.trans_to_obj(temp_chem_holder, min(reagents.total_volume,rand(1,4)))
|
||||
var/reagent_total
|
||||
var/list/reagent_response = list()
|
||||
for(var/datum/reagent/R in temp_chem_holder.reagents.reagent_list)
|
||||
|
||||
reagent_total = temp_chem_holder.reagents.get_reagent_amount(R.id)
|
||||
|
||||
reagent_response = chemreact[R]
|
||||
reagent_response = chemreact[R.id]
|
||||
|
||||
if(reagent_response["toxic"])
|
||||
adjustToxLoss(reagent_response["toxic"] * reagent_total)
|
||||
|
||||
@@ -29,7 +29,7 @@ Also includes Life and New
|
||||
var/mut_level = 0 //How mutated a specimen is. Irrelevant while mutable = NOMUT.
|
||||
var/mut_max = 100000
|
||||
var/colored = 1
|
||||
var/maleable = 0 //How easy is it to manipulate traitdat.traits after it's alive?
|
||||
var/maleable = MIN_MALEABLE //How easy is it to manipulate traitdat.traits after it's alive.
|
||||
|
||||
//Traits that might not be maleable.
|
||||
var/list/chemreact = list()
|
||||
@@ -45,16 +45,17 @@ Also includes Life and New
|
||||
|
||||
//Life additions
|
||||
/mob/living/simple_animal/xeno/Life()
|
||||
..()
|
||||
if(src.stat == 2)
|
||||
if(src.stat == DEAD)
|
||||
return 0
|
||||
|
||||
if(src.stasis)
|
||||
if(stasis)
|
||||
stasis--
|
||||
if(stasis < 0)
|
||||
stasis = 0
|
||||
return 0
|
||||
|
||||
..()
|
||||
handle_reagents()
|
||||
if(mut_level == mut_max && !(mutable & NOMUT))
|
||||
if((mut_level >= mut_max) && !(mutable & NOMUT))
|
||||
Mutate()
|
||||
|
||||
ProcessSpeechBuffer()
|
||||
|
||||
Reference in New Issue
Block a user