Merge nutrition refactor for vorestation

This commit is contained in:
Aronai Sieyes
2020-04-29 18:34:22 -04:00
parent f1cabd6742
commit 893130bdff
32 changed files with 98 additions and 469 deletions
-9
View File
@@ -36,14 +36,6 @@
/* VOREStation Edit - Duplicated in our code
/mob/living/carbon/Moved(atom/old_loc, direction, forced = FALSE)
. = ..()
<<<<<<< HEAD
if(src.nutrition && src.stat != 2)
src.nutrition -= DEFAULT_HUNGER_FACTOR/10
if(src.m_intent == "run")
src.nutrition -= DEFAULT_HUNGER_FACTOR/10
if((FAT in src.mutations) && src.m_intent == "run" && src.bodytemperature <= 360)
src.bodytemperature += 2
=======
if(.)
if(src.nutrition && src.stat != 2)
adjust_nutrition(-DEFAULT_HUNGER_FACTOR / 10)
@@ -52,7 +44,6 @@
if((FAT in src.mutations) && src.m_intent == "run" && src.bodytemperature <= 360)
src.bodytemperature += 2
>>>>>>> 61c4929... Merge pull request #7045 from Neerti/let_them_eat_all_the_cake
// Moving around increases germ_level faster
if(germ_level < GERM_LEVEL_MOVE_CAP && prob(8))
@@ -1141,6 +1141,7 @@
// Clear out their species abilities.
species.remove_inherent_verbs(src)
holder_type = null
hunger_rate = initial(hunger_rate) //VOREStation Add
species = GLOB.all_species[new_species]
@@ -1184,6 +1185,7 @@
maxHealth = species.total_health
hunger_rate = species.hunger_factor //VOREStation Add
if(LAZYLEN(descriptors))
descriptors = null
@@ -60,19 +60,13 @@
//Overriding carbon move proc that forces default hunger factor
/mob/living/carbon/Moved(atom/old_loc, direction, forced = FALSE)
. = ..()
if(src.nutrition && src.stat != 2)
if(ishuman(src))
var/mob/living/carbon/human/M = src
if(M.stat != 2 && M.nutrition > 0)
M.nutrition -= M.species.hunger_factor/10
if(M.m_intent == "run")
M.nutrition -= M.species.hunger_factor/10
if(M.nutrition < 0)
M.nutrition = 0
else
src.nutrition -= DEFAULT_HUNGER_FACTOR/10
if(src.m_intent == "run")
src.nutrition -= DEFAULT_HUNGER_FACTOR/10
// Technically this does mean being dragged takes nutrition
if(stat != DEAD)
adjust_nutrition(hunger_rate/-10)
if(m_intent == "run")
adjust_nutrition(hunger_rate/-10)
// Moving around increases germ_level faster
if(germ_level < GERM_LEVEL_MOVE_CAP && prob(8))
germ_level++
@@ -217,7 +217,7 @@
H.adjustFireLoss(-(light_amount * co2buff)) //this won't let you tank environmental damage from fire. MAYBE cold until your body temp drops.
if(H.nutrition < (200 + 400*co2buff)) //if no CO2, a fully lit tile gives them 1/tick up to 200. With CO2, potentially up to 600.
H.nutrition += (light_amount*(1+co2buff*5))
H.adjust_nutrition(light_amount*(1+co2buff*5))
// Too much poison in the air.
if(toxins_pp > safe_toxins_max)
@@ -357,7 +357,7 @@
var/short_emote_descriptor = list("picks", "grabs")
var/self_emote_descriptor = list("grab", "pick", "snatch")
var/fruit_type = "apple"
var/mob/organ_owner = null
var/mob/living/organ_owner = null
var/gen_cost = 0.5
/obj/item/organ/internal/fruitgland/New()
@@ -382,7 +382,7 @@
to_chat(organ_owner, "<span class='warning'>[pick(full_message)]</span>")
/obj/item/organ/internal/fruitgland/proc/do_generation()
organ_owner.nutrition -= gen_cost
organ_owner.adjust_nutrition(-gen_cost)
for(var/reagent in generated_reagents)
reagents.add_reagent(reagent, generated_reagents[reagent])
@@ -194,51 +194,29 @@ var/datum/species/shapeshifter/promethean/prometheans
var/turf/simulated/S = T
T.clean_blood()
S.dirt = 0
<<<<<<< HEAD
H.nutrition = max(H.nutrition, min(500, H.nutrition + rand(15, 30))) //VOREStation Edit: Gives nutrition up to a point instead of being capped
//VOREStation Edit Start
H.adjust_nutrition(H.nutrition < 500 ? rand(15, 30) : 0)
if(H.clean_blood(1))
H.nutrition = max(H.nutrition, min(500, H.nutrition + rand(15, 30))) //VOREStation Edit: Gives nutrition up to a point instead of being capped
H.adjust_nutrition(H.nutrition < 500 ? rand(15, 30) : 0)
if(H.r_hand)
if(H.r_hand.clean_blood())
H.nutrition = max(H.nutrition, min(500, H.nutrition + rand(15, 30))) //VOREStation Edit: Gives nutrition up to a point instead of being capped
H.adjust_nutrition(H.nutrition < 500 ? rand(15, 30) : 0)
if(H.l_hand)
if(H.l_hand.clean_blood())
H.nutrition = max(H.nutrition, min(500, H.nutrition + rand(15, 30))) //VOREStation Edit: Gives nutrition up to a point instead of being capped
H.adjust_nutrition(H.nutrition < 500 ? rand(15, 30) : 0)
if(H.head)
if(H.head.clean_blood())
H.update_inv_head(0)
H.nutrition = max(H.nutrition, min(500, H.nutrition + rand(15, 30))) //VOREStation Edit: Gives nutrition up to a point instead of being capped
H.adjust_nutrition(H.nutrition < 500 ? rand(15, 30) : 0)
if(H.wear_suit)
if(H.wear_suit.clean_blood())
H.update_inv_wear_suit(0)
H.nutrition = max(H.nutrition, min(500, H.nutrition + rand(15, 30))) //VOREStation Edit: Gives nutrition up to a point instead of being capped
H.adjust_nutrition(H.nutrition < 500 ? rand(15, 30) : 0)
if(H.w_uniform)
if(H.w_uniform.clean_blood())
H.update_inv_w_uniform(0)
H.nutrition = max(H.nutrition, min(500, H.nutrition + rand(15, 30))) //VOREStation Edit: Gives nutrition up to a point instead of being capped
=======
H.adjust_nutrition(rand(10, 20))
if(H.clean_blood(1))
H.adjust_nutrition(rand(5, 15))
if(H.r_hand)
if(H.r_hand.clean_blood())
H.adjust_nutrition(rand(5, 15))
if(H.l_hand)
if(H.l_hand.clean_blood())
H.adjust_nutrition(rand(5, 15))
if(H.head)
if(H.head.clean_blood())
H.update_inv_head(0)
H.adjust_nutrition(rand(5, 15))
if(H.wear_suit)
if(H.wear_suit.clean_blood())
H.update_inv_wear_suit(0)
H.adjust_nutrition(rand(5, 15))
if(H.w_uniform)
if(H.w_uniform.clean_blood())
H.update_inv_w_uniform(0)
H.adjust_nutrition(rand(5, 15))
>>>>>>> 61c4929... Merge pull request #7045 from Neerti/let_them_eat_all_the_cake
H.adjust_nutrition(H.nutrition < 500 ? rand(15, 30) : 0)
//VOREStation Edit End
//End cleaning code.
var/datum/gas_mixture/environment = T.return_air()
@@ -390,7 +390,7 @@
src.visible_message("<font color='red'><b>[src] suddenly extends their fangs and plunges them down into [B]'s neck!</b></font>")
B.apply_damage(5, BRUTE, BP_HEAD) //You're getting fangs pushed into your neck. What do you expect????
B.drip(80) //Remove enough blood to make them a bit woozy, but not take oxyloss.
src.nutrition += 400
adjust_nutrition(400)
sleep(50)
B.drip(1)
sleep(50)
@@ -836,7 +836,7 @@
if(!C.anchored && !C.pulledby) //Not currently anchored, and not pulled by anyone.
C.anchored = 1 //This is the only way to stop the inertial_drift.
C.nutrition -= 25
C.adjust_nutrition(-25)
update_floating()
to_chat(C, "<span class='notice'>You hover in place.</span>")
spawn(6) //.6 seconds.
@@ -376,7 +376,7 @@
icobase_tail = 1
inherent_verbs = list(
/mob/proc/weaveWebBindings)
/mob/living/proc/weaveWebBindings)
min_age = 18
max_age = 80
@@ -74,7 +74,7 @@
"uses their tongue to disinfect \a [W.desc] on [M]'s [affecting.name].",
"licks \a [W.desc] on [M]'s [affecting.name], cleaning it.")]</span>", \
"<span class='notice'>You treat \a [W.desc] on [M]'s [affecting.name] with your antiseptic saliva.</span>" )
nutrition -= 20
adjust_nutrition(-20)
W.salve()
W.bandage()
W.disinfect()
@@ -5,6 +5,7 @@
var/ooc_notes = null
var/obj/structure/mob_spawner/source_spawner = null
appearance_flags = TILE_BOUND|PIXEL_SCALE|KEEP_TOGETHER
var/hunger_rate = DEFAULT_HUNGER_FACTOR
//custom say verbs
var/custom_say = null
@@ -1,10 +1,10 @@
<<<<<<< HEAD
// These slimes have the mechanics xenobiologists care about, such as reproduction, mutating into new colors, and being able to submit through fear.
/mob/living/simple_mob/slime/xenobio
desc = "The most basic of slimes. The grey slime has no remarkable qualities, however it remains one of the most useful colors for scientists."
layer = MOB_LAYER + 1 // Need them on top of other mobs or it looks weird when consuming something.
ai_holder_type = /datum/ai_holder/simple_mob/xenobio_slime // This should never be changed for xenobio slimes.
max_nutrition = 1000
var/is_adult = FALSE // Slimes turn into adults when fed enough. Adult slimes are somewhat stronger, and can reproduce if fed enough.
var/maxHealth_adult = 200
var/power_charge = 0 // Disarm attacks can shock someone if high/lucky enough.
@@ -74,25 +74,25 @@
..()
/mob/living/simple_mob/slime/xenobio/examine(mob/user)
..()
. = ..()
if(hat)
to_chat(user, "It is wearing \a [hat].")
. += "It is wearing \a [hat]."
if(stat == DEAD)
to_chat(user, "It appears to be dead.")
. += "It appears to be dead."
else if(incapacitated(INCAPACITATION_DISABLED))
to_chat(user, "It appears to be incapacitated.")
. += "It appears to be incapacitated."
else if(harmless)
to_chat(user, "It appears to have been pacified.")
. += "It appears to have been pacified."
else
if(has_AI())
var/datum/ai_holder/simple_mob/xenobio_slime/AI = ai_holder
if(AI.rabid)
to_chat(user, "It seems very, very angry and upset.")
. += "It seems very, very angry and upset."
else if(AI.obedience >= 5)
to_chat(user, "It looks rather obedient.")
. += "It looks rather obedient."
else if(AI.discipline)
to_chat(user, "It has been subjugated by force, at least for now.")
. += "It has been subjugated by force, at least for now."
/mob/living/simple_mob/slime/xenobio/proc/make_adult()
if(is_adult)
@@ -102,6 +102,7 @@
melee_damage_lower = round(melee_damage_lower * 2) // 20
melee_damage_upper = round(melee_damage_upper * 2) // 30
maxHealth = maxHealth_adult
max_nutrition = 1200
amount_grown = 0
update_icon()
update_name()
@@ -277,285 +278,3 @@
lines.Add(description_info)
return lines.Join("\n")
=======
// These slimes have the mechanics xenobiologists care about, such as reproduction, mutating into new colors, and being able to submit through fear.
/mob/living/simple_mob/slime/xenobio
desc = "The most basic of slimes. The grey slime has no remarkable qualities, however it remains one of the most useful colors for scientists."
layer = MOB_LAYER + 1 // Need them on top of other mobs or it looks weird when consuming something.
ai_holder_type = /datum/ai_holder/simple_mob/xenobio_slime // This should never be changed for xenobio slimes.
max_nutrition = 1000
var/is_adult = FALSE // Slimes turn into adults when fed enough. Adult slimes are somewhat stronger, and can reproduce if fed enough.
var/maxHealth_adult = 200
var/power_charge = 0 // Disarm attacks can shock someone if high/lucky enough.
var/mob/living/victim = null // the person the slime is currently feeding on
var/rainbow_core_candidate = TRUE // If false, rainbow cores cannot make this type randomly.
var/mutation_chance = 25 // Odds of spawning as a new color when reproducing. Can be modified by certain xenobio products. Carried across generations of slimes.
var/list/slime_mutation = list(
/mob/living/simple_mob/slime/xenobio/orange,
/mob/living/simple_mob/slime/xenobio/metal,
/mob/living/simple_mob/slime/xenobio/blue,
/mob/living/simple_mob/slime/xenobio/purple
)
var/amount_grown = 0 // controls how long the slime has been overfed, if 10, grows or reproduces
var/number = 0 // This is used to make the slime semi-unique for indentification.
var/harmless = FALSE // Set to true when pacified. Makes the slime harmless, not get hungry, and not be able to grow/reproduce.
/mob/living/simple_mob/slime/xenobio/Initialize(mapload, var/mob/living/simple_mob/slime/xenobio/my_predecessor)
ASSERT(ispath(ai_holder_type, /datum/ai_holder/simple_mob/xenobio_slime))
number = rand(1, 1000)
update_name()
. = ..() // This will make the AI and do the other mob constructor things. It will also return the default hint at the end.
if(my_predecessor)
inherit_information(my_predecessor)
/mob/living/simple_mob/slime/xenobio/Destroy()
if(victim)
stop_consumption() // Unbuckle us from our victim.
return ..()
// Called when a slime makes another slime by splitting. The predecessor slime will be deleted shortly afterwards.
/mob/living/simple_mob/slime/xenobio/proc/inherit_information(var/mob/living/simple_mob/slime/xenobio/predecessor)
if(!predecessor)
return
var/datum/ai_holder/simple_mob/xenobio_slime/AI = ai_holder
var/datum/ai_holder/simple_mob/xenobio_slime/previous_AI = predecessor.ai_holder
ASSERT(istype(AI))
ASSERT(istype(previous_AI))
// Now to transfer the information.
// Newly made slimes are bit more rebellious than their predecessors, but they also somewhat forget the atrocities the xenobiologist may have done.
AI.discipline = max(previous_AI.discipline - 1, 0)
AI.obedience = max(previous_AI.obedience - 1, 0)
AI.resentment = max(previous_AI.resentment - 1, 0)
AI.rabid = previous_AI.rabid
/mob/living/simple_mob/slime/xenobio/update_icon()
icon_living = "[icon_state_override ? "[icon_state_override] slime" : "slime"] [is_adult ? "adult" : "baby"][victim ? " eating" : ""]"
icon_dead = "[icon_state_override ? "[icon_state_override] slime" : "slime"] [is_adult ? "adult" : "baby"] dead"
icon_rest = icon_dead
..() // This will apply the correct icon_state and do the other overlay-related things.
/mob/living/simple_mob/slime/xenobio/handle_special()
if(stat != DEAD)
handle_nutrition()
if(victim)
handle_consumption()
handle_stuttering() // ??
..()
/mob/living/simple_mob/slime/xenobio/examine(mob/user)
. = ..()
if(hat)
. += "It is wearing \a [hat]."
if(stat == DEAD)
. += "It appears to be dead."
else if(incapacitated(INCAPACITATION_DISABLED))
. += "It appears to be incapacitated."
else if(harmless)
. += "It appears to have been pacified."
else
if(has_AI())
var/datum/ai_holder/simple_mob/xenobio_slime/AI = ai_holder
if(AI.rabid)
. += "It seems very, very angry and upset."
else if(AI.obedience >= 5)
. += "It looks rather obedient."
else if(AI.discipline)
. += "It has been subjugated by force, at least for now."
/mob/living/simple_mob/slime/xenobio/proc/make_adult()
if(is_adult)
return
is_adult = TRUE
melee_damage_lower = round(melee_damage_lower * 2) // 20
melee_damage_upper = round(melee_damage_upper * 2) // 30
maxHealth = maxHealth_adult
max_nutrition = 1200
amount_grown = 0
update_icon()
update_name()
/mob/living/simple_mob/slime/xenobio/proc/update_name()
if(harmless) // Docile slimes are generally named, so we shouldn't mess with it.
return
name = "[slime_color] [is_adult ? "adult" : "baby"] [initial(name)] ([number])"
real_name = name
/mob/living/simple_mob/slime/xenobio/update_mood()
var/old_mood = mood
if(incapacitated(INCAPACITATION_DISABLED))
mood = "sad"
else if(harmless)
mood = ":33"
else if(has_AI())
var/datum/ai_holder/simple_mob/xenobio_slime/AI = ai_holder
if(AI.rabid)
mood = "angry"
else if(AI.target)
mood = "mischevous"
else if(AI.discipline)
mood = "pout"
else
mood = ":3"
else
mood = ":3"
if(old_mood != mood)
update_icon()
/mob/living/simple_mob/slime/xenobio/proc/enrage()
if(harmless)
return
if(has_AI())
var/datum/ai_holder/simple_mob/xenobio_slime/AI = ai_holder
AI.enrage()
/mob/living/simple_mob/slime/xenobio/proc/pacify()
harmless = TRUE
if(has_AI())
var/datum/ai_holder/simple_mob/xenobio_slime/AI = ai_holder
AI.pacify()
faction = "neutral"
// If for whatever reason the mob AI (or player) decides to try to attack something anyways.
melee_damage_upper = 0
melee_damage_lower = 0
update_mood()
// These are verbs so that player slimes can evolve/split.
/mob/living/simple_mob/slime/xenobio/verb/evolve()
set category = "Slime"
set desc = "This will let you evolve from baby to adult slime."
if(stat)
to_chat(src, span("warning", "I must be conscious to do this..."))
return
if(harmless)
to_chat(src, span("warning", "I have been pacified. I cannot evolve..."))
return
if(!is_adult)
if(amount_grown >= 10)
make_adult()
else
to_chat(src, span("warning", "I am not ready to evolve yet..."))
else
to_chat(src, span("warning", "I have already evolved..."))
/mob/living/simple_mob/slime/xenobio/verb/reproduce()
set category = "Slime"
set desc = "This will make you split into four new slimes."
if(stat)
to_chat(src, span("warning", "I must be conscious to do this..."))
return
if(harmless)
to_chat(src, span("warning", "I have been pacified. I cannot reproduce..."))
return
if(is_adult)
if(amount_grown >= 10)
// Check if there's enough 'room' to split.
var/list/nearby_things = orange(1, src)
var/free_tiles = 0
for(var/turf/T in nearby_things)
var/free = TRUE
if(T.density) // No walls.
continue
for(var/atom/movable/AM in T)
if(AM.density)
free = FALSE
break
if(free)
free_tiles++
if(free_tiles < 3) // Three free tiles are needed, as four slimes are made and the 4th tile is from the center tile that the current slime occupies.
to_chat(src, span("warning", "It is too cramped here to reproduce..."))
return
var/list/babies = list()
for(var/i = 1 to 4)
babies.Add(make_new_slime())
var/mob/living/simple_mob/slime/new_slime = pick(babies)
new_slime.universal_speak = universal_speak
if(src.mind)
src.mind.transfer_to(new_slime)
else
new_slime.key = src.key
qdel(src)
else
to_chat(src, span("warning", "I am not ready to reproduce yet..."))
else
to_chat(src, span("warning", "I have not evolved enough to reproduce yet..."))
// Used when reproducing or dying.
/mob/living/simple_mob/slime/xenobio/proc/make_new_slime(var/desired_type)
var/t = src.type
if(desired_type)
t = desired_type
if(prob(mutation_chance / 10))
t = /mob/living/simple_mob/slime/xenobio/rainbow
else if(prob(mutation_chance) && slime_mutation.len)
t = slime_mutation[rand(1, slime_mutation.len)]
var/mob/living/simple_mob/slime/xenobio/baby = new t(loc, src)
// Handle 'inheriting' from parent slime.
baby.mutation_chance = mutation_chance
baby.power_charge = round(power_charge / 4)
if(!istype(baby, /mob/living/simple_mob/slime/xenobio/rainbow))
baby.unity = unity
baby.faction = faction
baby.friends = friends.Copy()
step_away(baby, src)
return baby
/mob/living/simple_mob/slime/xenobio/get_description_interaction()
var/list/results = list()
if(!stat)
results += "[desc_panel_image("slimebaton")]to stun the slime, if it's being bad."
results += ..()
return results
/mob/living/simple_mob/slime/xenobio/get_description_info()
var/list/lines = list()
var/intro_line = "Slimes are generally the test subjects of Xenobiology, with different colors having different properties. \
They can be extremely dangerous if not handled properly."
lines.Add(intro_line)
lines.Add(null) // To pad the line breaks.
var/list/rewards = list()
for(var/potential_color in slime_mutation)
var/mob/living/simple_mob/slime/S = potential_color
rewards.Add(initial(S.slime_color))
var/reward_line = "This color of slime can mutate into [english_list(rewards)] colors, when it reproduces. It will do so when it has eatten enough."
lines.Add(reward_line)
lines.Add(null)
lines.Add(description_info)
return lines.Join("\n")
>>>>>>> 61c4929... Merge pull request #7045 from Neerti/let_them_eat_all_the_cake