From b7eb15b120522c22d2e8672ce99d844218a856c6 Mon Sep 17 00:00:00 2001 From: alex-gh Date: Mon, 24 Mar 2014 01:25:43 +0100 Subject: [PATCH] Hostile mobs will now destroy windoors --- code/game/machinery/doors/windowdoor.dm | 10 +++++++++- .../mob/living/simple_animal/hostile/hostile.dm | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 145cafa4e71..18be44f4e3e 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -189,6 +189,14 @@ /obj/machinery/door/window/attack_hand(mob/user as mob) return src.attackby(user, user) +/obj/machinery/door/window/attack_animal(mob/user as mob) + if(!isanimal(user)) return + var/mob/living/simple_animal/M = user + if(M.melee_damage_upper <= 0) return + playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1) + visible_message("\red [user] smashes against the [src.name].", 1) + take_damage(M.melee_damage_upper) + /obj/machinery/door/window/attackby(obj/item/weapon/I as obj, mob/user as mob) //If it's in the process of opening/closing, ignore the click @@ -349,4 +357,4 @@ /obj/machinery/door/window/brigdoor/southright dir = SOUTH icon_state = "rightsecure" - base_state = "rightsecure" + base_state = "rightsecure" diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index b70a3e27976..65e5d853153 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -271,6 +271,8 @@ for(var/atom/A in T) if(!A.Adjacent(src)) continue - if(istype(A, /obj/structure/window) || istype(A, /obj/structure/closet) || istype(A, /obj/structure/table) || istype(A, /obj/structure/grille) || istype(A, /obj/structure/rack)) + if(istype(A, /obj/structure/window) || istype(A, /obj/structure/closet) || \ + istype(A, /obj/structure/table) || istype(A, /obj/structure/grille) || \ + istype(A, /obj/structure/rack) || istype(A, /obj/machinery/door/window)) A.attack_animal(src) return