Added burrowing, foraging and scavenging interactions for simple_mob animals.

This commit is contained in:
MistakeNot4892
2022-08-12 20:43:31 +10:00
parent 1dd18306d7
commit bbddee97bb
14 changed files with 340 additions and 38 deletions
+29 -2
View File
@@ -71,9 +71,9 @@
..(W, user)
/obj/structure/flora/proc/can_harvest(var/obj/item/I)
/obj/structure/flora/proc/can_harvest(var/obj/item/I, var/ignore_tool = FALSE)
. = FALSE
if(harvest_tool && istype(I, harvest_tool) && harvest_loot && harvest_loot.len && harvest_count < max_harvests)
if((ignore_tool || (harvest_tool && istype(I, harvest_tool))) && harvest_loot && harvest_loot.len && harvest_count < max_harvests)
. = TRUE
return .
@@ -89,6 +89,33 @@
harvest_count++
return AM
/obj/structure/flora/attack_generic(mob/user, damage, attack_verb)
if(istype(user, /mob/living/simple_mob/animal) && user.a_intent != I_HURT)
var/mob/living/simple_mob/animal/critter = user
if(!critter.forager)
return ..()
if(!can_forage(critter))
to_chat(critter, SPAN_WARNING("You cannot see any edible fruit on \the [src]."))
return TRUE
show_animal_foraging_message(critter)
if(!do_after(critter, 2 SECONDS, src) || QDELETED(src) || !can_forage(user))
return TRUE
show_animal_eating_message(critter)
playsound(critter, 'sound/items/eatfood.ogg', rand(10,50), 1)
harvest_count++
critter.eat_food_item(spawn_harvest(pickweight(harvest_loot)))
return TRUE
return ..()
/obj/structure/flora/proc/can_forage(var/mob/critter)
return can_harvest(ignore_tool = TRUE)
/obj/structure/flora/proc/show_animal_foraging_message(var/mob/critter)
critter.visible_message(SPAN_NOTICE("\The [critter] begins sniffing at \the [src]."))
/obj/structure/flora/proc/show_animal_eating_message(var/mob/critter)
critter.visible_message(SPAN_NOTICE("\The [critter] rips away some of the fruit from \the [src]."))
//bushes
/obj/structure/flora/bush
name = "bush"
+8 -2
View File
@@ -30,9 +30,9 @@
/obj/structure/flora/tree/proc/choose_icon_state()
return icon_state
/obj/structure/flora/tree/can_harvest(var/obj/item/I)
/obj/structure/flora/tree/can_harvest(var/obj/item/I, var/ignore_tool = FALSE)
. = FALSE
if(!is_stump && harvest_tool && istype(I, harvest_tool) && harvest_loot && harvest_loot.len && harvest_count < max_harvests)
if(!is_stump && (ignore_tool || (harvest_tool && istype(I, harvest_tool))) && harvest_loot && harvest_loot.len && harvest_count < max_harvests)
. = TRUE
return .
@@ -139,6 +139,12 @@
return results
/obj/structure/flora/tree/show_animal_foraging_message(var/mob/critter)
critter.visible_message(SPAN_NOTICE("\The [critter] begins searching through the foliage of \the [src]."))
/obj/structure/flora/tree/show_animal_eating_message(var/mob/critter)
critter.visible_message(SPAN_NOTICE("\The [critter] pulls down some low-hanging fruit from \the [src]."))
// Subtypes.
// Pine trees