tl;dr goes to top of post

normal flying units (like flying windmills or hover turrets) seem to be np, factories have with some quirks.
-------------
air unit with maxVelocity=0
-spawns at ground, then rises to its flightheight
-bops up and down a bit, as spring aircraft never like to sit 100% still
-when bumped, there is a chance that it will go flying in a random direction, off the map. (wut)
-builders can build under it
-aircrafts can not be a factory
------
unit script:
Code: Select all
function script.Create()
Spring.MoveCtrl.Enable (unitID)
local x,y,z = Spring.GetUnitPosition (unitID)
Spring.MoveCtrl.SetPosition (unitID, x,y+300,z)
now unit sits perfectly still at its position in the air.
aircraft:
-when bumped, moves a few pixels (hardly noticeable but interessting)
coud be avoided by reseting position now and then or maybe there is some function for that.
ground unit:
works too, not sure what happens on collision
(was hard to tell and cba to make a testunit with bigger colsphere)
buildings:
-ground still blocked by yardmap, builders refuse to builder under unit
-yardMap = "yyy yyy yyy", and ground is free, builders build
yardmap = "" does not work.
factory:
[GiveUnits] spawned 1 tpfactory2 unit(s) for team 0
[f=0013556] [string "scripts/tpfactory2.lua"]:64: Enable(): Bad unitID
[f=0013556] stack traceback:
[C]: in function 'Enable'
[string "scripts/tpfactory2.lua"]:64: in function 'fun'
[string "LuaGadgets/Gadgets/unit_script.lua"]:747: in function <[string "LuaGadgets/Gadgets/unit_script.lua"]:745>
(wut)
A wupget appears:
Code: Select all
local fly = {
-- [UnitDefNames["tpjeep"].id] = true,
[UnitDefNames["tpsmallfac"].id] = true,
}
function gadget:UnitCreated(unitID, unitDefID, unitTeam, builderID)
if fly[unitDefID] then
Spring.MoveCtrl.Enable (unitID)
local x,y,z = Spring.GetUnitPosition (unitID)
Spring.MoveCtrl.SetPosition (unitID, x,y+200,z)
end
end
Now the factory is in the air.
It builds, finished units appear at ground.
Problem:
build something under the factory and it can not build stuff.
(and builders will not begin construction under factory while it is building)
Problems seems to be that factory does not want to build if something is "in" in. Maybe solvable with different yardmap or moving the nanopiece elsewhere?
Funfact:
Flying factory on top of normal factory:

Both can build, but only if the top factory is given the order first.
with all these variants, enemies will target the unit like before.
(this means moving your unit into the air does not make it targetable by AA weapons, you need to set categories)
Need a way to make factories build even if their buildspot is blocked.