mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-21 20:20:33 +01:00
[MIRROR] Basic Legion & Hivelord [MDB IGNORE] (#23964)
* Basic Legion & Hivelord * Update modular + fix diffs * Fixing diffs * More diffs * Adds an AI behavior to replace the 'wander = 0' varedit for the hivelord gate guardians --------- Co-authored-by: Jacquerel <hnevard@gmail.com> Co-authored-by: Giz <13398309+vinylspiders@users.noreply.github.com>
This commit is contained in:
co-authored by
Jacquerel
Giz
parent
67fa63d7b0
commit
37a8f73ae3
@@ -9,8 +9,13 @@
|
||||
|
||||
/datum/ai_planning_subtree/flee_target/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
|
||||
. = ..()
|
||||
if (!controller.blackboard[BB_BASIC_MOB_FLEEING] || !controller.blackboard_key_exists(target_key))
|
||||
var/atom/flee_from = controller.blackboard[target_key]
|
||||
if (!controller.blackboard[BB_BASIC_MOB_FLEEING] || QDELETED(flee_from))
|
||||
return
|
||||
var/flee_distance = controller.blackboard[BB_BASIC_MOB_FLEE_DISTANCE] || DEFAULT_BASIC_FLEE_DISTANCE
|
||||
if (get_dist(controller.pawn, flee_from) >= flee_distance)
|
||||
return
|
||||
|
||||
controller.queue_behavior(flee_behaviour, target_key, hiding_place_key)
|
||||
return SUBTREE_RETURN_FINISH_PLANNING //we gotta get out of here.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/// Blackboard key holding atom we want to stay away from
|
||||
var/target_key = BB_BASIC_MOB_CURRENT_TARGET
|
||||
/// How close will we allow our target to get?
|
||||
var/minimum_distance = 3
|
||||
var/minimum_distance = 4
|
||||
/// How far away will we allow our target to get?
|
||||
var/maximum_distance = 6
|
||||
/// How far do we look for our target?
|
||||
|
||||
@@ -22,24 +22,27 @@
|
||||
emote_see = string_list(emote_see)
|
||||
|
||||
/datum/ai_planning_subtree/random_speech/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
|
||||
if(SPT_PROB(speech_chance, seconds_per_tick))
|
||||
var/audible_emotes_length = emote_hear?.len
|
||||
var/non_audible_emotes_length = emote_see?.len
|
||||
var/speak_lines_length = speak?.len
|
||||
if(!SPT_PROB(speech_chance, seconds_per_tick))
|
||||
return
|
||||
speak(controller)
|
||||
|
||||
var/total_choices_length = audible_emotes_length + non_audible_emotes_length + speak_lines_length
|
||||
/// Actually perform an action
|
||||
/datum/ai_planning_subtree/random_speech/proc/speak(datum/ai_controller/controller)
|
||||
var/audible_emotes_length = emote_hear?.len
|
||||
var/non_audible_emotes_length = emote_see?.len
|
||||
var/speak_lines_length = speak?.len
|
||||
|
||||
var/random_number_in_range = rand(1, total_choices_length)
|
||||
var/total_choices_length = audible_emotes_length + non_audible_emotes_length + speak_lines_length
|
||||
|
||||
// Sound that plays when the mob does something audible
|
||||
var/sound_to_play = length(sound) > 0 ? pick(sound) : null
|
||||
var/random_number_in_range = rand(1, total_choices_length)
|
||||
var/sound_to_play = length(sound) > 0 ? pick(sound) : null
|
||||
|
||||
if(random_number_in_range <= audible_emotes_length)
|
||||
controller.queue_behavior(/datum/ai_behavior/perform_emote, pick(emote_hear), sound_to_play)
|
||||
else if(random_number_in_range <= (audible_emotes_length + non_audible_emotes_length))
|
||||
controller.queue_behavior(/datum/ai_behavior/perform_emote, pick(emote_see))
|
||||
else
|
||||
controller.queue_behavior(/datum/ai_behavior/perform_speech, pick(speak), sound_to_play)
|
||||
if(random_number_in_range <= audible_emotes_length)
|
||||
controller.queue_behavior(/datum/ai_behavior/perform_emote, pick(emote_hear), sound_to_play)
|
||||
else if(random_number_in_range <= (audible_emotes_length + non_audible_emotes_length))
|
||||
controller.queue_behavior(/datum/ai_behavior/perform_emote, pick(emote_see))
|
||||
else
|
||||
controller.queue_behavior(/datum/ai_behavior/perform_speech, pick(speak), sound_to_play)
|
||||
|
||||
/datum/ai_planning_subtree/random_speech/insect
|
||||
speech_chance = 5
|
||||
@@ -218,7 +221,9 @@
|
||||
var/list/speech_lines = controller.blackboard[BB_BASIC_MOB_SPEAK_LINES]
|
||||
if(isnull(speech_lines))
|
||||
return ..()
|
||||
|
||||
|
||||
// Note to future developers: this behaviour a singleton so this probably doesn't work as you would expect
|
||||
// The whole speech tree really needs to be refactored because this isn't how we use AI data these days
|
||||
speak = speech_lines[BB_EMOTE_SAY] || list()
|
||||
emote_see = speech_lines[BB_EMOTE_SEE] || list()
|
||||
emote_hear = speech_lines[BB_EMOTE_HEAR] || list()
|
||||
|
||||
@@ -23,3 +23,6 @@
|
||||
controller.queue_behavior(use_ability_behaviour, ability_key, target_key)
|
||||
if (finish_planning)
|
||||
return SUBTREE_RETURN_FINISH_PLANNING
|
||||
|
||||
/datum/ai_planning_subtree/targeted_mob_ability/continue_planning
|
||||
finish_planning = FALSE
|
||||
|
||||
Reference in New Issue
Block a user