http://springrts.git.sourceforge.net/gi ... b6;hb=HEAD
Could I request that HaveFreeLineOfFire or TryTarget become callable as a Lua function?
More precisely, I would like a function that returns true/false depending on whether a specific unit's specific weapon can fire at a target point.
EDIT:
Ability to accept hypothetical units would be VERY nice. (unitID replaced with unitDefID and x/y/z unit position)
This would greatly help unit AI determine good targets as well as tower placement for full AIs.
New Lua function: HasClearFiringLine
Moderator: Moderators
Re: New Lua function: HasClearFiringLine
+1 , I see this as a very useful feature, especially the virtual firing test. It should probably consist of a range of functions or overloaded variations:
The base function could be:
checkMobile, checkBuildings, checkFeatures and checkAllies would be optional flags to determine what obstacles are consider blocking for the purpose of the calculation.
From that base function a range of convenience functions could be defined either in the engine or in the mod, such as
The base function could be:
Code: Select all
trueOrFalse = GetWeaponCanHitPos(weaponDefId, locX, locY, locZ, targetX, targetY, targetZ, [checkMobile], [checkBuildings], [checkFeatures], [checkAllies])
From that base function a range of convenience functions could be defined either in the engine or in the mod, such as
Code: Select all
-- Return weapon id of first weapon that can hit, or null if can't.
GetUnitCanHitPos(unitID, targetX, targetY, targetZ)
GetDefCanHitPos(defID, locX, locY, locZ, targetX, targetY, targetZ)
GetUnitCanHitDef(unitID, defID, targetX, targetY, targetZ)
GetDefCanHitDef(defID, defID, locX, locY, locZ, targetX, targetY, targetZ)
GetUnitCanHitUnit(unitID, unitID)
GetDefCanHitUnit(defID, unitID, locX, locY, locZ)
Re: New Lua function: HasClearFiringLine
This is relevant to my interests. That thing i should be working on, one module in it always gets stuck when units are ordered to shoot at ground that they can't shoot.