Loading...
  OR  Zero-K Name:    Password:   

Post edit history

B1110785 2 on IncultaV2 (Multiplayer)

To display differences between versions, select one or more edits in the list using checkboxes and click "diff selected"
Post edit history
Date Editor Before After
5/9/2021 4:55:50 PMUSrankDave[tB] before revert after revert
Before After
1 For some reason unitnostuckinfactory.lua does not help in the case of an attack move order. 1 For some reason unitnostuckinfactory.lua does not help in the case of an attack move order.
2 \n 2 \n
3 This annoyed me enough I wrote a local widget. If a mobile builder is given an attack move order, this will insert a move order before. Here is the meat of it: 3 This annoyed me enough I wrote a local widget. If a mobile builder is given an attack move order, this will insert a move order before. Here is the meat of it:
4 4 function widget:UnitFromFactory( unitID, unitDefID, unitTeam, factID, factDefID, userOrders)
5 function widget:UnitCreated(unitID, unitDefID, unitTeam, builderID)
6 ---Order unit to move away from factory's build yard--- 5 ---Order unit to move away from factory's build yard---
7 if ( UnitDefs[unitDefID].isMobileBuilder ) then 6 if ( UnitDefs[unitDefID].isMobileBuilder ) then
8 local cmdID, _, _, cmdX, cmdY, cmdZ = Spring. GetUnitCurrentCommand( builderID) 7 local cmdID, _, _, cmdX, cmdY, cmdZ = Spring. GetUnitCurrentCommand( factID)
9 -- Fight command is cmdID 16 8 -- Fight command is cmdID 16
10 if ( cmdID == 16 ) then 9 if ( cmdID == 16 ) then
11 local dx,_,dz = Spring.GetUnitDirection(unitID) 10 local dx,_,dz = Spring.GetUnitDirection(unitID)
12 local x,y,z = Spring.GetUnitPosition(unitID) 11 local x,y,z = Spring.GetUnitPosition(unitID)
13 dx = dx*100 --Note: don't need trigonometry here because factory direction is either {0+-,1+-} or {1+-,0+-} (1 or 0), so multiply both with 100 elmo is enough 12 dx = dx*100 --Note: don't need trigonometry here because factory direction is either {0+-,1+-} or {1+-,0+-} (1 or 0), so multiply both with 100 elmo is enough
14 dz = dz*100 13 dz = dz*100
15 Spring.GiveOrderArrayToUnitArray( {unitID},{ 14 Spring.GiveOrderArrayToUnitArray( {unitID},{
16 {CMD.INSERT, {0, CMD_RAW_MOVE, CMD.OPT_INTERNAL, x+dx, y, z+dz}, CMD.OPT_ALT}, 15 {CMD.INSERT, {0, CMD_RAW_MOVE, CMD.OPT_INTERNAL, x+dx, y, z+dz}, CMD.OPT_ALT},
17 {CMD.INSERT, {1, cmdID, CMD.OPT_INTERNAL, cmdX, cmdY, cmdZ}, CMD.OPT_ALT}, 16 {CMD.INSERT, {1, cmdID, CMD.OPT_INTERNAL, cmdX, cmdY, cmdZ}, CMD.OPT_ALT},
18 })--insert move command before current fight command 17 })--insert move command before current fight command
19 end 18 end
20 end 19 end
21 end 20 end