mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 04:22:39 +01:00
Animal eating bugfix/cleanup (#8420)
This commit is contained in:
@@ -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", "<b>[user]</b> reluctantly nibbles a tiny part of \the [src]."),span("notice", "You reluctantly nibble a tiny part of \the [src]. <b>You can't stomach much more!</b>."))
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user