From d9d78715cd74010d29bcf169c7b0b8ea44f541cc Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sat, 2 Apr 2016 11:36:31 +0200 Subject: [PATCH] Fix paratroopers on heightmapped terrain --- OpenRA.Mods.Common/Activities/Parachute.cs | 4 ++-- OpenRA.Mods.Common/Traits/Mobile.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Activities/Parachute.cs b/OpenRA.Mods.Common/Activities/Parachute.cs index a9f2b40e01..04a7d09133 100644 --- a/OpenRA.Mods.Common/Activities/Parachute.cs +++ b/OpenRA.Mods.Common/Activities/Parachute.cs @@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Activities Activity LastTick(Actor self) { - pos.SetPosition(self, currentPosition - new WVec(0, 0, currentPosition.Z)); + pos.SetPosition(self, currentPosition); if (um != null) foreach (var u in para.ParachuteUpgrade) @@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Activities currentPosition -= fallVector; // If the unit has landed, this will be the last tick - if (currentPosition.Z <= 0) + if (self.World.Map.DistanceAboveTerrain(currentPosition).Length <= 0) return LastTick(self); pos.SetVisualPosition(self, currentPosition); diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index 7962d309a7..7166f0fea1 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -422,7 +422,7 @@ namespace OpenRA.Mods.Common.Traits { var cell = self.World.Map.CellContaining(pos); SetLocation(cell, FromSubCell, cell, FromSubCell); - SetVisualPosition(self, self.World.Map.CenterOfSubCell(cell, FromSubCell) + new WVec(0, 0, pos.Z)); + SetVisualPosition(self, self.World.Map.CenterOfSubCell(cell, FromSubCell) + new WVec(0, 0, self.World.Map.DistanceAboveTerrain(pos).Length)); FinishedMoving(self); }