From cf880bd40b1b2bb381483d8c803ee9cfffdd7adf Mon Sep 17 00:00:00 2001 From: Fox McCloud Date: Thu, 11 Apr 2019 04:24:36 -0400 Subject: [PATCH] Fixes and Updates Goats --- .../simple_animal/friendly/farm_animals.dm | 65 ++++++++++++------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm index 03f353754fe..dd0c5b9f72a 100644 --- a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm +++ b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm @@ -31,14 +31,6 @@ /mob/living/simple_animal/hostile/retaliate/goat/handle_automated_movement() ..() - if(!pulledby) - for(var/direction in shuffle(list(1,2,4,8,5,6,9,10))) - var/step = get_step(src, direction) - if(step) - if(locate(/obj/structure/spacevine) in step) - Move(step, get_dir(src, step)) - -/mob/living/simple_animal/hostile/retaliate/goat/handle_automated_action() //chance to go crazy and start wacking stuff if(!enemies.len && prob(1)) Retaliate() @@ -46,11 +38,16 @@ if(enemies.len && prob(10)) enemies = list() LoseTarget() - src.visible_message("[src] calms down.") + visible_message("[src] calms down.") - var/obj/structure/spacevine/SV = locate(/obj/structure/spacevine) in loc - if(SV) - SV.eat(src) + if(stat == CONSCIOUS) + eat_plants() + if(!pulledby) + for(var/direction in shuffle(list(1,2,4,8,5,6,9,10))) + var/step = get_step(src, direction) + if(step) + if(locate(/obj/structure/spacevine) in step || locate(/obj/structure/glowshroom) in step) + Move(step, get_dir(src, step)) /mob/living/simple_animal/hostile/retaliate/goat/Life(seconds, times_fired) . = ..() @@ -60,30 +57,52 @@ /mob/living/simple_animal/hostile/retaliate/goat/Retaliate() ..() - src.visible_message("[src] gets an evil-looking gleam in their eye.") + visible_message("[src] gets an evil-looking gleam in their eye.") /mob/living/simple_animal/hostile/retaliate/goat/Move() - ..() + . = ..() if(!stat) - var/obj/structure/spacevine/SV = locate(/obj/structure/spacevine) in loc - if(SV) - SV.eat(src) + eat_plants() -/mob/living/simple_animal/hostile/retaliate/goat/attackby(var/obj/item/O as obj, var/mob/user as mob, params) - if(stat == CONSCIOUS && istype(O, /obj/item/reagent_containers/glass)) +/mob/living/simple_animal/hostile/retaliate/goat/proc/eat_plants() + var/eaten = FALSE + var/obj/structure/spacevine/SV = locate(/obj/structure/spacevine) in loc + if(SV) + SV.eat(src) + eaten = TRUE + + var/obj/structure/glowshroom/GS = locate(/obj/structure/glowshroom) in loc + if(GS) + qdel(GS) + eaten = TRUE + + if(eaten && prob(10)) + say("Nom") + +/mob/living/simple_animal/hostile/retaliate/goat/attackby(obj/item/I, mob/user, params) + if(stat == CONSCIOUS && istype(I, /obj/item/reagent_containers/glass)) user.changeNext_move(CLICK_CD_MELEE) - var/obj/item/reagent_containers/glass/G = O + var/obj/item/reagent_containers/glass/G = I var/transfered = min(milk_content, rand(5,10), (G.volume - G.reagents.total_volume)) if(transfered > 0) - user.visible_message("[user] milks [src] using \the [O].") + user.visible_message("[user] milks [src] using [G].") G.reagents.add_reagent("milk", transfered) milk_content -= transfered else if(G.reagents.total_volume >= G.volume) - to_chat(user, "\The [O] is full.") + to_chat(user, "[G] is full.") else to_chat(user, "The udder is dry. Wait a bit longer...") + return TRUE else - ..() + return ..() + +/mob/living/simple_animal/hostile/retaliate/goat/AttackingTarget() + ..() + if(isdiona(target)) + var/mob/living/carbon/human/H = target + var/obj/item/organ/external/NB = pick(H.bodyparts) + H.visible_message("[src] takes a big chomp out of [H]!", "[src] takes a big chomp out of your [NB.name]!") + NB.droplimb() //cow /mob/living/simple_animal/cow