Skip to content

Commit

Permalink
Fix buildlocation elevation
Browse files Browse the repository at this point in the history
  • Loading branch information
Uveso authored and shalkya committed Aug 10, 2020
1 parent b4d103d commit d587e9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions engine/Sim/CAiBrain.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ end
--- Orders the builder to build a unit.
-- @param builder Unit, (engineer) to use.
-- @param blueprintID Unit's bp ID to build, example: 'ueb0101'.
-- @param locationInfo Table {x, z, 0}.
-- @param something TODO: true/false.
-- @param buildLocation Table {x, z, 0}.
-- @param buildRelative: true/false. true = build coordinates are relative to the starting location, false = absolute coords
-- @return true/false
function CAiBrain:BuildStructure(builder, blueprintID, locationInfo, something)
function CAiBrain:BuildStructure(builder, blueprintID, buildLocation, buildRelative)
end

--- Orders a mobile factory to build a unit.
Expand Down
7 changes: 3 additions & 4 deletions lua/platoon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3590,15 +3590,14 @@ Platoon = Class(moho.platoon_methods) {
while not eng.Dead and not commandDone and table.getn(eng.EngineerBuildQueue) > 0 do
local whatToBuild = eng.EngineerBuildQueue[1][1]
local buildLocation = {eng.EngineerBuildQueue[1][2][1], 0, eng.EngineerBuildQueue[1][2][2]}
if GetTerrainHeight(buildLocation[1], buildLocation[2]) > GetSurfaceHeight(buildLocation[1], buildLocation[2]) then
if GetTerrainHeight(buildLocation[1], buildLocation[3]) > GetSurfaceHeight(buildLocation[1], buildLocation[3]) then
--land
buildLocation[2] = GetTerrainHeight(buildLocation[1], buildLocation[2])
buildLocation[2] = GetTerrainHeight(buildLocation[1], buildLocation[3])
else
--water
buildLocation[2] = GetSurfaceHeight(buildLocation[1], buildLocation[2])
buildLocation[2] = GetSurfaceHeight(buildLocation[1], buildLocation[3])
end
local buildRelative = eng.EngineerBuildQueue[1][3]

if not eng.NotBuildingThread then
eng.NotBuildingThread = eng:ForkThread(eng.PlatoonHandle.WatchForNotBuilding)
end
Expand Down

0 comments on commit d587e9c

Please sign in to comment.