mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 03:57:13 +01:00
Mob grab/eating refactor
This refactors the mob-eat-mob code and fixes a few bugs along the way. - Bursting out of a stomach now has a 0.4 second delay between attacks, so the message cannot be spammed. - The list of mobs that can eat other mobs has been refactored to be a subproc instead of a 255char~ list on one line. - Mob grab uses #defines for the time it takes to eat something else, now. - Fixed xenomorphs bugging out the grab system, and made sure that fat people can't actually eat them because of this.
This commit is contained in:
@@ -49,6 +49,8 @@ In all, this is a lot like the monkey code. /N
|
||||
/mob/living/carbon/alien/attack_hand(mob/living/carbon/human/M as mob)
|
||||
if(..()) //to allow surgery to return properly.
|
||||
return 0
|
||||
if(istype(src,/mob/living/carbon/alien/humanoid))
|
||||
return 0 //this is horrible but 100% necessary
|
||||
|
||||
switch(M.a_intent)
|
||||
if("help")
|
||||
|
||||
@@ -254,18 +254,7 @@
|
||||
help_shake_act(M)
|
||||
|
||||
if ("grab")
|
||||
if (M == src || anchored)
|
||||
return
|
||||
var/obj/item/weapon/grab/G = new /obj/item/weapon/grab(M, src)
|
||||
|
||||
M.put_in_active_hand(G)
|
||||
|
||||
G.synch()
|
||||
|
||||
LAssailant = M
|
||||
|
||||
playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
|
||||
visible_message("<span class='warning'>[M] has grabbed [src] passively!</span>")
|
||||
grabbedby(M)
|
||||
|
||||
if ("harm")
|
||||
M.do_attack_animation(src)
|
||||
|
||||
@@ -27,34 +27,47 @@ mob/living
|
||||
if(germ_level < GERM_LEVEL_MOVE_CAP && prob(8))
|
||||
germ_level++
|
||||
|
||||
#define STOMACH_ATTACK_DELAY 4
|
||||
|
||||
/mob/living/carbon/var/last_stomach_attack //defining this here because no one would look in carbon_defines for it
|
||||
|
||||
/mob/living/carbon/relaymove(var/mob/user, direction)
|
||||
if(user in src.stomach_contents)
|
||||
if(prob(40))
|
||||
for(var/mob/M in hearers(4, src))
|
||||
if(M.client)
|
||||
M.show_message(text("\red You hear something rumbling inside [src]'s stomach..."), 2)
|
||||
var/obj/item/I = user.get_active_hand()
|
||||
if(I && I.force)
|
||||
var/d = rand(round(I.force / 4), I.force)
|
||||
if(istype(src, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = src
|
||||
var/obj/item/organ/external/organ = H.get_organ("chest")
|
||||
if (istype(organ))
|
||||
if(organ.take_damage(d, 0))
|
||||
H.UpdateDamageIcon()
|
||||
H.updatehealth()
|
||||
else
|
||||
src.take_organ_damage(d)
|
||||
for(var/mob/M in viewers(user, null))
|
||||
if(M.client)
|
||||
M.show_message(text("\red <B>[user] attacks [src]'s stomach wall with the [I.name]!"), 2)
|
||||
playsound(user.loc, 'sound/effects/attackblob.ogg', 50, 1)
|
||||
if(last_stomach_attack + STOMACH_ATTACK_DELAY > world.time) return
|
||||
|
||||
if(prob(src.getBruteLoss() - 50))
|
||||
for(var/atom/movable/A in stomach_contents)
|
||||
A.loc = loc
|
||||
stomach_contents.Remove(A)
|
||||
src.gib()
|
||||
last_stomach_attack = world.time
|
||||
for(var/mob/M in hearers(4, src))
|
||||
if(M.client)
|
||||
M.show_message(text("\red You hear something rumbling inside [src]'s stomach..."), 2)
|
||||
|
||||
var/obj/item/I = user.get_active_hand()
|
||||
if(I && I.force)
|
||||
var/d = rand(round(I.force / 4), I.force)
|
||||
|
||||
if(istype(src, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = src
|
||||
var/obj/item/organ/external/organ = H.get_organ("chest")
|
||||
if (istype(organ))
|
||||
if(organ.take_damage(d, 0))
|
||||
H.UpdateDamageIcon()
|
||||
|
||||
H.updatehealth()
|
||||
|
||||
else
|
||||
src.take_organ_damage(d)
|
||||
|
||||
for(var/mob/M in viewers(user, null))
|
||||
if(M.client)
|
||||
M.show_message(text("\red <B>[user] attacks [src]'s stomach wall with the [I.name]!"), 2)
|
||||
playsound(user.loc, 'sound/effects/attackblob.ogg', 50, 1)
|
||||
|
||||
if(prob(src.getBruteLoss() - 50))
|
||||
for(var/atom/movable/A in stomach_contents)
|
||||
A.loc = loc
|
||||
stomach_contents.Remove(A)
|
||||
src.gib()
|
||||
|
||||
#undef STOMACH_ATTACK_DELAY
|
||||
|
||||
/mob/living/carbon/gib()
|
||||
for(var/mob/M in src)
|
||||
|
||||
Reference in New Issue
Block a user