does the absorb-release-thing more betterer

This commit is contained in:
Screemonster
2018-01-05 01:08:22 +00:00
parent a0b02b57c1
commit 3090acdceb
2 changed files with 10 additions and 12 deletions

View File

@@ -36,9 +36,7 @@
/mob/living/simple_animal/Destroy()
for(var/I in vore_organs)
var/datum/belly/B = vore_organs[I]
for(var/mob/living/M in B.internal_contents) // because release_all_contents doesn't release absorbed things
M.absorbed = 0
B.release_all_contents() // When your stomach is empty
B.release_all_contents(include_absorbed = TRUE) // When your stomach is empty
prey_excludes.Cut()
. = ..()
@@ -129,9 +127,7 @@
/mob/living/simple_animal/death()
for(var/I in vore_organs)
var/datum/belly/B = vore_organs[I]
for(var/mob/living/M in B.internal_contents) // because release_all_contents doesn't release absorbed things
M.absorbed = 0
B.release_all_contents() // When your stomach is empty
B.release_all_contents(include_absorbed = TRUE) // When your stomach is empty
..() // then you have my permission to die.
// Simple animals have only one belly. This creates it (if it isn't already set up)

View File

@@ -114,20 +114,22 @@
// Release all contents of this belly into the owning mob's location.
// If that location is another mob, contents are transferred into whichever of its bellies the owning mob is in.
// Returns the number of mobs so released.
/datum/belly/proc/release_all_contents()
/datum/belly/proc/release_all_contents(var/include_absorbed = FALSE)
if (internal_contents.len == 0)
return 0
for (var/atom/movable/M in internal_contents)
for (var/M in internal_contents)
if(istype(M,/mob/living))
var/mob/living/ML = M
if(ML.absorbed)
if(ML.absorbed && !include_absorbed)
continue
ML.absorbed = FALSE
M.forceMove(owner.loc) // Move the belly contents into the same location as belly's owner.
internal_contents -= M // Remove from the belly contents
var/atom/movable/AM = M
AM.forceMove(owner.loc) // Move the belly contents into the same location as belly's owner.
internal_contents -= AM // Remove from the belly contents
var/datum/belly/B = check_belly(owner) // This makes sure that the mob behaves properly if released into another mob
if(B)
B.internal_contents += M
B.internal_contents += AM
items_preserved.Cut()
checked_slots.Cut()
owner.visible_message("<font color='green'><b>[owner] expels everything from their [lowertext(name)]!</b></font>")