1
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

31 lines
1.3 KiB

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