Fix a few things with grabs

Previous commit broke a few things, this one fixes it

Fixed;
 - Runtime error of trying to assign something that was deleted
 - Nonsensical functionality
This commit is contained in:
Tigercat2000
2015-05-07 06:25:05 -07:00
parent 5f26969364
commit fe5d0d907a
+8 -7
View File
@@ -66,6 +66,7 @@
confirm()
if(assailant.client)
if(!hud) return //this somehow can runtime under the right circumstances
assailant.client.screen -= hud
assailant.client.screen += hud
@@ -126,7 +127,7 @@
if(affecting.loc != assailant.loc)
force_down = 0
else
affecting.Weaken(1)
affecting.Weaken(3) //1 wears off too quick
if(state >= GRAB_NECK)
affecting.Stun(5) //It will hamper your voice, being choked and all.
@@ -266,7 +267,7 @@
/obj/item/weapon/grab/attack(mob/living/M, mob/living/carbon/user)
if(!affecting)
return
if(M == affecting)
if(ishuman(M) && ishuman(assailant))
var/mob/living/carbon/human/affected = affecting
@@ -282,7 +283,7 @@
assailant << "<span class='warning'>You require a better grab to do this.</span>"
return
var/obj/item/organ/external/organ = affected.get_organ(check_zone(last_hit_zone))
if(!organ || organ.is_broken())
if(!organ || organ.is_broken() || organ.limb_name == "chest" || organ.limb_name == "groin") //necessary to prevent chest and groin
return
assailant.visible_message("<span class='danger'>[user] is jointlocking [affecting]'s [organ.name]!</span>")
var/armor = affected.run_armor_check(affecting, "melee")
@@ -355,17 +356,17 @@
if(M == assailant && state >= GRAB_AGGRESSIVE) //no eatin unless you have an agressive grab
if(checkvalid(user, affecting)) //wut
if(checkvalid(user, affecting)) //wut
var/mob/living/carbon/attacker = user
user.visible_message("<span class='danger'>[user] is attempting to devour \the [affecting]!</span>")
if(!do_mob(user, affecting) || !do_after(user, checktime(user, affecting))) return
user.visible_message("<span class='danger'>[user] devours \the [affecting]!</span>")
affecting.loc = user
attacker.stomach_contents.Add(affecting)
qdel(src)
qdel(src)
/obj/item/weapon/grab/proc/checkvalid(var/mob/attacker, var/mob/prey) //does all the checking for the attack proc to see if a mob can eat another with the grab
if(ishuman(attacker) && (FAT in attacker.mutations) && iscarbon(prey) && !isalien(prey)) //Fat people eating carbon mobs but not xenos
@@ -410,4 +411,4 @@
#undef EAT_TIME_XENO
#undef EAT_TIME_FAT
#undef EAT_TIME_MOUSE
#undef EAT_TIME_MOUSE