@@ -49,8 +49,10 @@ HeightDieUpdateModuleData::HeightDieUpdateModuleData( void )
4949{
5050
5151 m_targetHeightAboveTerrain = 0 .0f ;
52+ m_dieAboveTargetHeight = FALSE ;
5253 m_targetHeightIncludesStructures = FALSE ;
5354 m_onlyWhenMovingDown = FALSE ;
55+ m_onlyWhenMovingUp = FALSE ;
5456 m_destroyAttachedParticlesAtHeight = -1 .0f ;
5557 m_snapToGroundOnDeath = FALSE ;
5658 m_initialDelay = 0 ;
@@ -68,7 +70,9 @@ void HeightDieUpdateModuleData::buildFieldParse(MultiIniFieldParse& p)
6870 {
6971 { " TargetHeight" , INI::parseReal, NULL , offsetof ( HeightDieUpdateModuleData, m_targetHeightAboveTerrain ) },
7072 { " TargetHeightIncludesStructures" , INI::parseBool, NULL , offsetof ( HeightDieUpdateModuleData, m_targetHeightIncludesStructures ) },
73+ { " DieAboveTargetHeight" , INI::parseBool, NULL , offsetof ( HeightDieUpdateModuleData, m_dieAboveTargetHeight) },
7174 { " OnlyWhenMovingDown" , INI::parseBool, NULL , offsetof ( HeightDieUpdateModuleData, m_onlyWhenMovingDown ) },
75+ { " OnlyWhenMovingUp" , INI::parseBool, NULL , offsetof ( HeightDieUpdateModuleData, m_onlyWhenMovingUp ) },
7276 { " DestroyAttachedParticlesAtHeight" , INI::parseReal, NULL , offsetof ( HeightDieUpdateModuleData, m_destroyAttachedParticlesAtHeight ) },
7377 { " SnapToGroundOnDeath" , INI::parseBool, NULL , offsetof ( HeightDieUpdateModuleData, m_snapToGroundOnDeath ) },
7478 { " InitialDelay" , INI::parseDurationUnsignedInt, NULL , offsetof ( HeightDieUpdateModuleData, m_initialDelay ) },
@@ -148,6 +152,14 @@ UpdateSleepTime HeightDieUpdate::update( void )
148152
149153 }
150154
155+ if (modData->m_onlyWhenMovingUp )
156+ {
157+
158+ if (pos->z <= m_lastPosition.z )
159+ directionOK = FALSE ;
160+
161+ }
162+
151163 // get the terrain height
152164 Real terrainHeightAtPos = TheTerrainLogic->getGroundHeight ( pos->x , pos->y );
153165
@@ -215,8 +227,15 @@ UpdateSleepTime HeightDieUpdate::update( void )
215227
216228 }
217229
230+ bool doTheKill = false ;
231+
232+ if (modData->m_dieAboveTargetHeight )
233+ doTheKill = pos->z > targetHeight && directionOK;
234+ else
235+ doTheKill = pos->z < targetHeight && directionOK;
236+
218237 // if we are below the target height ... DIE!
219- if ( pos-> z < targetHeight && directionOK )
238+ if (doTheKill )
220239 {
221240
222241 // if we're supposed to snap us to the ground on death do so
0 commit comments