Allows Ian to eat homework (#15786)

* Dog food V1

* m

* Fixed string

* Review thing
This commit is contained in:
SabreML
2021-04-17 13:45:40 +01:00
committed by GitHub
parent 2121275853
commit 6eb6747980
3 changed files with 94 additions and 54 deletions
@@ -503,53 +503,58 @@
/mob/living/simple_animal/pet/dog/corgi/Ian/handle_automated_movement()
. = ..()
//Feeding, chasing food, FOOOOODDDD
if(!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
if(resting || buckled)
return
if(++turns_since_scan > 5)
turns_since_scan = 0
// Has a target, but it's not where it was before, and it wasn't picked up by someone.
if(movement_target && !(isturf(movement_target.loc) || ishuman(movement_target.loc)))
movement_target = null
stop_automated_movement = FALSE
// No current target, or current target is out of range.
var/list/snack_range = oview(src, 3)
if(!movement_target || !(movement_target.loc in snack_range))
movement_target = null
stop_automated_movement = FALSE
var/obj/item/possible_target = null
for(var/I in snack_range)
if(istype(I, /obj/item/reagent_containers/food/snacks)) // Noms
possible_target = I
break
else if(istype(I, /obj/item/paper)) // Important noms
if(prob(10))
possible_target = I
break
if(movement_target)
spawn(0)
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(possible_target && (isturf(possible_target.loc) || ishuman(possible_target.loc))) // On the ground or in someone's hand.
movement_target = possible_target
if(movement_target)
INVOKE_ASYNC(src, .proc/move_to_target)
if(movement_target) //Not redundant due to sleeps, Item can be gone in 6 decisecomds
if(movement_target.loc.x < src.x)
dir = WEST
else if(movement_target.loc.x > src.x)
dir = EAST
else if(movement_target.loc.y < src.y)
dir = SOUTH
else if(movement_target.loc.y > src.y)
dir = NORTH
else
dir = SOUTH
if(prob(1))
chasetail()
if(!Adjacent(movement_target)) //can't reach food through windows.
return
/mob/living/simple_animal/pet/dog/corgi/Ian/proc/move_to_target()
stop_automated_movement = TRUE
step_to(src, movement_target, 1)
sleep(3)
step_to(src, movement_target, 1)
sleep(3)
step_to(src, movement_target, 1)
if(isturf(movement_target.loc) )
movement_target.attack_animal(src)
else if(ishuman(movement_target.loc) )
if(prob(20))
custom_emote(1, "stares at [movement_target.loc]'s [movement_target] with a sad puppy-face")
if(movement_target) // Not redundant due to sleeps, Item can be gone in 6 deciseconds
// Face towards the thing
dir = get_dir(src, movement_target)
if(prob(1))
custom_emote(1, pick("dances around.","chases its tail!"))
spin(20, 1)
if(!Adjacent(movement_target)) //can't reach food through windows.
return
if(isturf(movement_target.loc))
movement_target.attack_animal(src) // Eat the thing
else if(prob(30) && ishuman(movement_target.loc)) // mean hooman has stolen it
custom_emote(EMOTE_VISUAL, "stares at [movement_target.loc]'s [movement_target] with a sad puppy-face.")
/obj/item/reagent_containers/food/snacks/meat/corgi
name = "Corgi meat"
+47 -12
View File
@@ -163,6 +163,51 @@
else
return ..()
/obj/item/paper/attack_animal(mob/living/simple_animal/M)
if(!isdog(M)) // Only dogs can eat homework.
return
var/mob/living/simple_animal/pet/dog/D = M
D.changeNext_move(CLICK_CD_MELEE)
if(world.time < D.last_eaten + 30 SECONDS)
to_chat(D, "<span class='warning'>You are too full to try eating [src] now.</span>")
return
D.visible_message("<span class='warning'>[D] starts chewing the corner of [src]!</span>",
"<span class='notice'>You start chewing the corner of [src].</span>",
"<span class='warning'>You hear a quiet gnawing, and the sound of paper rustling.</span>")
playsound(src, 'sound/effects/pageturn2.ogg', 100, TRUE)
if(!do_after(D, 10 SECONDS, FALSE, src))
return
if(world.time < D.last_eaten + 30 SECONDS) // Check again to prevent eating multiple papers at once.
to_chat(D, "<span class='warning'>You are too full to try eating [src] now.</span>")
return
D.last_eaten = world.time
// 90% chance of a crumpled paper with illegible text.
if(prob(90))
var/message_ending = "."
var/obj/item/paper/crumpled/P = new(loc)
P.name = name
if(info) // Something written on the paper.
/*var/new_text = strip_html_properly(info, MAX_PAPER_MESSAGE_LEN, TRUE) // Don't want HTML stuff getting gibberished.
P.info = Gibberish(new_text, 100)*/
P.info = "<i>Whatever was once written here has been made completely illegible by a combination of chew marks and saliva.</i>"
message_ending = ", the drool making it an unreadable mess!"
P.update_icon()
qdel(src)
D.visible_message("<span class='warning'>[D] finishes eating [src][message_ending]</span>",
"<span class='notice'>You finish eating [src][message_ending]</span>")
D.emote("bark")
// 10% chance of the paper just being eaten entirely.
else
D.visible_message("<span class='warning'>[D] swallows [src] whole!</span>", "<span class='notice'>You swallow [src] whole. Tasty!</span>")
playsound(D, 'sound/items/eatfood.ogg', 50, TRUE)
qdel(src)
/obj/item/paper/proc/addtofield(id, text, links = 0)
if(id > MAX_PAPER_FIELDS)
return
@@ -487,7 +532,8 @@
icon_state = "scrap"
/obj/item/paper/crumpled/update_icon()
return
if(info)
icon_state = "scrap_words"
/obj/item/paper/crumpled/bloody
icon_state = "scrap_bloodied"
@@ -591,10 +637,6 @@
name = "paper- 'Note'"
info = "The call has gone out! Our ancestral home has been rediscovered! Not a small patch of land, but a true clown nation, a true Clown Planet! We're on our way home at last!"
/obj/item/paper/crumpled
name = "paper scrap"
icon_state = "scrap"
/obj/item/paper/syndicate
name = "paper"
header = "<p><img style='display: block; margin-left: auto; margin-right: auto;' src='syndielogo.png' width='220' height='135' /></p><hr />"
@@ -611,13 +653,6 @@
info = ""
footer = "<hr /><p style='font-family:Verdana;'><em>Failure to adhere appropriately to orders that may be contained herein is in violation of Space Law, and punishments may be administered appropriately upon return to Central Command.</em><br /><em>The recipient(s) of this memorandum acknowledge by reading it that they are liable for any and all damages to crew or station that may arise from ignoring suggestions or advice given herein.</em></p>"
/obj/item/paper/crumpled/update_icon()
return
/obj/item/paper/crumpled/bloody
icon_state = "scrap_bloodied"
/obj/item/paper/evilfax
name = "Centcomm Reply"
info = ""