Code: Select all
function gadget:UnitFinished(unitID, unitDefID, teamID)
if (is_miner_type (unitDefID) == true) then
Code: Select all
function is_miner_type (unitDefID)
Spring.Echo("is_miner_type called!")
local def = UnitDefs[unitDefID]
--Spring.Echo(def)
local custom = def.customParams
if(custom) then
--Spring.Echo(m)
--Spring.Echo(UnitDefs[unitDefID])
return custom.is_miner
end
--[[
if (unitDefID == nil) then return false end
local unitDef = UnitDefs[unitDefID]
if (unitDef == nil) then return false end
local unitname = unitDef.name
for _,v in pairs(miner_name) do
if v == unitname then return true end
end ]]
return false
end