enderalse/source/scripts/_00e_playerhousingcurrentomanipulate.psc

32 lines
1.3 KiB
Plaintext

Scriptname _00E_PlayerhousingCurrentOManipulate extends ReferenceAlias
float deltaTranslationZ = 0.0
float deltaRotation = 0.0
;translations needs to be extracted from the rest of the code due to performance reasons (don't know why exactely, but defining new functions slows this down dramatically)
;the registerForControl / unregisterForControl are called in _00E_PlayerhousingMaster
Event onControlDown(String control)
getRef().stopTranslation()
if control == "Forward"
deltaTranslationZ = 100
elseif control == "Back"
deltaTranslationZ = -100
elseif control == "strafe left"
deltaRotation = 100
elseif control == "strafe right"
deltaRotation = -100
Endif
getRef().translateTo(getRef().getPositionX(), getRef().getPositionY(), getRef().getPositionZ() + deltaTranslationZ, getRef().getAngleX(), getRef().getAngleY(), getRef().getAngleZ() + deltaRotation, 100, 100)
Endevent
Event onControlUp(String control, float holdTime)
getRef().stopTranslation()
if control == "Forward" || control == "Back"
deltaTranslationZ = 0
elseif control == "strafe left" || control == "strafe right"
deltaRotation = 0
Endif
getRef().translateTo(getRef().getPositionX(), getRef().getPositionY(), getRef().getPositionZ() + deltaTranslationZ, getRef().getAngleX(), getRef().getAngleY(), getRef().getAngleZ() + deltaRotation, 100, 100)
Endevent