Added a Is3DLoaded() check to critterMoth

This commit is contained in:
Eddoursul 2024-01-28 04:25:02 +01:00
parent 3805291636
commit 31646a4eac
2 changed files with 4 additions and 2 deletions

Binary file not shown.

View File

@ -448,13 +448,15 @@ Function GoToNewPlant(float afSpeed)
string landingMarkerName = LandingMarkerPrefix + RandomInt(1, 3)
float newPlantDistance = Math.sqrt(Math.pow(newPlantX - self.GetPositionX(), 2) + Math.pow(newPlantY - self.GetPositionY(), 2) + Math.pow(newPlantZ - self.GetPositionZ(), 2))
float adjustedBellShapePathHeight = fBellShapePathHeight - (fBellShapePathHeight * (Math.pow(0.995, newPlantDistance)))
if (newPlant.HasNode(landingMarkerName))
bool bIsLoaded = newPlant.Is3DLoaded()
if (bIsLoaded && newPlant.HasNode(landingMarkerName))
BellShapeTranslateToRefNodeAtSpeedAndGotoState(CurrentPlant, landingMarkerName, adjustedBellShapePathHeight, afSpeed, fMaxRotationSpeed, "AtPlant")
else
; traceConditional(self + " could not find landing marker " + landingMarkerName + " on plant " + newPlant, bCritterDebug)
string firstMarkerName = LandingMarkerPrefix + 1
if (newPlant.HasNode(firstMarkerName))
if (bIsLoaded && newPlant.HasNode(firstMarkerName))
BellShapeTranslateToRefNodeAtSpeedAndGotoState(CurrentPlant, firstMarkerName, adjustedBellShapePathHeight, afSpeed, fMaxRotationSpeed, "AtPlant")
else
; traceConditional(self + " could not find landing marker " + firstMarkerName + " on plant " + newPlant, bCritterDebug)