mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-08-31 00:59:16 +01:00
Adding some generalized reagent processing for animals.
This commit is contained in:
@@ -53,6 +53,12 @@
|
||||
/mob/living/simple_mob/animal/proc/has_appetite()
|
||||
return TRUE
|
||||
|
||||
/mob/living/simple_mob/animal/proc/add_nutrition(var/amt)
|
||||
nutrition = clamp(nutrition + amt, 0, max_nutrition)
|
||||
|
||||
/mob/living/simple_mob/animal/proc/remove_nutrition(var/amt)
|
||||
nutrition = clamp(nutrition - amt, 0, max_nutrition)
|
||||
|
||||
/mob/living/simple_mob/animal/get_snow_footprint_state()
|
||||
if(!hovering)
|
||||
return "snow_animalprints"
|
||||
@@ -123,3 +129,6 @@
|
||||
snack.dropInto(loc)
|
||||
else
|
||||
snack.animal_consumed(src)
|
||||
|
||||
/mob/living/simple_mob/animal/proc/get_dietary_food_modifier(var/datum/reagent/nutriment/food)
|
||||
return 0.3
|
||||
|
||||
@@ -288,28 +288,24 @@ var/global/list/last_drake_howl = list()
|
||||
setMoveCooldown(1 SECOND)
|
||||
spend_sap(2)
|
||||
|
||||
/mob/living/simple_mob/animal/sif/grafadreka/get_dietary_food_modifier(var/datum/reagent/nutriment/food)
|
||||
if(food.allergen_type & ALLERGEN_MEAT)
|
||||
return ..()
|
||||
return 0.1
|
||||
|
||||
/mob/living/simple_mob/animal/sif/grafadreka/Life()
|
||||
. = ..()
|
||||
|
||||
// Don't make clientless drakes lose nutrition or they'll all go feral.
|
||||
if(stat == CONSCIOUS && !resting && client)
|
||||
remove_nutrition(0.3)
|
||||
|
||||
// Process food and sap chems.
|
||||
if(stat == CONSCIOUS && client) // Hibernating drakes don't get hungy.
|
||||
// by default we lose nutrition. Hungry hungry drakes.
|
||||
|
||||
var/food_val = (resting || !client) ? 0 : -0.3 // Don't make clientless drakes lose nutrition or they'll all go feral.
|
||||
|
||||
// Very basic metabolism.
|
||||
if(reagents?.total_volume)
|
||||
for(var/datum/reagent/chem in reagents.reagent_list)
|
||||
var/removing = min(REM, chem.volume)
|
||||
if(istype(chem, /datum/reagent/nutriment))
|
||||
var/datum/reagent/nutriment/food = chem
|
||||
food_val += (food.nutriment_factor * removing) * ((food.allergen_type & ALLERGEN_MEAT) ? 0.3 : 0.1)
|
||||
else if(istype(chem, /datum/reagent/toxin/sifslurry))
|
||||
add_sap(removing * 3)
|
||||
reagents.remove_reagent(chem.id, removing)
|
||||
|
||||
if(food_val != 0)
|
||||
nutrition = clamp(nutrition + food_val, 0, max_nutrition)
|
||||
if(reagents?.total_volume)
|
||||
for(var/datum/reagent/chem in reagents.reagent_list)
|
||||
var/removed = min(chem.ingest_met, chem.volume)
|
||||
chem.affect_animal(src, removed)
|
||||
reagents.remove_reagent(chem.id, removed)
|
||||
|
||||
/mob/living/simple_mob/animal/sif/grafadreka/proc/has_sap(var/amt)
|
||||
return stored_sap >= amt
|
||||
@@ -648,10 +644,26 @@ var/global/list/last_drake_howl = list()
|
||||
name = "drake's pannier"
|
||||
|
||||
/mob/living/simple_mob/animal/sif/grafadreka/trained/attackby(obj/item/O, mob/user)
|
||||
if(user.a_intent == I_HURT || (istype(O, /obj/item/stack/medical) && user.a_intent == I_HELP))
|
||||
|
||||
// bonk
|
||||
if(user.a_intent == I_HURT)
|
||||
return ..()
|
||||
|
||||
// Pass some items down to heal or run injection etc.
|
||||
var/static/list/allow_type_to_pass = list(
|
||||
/obj/item/healthanalyzer,
|
||||
/obj/item/stack/medical,
|
||||
/obj/item/reagent_containers/syringe
|
||||
)
|
||||
if(user.a_intent == I_HELP)
|
||||
for(var/pass_type in allow_type_to_pass)
|
||||
if(istype(O, pass_type))
|
||||
return ..()
|
||||
|
||||
// Open our storage, if we have it.
|
||||
if(pannier)
|
||||
return pannier.attackby(O, user)
|
||||
|
||||
return ..()
|
||||
|
||||
/mob/living/simple_mob/animal/sif/grafadreka/trained/add_glow()
|
||||
|
||||
@@ -170,6 +170,9 @@
|
||||
remove_self(removed)
|
||||
return
|
||||
|
||||
/datum/reagent/proc/affect_animal(var/mob/living/simple_mob/animal/M, var/removed)
|
||||
return
|
||||
|
||||
/datum/reagent/proc/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
|
||||
return
|
||||
|
||||
|
||||
@@ -36,6 +36,10 @@
|
||||
if(data[taste]/totalFlavor < 0.1)
|
||||
data -= taste
|
||||
|
||||
/datum/reagent/nutriment/affect_animal(var/mob/living/simple_mob/animal/M, var/removed)
|
||||
M.add_nutrition((nutriment_factor * removed) * M.get_dietary_food_modifier(src) * 0.5)
|
||||
return ..()
|
||||
|
||||
/datum/reagent/nutriment/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
|
||||
if(!injectable && alien != IS_SLIME)
|
||||
M.adjustToxLoss(0.1 * removed)
|
||||
@@ -45,9 +49,12 @@
|
||||
|
||||
/datum/reagent/nutriment/affect_ingest(var/mob/living/carbon/M, var/alien, var/removed)
|
||||
switch(alien)
|
||||
if(IS_DIONA) return
|
||||
if(IS_UNATHI) removed *= 0.5
|
||||
if(issmall(M)) removed *= 2 // Small bodymass, more effect from lower volume.
|
||||
if(IS_DIONA)
|
||||
return
|
||||
if(IS_UNATHI)
|
||||
removed *= 0.5
|
||||
if(issmall(M))
|
||||
removed *= 2 // Small bodymass, more effect from lower volume.
|
||||
if(!(M.species.allergens & allergen_type)) //assuming it doesn't cause a horrible reaction, we'll be ok!
|
||||
M.heal_organ_damage(0.5 * removed, 0)
|
||||
M.adjust_nutrition(nutriment_factor * removed)
|
||||
|
||||
@@ -52,6 +52,12 @@
|
||||
overdose_mod = 0.25
|
||||
scannable = 1
|
||||
|
||||
/datum/reagent/bicaridine/affect_animal(var/mob/living/simple_mob/animal/M, var/removed)
|
||||
if(istype(M, /mob/living/simple_mob/animal/sif/grafadreka))
|
||||
var/mob/living/simple_mob/animal/sif/grafadreka/drake = M
|
||||
drake.sap_heal_threshold = clamp(drake.sap_heal_threshold + (0.1 * removed), 0, 1)
|
||||
return ..()
|
||||
|
||||
/datum/reagent/bicaridine/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
|
||||
var/chem_effective = 1 * M.species.chem_strength_heal
|
||||
if(alien == IS_SLIME)
|
||||
|
||||
@@ -442,15 +442,21 @@
|
||||
color = "#C6E2FF"
|
||||
strength = 2
|
||||
overdose = 20
|
||||
var/sap_regen_power = 12
|
||||
|
||||
/datum/reagent/toxin/sifslurry/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
|
||||
if(alien == IS_DIONA) // Symbiotic bacteria.
|
||||
M.adjust_nutrition(strength * removed)
|
||||
return
|
||||
else
|
||||
M.add_modifier(/datum/modifier/slow_pulse, 30 SECONDS)
|
||||
M.add_modifier(/datum/modifier/slow_pulse, 30 SECONDS)
|
||||
..()
|
||||
|
||||
/datum/reagent/toxin/sifslurry/affect_animal(var/mob/living/simple_mob/animal/M, var/removed)
|
||||
if(istype(M, /mob/living/simple_mob/animal/sif/grafadreka))
|
||||
var/mob/living/simple_mob/animal/sif/grafadreka/drake = M
|
||||
drake.add_sap(removed * sap_regen_power)
|
||||
return ..()
|
||||
|
||||
/datum/reagent/toxin/sifslurry/overdose(var/mob/living/carbon/M, var/alien, var/removed) // Overdose effect.
|
||||
if(alien == IS_DIONA)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user