From 27d8c489ee583ef14457d3c770473af01e8098ca Mon Sep 17 00:00:00 2001 From: phil235 Date: Wed, 31 Dec 2014 15:01:23 +0100 Subject: [PATCH] Fixes carp, mimic and tree nog being able to knockdown their target. Fixes player controlled hostile simple animal not calling AttackingTarget() for their melee attack. Fixes player controlled hostile simple animal's ranged attack targeting the target from their previous melee attack instead of the target clicked. --- code/_onclick/other_mobs.dm | 6 +++++- .../mob/living/simple_animal/hostile/carp.dm | 6 +++--- .../mob/living/simple_animal/hostile/faithless.dm | 8 ++++---- .../mob/living/simple_animal/hostile/hostile.dm | 1 + .../mob/living/simple_animal/hostile/mimic.dm | 8 ++++---- .../mob/living/simple_animal/hostile/statue.dm | 13 +++++-------- .../mob/living/simple_animal/hostile/tree.dm | 8 ++++---- 7 files changed, 26 insertions(+), 24 deletions(-) diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm index 06e2fed0368..2f52dd09318 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -42,12 +42,16 @@ */ /mob/living/UnarmedAttack(var/atom/A) A.attack_animal(src) + +/mob/living/simple_animal/hostile/UnarmedAttack(var/atom/A) + target = A + AttackingTarget() + /atom/proc/attack_animal(mob/user as mob) return /mob/living/RestrainedClickOn(var/atom/A) return - /* Monkeys */ diff --git a/code/modules/mob/living/simple_animal/hostile/carp.dm b/code/modules/mob/living/simple_animal/hostile/carp.dm index 06f43d0b8aa..ed403a75199 100644 --- a/code/modules/mob/living/simple_animal/hostile/carp.dm +++ b/code/modules/mob/living/simple_animal/hostile/carp.dm @@ -47,9 +47,9 @@ F emote("me", 1, "nashes at [.]!") /mob/living/simple_animal/hostile/carp/AttackingTarget() - . =..() - var/mob/living/carbon/L = . - if(istype(L)) + ..() + if(isliving(target)) + var/mob/living/L = target if(prob(15)) L.Weaken(3) L.visible_message("\the [src] knocks down \the [L]!") diff --git a/code/modules/mob/living/simple_animal/hostile/faithless.dm b/code/modules/mob/living/simple_animal/hostile/faithless.dm index b818475bb03..51465393c2c 100644 --- a/code/modules/mob/living/simple_animal/hostile/faithless.dm +++ b/code/modules/mob/living/simple_animal/hostile/faithless.dm @@ -40,9 +40,9 @@ emote("me", 1, "wails at [.]!") /mob/living/simple_animal/hostile/faithless/AttackingTarget() - . =..() - var/mob/living/L = . - if(istype(L)) + ..() + if(isliving(target)) + var/mob/living/L = target if(prob(12)) L.Weaken(3) - L.visible_message("\the [src] knocks down \the [L]!") \ No newline at end of file + L.visible_message("\The [src] knocks down \the [L]!") \ No newline at end of file diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index 68f8c76ed69..3828dbdce6c 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -311,5 +311,6 @@ /mob/living/simple_animal/hostile/RangedAttack(var/atom/A, var/params) //Player firing if(ranged && ranged_cooldown <= 0) + target = A OpenFire(A) ..() \ No newline at end of file diff --git a/code/modules/mob/living/simple_animal/hostile/mimic.dm b/code/modules/mob/living/simple_animal/hostile/mimic.dm index 116a2b82ec6..6bdbc2cc728 100644 --- a/code/modules/mob/living/simple_animal/hostile/mimic.dm +++ b/code/modules/mob/living/simple_animal/hostile/mimic.dm @@ -206,13 +206,13 @@ var/global/list/protected_objects = list(/obj/structure/table, /obj/structure/ca ..() /mob/living/simple_animal/hostile/mimic/copy/AttackingTarget() - . =..() + ..() if(knockdown_people) - var/mob/living/L = . - if(istype(L)) + if(isliving(target)) + var/mob/living/L = target if(prob(15)) L.Weaken(1) - L.visible_message("\the [src] knocks down \the [L]!") + L.visible_message("\The [src] knocks down \the [L]!") // // Machine Mimics (Made by Malf AI) diff --git a/code/modules/mob/living/simple_animal/hostile/statue.dm b/code/modules/mob/living/simple_animal/hostile/statue.dm index 93ad66bd444..8feffe077f3 100644 --- a/code/modules/mob/living/simple_animal/hostile/statue.dm +++ b/code/modules/mob/living/simple_animal/hostile/statue.dm @@ -88,7 +88,11 @@ GiveTarget(watching) /mob/living/simple_animal/hostile/statue/AttackingTarget() - if(!can_be_seen()) + if(can_be_seen()) + if(client) + src << "You cannot attack, there are eyes on you!" + return + else ..() /mob/living/simple_animal/hostile/statue/DestroySurroundings() @@ -99,13 +103,6 @@ if(!can_be_seen()) ..() -/mob/living/simple_animal/hostile/statue/UnarmedAttack() - if(can_be_seen()) - if(client) - src << "You cannot attack, there are eyes on you!" - return - ..() - /mob/living/simple_animal/hostile/statue/proc/can_be_seen(var/turf/destination) if(!cannot_be_seen) return null diff --git a/code/modules/mob/living/simple_animal/hostile/tree.dm b/code/modules/mob/living/simple_animal/hostile/tree.dm index 2feb135ecdc..43ee23cf49b 100644 --- a/code/modules/mob/living/simple_animal/hostile/tree.dm +++ b/code/modules/mob/living/simple_animal/hostile/tree.dm @@ -43,12 +43,12 @@ emote("me", 1, "growls at [.].") /mob/living/simple_animal/hostile/tree/AttackingTarget() - . =..() - var/mob/living/L = . - if(istype(L)) + ..() + if(isliving(target)) + var/mob/living/L = target if(prob(15)) L.Weaken(3) - L.visible_message("\the [src] knocks down \the [L]!") + L.visible_message("\The [src] knocks down \the [L]!") /mob/living/simple_animal/hostile/tree/Die() ..()