mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 12:35:33 +01:00
Basic Legion & Hivelord (#78624)
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user