mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-13 08:03:43 +01:00
Basic mobs targeting, attacks, and pig migration. (#28987)
* Basic mobs targeting, attacks, and pig migration. * run updatepaths * fix duplicate macro def * Update code/datums/ai/basic_mobs/basic_ai_behaviors/basic_attacking.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> Signed-off-by: warriorstar-orion <orion@snowfrost.garden> --------- Signed-off-by: warriorstar-orion <orion@snowfrost.garden> Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
5da3694877
commit
efc8adb6dd
@@ -19,6 +19,7 @@ RESTRICT_TYPE(/mob/living/basic)
|
||||
name = "basic mob"
|
||||
desc = "If you can see this, make an issue report on GitHub."
|
||||
healable = TRUE
|
||||
icon = 'icons/mob/animal.dmi'
|
||||
|
||||
var/basic_mob_flags
|
||||
|
||||
@@ -110,6 +111,9 @@ RESTRICT_TYPE(/mob/living/basic)
|
||||
|
||||
// Attack related vars.
|
||||
// Unclear how much of this should either be componentized or pulled to /mob/living
|
||||
/// Sound played when the critter attacks.
|
||||
var/attack_sound = 'sound/weapons/punch1.ogg'
|
||||
/// Sound played when the critter is attacked.
|
||||
var/attacked_sound = 'sound/weapons/punch1.ogg'
|
||||
/// The amount of damage done to the mob when hand-attacked on harm intent.
|
||||
var/harm_intent_damage = 3
|
||||
@@ -117,6 +121,20 @@ RESTRICT_TYPE(/mob/living/basic)
|
||||
var/list/damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 1, STAMINA = 0, OXY = 1)
|
||||
/// Minimum force required to deal any damage
|
||||
var/force_threshold = 0
|
||||
/// Lower bound of damage done by unarmed melee attacks.
|
||||
var/melee_damage_lower = 0
|
||||
/// Upper bound of damage done by unarmed melee attacks.
|
||||
var/melee_damage_upper = 0
|
||||
/// How much damage this simple animal does to objects, if any
|
||||
var/obj_damage = 0
|
||||
/// Flat armour reduction, occurs after percentage armour penetration.
|
||||
var/armour_penetration_flat = 0
|
||||
/// Percentage armour reduction, happens before flat armour reduction.
|
||||
var/armour_penetration_percentage = 0
|
||||
/// Damage type of a simple mob's melee attack, should it do damage.
|
||||
var/melee_damage_type = BRUTE
|
||||
/// How often can you melee attack?
|
||||
var/melee_attack_cooldown = 2 SECONDS
|
||||
|
||||
/mob/living/basic/Initialize(mapload)
|
||||
. = ..()
|
||||
@@ -164,6 +182,25 @@ RESTRICT_TYPE(/mob/living/basic)
|
||||
/mob/living/basic/proc/valid_respawn_target_for(mob/user)
|
||||
return FALSE
|
||||
|
||||
/mob/living/basic/resolve_unarmed_attack(atom/attack_target, list/modifiers)
|
||||
melee_attack(attack_target, modifiers)
|
||||
|
||||
/mob/living/basic/proc/melee_attack(atom/target, list/modifiers, ignore_cooldown = FALSE)
|
||||
if(!early_melee_attack(target, modifiers, ignore_cooldown))
|
||||
return FALSE
|
||||
|
||||
var/result = target.attack_basic_mob(src, modifiers)
|
||||
SEND_SIGNAL(src, COMSIG_HOSTILE_POST_ATTACKINGTARGET, target, result)
|
||||
return result
|
||||
|
||||
/mob/living/basic/proc/early_melee_attack(atom/target, list/modifiers, ignore_cooldown = FALSE)
|
||||
face_atom(target)
|
||||
if(!ignore_cooldown)
|
||||
changeNext_move(melee_attack_cooldown)
|
||||
if(SEND_SIGNAL(src, COMSIG_HOSTILE_PRE_ATTACKINGTARGET, target, Adjacent(target), modifiers) & COMPONENT_HOSTILE_NO_ATTACK)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/mob/living/basic/handle_environment(datum/gas_mixture/readonly_environment)
|
||||
SEND_SIGNAL(src, COMSIG_SIMPLEANIMAL_HANDLE_ENVIRONMENT, readonly_environment)
|
||||
|
||||
|
||||
@@ -1,7 +1,30 @@
|
||||
/datum/ai_planning_subtree/random_speech/cow
|
||||
speech_chance = 2
|
||||
speak = list("Moo?", "Moo", "MOOOOOO")
|
||||
speak_verbs = list("moos", "moos hauntingly")
|
||||
sound = list('sound/creatures/cow.ogg')
|
||||
emote_hear = list("brays.")
|
||||
emote_see = list("shakes her head.")
|
||||
|
||||
/datum/ai_controller/basic_controller/cow
|
||||
blackboard = list(
|
||||
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
|
||||
BB_BASIC_MOB_TIP_REACTING = FALSE,
|
||||
BB_BASIC_MOB_TIPPER = null,
|
||||
)
|
||||
|
||||
ai_traits = AI_FLAG_STOP_MOVING_WHEN_PULLED
|
||||
ai_movement = /datum/ai_movement/basic_avoidance
|
||||
idle_behavior = /datum/idle_behavior/idle_random_walk
|
||||
planning_subtrees = list(
|
||||
/datum/ai_planning_subtree/tip_reaction,
|
||||
/datum/ai_planning_subtree/find_food,
|
||||
/datum/ai_planning_subtree/random_speech/cow,
|
||||
)
|
||||
|
||||
/mob/living/basic/cow
|
||||
name = "cow"
|
||||
desc = "Known for their milk, just don't tip them over."
|
||||
icon = 'icons/mob/animal.dmi'
|
||||
icon_state = "cow"
|
||||
icon_living = "cow"
|
||||
icon_dead = "cow_dead"
|
||||
@@ -1,15 +0,0 @@
|
||||
/datum/ai_controller/basic_controller/cow
|
||||
blackboard = list(
|
||||
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
|
||||
BB_BASIC_MOB_TIP_REACTING = FALSE,
|
||||
BB_BASIC_MOB_TIPPER = null,
|
||||
)
|
||||
|
||||
ai_traits = AI_FLAG_STOP_MOVING_WHEN_PULLED
|
||||
ai_movement = /datum/ai_movement/basic_avoidance
|
||||
idle_behavior = /datum/idle_behavior/idle_random_walk
|
||||
planning_subtrees = list(
|
||||
/datum/ai_planning_subtree/tip_reaction,
|
||||
/datum/ai_planning_subtree/find_food,
|
||||
/datum/ai_planning_subtree/random_speech/cow,
|
||||
)
|
||||
@@ -0,0 +1,50 @@
|
||||
/datum/ai_planning_subtree/random_speech/pig
|
||||
speech_chance = 2
|
||||
speak = list("oink?", "oink", "OINK")
|
||||
sound = list(
|
||||
'sound/creatures/pig/pig1.ogg',
|
||||
'sound/creatures/pig/pig2.ogg'
|
||||
)
|
||||
emote_hear = list("oinks.")
|
||||
emote_see = list("rolls around.")
|
||||
|
||||
/datum/ai_controller/basic_controller/pig
|
||||
blackboard = list(
|
||||
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
|
||||
)
|
||||
|
||||
ai_traits = AI_FLAG_STOP_MOVING_WHEN_PULLED
|
||||
ai_movement = /datum/ai_movement/basic_avoidance
|
||||
idle_behavior = /datum/idle_behavior/idle_random_walk
|
||||
planning_subtrees = list(
|
||||
/datum/ai_planning_subtree/find_nearest_thing_which_attacked_me_to_flee,
|
||||
/datum/ai_planning_subtree/flee_target,
|
||||
/datum/ai_planning_subtree/target_retaliate,
|
||||
/datum/ai_planning_subtree/basic_melee_attack_subtree,
|
||||
/datum/ai_planning_subtree/random_speech/pig,
|
||||
)
|
||||
|
||||
/mob/living/basic/pig
|
||||
name = "pig"
|
||||
desc = "Oink oink."
|
||||
icon_state = "pig"
|
||||
icon_living = "pig"
|
||||
icon_dead = "pig_dead"
|
||||
ai_controller = /datum/ai_controller/basic_controller/pig
|
||||
see_in_dark = 6
|
||||
butcher_results = list(/obj/item/food/meat/ham = 6)
|
||||
health = 50
|
||||
maxHealth = 50
|
||||
melee_damage_lower = 1
|
||||
melee_damage_upper = 2
|
||||
mob_biotypes = MOB_ORGANIC | MOB_BEAST
|
||||
gold_core_spawnable = FRIENDLY_SPAWN
|
||||
blood_volume = BLOOD_VOLUME_NORMAL
|
||||
unintelligble_phrases = list("Oink?", "Oink", "OINK")
|
||||
unintelligble_speak_verbs = list("oinks")
|
||||
|
||||
/mob/living/basic/pig/Initialize(mapload)
|
||||
. = ..()
|
||||
AddElement(/datum/element/ai_retaliate)
|
||||
AddElement(/datum/element/ai_flee_while_injured)
|
||||
AddComponent(/datum/component/footstep, FOOTSTEP_MOB_SHOE)
|
||||
Reference in New Issue
Block a user