Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the broken music slider and linked the trackbars (a page refresh for the submenu is still required). Add information for the fighter pullup error.
- Loading branch information
1 parent
d30570c
commit 8777f8c
Showing
3 changed files
with
89 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,38 @@ | ||
if not gadgetHandler:IsSyncedCode() then return end | ||
|
||
function gadget:GetInfo() return { | ||
name = "Fighter pull-up", | ||
desc = "Sets attack safety distance for fighter/bomber aircraft", | ||
author = "raaar", | ||
date = "2015", | ||
license = "PD", | ||
layer = 3, | ||
enabled = true | ||
} end | ||
function gadget:GetInfo() | ||
return { | ||
name = "Fighter pull-up", | ||
desc = "Sets attack safety distance for fighter/bomber aircraft", | ||
author = "raaar", | ||
date = "2015", | ||
license = "PD", | ||
layer = 3, | ||
enabled = true | ||
} | ||
end | ||
|
||
local pullupDist = {} | ||
|
||
for unitDefID, unitDef in pairs(UnitDefs) do | ||
local dist = unitDef.customParams.fighter_pullup_dist | ||
if dist then | ||
pullupDist[unitDefID] = dist | ||
end | ||
end | ||
|
||
local spMcSetAirMoveTypeData = Spring.MoveCtrl.SetAirMoveTypeData | ||
local spMoveCtrlGetTag = Spring.MoveCtrl.GetTag | ||
local spMoveCtrlSetAirMoveTypeData = Spring.MoveCtrl.SetAirMoveTypeData | ||
local moveTypeDataTable = {attackSafetyDistance = 123} | ||
|
||
function gadget:UnitCreated(unitID, unitDefID) | ||
local dist = pullupDist[unitDefID] | ||
if dist then | ||
moveTypeDataTable.attackSafetyDistance = dist | ||
spMcSetAirMoveTypeData(unitID, moveTypeDataTable) | ||
if spMoveCtrlGetTag(unitID) == nil then | ||
moveTypeDataTable.attackSafetyDistance = dist | ||
spMoveCtrlSetAirMoveTypeData(unitID, moveTypeDataTable) | ||
else | ||
Spring.Echo("LUA_ERRRUN", "Fighter pullup with spMoveCtrlGetTag", (UnitDefs[unitDefID] and UnitDefs[unitDefID].name) or "noname") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters