From 0e4e5e18f1787e8ae01563e60cb1f46b5ca4c85c Mon Sep 17 00:00:00 2001 From: xDanilcusx Date: Thu, 19 Sep 2024 05:27:25 +0300 Subject: [PATCH 1/2] Merge issues --- .../carbon/human/ai/action_datums/item_pickup.dm | 1 - .../carbon/human/ai/brain/ai_brain_targeting.dm | 12 +++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/code/modules/mob/living/carbon/human/ai/action_datums/item_pickup.dm b/code/modules/mob/living/carbon/human/ai/action_datums/item_pickup.dm index 49481419b4..8d5322e346 100644 --- a/code/modules/mob/living/carbon/human/ai/action_datums/item_pickup.dm +++ b/code/modules/mob/living/carbon/human/ai/action_datums/item_pickup.dm @@ -63,7 +63,6 @@ var/obj/item/ammo_magazine/mag = to_pickup if(istype(brain.primary_weapon, mag.gun_type)) brain.tied_human.put_in_hands(to_pickup, TRUE) - brain.store_item(to_pickup, storage_spot, HUMAN_AI_AMMUNITION) return ONGOING_ACTION_COMPLETED diff --git a/code/modules/mob/living/carbon/human/ai/brain/ai_brain_targeting.dm b/code/modules/mob/living/carbon/human/ai/brain/ai_brain_targeting.dm index 015decc130..395bb9810b 100644 --- a/code/modules/mob/living/carbon/human/ai/brain/ai_brain_targeting.dm +++ b/code/modules/mob/living/carbon/human/ai/brain/ai_brain_targeting.dm @@ -205,14 +205,6 @@ if(primary_weapon.current_mag?.current_rounds <= 1 && !primary_weapon.in_chamber) // bullet removal comes after comsig is triggered end_gun_fire() - return - - if(!(current_target in viewers(world.view, tied_human))) - if(!in_cover) - ADD_ONGOING_ACTION(src, AI_ACTION_APPROACH_C, current_target, 0) - else if(overwatch_allowed) - establish_overwatch() - end_gun_fire() if(gun_data?.disposable) var/obj/item/gun = primary_weapon set_primary_weapon(null) @@ -221,7 +213,9 @@ if(get_dist(tied_human, current_target) > gun_data.maximum_range) end_gun_fire() - if(overwatch_allowed) + if(!in_cover) + ADD_ONGOING_ACTION(src, AI_ACTION_APPROACH_C, current_target, 0) + else if(overwatch_allowed) establish_overwatch() else if(grenading_allowed) throw_grenade_cover() From 59d88ad085e8d14391489009cb12d39142d901bb Mon Sep 17 00:00:00 2001 From: xDanilcusx Date: Thu, 19 Sep 2024 05:47:17 +0300 Subject: [PATCH 2/2] Trowback -> Throwback and nade AI action define --- code/__DEFINES/human_ai.dm | 3 ++- code/modules/mob/living/carbon/human/ai/brain/ai_brain.dm | 4 ++-- .../mob/living/carbon/human/ai/brain/ai_brain_targeting.dm | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/code/__DEFINES/human_ai.dm b/code/__DEFINES/human_ai.dm index 8decd957f2..da10ebcf13 100644 --- a/code/__DEFINES/human_ai.dm +++ b/code/__DEFINES/human_ai.dm @@ -9,7 +9,8 @@ #define AI_ACTION_PICKUP_GUN /datum/ongoing_action/item_pickup/pickup_primary #define AI_ACTION_COVER /datum/ongoing_action/take_cover #define AI_ACTION_COVER_I /datum/ongoing_action/take_inside_cover -#define AI_ACTION_TROWBACK /datum/ongoing_action/throw_back_nade +#define AI_ACTION_THROWBACK /datum/ongoing_action/throw_back_nade +#define AI_ACTION_NADE /datum/ongoing_action/throw_grenade /// Action is completed, delete this and move onto the next ongoing action #define ONGOING_ACTION_COMPLETED "completed" diff --git a/code/modules/mob/living/carbon/human/ai/brain/ai_brain.dm b/code/modules/mob/living/carbon/human/ai/brain/ai_brain.dm index 249ceae6fb..8968be6010 100644 --- a/code/modules/mob/living/carbon/human/ai/brain/ai_brain.dm +++ b/code/modules/mob/living/carbon/human/ai/brain/ai_brain.dm @@ -133,7 +133,7 @@ GLOBAL_LIST_EMPTY(human_ai_brains) tied_human.swap_hand() /datum/human_ai_brain/proc/nade_throwback(list/things_around) - if(has_ongoing_action(AI_ACTION_TROWBACK)) + if(has_ongoing_action(AI_ACTION_THROWBACK)) return var/turf/place_to_throw @@ -192,7 +192,7 @@ GLOBAL_LIST_EMPTY(human_ai_brains) return throw_back_nade: - ADD_ONGOING_ACTION(src, AI_ACTION_TROWBACK, throw_nade, place_to_throw) + ADD_ONGOING_ACTION(src, AI_ACTION_THROWBACK, throw_nade, place_to_throw) /// Use ADD_ONGOING_ACTION() macro instead of calling this directly /datum/human_ai_brain/proc/_add_ongoing_action(datum/ongoing_action/path, ...) diff --git a/code/modules/mob/living/carbon/human/ai/brain/ai_brain_targeting.dm b/code/modules/mob/living/carbon/human/ai/brain/ai_brain_targeting.dm index 395bb9810b..2885776717 100644 --- a/code/modules/mob/living/carbon/human/ai/brain/ai_brain_targeting.dm +++ b/code/modules/mob/living/carbon/human/ai/brain/ai_brain_targeting.dm @@ -301,13 +301,13 @@ attack_target() /datum/human_ai_brain/proc/throw_grenade_cover() - if(!target_floor || has_ongoing_action(/datum/ongoing_action/throw_grenade)) + if(!target_floor || has_ongoing_action(AI_ACTION_NADE)) return var/obj/item/explosive/grenade/nade = locate() in equipment_map[HUMAN_AI_GRENADES] if(!nade) return - ADD_ONGOING_ACTION(src, /datum/ongoing_action/throw_grenade, nade, target_floor) + ADD_ONGOING_ACTION(src, AI_ACTION_NADE, nade, target_floor) #undef EXTRA_CHECK_DISTANCE_MULTIPLIER