mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-28 02:52:28 +00:00
Adds chemical processing, trait inheritance.
This commit is contained in:
@@ -84,6 +84,10 @@ var/global/list/xenoChemList = list("mutationtoxin",
|
||||
traits["[trait]"] = newval
|
||||
return
|
||||
|
||||
/datum/xeno/traits/proc/get_trait(var/trait)
|
||||
var/val = traits["[trait]"]
|
||||
return val
|
||||
|
||||
/datum/xeno/traits/New()
|
||||
..()
|
||||
set_trait(TRAIT_XENO_COLOR, "#CACACA")
|
||||
|
||||
@@ -24,11 +24,14 @@ Slime specific procs go here.
|
||||
traitdat.traits[TRAIT_XENO_STR_RANGE] =round(rand(0,2))
|
||||
traitdat.traits[TRAIT_XENO_CANLEARN] = prob(68)
|
||||
traitdat.traits[TRAIT_XENO_SPEED] = round(rand(-10,10))
|
||||
|
||||
//RandomChemicals()
|
||||
|
||||
|
||||
/mob/living/simple_animal/xeno/slime/proc/GrowUp()
|
||||
GenerateAdult()
|
||||
|
||||
maxHealth = traitdat.traits[TRAIT_XENO_HEALTH]
|
||||
maxHealth = traitdat.get_trait(TRAIT_XENO_HEALTH)
|
||||
health = maxHealth
|
||||
is_child = 0
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Procs for targeting
|
||||
*/
|
||||
/mob/living/simple_animal/xeno/proc/ProcessTraits()
|
||||
if(maleable >= MAX_MALEABLE)
|
||||
maxHealth = traitdat.traits[TRAIT_XENO_HEALTH]
|
||||
maxHealth = traitdat.get_trait(TRAIT_XENO_HEALTH)
|
||||
health = maxHealth
|
||||
if(traitdat.chemlist.len) //Let's make sure that this has a length.
|
||||
chemreact = traitdat.chemlist
|
||||
@@ -41,8 +41,8 @@ Procs for targeting
|
||||
else
|
||||
speak_chance = 0
|
||||
|
||||
melee_damage_lower = traitdat.traits[TRAIT_XENO_STRENGTH] - traitdat.traits[TRAIT_XENO_STR_RANGE]
|
||||
melee_damage_upper = traitdat.traits[TRAIT_XENO_STRENGTH] + traitdat.traits[TRAIT_XENO_STR_RANGE]
|
||||
melee_damage_lower = traitdat.get_trait(TRAIT_XENO_STRENGTH) - traitdat.get_trait(TRAIT_XENO_STR_RANGE)
|
||||
melee_damage_upper = traitdat.traits[TRAIT_XENO_STRENGTH] + traitdat.get_trait(TRAIT_XENO_STR_RANGE)
|
||||
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ Procs for targeting
|
||||
|
||||
/mob/living/simple_animal/xeno/proc/ProcessSpeechBuffer()
|
||||
if(speech_buffer.len)
|
||||
if(prob(traitdat.traits[TRAIT_XENO_LEARNCHANCE]) && traitdat.traits[TRAIT_XENO_CANLEARN])
|
||||
if(prob(traitdat.get_trait(TRAIT_XENO_LEARNCHANCE)) && traitdat.get_trait(TRAIT_XENO_CANLEARN))
|
||||
var/chosen = pick(speech_buffer)
|
||||
speak.Add(chosen)
|
||||
log_debug("Added [chosen] to speak list.")
|
||||
@@ -153,4 +153,16 @@ Procs for targeting
|
||||
else
|
||||
..()
|
||||
|
||||
|
||||
/mob/living/simple_animal/xeno/proc/RandomChemicals()
|
||||
traitdat.chemlist.Cut() //Clear the amount first.
|
||||
|
||||
var/num_chems = round(rand(1,4))
|
||||
var/list/chemchoices = xenoChemList
|
||||
|
||||
for(var/i = 1 to num_chems)
|
||||
var/chemtype = pick(chemchoices)
|
||||
chemchoices -= chemtype
|
||||
var/chemamount = rand(1,5)
|
||||
traitdat.chemlist[chemtype] = chemamount
|
||||
|
||||
traitdat.chemlist += default_chems
|
||||
|
||||
@@ -73,11 +73,25 @@ Also includes Life and New
|
||||
return 1 //Everything worked okay.
|
||||
|
||||
/mob/living/simple_animal/xeno/New()
|
||||
traitdat = new()
|
||||
var/traits
|
||||
if(istype(loc, /mob/living/simple_animal/xeno))
|
||||
var/mob/living/simple_animal/xeno/X = loc
|
||||
traits = X.traitdat
|
||||
/*
|
||||
if(istype(loc, /obj/machinery/xenobio/replicator))
|
||||
var/obj/machinery/xenobio/replicator/R = loc
|
||||
traits = R.connected.traitdat
|
||||
*/
|
||||
if(!traits)
|
||||
traitdat = new()
|
||||
else
|
||||
traitdat = traits
|
||||
|
||||
ProcessTraits()
|
||||
|
||||
..()
|
||||
if(colored)
|
||||
color = traitdat.traits[TRAIT_XENO_COLOR]
|
||||
color = traitdat.get_trait(TRAIT_XENO_COLOR)
|
||||
create_reagents(internal_vol)
|
||||
temp_chem_holder = new()
|
||||
temp_chem_holder.create_reagents(20)
|
||||
|
||||
Reference in New Issue
Block a user