1. How would we get the sun's angle and use it to project the shadow correctly, based on angle?
2. I see that aircraft still keep drawing their blobs even though regular shadows are on. What's up with that? Is there any way to selectively turn shadows on and off, per Unit, via LUA? Or are we going to need to draw shadows entirely via LUA first?
3. I tried to set it up so that I could experiment with using it for ground units. I changed the code that looks at the unitdef for canFly, and tried something else, which isn't working. Here's the original chunk:
Code: Select all
function widget:Update(dt)
gameFrame = GetGameFrame()
if ((gameFrame%90)<1) then
aircraftList = {}
local teams = GetTeamList()
for _,teamID in ipairs(teams) do
teamUnits = GetTeamUnits(teamID)
teamUnits.n = nil
for _,unitID in ipairs(teamUnits) do
unitDefID = GetUnitDefID(unitID)
unitDef = UnitDefs[unitDefID or -1]
if (unitDef)and(unitDef.canFly) then
insert(aircraftList, unitID)
end
end
end
end
Code: Select all
function widget:Update(dt)
gameFrame = GetGameFrame()
if ((gameFrame%90)<1) then
aircraftList = {}
local teams = GetTeamList()
for _,teamID in ipairs(teams) do
teamUnits = GetTeamUnits(teamID)
teamUnits.n = nil
for _,unitID in ipairs(teamUnits) do
unitDefID = GetUnitDefID(unitID)
unitDef = UnitDefs[unitDefID or -1]
local cats = UnitDefs[UnitDefID].modCategories
if (cats) then
if (cats["BLOBSHADOW"]) then insert(aircraftList, unitID)
end
end
end
end
end
end
Error in Update(): [string "LuaUI/Widgets/unit_blobshadow.lua"]:160: attempt to index field '?' (a nil value)
Line 160 is: local cats = UnitDefs[UnitDefID].modCategories
It just seems strange... didn't I already define that field? All I wanted was to use the Category line in the FBI to store the string "BLOBSHADOW"... is there something else I needed to do, to parse this out?