From 81ca3fb625112c55fc95aef1d29895bcd56b27dd Mon Sep 17 00:00:00 2001 From: Firecage Date: Mon, 14 Oct 2019 06:33:23 +0200 Subject: [PATCH] All dogs can now eat snacks and dance, including puppy Ian. (#46925) * Changes the Ian puppy into an actual Ian puppy. * Adds the unique_pet var to puppy Ian. * All dogs can now eat snacks and dance. * Moves the proc to its proper position in the file. --- code/__DEFINES/is_helpers.dm | 2 + code/modules/food_and_drinks/food/snacks.dm | 2 +- .../mob/living/simple_animal/friendly/dog.dm | 132 ++++++++---------- 3 files changed, 59 insertions(+), 77 deletions(-) diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm index 36307710559..1152a316295 100644 --- a/code/__DEFINES/is_helpers.dm +++ b/code/__DEFINES/is_helpers.dm @@ -122,6 +122,8 @@ GLOBAL_LIST_INIT(turfs_without_ground, typecacheof(list( #define iscat(A) (istype(A, /mob/living/simple_animal/pet/cat)) +#define isdog(A) (istype(A, /mob/living/simple_animal/pet/dog)) + #define iscorgi(A) (istype(A, /mob/living/simple_animal/pet/dog/corgi)) #define ishostile(A) (istype(A, /mob/living/simple_animal/hostile)) diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm index 5d25605a387..9295b55acbd 100644 --- a/code/modules/food_and_drinks/food/snacks.dm +++ b/code/modules/food_and_drinks/food/snacks.dm @@ -320,7 +320,7 @@ All foods are distributed among various categories. Use common sense. /obj/item/reagent_containers/food/snacks/attack_animal(mob/M) if(isanimal(M)) - if(iscorgi(M)) + if(isdog(M)) var/mob/living/L = M if(bitecount == 0 || prob(50)) M.emote("me", 1, "nibbles away at \the [src]") diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm index 3e633932872..23f01f86e72 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -16,9 +16,65 @@ see_in_dark = 5 speak_chance = 1 turns_per_move = 10 + var/turns_since_scan = 0 + var/obj/movement_target do_footstep = TRUE +/mob/living/simple_animal/pet/dog/Life() + ..() + + //Feeding, chasing food, FOOOOODDDD + if(!stat && !resting && !buckled) + turns_since_scan++ + if(turns_since_scan > 5) + turns_since_scan = 0 + if((movement_target) && !(isturf(movement_target.loc) || ishuman(movement_target.loc) )) + movement_target = null + stop_automated_movement = 0 + if( !movement_target || !(movement_target.loc in oview(src, 3)) ) + movement_target = null + stop_automated_movement = 0 + for(var/obj/item/reagent_containers/food/snacks/S in oview(src,3)) + if(isturf(S.loc) || ishuman(S.loc)) + movement_target = S + break + if(movement_target) + stop_automated_movement = 1 + step_to(src,movement_target,1) + sleep(3) + step_to(src,movement_target,1) + sleep(3) + step_to(src,movement_target,1) + + if(movement_target) //Not redundant due to sleeps, Item can be gone in 6 decisecomds + if (movement_target.loc.x < src.x) + setDir(WEST) + else if (movement_target.loc.x > src.x) + setDir(EAST) + else if (movement_target.loc.y < src.y) + setDir(SOUTH) + else if (movement_target.loc.y > src.y) + setDir(NORTH) + else + setDir(SOUTH) + + if(!Adjacent(movement_target)) //can't reach food through windows. + return + + if(isturf(movement_target.loc) ) + movement_target.attack_animal(src) + else if(ishuman(movement_target.loc) ) + if(prob(20)) + emote("me", 1, "stares at [movement_target.loc]'s [movement_target] with a sad puppy-face") + + if(prob(1)) + emote("me", 1, pick("dances around.","chases its tail!")) + spawn(0) + for(var/i in list(1,2,4,8,4,2,1,2,4,8,4,2,1,2,4,8,4,2)) + setDir(i) + sleep(1) + //Corgis and pugs are now under one dog subtype /mob/living/simple_animal/pet/dog/corgi @@ -333,8 +389,6 @@ real_name = "Ian" //Intended to hold the name without altering it. gender = MALE desc = "It's the HoP's beloved corgi." - var/turns_since_scan = 0 - var/obj/movement_target response_help_continuous = "pets" response_help_simple = "pet" response_disarm_continuous = "bops" @@ -423,60 +477,6 @@ fdel(json_file) WRITE_FILE(json_file, json_encode(file_data)) -/mob/living/simple_animal/pet/dog/corgi/Ian/Life() - ..() - - //Feeding, chasing food, FOOOOODDDD - if(!stat && !resting && !buckled) - turns_since_scan++ - if(turns_since_scan > 5) - turns_since_scan = 0 - if((movement_target) && !(isturf(movement_target.loc) || ishuman(movement_target.loc) )) - movement_target = null - stop_automated_movement = 0 - if( !movement_target || !(movement_target.loc in oview(src, 3)) ) - movement_target = null - stop_automated_movement = 0 - for(var/obj/item/reagent_containers/food/snacks/S in oview(src,3)) - if(isturf(S.loc) || ishuman(S.loc)) - movement_target = S - break - if(movement_target) - stop_automated_movement = 1 - step_to(src,movement_target,1) - sleep(3) - step_to(src,movement_target,1) - sleep(3) - step_to(src,movement_target,1) - - if(movement_target) //Not redundant due to sleeps, Item can be gone in 6 decisecomds - if (movement_target.loc.x < src.x) - setDir(WEST) - else if (movement_target.loc.x > src.x) - setDir(EAST) - else if (movement_target.loc.y < src.y) - setDir(SOUTH) - else if (movement_target.loc.y > src.y) - setDir(NORTH) - else - setDir(SOUTH) - - if(!Adjacent(movement_target)) //can't reach food through windows. - return - - if(isturf(movement_target.loc) ) - movement_target.attack_animal(src) - else if(ishuman(movement_target.loc) ) - if(prob(20)) - emote("me", 1, "stares at [movement_target.loc]'s [movement_target] with a sad puppy-face") - - if(prob(1)) - emote("me", 1, pick("dances around.","chases its tail!")) - spawn(0) - for(var/i in list(1,2,4,8,4,2,1,2,4,8,4,2,1,2,4,8,4,2)) - setDir(i) - sleep(1) - /mob/living/simple_animal/pet/dog/corgi/Ian/narsie_act() playsound(src, 'sound/magic/demon_dies.ogg', 75, TRUE) var/mob/living/simple_animal/pet/dog/corgi/narsie/N = new(loc) @@ -618,7 +618,6 @@ response_disarm_simple = "bop" response_harm_continuous = "kicks" response_harm_simple = "kick" - var/turns_since_scan = 0 var/puppies = 0 //Lisa already has a cute bow! @@ -633,25 +632,6 @@ make_babies() - if(!stat && !resting && !buckled) - if(prob(1)) - emote("me", 1, pick("dances around.","chases her tail.")) - spawn(0) - for(var/i in list(1,2,4,8,4,2,1,2,4,8,4,2,1,2,4,8,4,2)) - setDir(i) - sleep(1) - -/mob/living/simple_animal/pet/dog/pug/Life() - ..() - - if(!stat && !resting && !buckled) - if(prob(1)) - emote("me", 1, pick("chases its tail.")) - spawn(0) - for(var/i in list(1,2,4,8,4,2,1,2,4,8,4,2,1,2,4,8,4,2)) - setDir(i) - sleep(1) - /mob/living/simple_animal/pet/dog/attack_hand(mob/living/carbon/human/M) . = ..() switch(M.a_intent)