Beherith wrote:If one cant build on dunes, how does one cap mexes in sand?
Units that extract metal are allowed:
Code: Select all
local isNotValid = {}
for uDefID, uDef in pairs(UnitDefs) do
if (uDef.extractsMetal == 0) and (uDef.maxAcc < 0.01) then --if it's not a metal extractor and does not move, it is not valid
if string.find(uDef.tooltip, " Mine") == nil then --if it's a mine, it is valid
isNotValid[uDefID] = true
end
end
end
The code above defines the list of units that can't be built on the sand. Though it looks odd, I'm using maxAcc<0.01 as a test because nano turret is not isBuilding=true, and dragon's claw has some infintessimally small maxAcc. If there's a better way than string-searching to sort mines (the kind that blow up) out of the unit blacklist, let me know.
edit: On another note, I'm fiddling with moving invalid build commands to the nearest bit of rock, so that AIs are not totally broken. The code to find nearest rock works okay, but issuing new commands seems not to do anything. Does this need to be done with a widget instead of a gadget?