Skip to content

Commit

Permalink
Fix air wrecks
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheeo committed Dec 13, 2014
1 parent 44d76ae commit 4210bd3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lua/sim/Unit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1424,11 +1424,15 @@ Unit = Class(moho.unit_methods) {
mass = mass * 0.5
energy = energy * 0.5
end

if self:GetCurrentLayer() == 'Air' then
pos[2] = GetSurfaceHeight(pos[1], pos[3])
elseif self:GetCurrentLayer() == 'Seabed' or self:GetCurrentLayer() == 'Land' then
pos[2] = GetTerrainHeight(pos[1], pos[3]) + GetTerrainTypeOffset(pos[1], pos[3])
else
pos[2] = GetSurfaceHeight(pos[1], pos[3]) + GetTerrainTypeOffset(pos[1], pos[3])
end

-- Stop the Y position of the wreck being on the seabed for Naval Factories
if not (EntityCategoryContains(categories.FACTORY, self) and EntityCategoryContains(categories.STRUCTURE, self) and EntityCategoryContains(categories.NAVAL, self)) then
pos[2] = GetTerrainHeight(pos[1], pos[3]) + GetTerrainTypeOffset(pos[1], pos[3])
end

local prop = CreateProp( pos, wreck )

Expand Down

1 comment on commit 4210bd3

@aeoncleanse
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change has not worked. Loaded up Crag Dunes with this branch up to date and checked out, and I still get hovering Air wrecks.

Please sign in to comment.