function ModifyGateBJ takes integer gateOperation, destructable d returns nothing
if (gateOperation == bj_GATEOPERATION_CLOSE) then
if (GetDestructableLife(d) <= 0) then
call DestructableRestoreLife(d, GetDestructableMaxLife(d), true)
endif
call SetDestructableAnimation(d, "stand")
elseif (gateOperation == bj_GATEOPERATION_OPEN) then
if (GetDestructableLife(d) > 0) then
call KillDestructable(d)
endif
call SetDestructableAnimation(d, "death alternate")
elseif (gateOperation == bj_GATEOPERATION_DESTROY) then
if (GetDestructableLife(d) > 0) then
call KillDestructable(d)
endif
call SetDestructableAnimation(d, "death")
else
// Unrecognized gate state - ignore the request.
endif
endfunction