Skip to content

Commit

Permalink
Added a cursor for SetTarget.
Browse files Browse the repository at this point in the history
  • Loading branch information
GoogleFrog committed Nov 20, 2017
1 parent d09a4cd commit 6947a99
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 9 deletions.
9 changes: 9 additions & 0 deletions Anims/cursortarget.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
hotspot center
frame anims/cursortarget_0.png 0.3
frame anims/cursortarget_1.png 0.13
frame anims/cursortarget_2.png 0.10
frame anims/cursortarget_3.png 0.07
frame anims/cursortarget_4.png 0.04
frame anims/cursortarget_3.png 0.07
frame anims/cursortarget_2.png 0.10
frame anims/cursortarget_1.png 0.13
Binary file added Anims/cursortarget_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Anims/cursortarget_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Anims/cursortarget_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Anims/cursortarget_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Anims/cursortarget_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Anims/zk_static/cursortarget_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 14 additions & 9 deletions LuaRules/Gadgets/unit_target_on_the_move.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
if not gadgetHandler:IsSyncedCode() then
return
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

function gadget:GetInfo()
return {
Expand All @@ -17,7 +12,19 @@ function gadget:GetInfo()
enabled = true,
}
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
include("LuaRules/Configs/customcmds.h.lua")

if not gadgetHandler:IsSyncedCode() then
function gadget:Initialize()
Spring.SetCustomCommandDrawData(CMD_UNIT_SET_TARGET, "SetTarget", {1.0, 0.75, 0.0, 0.7}, true)
Spring.SetCustomCommandDrawData(CMD_UNIT_SET_TARGET_CIRCLE, "SetTarget", {1.0, 0.75, 0.0, 0.7}, true)
Spring.AssignMouseCursor("SetTarget", "cursortarget", true, false)
end

return
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local spInsertUnitCmdDesc = Spring.InsertUnitCmdDesc
Expand Down Expand Up @@ -79,14 +86,12 @@ local allyTargetUnits = {
[UnitDefNames["jumpsumo"].id] = true,
}

include("LuaRules/Configs/customcmds.h.lua")

local unitSetTargetCmdDesc = {
id = CMD_UNIT_SET_TARGET,
type = CMDTYPE.ICON_UNIT_OR_RECTANGLE,
name = 'Set Target',
action = 'settarget',
cursor = 'Attack',
cursor = 'SetTarget',
tooltip = 'Sets target for unit, not removed by move commands',
hidden = true,
}
Expand All @@ -96,7 +101,7 @@ local unitSetTargetCircleCmdDesc = {
type = CMDTYPE.ICON_UNIT_OR_AREA,
name = 'Set Target Circle',
action = 'settargetcircle',
cursor = 'Attack',
cursor = 'SetTarget',
tooltip = 'Sets target for unit, not removed by move commands, circle version',
hidden = false,
}
Expand Down

0 comments on commit 6947a99

Please sign in to comment.