var() float NRG;
var() bool bShielded;
var int no;
exec function UnShield()
{
bShielded=false;
TweenAnim('ShldDown', 0.12);
Jump();
}
exec function shield()
{
if(NRG>=5)
{
bshielded=True;
//PlayAnim('ShldUp', 0.7, 0.12);
TweenAnim('HoldShield', 0.12);
gotostate('Shielded');
}
}
State Shielded
{
Ignores TakeDamage;
exec function Fire( optional float F )
{
UnShield();
}
exec function AltFire( optional float F )
{
UnShield();
}
function PlayChatting()
{
}
exec function Taunt( name Sequence )
{
}
function AnimEnd()
{
if ( Role < ROLE_Authority )
return;
if ( Health <= 0 )
{
GotoState('Dying');
return;
}
GotoState('PlayerWalking');
PendingWeapon.SetDefaultDisplayProperties();
ChangedWeapon();
}
function Landed(vector HitNormal)
{
if ( Role == ROLE_Authority )
PlaySound(Land, SLOT_Interact, 0.3, false, 800, 1.0);
if ( bUpdating )
return;
TakeFallingDamage();
bJustLanded = true;
}
function Rise()
{
if ( (Role == ROLE_Authority) && (Health <= 0) )
{
GotoState('Dying');
return;
}
if ( !bRising )
{
bShielded=false;
TweenAnim('ShldDown', 0.12);
Jump();
Enable('AnimEnd');
BaseEyeHeight = Default.BaseEyeHeight;
UnShield();
}
}
function ProcessMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)
{
if ( bJustFired || bPressedJump || (NewAccel.Z > 0) )
Rise();
Acceleration = vect(0,0,0);
}
event PlayerTick( float DeltaTime )
{
Weapon = None; // in case client confused because of weapon switch just before feign death
if ( bUpdatePosition )
ClientUpdatePosition();
PlayerMove(DeltaTime);
}
function ServerMove
(
float TimeStamp,
vector Accel,
vector ClientLoc,
bool NewbRun,
bool NewbDuck,
bool NewbJumpStatus,
bool bFired,
bool bAltFired,
bool bForceFire,
bool bForceAltFire,
eDodgeDir DodgeMove,
byte ClientRoll,
int View,
optional byte OldTimeDelta,
optional int OldAccel
)
{
Global.ServerMove(TimeStamp, Accel, ClientLoc, NewbRun, NewbDuck, NewbJumpStatus,
bFired, bAltFired, bForceFire, bForceAltFire, DodgeMove, ClientRoll, (32767 & (Rotation.Pitch/2)) * 32768 + (32767 & (Rotation.Yaw/2)));
}
function PlayerMove( float DeltaTime)
{
local rotator currentRot;
local vector NewAccel;
aLookup *= 0.24;
aTurn *= 0.24;
// Update acceleration.
if ( !IsAnimating() && (aForward != 0) || (aStrafe != 0) )
NewAccel = vect(0,0,1);
else
NewAccel = vect(0,0,0);
// Update view rotation.
currentRot = Rotation;
UpdateRotation(DeltaTime, 1);
SetRotation(currentRot);
if ( Role < ROLE_Authority ) // then save this move and replicate it
ReplicateMove(DeltaTime, NewAccel, DODGE_None, Rot(0,0,0));
else
ProcessMove(DeltaTime, NewAccel, DODGE_None, Rot(0,0,0));
bPressedJump = false;
}
function PlayDying(name DamageType, vector HitLocation)
{
BaseEyeHeight = Default.BaseEyeHeight;
if ( bRising || IsAnimating() )
Global.PlayDying(DamageType, HitLocation);
}
function ChangedWeapon()
{
Weapon = None;
Inventory.ChangedWeapon();
}
function EndState()
{
bJustFired = false;
bshielded = false;
}
function BeginState()
{
local rotator NewRot;
if ( carriedDecoration != None )
DropDecoration();
NewRot = Rotation;
NewRot.Pitch = 0;
SetRotation(NewRot);
bIsCrouching = false;
bPressedJump = false;
bJustFired = false;
bRising = false;
Disable('AnimEnd');
PlayShield();
bShielded = true;
}
}
function PlayRising()
{
TweenAnim('ShldDown', 0.12);
}
function PlayShield()
{
PlayAnim('ShldUp', 0.7, 0.12);
}