diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 4ed41edfff1..2efb86d7782 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -285,17 +285,20 @@ if (!stat || prob(0.5)) wake_up() - //Eating in tile - for(var/obj/item/reagent_containers/food/snacks/S in src.loc) - if(can_eat() && (nutrition < max_nutrition * 0.3)) //Only when sufficiently hungry - UnarmedAttack(S) - else - break + if(nutrition < max_nutrition / 3 && isturf(loc)) //If we're hungry enough (and not being held/in a bag), we'll check our tile for food. + handle_eating() /mob/living/simple_animal/proc/handle_supernatural() if(purge) purge -= 1 +/mob/living/simple_animal/proc/handle_eating() + var/list/food_choices = list() + for(var/obj/item/reagent_containers/food/snacks/S in get_turf(src)) + food_choices += S + if(food_choices.len) //Only when sufficiently hungry + UnarmedAttack(pick(food_choices)) + //Simple reagent processing for simple animals //This allows animals to digest food, and only food //Most drugs, poisons etc, are designed to work on carbons and affect many values a simple animal doesnt have diff --git a/code/modules/reagents/reagent_containers/food/snacks.dm b/code/modules/reagents/reagent_containers/food/snacks.dm index f4811760999..baf98dfeee5 100644 --- a/code/modules/reagents/reagent_containers/food/snacks.dm +++ b/code/modules/reagents/reagent_containers/food/snacks.dm @@ -388,41 +388,26 @@ if(!isanimal(user) && !isalien(user)) return - var/amount_eaten = bitesize var/m_bitesize = bitesize - - if (isanimal(user)) + if(isanimal(user)) var/mob/living/simple_animal/SA = user - m_bitesize = bitesize * SA.bite_factor//Modified bitesize based on creature size - amount_eaten = m_bitesize - if (!SA.can_eat()) + m_bitesize = bitesize * SA.bite_factor //Modified bitesize based on creature size + if(!SA.can_eat()) to_chat(user, span("danger", "You're too full to eat anymore!")) return if(reagents && user.reagents) m_bitesize = min(m_bitesize, reagents.total_volume) - //If the creature can't even stomach half a bite, then it eats nothing - if (((user.reagents.maximum_volume - user.reagents.total_volume) < m_bitesize * 0.5)) - amount_eaten = 0 - else - amount_eaten = reagents.trans_to_mob(user, m_bitesize, CHEM_INGEST) - if (amount_eaten) - bitecount++ - if (amount_eaten < m_bitesize) - user.visible_message(span("notice", "[user] reluctantly nibbles a tiny part of \the [src]."),span("notice", "You reluctantly nibble a tiny part of \the [src]. You can't stomach much more!.")) - animate_shake() - var/toplay = pick(list('sound/effects/creatures/nibble1.ogg','sound/effects/creatures/nibble2.ogg')) - playsound(loc, toplay, 30, 1) - else - to_chat(user, span("danger", "You're too full to eat anymore!")) + if(((user.reagents.maximum_volume - user.reagents.total_volume) < m_bitesize * 0.5)) //If the creature can't even stomach half a bite, then it eats nothing + to_chat(user, span("danger", "You're too full to eat anymore!")) + return - spawn(5) - if(!src && !user.client) - user.custom_emote(1,"[pick("burps", "cries for more", "burps twice", "looks at the area where the food was")]") - qdel(src) + reagents.trans_to_mob(user, m_bitesize, CHEM_INGEST) + bitecount++ + animate_shake() + playsound(loc, pick('sound/effects/creatures/nibble1.ogg','sound/effects/creatures/nibble2.ogg'), 30, 1) - if (reagents) - on_consume(user) + on_consume(user, user) //mob is both user and target for on_consume since it is feeding itself in this instance /obj/item/reagent_containers/food/snacks/on_reagent_change() update_icon() diff --git a/html/changelogs/doxxmedearly - animalfoodupdates.yml b/html/changelogs/doxxmedearly - animalfoodupdates.yml new file mode 100644 index 00000000000..e7c054d6b65 --- /dev/null +++ b/html/changelogs/doxxmedearly - animalfoodupdates.yml @@ -0,0 +1,9 @@ +# Your name. +author: Doxxmedearly + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +changes: + - bugfix: "Animals eating food in their tile will no longer produce random trash items, and will be deleted properly when finished."