Dogs now bark at felinids and mailmen (#72134)

## About The Pull Request
AI dogs can now rarely bark and paw at nearby felinids and people
wearing mailman clothing. Also fixes dog harass/attack AI to now only
close within 3 tiles of a target before stopping, and only attacking if
the target approaches them (or the dog is pushed into them I guess) like
originally intended.
## Why It's Good For The Game
Adds more little fun moments and life to the game. also grrr cats
## Changelog
🆑 Ryll/Shaps
add: Dogs will now occasionally bark at their two mortal enemies:
felinids and mailmen
fix: Dogs set to attack will now only close within 3 tiles of their
target, and must be approached further by their target (or pushed next
to their target) to actually attack
/🆑
This commit is contained in:
Ryll Ryll
2022-12-26 22:20:14 -08:00
committed by GitHub
parent f960967cea
commit 2f0abeda30
8 changed files with 37 additions and 9 deletions
+1
View File
@@ -165,6 +165,7 @@
#define BB_DOG_PLAYING_DEAD "BB_DOG_PLAYING_DEAD"
#define BB_DOG_HARASS_TARGET "BB_DOG_HARASS_TARGET"
#define BB_DOG_HARASS_FRUSTRATION "BB_DOG_HARASS_FRUSTRATION"
#define BB_DOG_HARASS_HARM "BB_DOG_HARASS_HARM"
#define BB_DOG_IS_SLOW "BB_DOG_IS_SLOW"
/// Basically, what is our vision/hearing range for picking up on things to fetch/
+3
View File
@@ -441,6 +441,9 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
/// If the mob has this trait and die, their bomb implant doesn't detonate automatically. It must be consciously activated.
#define TRAIT_PREVENT_IMPLANT_AUTO_EXPLOSION "prevent_implant_auto_explosion"
/// If applied to a mob, nearby dogs will have a small chance to nonharmfully harass said mob
#define TRAIT_HATED_BY_DOGS "hated_by_dogs"
// METABOLISMS
// Various jobs on the station have historically had better reactions
// to various drinks and foodstuffs. Security liking donuts is a classic
+15 -9
View File
@@ -163,7 +163,7 @@
/// This behavior involves either eating a snack we can reach, or begging someone holding a snack
/datum/ai_behavior/harass
behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_MOVE_AND_PERFORM
required_distance = 1
required_distance = 3
/datum/ai_behavior/harass/perform(delta_time, datum/ai_controller/controller)
. = ..()
@@ -215,13 +215,19 @@
controller.blackboard[BB_DOG_HARASS_FRUSTRATION] = world.time
// make sure the pawn gets some temporary strength boost to actually attack the target instead of pathetically nuzzling them.
var/old_melee_lower = living_pawn.melee_damage_lower
var/old_melee_upper = living_pawn.melee_damage_upper
living_pawn.melee_damage_lower = max(5, old_melee_lower)
living_pawn.melee_damage_upper = max(10, old_melee_upper)
if(controller.blackboard[BB_DOG_HARASS_HARM])
// make sure the pawn gets some temporary strength boost to actually attack the target instead of pathetically nuzzling them.
var/old_melee_lower = living_pawn.melee_damage_lower
var/old_melee_upper = living_pawn.melee_damage_upper
living_pawn.melee_damage_lower = max(5, old_melee_lower)
living_pawn.melee_damage_upper = max(10, old_melee_upper)
living_pawn.UnarmedAttack(living_target, FALSE)
living_pawn.UnarmedAttack(living_target, FALSE)
living_pawn.melee_damage_lower = old_melee_lower
living_pawn.melee_damage_upper = old_melee_upper
living_pawn.melee_damage_lower = old_melee_lower
living_pawn.melee_damage_upper = old_melee_upper
else
if(prob(20))
living_pawn.do_attack_animation(living_target, ATTACK_EFFECT_DISARM)
playsound(living_target, 'sound/weapons/thudswoosh.ogg', 50, TRUE, -1)
living_target.visible_message(span_danger("[living_pawn] paws ineffectually at [living_target]!"), span_danger("[living_pawn] paws ineffectually at you!"))
+3
View File
@@ -9,6 +9,7 @@
BB_DOG_PLAYING_DEAD = FALSE,
BB_DOG_HARASS_TARGET = null,
BB_DOG_HARASS_FRUSTRATION = null,
BB_DOG_HARASS_HARM = TRUE,
BB_VISION_RANGE = AI_DOG_VISION_RANGE,
)
ai_movement = /datum/ai_movement/jps
@@ -280,6 +281,7 @@
pawn.visible_message(span_notice("[pawn] follows [pointing_friend]'s gesture towards [pointed_movable] and growls intensely!"))
set_movement_target(pointed_movable)
blackboard[BB_DOG_HARASS_TARGET] = WEAKREF(pointed_movable)
blackboard[BB_DOG_HARASS_HARM] = TRUE
if(living_pawn.buckled)
queue_behavior(/datum/ai_behavior/resist)//in case they are in bed or something
queue_behavior(/datum/ai_behavior/harass)
@@ -299,6 +301,7 @@
BB_DOG_PLAYING_DEAD = FALSE,
BB_DOG_HARASS_TARGET = null,
BB_DOG_HARASS_FRUSTRATION = null,
BB_DOG_HARASS_HARM = TRUE,
BB_VISION_RANGE = AI_DOG_VISION_RANGE,
BB_BABIES_PARTNER_TYPES = list(/mob/living/basic/pet/dog),
+12
View File
@@ -38,3 +38,15 @@
controller.set_movement_target(type, return_target)
controller.queue_behavior(/datum/ai_behavior/deliver_item)
return
if(DT_PROB(10, delta_time))
for(var/mob/living/iter_living in oview(2, living_pawn))
if(iter_living.stat != CONSCIOUS || !HAS_TRAIT(iter_living, TRAIT_HATED_BY_DOGS))
continue
living_pawn.audible_message(span_warning("[living_pawn] growls at [iter_living], seemingly annoyed by [iter_living.p_their()] presence."), hearing_distance = COMBAT_MESSAGE_RANGE)
controller.set_movement_target(iter_living)
controller.blackboard[BB_DOG_HARASS_TARGET] = WEAKREF(iter_living)
controller.blackboard[BB_DOG_HARASS_HARM] = FALSE
controller.queue_behavior(/datum/ai_behavior/harass)
return
+1
View File
@@ -49,6 +49,7 @@
name = "mailman's hat"
icon_state = "mailman"
desc = "<i>'Right-on-time'</i> mail service head wear."
clothing_traits = list(TRAIT_HATED_BY_DOGS)
/obj/item/clothing/head/bio_hood/plague
name = "plague doctor's hat"
@@ -26,6 +26,7 @@
desc = "<i>'Special delivery!'</i>"
icon_state = "mailman"
inhand_icon_state = "b_suit"
clothing_traits = list(TRAIT_HATED_BY_DOGS)
/obj/item/clothing/under/misc/psyche
name = "psychedelic jumpsuit"
@@ -10,6 +10,7 @@
external_organs = list(
/obj/item/organ/external/tail/cat = "Cat",
)
inherent_traits = list(TRAIT_CAN_USE_FLIGHT_POTION, TRAIT_HATED_BY_DOGS)
changesource_flags = MIRROR_BADMIN | WABBAJACK | MIRROR_PRIDE | MIRROR_MAGIC | RACE_SWAP | ERT_SPAWN | SLIME_EXTRACT
species_language_holder = /datum/language_holder/felinid
disliked_food = GROSS | CLOTH | RAW