ChangeElevatorHeight
- Parameters
-
d destructable
newHeight integer
- comment
- patch
1.07
- Source
- Blizzard.j
- return type
nothing
- Source code
function ChangeElevatorHeight takes destructable d, integer newHeight returns nothing local integer oldHeight // Cap the new height within the supported range. set newHeight = IMaxBJ(1, newHeight) set newHeight = IMinBJ(3, newHeight) // Find out what height the elevator is already at. set oldHeight = GetElevatorHeight(d) // Set the elevator's occlusion height. call SetDestructableOccluderHeight(d, bj_CLIFFHEIGHT*(newHeight-1)) if (newHeight == 1) then if (oldHeight == 2) then call SetDestructableAnimation(d, "birth") call QueueDestructableAnimation(d, "stand") elseif (oldHeight == 3) then call SetDestructableAnimation(d, "birth third") call QueueDestructableAnimation(d, "stand") else // Unrecognized old height - snap to new height. call SetDestructableAnimation(d, "stand") endif elseif (newHeight == 2) then if (oldHeight == 1) then call SetDestructableAnimation(d, "death") call QueueDestructableAnimation(d, "stand second") elseif (oldHeight == 3) then call SetDestructableAnimation(d, "birth second") call QueueDestructableAnimation(d, "stand second") else // Unrecognized old height - snap to new height. call SetDestructableAnimation(d, "stand second") endif elseif (newHeight == 3) then if (oldHeight == 1) then call SetDestructableAnimation(d, "death third") call QueueDestructableAnimation(d, "stand third") elseif (oldHeight == 2) then call SetDestructableAnimation(d, "death second") call QueueDestructableAnimation(d, "stand third") else // Unrecognized old height - snap to new height. call SetDestructableAnimation(d, "stand third") endif else // Unrecognized new height - ignore the request. endif endfunction