only use sound for buildings with arrows

This commit is contained in:
real_tabasco_sauce 2024-09-16 08:52:24 -07:00
parent e4aedaf3ac
commit 7b9bfb637e

View File

@ -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;
}
}