diff --git a/AutoMark/scripts/mods/AutoMark/AutoMark.lua b/AutoMark/scripts/mods/AutoMark/AutoMark.lua index 6c72d2c..3cc8365 100644 --- a/AutoMark/scripts/mods/AutoMark/AutoMark.lua +++ b/AutoMark/scripts/mods/AutoMark/AutoMark.lua @@ -457,6 +457,10 @@ local function can_noospheric_command_boost() return player_ability_extension:has_enough_ability_charge_percentage("combat_ability", cryptic_talent_settings.servo_skull_shooting_tagging.minimum_capacitance) end +local function is_training_grounds() + return Managers.state.game_mode:game_mode_name() == "training_grounds" +end + local function is_player_in_platform() local locomotion_component = context.locomotion_component local locomotion_parent_unit = locomotion_component and locomotion_component.parent_unit @@ -473,7 +477,7 @@ local function is_tag_valid(tag_name) elseif tag_name == TAG_NAMES.ENEMY_TAG then return context.class_name ~= "veteran" or not context.has_focus_target elseif tag_name == TAG_NAMES.SERVO_SKULL_TAG then - return context.class_name == "cryptic" and context.has_servo_skull and not mod:is_servo_skull_hacking() + return context.class_name == "cryptic" and context.has_servo_skull and mod:is_servo_skull_ready_to_shoot() and (is_training_grounds() or can_noospheric_command_boost()) end return false end diff --git a/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua b/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua index a66c9b6..669d553 100644 --- a/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua +++ b/AutoMark/scripts/mods/AutoMark/mark/servo_skull_mark.lua @@ -210,6 +210,19 @@ function mod:is_servo_skull_hacking() return state == servo_skull_states.hacking end +function mod:is_servo_skull_ready_to_shoot() + local companion_spawner_extension = context.companion_spawner_extension + local companion_unit = companion_spawner_extension and companion_spawner_extension:spawned_unit_lookup(special_rules.cryptic_servo_skull_hack) + if not companion_unit then + return false + end + + local game_session = Managers.state.game_session:game_session() + local game_object_id = Managers.state.unit_spawner:game_object_id(companion_unit) + local state = get_game_object_field(game_session, game_object_id, "state") + return state == servo_skull_states.following or state == servo_skull_states.following_shooting or state == servo_skull_states.following_shooting_ability +end + function mod:is_noospheric_command_boost_breed_valid(target_unit) local unit_data_extension = ScriptUnit_extension(target_unit, "unit_data_system") local breed_data = unit_data_extension and unit_data_extension._breed