Skip to content

Commit

Permalink
New icons, emulating style of current commands. Implemented cache as …
Browse files Browse the repository at this point in the history
…true false instead of positive/negative numbers.
  • Loading branch information
Dave-tB committed Oct 6, 2021
1 parent 48c163e commit b31b8bc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
Binary file modified Anims/cursorplate_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 modified Anims/zk_large/cursorplate_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions LuaRules/Configs/customcmds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
-- 30000 - 39999: LuaRules
--

--[[ WARNING!! Only BASE VANILLA ZK commands belong here!
If you are a modder adding custom commands, MAKE YOUR OWN FILE.
By overriding this file you're SETTING YOURSELF UP FOR FAILURE
when ZK adds something to this file (your override won't have
the new addition) and making things confusing for other modders
who might want to use your code (with your own file it will be
obvious where the extra commands are coming from). ]]

-- if you add a command, please order it by ID!
return {
RETREAT_ZONE = 10001,
Expand Down Expand Up @@ -107,4 +115,7 @@ return {

-- build plate
PLATE = 39802,

--[[ WARNING!! Only BASE VANILLA ZK commands belong here!
See the bigass chunk of text at the top of the file. ]]
}
8 changes: 4 additions & 4 deletions LuaRules/Gadgets/cmd_generic_plate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ function setContains(set, key)
end

local function CanBuildFactoryPlate(unitDefID)
if not (setContains(defIDCache, unitDefID) or setContains(defIDCache, -unitDefID)) then
if not (setContains(defIDCache, {unitDefID, true}) or setContains(defIDCache, {unitDefID, false})) then
local ud = UnitDefs[unitDefID]
local bo = ud.buildOptions
for i = 1, #bo do
local cp = UnitDefs[bo[i]].customParams
if cp.parent_of_plate then
addToSet(defIDCache, unitDefID, true)
addToSet(defIDCache, {unitDefID, true})
return true
end
end
addToSet(defIDCache, -unitDefID)
addToSet(defIDCache, {unitDefID, false})
return false
else
if setContains(defIDCache, unitDefID) then
if setContains(defIDCache, {unitDefID, true}) then
return true
else
return false
Expand Down
Binary file modified LuaUI/Images/commands/plate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b31b8bc

Please sign in to comment.