//=============================================================================
// SpacePawn.
//=============================================================================
class SpacePawn extends KFHumanPawn
placeable;
var bool bSpaceJump,bSpaceWalk;
function SpaceJump(){
bSpaceJump = true;
log( "Executing spacejump" );
}
function SpaceWalk(){
bSpaceWalk = true;
log( "Executing spacewalk" );
}
function trigger( actor Other, pawn EventInstigator ){
local int i;
//for ( i=0; i<Touching.Length; i++ ){
//if (Other.SurfaceType != EST_Default){
SpaceWalk();
log( "Event Trigger" );
log( Other.SurfaceType );
// }
// }
}
function bump( Actor Other ){
local int i;
//for ( i=0; i<Touching.Length; i++ ){
//if (Other.SurfaceType != EST_Default){
SpaceWalk();
log( Other.SurfaceType );
log( "Event Bump" );
// }
// }
}
function touch( Actor Other ){
local int i;
//for ( i=0; i<Touching.Length; i++ ){
//if (Other.IsA('Brush')){
if ( ! Other.IsA('SpacePawn')){
SpaceWalk();
log( Other.SurfaceType );
log( "Event Touch" );
}
//}
// }
}
function bool DoJump( bool bUpdating )
{
if ( !bIsCrouched && !bWantsToCrouch && ((Physics == PHYS_Walking) || (Physics == PHYS_Ladder) || (Physics == PHYS_Spider)) )
{
if ( Role == ROLE_Authority )
{
if ( (Level.Game != None) && (Level.Game.GameDifficulty > 2) )
MakeNoise(0.1 * Level.Game.GameDifficulty);
if ( bCountJumps && (Inventory != None) )
Inventory.OwnerEvent('Jumped');
}
SpaceJump();
if ( Physics == PHYS_Spider )
Velocity = JumpZ * Floor;
else if ( Physics == PHYS_Ladder )
Velocity.Z = 0;
else if ( bIsWalking )
Velocity.Z = Default.JumpZ;
else
Velocity.Z = JumpZ;
if ( (Base != None) && !Base.bWorldGeometry )
Velocity.Z += Base.Velocity.Z;
SetPhysics(PHYS_Falling);
return true;
}
return false;
}
//Simulated function tick(float DeltaTime) {
//log(self.GetStateName() );
//}
state PlayerFlying
{
function HitWall(vector HitNormal, actor Wall){
local int i;
SetPhysics(PHYS_Flying);
//for ( i=0; i<Touching.Length; i++ ){
//if (Other.IsA('Brush')){
log( "Event Hit Wall" );
if ( Physics == PHYS_Flying){
SpaceWalk();
log( Wall.SurfaceType );
log( "Event Hit Wall" );
}
//}
//}
}
}
//=============================================================================
// PawnStart.
//=============================================================================
class PawnStart extends Triggers
placeable;
var() edfindable Actor ResetToPoint;
var() class<MyKFRedTDMPlayer> ResetPawn;
function Touch( Actor Other )
{
local Pawn NewPawn,OldPawn;
local Controller C;
Super.Touch(Other);
if( KFPawn(Other)!=None && KFPawn(Other).Health>0 && KFPawn(Other).Controller!=None )
{
OldPawn = Pawn(Other);
C = OldPawn.Controller;
NewPawn = Spawn(ResetPawn,,,ResetToPoint.Location,ResetToPoint.Rotation);
if( NewPawn==None )
{
C.Pawn.Died(None,Class'DamageType',vect(0,0,0));
return;
}
C.UnPossess();
C.Possess(NewPawn);
OldPawn.Destroy();
UnrealPawn(NewPawn).AddDefaultInventory();
}
}
//=============================================================================
// Space.
//=============================================================================
class Space extends Triggers
placeable;
simulated function tick( float DeltaTime ) {
local Controller C;
local Pawn p;
local int i;
for( C = Level.ControllerList; C != None; C = C.nextController ) {
if ( C.IsA('PlayerController')) {
if ( C.Pawn == none) continue;
p = C.Pawn;
log(p.controller.GetStateName());
//Spidering
if (p.controller.IsInState('PlayerSpidering')&& SpacePawn(p).bSpaceJump) {
p.controller.GotoState('Playerflying');
//p.SetCollision(true, true , true);
//p.bCollideWorld = true;
//playercontroller(p).GroundPitch = 0;
if ( p != None ){
p.SetCollisionSize(p.Default.CollisionRadius,p.Default.CollisionHeight);
p.ShouldCrouch(false);
p.ShouldProne(false);
p.bCrawler = p.Default.bCrawler;
p.bCollideWorld = true;
p.SetCollision(true, true , true);
}
log( "jumping to flying" );
return;
}
// Falling
if (p.controller.IsInState('Playerfalling')) {
p.controller.GotoState('Playerflying');
return;
}
// Flying
if (p.controller.IsInState('Playerflying')&&SpacePawn(p).bSpaceWalk) {
p.SetCollision(true, true , true);
p.bCollideWorld = true;
p.controller.GotoState('Playerspidering');
SpacePawn(p).bSpaceWalk = false;
SpacePawn(p).bSpaceJump = false;
log( "fly to spider" );
return;
}
// Walking
if (p.controller.IsInState('Playerwalking')) {
if (SpacePawn(p).bSpaceJump){
log( "walking to fly" );
p.SetCollision(true, true , true);
p.bCollideWorld = true;
p.controller.GotoState('PlayerFlying');
SpacePawn(p).bSpaceWalk = false;
return;
} log( "walking to spider" );
p.SetCollision(true, true , true);
p.bCollideWorld = true;
p.controller.GotoState('PlayerSpidering');
SpacePawn(p).bSpaceWalk = false;
return;
}
}
}
}