Little tweaks to holder noms

Moves the part of the code handling the holder handling on scooped up snacking to where the actual snacking happens, and also clears and deletes the holder afterward.
Also contains checks to make sure any undeclared stowaways in holder contents also get eaten (or dumped on the ground if that somehow fails) instead of getting deleted with the holder. Probably fixes a garbage collection jank bug that sometimes makes the holder dump the prey back on ground after they've already been eaten, and also fixes the thing with the holder item still lingering in hand for the entire life tick duration after the prey has already been eaten.
This commit is contained in:
Verkister
2021-11-22 20:00:35 +02:00
committed by GitHub
parent dead3acae1
commit 1ea4e0e146
+11 -4
View File
@@ -143,9 +143,7 @@
if(is_vore_predator(src))
for(var/mob/living/M in H.contents)
if(attacker.eat_held_mob(attacker, M, src))
if(H.held_mob == M)
H.held_mob = null
return TRUE //return TRUE to exit upper procs
return TRUE //return TRUE to exit upper procs
else
log_debug("[attacker] attempted to feed [H.contents] to [src] ([type]) but it failed.")
@@ -518,7 +516,16 @@
user.visible_message(success_msg)
// Actually shove prey into the belly.
belly.nom_mob(prey, user)
if(istype(prey.loc, /obj/item/weapon/holder))
var/obj/item/weapon/holder/H = prey.loc
for(var/mob/living/M in H.contents)
belly.nom_mob(M, user)
if(M.loc == H) // In case nom_mob failed somehow.
M.forceMove(get_turf(src))
H.held_mob = null
qdel(H)
else
belly.nom_mob(prey, user)
if(!ishuman(user))
user.update_icons()