From 7ca0020a7ba047f7127b4fd775dd3ccf382e667a Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 15 Sep 2024 22:12:09 -0700 Subject: [PATCH] fixes a few bugs --- .../carbon/human/ai/action_datums/pickup_primary.dm | 8 ++++++++ .../mob/living/carbon/human/ai/brain/ai_brain_items.dm | 2 +- .../living/carbon/human/ai/faction_management_panel.dm | 4 ++-- colonialmarines.dme | 1 + tgui/packages/tgui/interfaces/HumanFactionManager.tsx | 8 ++++---- 5 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 code/modules/mob/living/carbon/human/ai/action_datums/pickup_primary.dm diff --git a/code/modules/mob/living/carbon/human/ai/action_datums/pickup_primary.dm b/code/modules/mob/living/carbon/human/ai/action_datums/pickup_primary.dm new file mode 100644 index 0000000000..634df82299 --- /dev/null +++ b/code/modules/mob/living/carbon/human/ai/action_datums/pickup_primary.dm @@ -0,0 +1,8 @@ +/// In case they drop their primary but get a new one in the time it takes to retrieve their old one +/datum/ongoing_action/item_pickup/pickup_primary + name = "Pickup Primary" + +/datum/ongoing_action/item_pickup/pickup_primary/trigger_action() + if(brain.primary_weapon) + return ONGOING_ACTION_COMPLETED + return ..() diff --git a/code/modules/mob/living/carbon/human/ai/brain/ai_brain_items.dm b/code/modules/mob/living/carbon/human/ai/brain/ai_brain_items.dm index c6af584f79..3e29b4931b 100644 --- a/code/modules/mob/living/carbon/human/ai/brain/ai_brain_items.dm +++ b/code/modules/mob/living/carbon/human/ai/brain/ai_brain_items.dm @@ -235,7 +235,7 @@ if(dropped == primary_weapon) set_primary_weapon(null) - ADD_ONGOING_ACTION(src, /datum/ongoing_action/item_pickup, dropped) + ADD_ONGOING_ACTION(src, /datum/ongoing_action/item_pickup/pickup_primary, dropped) for(var/slot in container_refs) if(container_refs[slot] == dropped) appraise_inventory(slot == "belt", slot == "backpack", slot == "left_pocket", slot == "right_pocket") diff --git a/code/modules/mob/living/carbon/human/ai/faction_management_panel.dm b/code/modules/mob/living/carbon/human/ai/faction_management_panel.dm index a19ec905d6..6780255589 100644 --- a/code/modules/mob/living/carbon/human/ai/faction_management_panel.dm +++ b/code/modules/mob/living/carbon/human/ai/faction_management_panel.dm @@ -109,7 +109,7 @@ return var/datum/human_ai_faction/faction_obj = SShuman_ai.human_ai_factions[gotten_faction] - var/gotten_input = tgui_input_list(ui.user, "Set which faction being neutral to [gotten_faction]?", "Add Neutral Faction", (FACTION_LIST_HUMANOID + FACTION_LIST_XENOMORPH) - faction_obj.get_neutral_factions()) + var/gotten_input = tgui_input_list(ui.user, "Set which faction being neutral to [gotten_faction]?", "Add Neutral Faction", (FACTION_LIST_HUMANOID + FACTION_LIST_XENOMORPH) - faction_obj.get_neutral_factions() - faction_obj.faction) if(!gotten_input) return @@ -124,7 +124,7 @@ return var/datum/human_ai_faction/faction_obj = SShuman_ai.human_ai_factions[gotten_faction] - var/gotten_input = tgui_input_list(ui.user, "Set which faction being friendly to [gotten_faction]?", "Add Friendly Faction", (FACTION_LIST_HUMANOID + FACTION_LIST_XENOMORPH) - faction_obj.get_friendly_factions()) + var/gotten_input = tgui_input_list(ui.user, "Set which faction being friendly to [gotten_faction]?", "Add Friendly Faction", (FACTION_LIST_HUMANOID + FACTION_LIST_XENOMORPH) - faction_obj.get_friendly_factions() - faction_obj.faction) if(!gotten_input) return diff --git a/colonialmarines.dme b/colonialmarines.dme index d9976e6d6b..e11d4e4f5e 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -1981,6 +1981,7 @@ #include "code\modules\mob\living\carbon\human\ai\ai_equipment.dm" #include "code\modules\mob\living\carbon\human\ai\ai_management_menu.dm" #include "code\modules\mob\living\carbon\human\ai\faction_management_panel.dm" +#include "code\modules\mob\living\carbon\human\ai\action_datums\pickup_primary.dm" #include "code\modules\mob\living\carbon\human\ai\action_datums\orders\order_action.dm" #include "code\modules\mob\living\carbon\human\ai\action_datums\orders\patrol_waypoints.dm" #include "code\modules\mob\living\carbon\human\ai\brain\ai_brain_communication.dm" diff --git a/tgui/packages/tgui/interfaces/HumanFactionManager.tsx b/tgui/packages/tgui/interfaces/HumanFactionManager.tsx index 0999a717e9..07fbf02c8e 100644 --- a/tgui/packages/tgui/interfaces/HumanFactionManager.tsx +++ b/tgui/packages/tgui/interfaces/HumanFactionManager.tsx @@ -99,7 +99,7 @@ const ExistingFaction = (props) => { content="Add" onClick={() => act('add_friendly_faction', { - faction: faction, + faction: faction.name, }) } style={{ @@ -110,7 +110,7 @@ const ExistingFaction = (props) => { content="Remove" onClick={() => act('remove_friendly_faction', { - faction: faction, + faction: faction.name, }) } style={{ @@ -126,7 +126,7 @@ const ExistingFaction = (props) => { content="Add" onClick={() => act('add_neutral_faction', { - faction: faction, + faction: faction.name, }) } style={{ @@ -137,7 +137,7 @@ const ExistingFaction = (props) => { content="Remove" onClick={() => act('remove_neutral_faction', { - faction: faction, + faction: faction.name, }) } style={{