From 7b9bfb637e6397ec8f837599d30b0b04b6ccba17 Mon Sep 17 00:00:00 2001 From: real_tabasco_sauce Date: Mon, 16 Sep 2024 08:52:24 -0700 Subject: [PATCH] only use sound for buildings with arrows --- community-mod/gui/session/unit_actions.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/community-mod/gui/session/unit_actions.js b/community-mod/gui/session/unit_actions.js index 9bda86a..1922b32 100644 --- a/community-mod/gui/session/unit_actions.js +++ b/community-mod/gui/session/unit_actions.js @@ -1042,7 +1042,7 @@ var g_UnitActions = "pushFront": pushFront }); - if (action.data.command === "attack-only" || action.data.command === "attack") + if (action.data.sound) Engine.GuiInterfaceCall("PlaySound", { "name": "focus_fire", "entity": action.firstAbleEntity @@ -1080,12 +1080,16 @@ var g_UnitActions = // default to walking there (or attack-walking if hotkey pressed) let data = { "command": "walk" }; let cursor = ""; + data.sound = false; - if (Engine.HotkeyIsPressed("session.attack")) { + if (entState.attack && Engine.HotkeyIsPressed("session.attack")) { cursor = "action-target"; data.command = "attack-only"; if (targetState && playerCheck(entState, targetState, ["Enemy"])) + { data.target = targetState.id; + data.sound = true; + } return { "possible": true, "data": data, @@ -1228,6 +1232,8 @@ var g_UnitActions = else { cursor = "action-attack"; data.command = "attack"; + if (entState.attack) + data.sound = true; } }