## Engine
Class Pawn

source: C:\XIII\Engine\Classes\Pawn.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Pawn

Direct Known Subclasses:Scout, Vehicle, USA02HelicoBoss, XIIIAmbientPawn, XIIIPawn, TheDuck

class Pawn
extends Engine.Actor

    //=============================================================================
    // Pawn, the base class of all actors that can be controlled by players or AI.
    //
    // Pawns are the physical representations of players and creatures in a level.
    // Pawns have a mesh, collision, and physics.  Pawns can take damage, make sounds,
    // and hold weapons and other inventory.  In short, they are responsible for all
    // physical interaction between the player or AI and the world.
    //
    // This is a built-in Unreal class and it shouldn't be modified.
    //=============================================================================

Variables
`float` | `AccelRate` max acceleration rate
`float` | `AirControl` amount of AirControl available to the pawn
`float` | `AirSpeed` The maximum flying speed.
`byte` | `AltFlashCount` used for third person weapon anims/effects
`NavigationPoint` | `Anchor` current nearest path;
`float` | `Angle` current angle (sin) for the SpineYaw
`name` | `AnimAction` use for replicating anims
`int` | `AnimM16` used for the Random Choice for the M16 Firing Animation
`name` | `AnimStatus` PlayerControllerState to use when moving in water
`float` | `AvgPhysicsTime` Physics updating time monitoring (for AI monitoring reaching destinations)
`float` | `BaffeTimer` to reset Baffe(tm) Channel
`float` | `BaseEyeHeight` Base eye height above collision center.
`class` | `BloodEffect` Name used for this pawn type in menus (e.g. player selection)
`float` | `BreathTime` used for getting BreathTimer() messages (for no air, etc.)
`float` | `CarcassCollisionHeight` collision height of dead body lying on the ground
`Actor` | `ControlledActor` Actor being controlled by Pawn e.g. KVehicle, WeaponTurret
`Controller` | `Controller`
`Controller` | `Controller`
`class` | `ControllerClass` default class to use when pawn is controlled by AI (can be modified by an AIScript)
`byte` | `ControllerPitch` used for the net spine control
`float` | `CrouchHeight` CollisionHeight when crouching
`float` | `CrouchRadius` CollisionRadius when crouching
`int` | `CrouchedVisibility` Visibility to give a pawn if crouched
`float` | `CrouchingPct` pct. of running speed (GroundSpeed) that crouching speed is
`EDrawType` | `DTMemorize` Used when taken as a corpse
`float` | `DTimerStep` Steps for Breathtimer
`float` | `DeadPawnSightCounter` once dead, this is the delay before the pawn signal himself to the other controllers
`float` | `DelayBeforeDestroyWhenDead` The pawn's current Helm.
`float` | `DesiredSpeed` How visible is the pawn? 0=invisible, 128=normal, 255=highly visible
`float` | `DistanceBeforeDestroyWhenDead` The pawn's current Helm.
`float` | `DrownTimer` Time underwater
`Emitter` | `DrowningSFX` Used for Damage location
`float` | `EyeHeight` Current eye height, adjusted for bobbing and stairs.
`byte` | `FlashCount` used for third person weapon anims/effects
`vector` | `Floor` Normal of floor pawn is standing on (only used by PHYS_Spider and PHYS_Walking)
`float` | `GroundSpeed` The maximum ground speed.
`float` | `HeadShotFactor` damage multiplicator for the headshot
`PhysicsVolume` | `HeadVolume` physics volume of head
`int` | `HeadYaw` current value of the spine Head
`float` | `HeadYawRotationSpeed` rotation speed in rad/s
`Armor` | `Helm` The pawn's current Helm.
`class` | `HitDamageType` damage type of last hit (for playing hit/death anims)
`sound` | `HitSound[4]` last time pawn played a takehit animation (updated in PlayHit())
`float` | `JumpZ` vertical acceleration w/ jump
`float` | `LadderSpeed` Ladder climbing speed
`name` | `LandMovementState` PlayerControllerState to use when moving on land or air
`name` | `LastBoneHit` Used for Damage location
`Material` | `LastCollidedMaterial` used for the net spine control
`float` | `LastPainSound` last time pawn played a takehit animation (updated in PlayHit())
`float` | `LastPainTime` last time pawn played a takehit animation (updated in PlayHit())
`class` | `LowDetailBlood` Name used for this pawn type in menus (e.g. player selection)
`class` | `LowGoreBlood` Name used for this pawn type in menus (e.g. player selection)
`float` | `MaxDesiredSpeed` How visible is the pawn? 0=invisible, 128=normal, 255=highly visible
`float` | `MaxFallSpeed` max speed pawn can land without taking damage (also limits what paths AI can use)
`int` | `MaxHeadYaw` max range of the spine Head
`int` | `MaxSpineYaw` max range of the spine yaw
`BaffeCount,` | `MemBaffeCount` to play takehit on clients
`string` | `MenuName` Name used for this pawn type in menus (e.g. player selection)
`float` | `MovementAnimRate[4]` anim rate scaling for each direction (rate will be blended)
`name` | `MovementAnims[4]` Forward, Left, Back, Right
`float` | `MovementBlendStartTime` used for delaying the start of run blending
`Projector` | `MyBloodPool` maybe used by CWndSFX to use same texture.
`Emitter` | `MyDeathOno` maybe used by CWndSFX to use same texture.
`vector` | `MyOldAcceleration` Because can't use OldAcceleration != Acceleration (engine modified)
`vector` | `OldAcceleration` used for determining if pawn is turning
`EPhysics` | `OldPhysics` engine animation update using physics params
`float` | `OldRotYaw` used for determining if pawn is turning
`SkinID,` | `OldSkinID` Used to replicate skins
`float` | `OldZ` Old Z Location - used for eyeheight smoothing
`LadderVolume` | `OnLadder` ladder currently being climbed
`Pawn` | `PawnKiller` The pawn's current Helm.
`Powerups` | `PendingItem` To switch between weapon and items modes.
`Powerups` | `PendingItems` NOT USED ANYMORE, NEED TO BE COMMENTED (but full engine rebuild necessary after).
`Weapon` | `PendingWeapon` Will become weapon once current weapon is put down
`PlayerReplicationInfo` | `PlayerReplicationInfo` collision height of dead body lying on the ground
`PlayerReplicationInfo` | `PlayerReplicationInfo` collision height of dead body lying on the ground
`byte` | `ReloadClientCount` used for third person weapon anims/effects
`Powerups` | `SelectedItem` currently selected inventory item
`ShadowProjector` | `Shadow` Name used for this pawn type in menus (e.g. player selection)
`float` | `SpeedFactorLimit` speed limit, used in one map only but need this (Plage01 == Beach01)
`int` | `SpineYaw` current value of the spine yaw
`float` | `SpineYawRotationSpeed` rotation speed in rad/s
`float` | `SplashTime` time of last splash
`vector` | `TakeHitLocation` location of last hit (for playing hit/death anims)
`vector` | `TearOffMomentum` momentum to apply when torn off (bTearOff == true)
`name` | `TurnLeftAnim` turning left anim
`name` | `TurnRightAnim` turning right anim when standing in place (scaled by turn speed)
`float` | `UncrouchTime` when auto-crouch during movement, continually try to uncrouch once this decrements to zero
`TriggerParticleEmitter` | `UnderWaterSFX` Used for Damage location
`float` | `UnderWaterTime` how much time pawn can go without air (in seconds)
`Armor` | `Vest` The pawn's current armor.
`byte` | `Visibility` How visible is the pawn? 0=invisible, 128=normal, 255=highly visible
`name` | `WaitWeaponAnim` Sub-animation to be played on SUBWEAPONCHANNEL
`float` | `WalkingPct` pct. of running speed that walking speed is
`name` | `WaterMovementState` PlayerControllerState to use when moving in water
`float` | `WaterSpeed` The maximum swimming speed.
`Weapon` | `Weapon` The pawn's current weapon.
`name` | `WeaponAnim` Sub-animation to be played on SUBWEAPONCHANNEL
`name` | `WeaponMode` Got by weapon to play right anims
`bool` | `bAllowJump` to disable jump while holding prisonner
`bool` | `bAmbientCreature` AIs will ignore me
`bool` | `bAutoActivate` if true, automatically activate Powerups which have their bAutoActivate==true
`bool` | `bAvoidLedges` don't get too close to ledges
`bool` | `bBoss` this is a boss,used to show name & health bar if target
`bool` | `bCanBeGrabbed` to allow grab of myself like Corpse/Prisonner
`bool` | `bCanBeStunned` This pawn can be stunned using deco weapons
`bool` | `bCanClimbLadders` movement capabilities - used by AI
`bool` | `bCanCrouch` if true, this pawn is capable of crouching
`bool` | `bCanFly` movement capabilities - used by AI
`bool` | `bCanJump` movement capabilities - used by AI
`bool` | `bCanPickupInventory` if true, will pickup inventory when touching pickup actors
`bool` | `bCanStrafe` movement capabilities - used by AI
`bool` | `bCanSwim` movement capabilities - used by AI
`bool` | `bCanWalk` movement capabilities - used by AI
`bool` | `bCanWalkOffLedges` Can still fall off ledges, even when walking (for Player Controlled pawns)
`bool` | `bCauseEventOnStun` to allow event triggering when only stunned & not dead
`bool` | `bChangingWeapon` used for third person weapon anims/effects
`bool` | `bCrawler` crawling - pitch and roll based on surface pawn is on
`bool` | `bDBAnim` ::DBUG:: Info
`bool` | `bDBCartoon` ::DBUG:: Info
`bool` | `bDBShowAutoAim` ::DBUG:: Info
`bool` | `bDestroyWhenDead` i should be destroyed wxhen dead to optimize
`bool` | `bDrawBreathtimer` For hud to draw timer
`bool` | `bEnTrainTirer` [FRD] Allo shooting after dying (last burst)
`bool` | `bEnableSpineControl` to allow spine control
`bool` | `bHaveOnlyOneHandFree` Used to allow selection of 2H weapons (mean LHAnd is Active holding someone)
`bool` | `bHeadControl` if true and bPhysicsAnimUpdate, then orient the Head of the pawn
`bool` | `bHeadYaw` enable the Spine Yaw Control ( only if bPhysicsAnimUpdate & bSpineControl )
`bool` | `bInitializeAnimation` engine animation update using physics params
`bool` | `bInvulnerableBody` used when dying
`bool` | `bIsCrouched` set by physics to specify that pawn is currently crouched
`bool` | `bIsDead` if true, the pawn is considered as dead
`bool` | `bIsFemale` This pawn can be stunned using deco weapons
`bPaf,` | `bIsPafable` true if the player is hit by some weapon (Paf(fr) == Hit(En))
`bool` | `bIsWalking` currently walking (can't jump, affects animations)
`bool` | `bJumpImpulse` used for playing jump impulsion
`bool` | `bJustLanded` used by eyeheight adjustment
`bool` | `bMoving` we are moving
`bool` | `bNoVelocityUpdate` used by C++ physics
`bool` | `bPhysicsAnimUpdate` engine animation update using physics params
`bool` | `bPlayedDeath` engine animation update using physics params
`bool` | `bPrisonner` We have a prisonner in LaftHand to handle slower speed
`bool` | `bReducedSpeed` used by movement natives
`bool` | `bReloadingWeapon` used for third person weapon anims/effects
`bool` | `bRndAnimM16` used for the Random Choice For the M16 Firing Animation
`bool` | `bSimulateGravity` simulate gravity for this pawn on network clients when predicting position (true if pawn is walking or falling)
`bool` | `bSpineControl` if true and bPhysicsAnimUpdate, then orient upper part of pawn's body in controller direction
`bool` | `bSpineYaw` enable the Spine Yaw Control ( only if bPhysicsAnimUpdate & bSpineControl )
`bool` | `bStopAtLedges` if bAvoidLedges and bStopAtLedges, Pawn doesn't try to walk along the edge at all
`bool` | `bStunnedIfJumpedOn` to allow dogs not being stunned by jumping on their head (too easy)
`bool` | `bThumped` Used when falling/dying
`bool` | `bTryToUncrouch` when auto-crouch during movement, continually try to uncrouch
`bool` | `bUpAndOut` used by swimming
`bool` | `bUpdateEyeheight` if true, UpdateEyeheight will get called every tick
`bool` | `bUpdatingDisplay` to avoid infinite recursion through inventory setdisplay
`bool` | `bWantsToCrouch` if true crouched (physics will automatically reduce collision height to CrouchHeight)
`bool` | `bWasCrouched` engine animation update using physics params
`bool` | `bWasFalling` engine animation update using physics params
`bool` | `bWasOnGround` engine animation update using physics params
`bool` | `bWasWalking` engine animation update using physics params
`bool` | `bWeaponFiring` used for third person weapon anims/effects
`sound` | `hBodyFallSound` falling body touched ground
`sound` | `hBubbleSound` falling body touched ground
`sound` | `hCrouchSound` Crouching sound
`sound` | `hHitSound` Hit Sound for XIII in solo game, else use Hitsound of the Skin
`sound` | `hJumpSound` Jump Sound
`sound` | `hLadderSound` Climbing sound
`sound` | `hNotifSwimSound` falling body touched ground
`sound` | `hStunFromAboveSound` Visibility to give a pawn if crouched
`sound` | `hSwimmingSound` falling body touched ground
`sound` | `hUnCrouchSound` UnCrouching sound
`Pawn` | `nextPawn` chained Pawn list
`float` | `noise1loudness` last time pawn played a takehit animation (updated in PlayHit())
`Pawn` | `noise1other` last time pawn played a takehit animation (updated in PlayHit())
`vector` | `noise1spot` last time pawn played a takehit animation (updated in PlayHit())
`float` | `noise1time` last time pawn played a takehit animation (updated in PlayHit())
`float` | `noise2loudness` last time pawn played a takehit animation (updated in PlayHit())
`Pawn` | `noise2other` last time pawn played a takehit animation (updated in PlayHit())
`vector` | `noise2spot` last time pawn played a takehit animation (updated in PlayHit())
`float` | `noise2time` last time pawn played a takehit animation (updated in PlayHit())

States
Dying

Function Summary
`bool` | `AddInventory(Inventory NewItem)`
    // Add Item to this pawn's inventory.
    // Returns true if successfully added, false if not.
`void` | `AddPawnToList()`
`void` | `AddVelocity(vector NewVelocity)`
    //_____________________________________________________________________________
`rotator` | `AdjustAim(Ammunition FiredAmmunition, vector projStart, int aimerror)`
    //_____________________________________________________________________________
`void` | `BecomeViewTarget()`
    //_____________________________________________________________________________
`vector` | `CalcDrawOffset(Inventory Inv)`
    /*simulated
`vector` | `CalcDrawOffset(Inventory Inv)`
    /*simulated
`bool` | `CanHoldDualWeapons()`
    //_____________________________________________________________________________
`bool` | `CanSplash()`
    //_____________________________________________________________________________
`void` | `ChangedWeapon()`
    // Just changed to pendingWeapon
`bool` | `CheckWaterJump(out vector)`
`simulated` | `ChunkUp(int Damage)`
    // blow up into little pieces (implemented in subclass)
`void` | `ClientReStart()`
`void` | `ClientSetLocation(vector NewLocation, rotator NewRotation)`
`void` | `ClientSetRotation(rotator NewRotation)`
`void` | `ClimbLadder(LadderVolume L)`
    //_____________________________________________________________________________
`simulated` | `DeleteInventory(Inventory Item)`
    // Remove Item from this pawn's inventory, if it exists.
`simulated` | `DisplayDebug(Canvas Canvas, out float, out float)`
    //_____________________________________________________________________________
    // list important actor variable on canvas.  Also show the pawn's controller and weapon info
`void` | `DoJump(bool bUpdating)`
    //Player Jumped
`void` | `DropToGround()`
    //_____________________________________________________________________________
`vector` | `EyePosition()`
    {
    	return EyeHeight * vect(0,0,1);
    }
    */
`vector` | `EyePosition()`
    {
    	return EyeHeight * vect(0,0,1);
    }
    */
`simulated` | `FaceRotation(rotator NewRotation, float DeltaTime)`
    {
    	if ( Physics == PHYS_Ladder )
    		SetRotation(OnLadder.WallDir);
    	else
    	{
    		if ( (Physics == PHYS_Walking) || (Physics == PHYS_Falling) )
    			NewRotation.Pitch = 0;
    		SetRotation(NewRotation);
    	}
    }*/
`simulated` | `FaceRotation(rotator NewRotation, float DeltaTime)`
    {
    	if ( Physics == PHYS_Ladder )
    		SetRotation(OnLadder.WallDir);
    	else
    	{
    		if ( (Physics == PHYS_Walking) || (Physics == PHYS_Falling) )
    			NewRotation.Pitch = 0;
    		SetRotation(NewRotation);
    	}
    }*/
`Inventory` | `FindInventoryKind(Name DesiredClassName)`
`Inventory` | `FindInventoryType(class DesiredClass)`
    {
    	local Inventory Inv;

    	for( Inv=Inventory; Inv!=None; Inv=Inv.Inventory )
    		if ( Inv.class == DesiredClass )
    			return Inv;
    	return None;
    } */
`Inventory` | `FindInventoryType(class DesiredClass)`
    {
    	local Inventory Inv;

    	for( Inv=Inventory; Inv!=None; Inv=Inv.Inventory )
    		if ( Inv.class == DesiredClass )
    			return Inv;
    	return None;
    } */
`void` | `FinishedInterpolation(InterpolationPoint Other)`
    //_____________________________________________________________________________
`void` | `Gasp()`
`String` | `GetHumanReadableName()`
    //_____________________________________________________________________________
`Actor` | `GetMoveTarget()`
    /* XIIIUNUSED
`rotator` | `GetViewRotation()`
    {
    	if ( Controller == None )
    		return Rotation;
    	else
    		return Controller.Rotation;
    }*/
`rotator` | `GetViewRotation()`
    {
    	if ( Controller == None )
    		return Rotation;
    	else
    		return Controller.Rotation;
    }*/
`name` | `GetWeaponBoneFor(Inventory I)`
    /*
    {
    	local Weapon OldWeapon;

    	OldWeapon = Weapon;

    	if (Weapon == PendingWeapon)
    	{
    		if ( Weapon == None )
    		{
    			Controller.SwitchToBestWeapon();
    			return;
    		}
    		else if ( Weapon.IsInState('DownWeapon') )
    			Weapon.GotoState('Idle');
    		PendingWeapon = None;
    		ServerChangedWeapon(OldWeapon, Weapon);
    		return;
    	}
    	if ( PendingWeapon == None )
    		PendingWeapon = Weapon;

    	Weapon = PendingWeapon;
    	if ( (Weapon != None) && (Level.NetMode == NM_Client) )
    		Weapon.BringUp();
    	PendingWeapon = None;
    	Weapon.Instigator = self;
    	ServerChangedWeapon(OldWeapon, Weapon);
    	if ( Controller != None )
    		Controller.ChangedWeapon();
    }
    */
`void` | `GiveWeapon(string aClassName)`
    //_____________________________________________________________________________
`void` | `HandlePickup(Pickup pick)`
    //_____________________________________________________________________________
`void` | `HeadYawControl(bool IsControlled, int MaxValue, float RotationSpeed)`
`float` | `HealthPercent()`
    //_____________________________________________________________________________
    // ELR
`bool` | `InGodMode()`
    //_____________________________________________________________________________
`bool` | `InsertInventory(Inventory NewItem, Inventory RefItem)`
    //_____________________________________________________________________________
    // insert/move Item to this pawn's inventory after RefItem
    // Returns true if successfully added, false if not.
`bool` | `IsHumanControlled()`
    {
    	return ( PlayerController(Controller) != None );
    }*/
`bool` | `IsHumanControlled()`
    {
    	return ( PlayerController(Controller) != None );
    }*/
`bool` | `IsInPain()`
    //Pain timer just expired.
    //Check what zone I'm in (and which parts are)
    //based on that cause damage, and reset BreathTime
`bool` | `IsLocallyControlled()`
    {
    	if ( Level.NetMode == NM_Standalone )
    		return true;
    	if ( Controller == None )
    		return false;
    	if ( PlayerController(Controller) == None )
    		return true;

    	return ( Viewport(PlayerController(Controller).Player) != None );
    }*/
`bool` | `IsLocallyControlled()`
    {
    	if ( Level.NetMode == NM_Standalone )
    		return true;
    	if ( Controller == None )
    		return false;
    	if ( PlayerController(Controller) == None )
    		return true;

    	return ( Viewport(PlayerController(Controller).Player) != None );
    }*/
`bool` | `IsPlayerPawn()`
    {
    	return ( (Controller != None) && Controller.bIsPlayer );
    }*/
`bool` | `IsPlayerPawn()`
    {
    	return ( (Controller != None) && Controller.bIsPlayer );
    }*/
`void` | `JumpOffPawn()`
    //Base change - if new base is pawn or decoration, damage based on relative mass and old velocity
    // Also, non-players will jump off pawns immediately
`void` | `JumpOutOfWater(vector jumpDir)`
    //_____________________________________________________________________________
`void` | `KilledBy(Pawn EventInstigator)`
    //_____________________________________________________________________________
`bool` | `LineOfSightTo(Actor Other)`
    //_____________________________________________________________________________
`bool` | `NearMoveTarget()`
    //_____________________________________________________________________________
`void` | `NextItem()`
    // The player/bot wants to select next item
`bool` | `PointOfView()`
    //_____________________________________________________________________________
    // called by controller when possessing this pawn
    // false = 1st person, true = 3rd person
`void` | `PossessedBy(Controller C)`
    //_____________________________________________________________________________
    // Pawn is possessed by Controller
`void` | `PreSetMovement()`
    /* PreSetMovement()
    default for walking creature.  Re-implement in subclass
    for swimming/flying capability
    */
`bool` | `PressingAltFire()`
    //_____________________________________________________________________________
`bool` | `PressingFire()`
    {
    	return ( (Controller != None) && (Controller.bFire != 0) );
    }*/
`bool` | `PressingFire()`
    {
    	return ( (Controller != None) && (Controller.bFire != 0) );
    }*/
`void` | `RemovePawnFromList()`
    // Used to handle Level.PawnList
`void` | `Reset()`
    //_____________________________________________________________________________
    // reset actor to initial state - used when restarting level without reloading.
`void` | `RestartPlayer()`
    //_____________________________________________________________________________
`void` | `ServerChangedWeapon(Weapon OldWeapon, Weapon W)`
`void` | `SetDefaultDisplayProperties()`
    //_____________________________________________________________________________
`void` | `SetDisplayProperties(ERenderStyle NewStyle, Material NewTexture, bool bLighting)`
    //_____________________________________________________________________________
`simulated` | `SetMesh()`
`void` | `SetMoveTarget(Actor NewTarget)`
    //_____________________________________________________________________________
`void` | `SetMovementPhysics()`
`simulated` | `SetViewRotation(rotator NewRotation)`
    //_____________________________________________________________________________
`void` | `SetWalking(bool bNewIsWalking)`
    /*
`void` | `SetWalking(bool bNewIsWalking)`
    /*
`Actor` | `ShootSpecial(Actor A)`
    //_____________________________________________________________________________
`void` | `ShouldCrouch(bool Crouch)`
    //_____________________________________________________________________________
    // Controller is requesting that pawn crouch
`void` | `SpineYawControl(bool IsControlled, int MaxValue, float RotationSpeed)`
    //_____________________________________________________________________________
`void` | `TakeDrowningDamage()`
`void` | `TakeFallingDamage()`
`void` | `TossWeapon(vector TossVel)`
    // toss out the weapon currently held
`bool` | `TouchingWaterVolume()`
`void` | `Trigger(Actor Other, Pawn EventInstigator)`
    //_____________________________________________________________________________
`void` | `UnPossessed()`
    //_____________________________________________________________________________
`void` | `YouCantClimb()`
`void` | `gibbedBy(Actor Other)`

State Dying Function Summary
`void` | `PlayLanded(float impactVel)`
`bool` | `CannotJumpNow()`
    // Animation group checks (usually implemented in subclass)
`void` | `PlayWeaponSwitch(Weapon NewWeapon)`
`void` | `BeginState()`
`void` | `BaseChange()`
`void` | `LieStill()`
`void` | `LandThump()`
`void` | `ReduceCylinder()`
    // prone body should have low height, wider radius
`void` | `Landed(vector HitNormal)`
`void` | `Timer()`
`void` | `PlayWeaponSwitch(Weapon NewWeapon)`
`void` | `PlayFiring(float Rate, name FiringMode)`

Source Code

    00001	//=============================================================================
    00002	// Pawn, the base class of all actors that can be controlled by players or AI.
    00003	//
    00004	// Pawns are the physical representations of players and creatures in a level.
    00005	// Pawns have a mesh, collision, and physics.  Pawns can take damage, make sounds,
    00006	// and hold weapons and other inventory.  In short, they are responsible for all
    00007	// physical interaction between the player or AI and the world.
    00008	//
    00009	// This is a built-in Unreal class and it shouldn't be modified.
    00010	//=============================================================================
    00011	class Pawn extends Actor
    00012	    abstract
    00013	    native
    00014	    placeable
    00015	    nativereplication;
    00016
    00017	#exec Texture Import File=Textures\Pawn.pcx Name=S_Pawn Mips=Off MASKED=1 COMPRESS=DXT1
    00018
    00019	//_____________________________________________________________________________
    00020	// Pawn variables.
    00021	enum DamageLocations
    00022	{
    00023	    LOC_Head,
    00024	    LOC_Body,
    00025	    LOC_HeadSide,
    00026	};
    00027	enum EGameOver
    00028	{
    00029		GO_Never, GO_TakeDamageFromPlayer, GO_KillByPlayer, GO_AnyDeath
    00030	};
    00031
    00032	var Controller Controller;
    00033
    00034	// Physics related flags.
    00035	var bool bJustLanded;           // used by eyeheight adjustment
    00036	var bool bUpAndOut;             // used by swimming
    00037	var bool bIsWalking;            // currently walking (can't jump, affects animations)
    00038	//var bool bWarping;              // Set when travelling through warpzone (so shouldn't telefrag)
    00039	var bool bWantsToCrouch;        // if true crouched (physics will automatically reduce collision height to CrouchHeight)
    00040	var const bool bIsCrouched;     // set by physics to specify that pawn is currently crouched
    00041	var const bool bTryToUncrouch;  // when auto-crouch during movement, continually try to uncrouch
    00042	var() bool bCanCrouch;          // if true, this pawn is capable of crouching
    00043	var bool bCrawler;              // crawling - pitch and roll based on surface pawn is on
    00044	var const bool bReducedSpeed;   // used by movement natives
    00045	var bool bCanJump;              // movement capabilities - used by AI
    00046	var bool bCanWalk;
    00047	var bool bCanSwim;
    00048	var bool bCanFly;
    00049	var bool bCanClimbLadders;
    00050	var bool bCanStrafe;
    00051	var bool bAvoidLedges;          // don't get too close to ledges
    00052	var bool bStopAtLedges;         // if bAvoidLedges and bStopAtLedges, Pawn doesn't try to walk along the edge at all
    00053	//var bool bNoJumpAdjust;         // set to tell controller not to modify velocity of a jump/fall
    00054	//var bool bCountJumps;           // if true, inventory wants message whenever this pawn jumps
    00055	var const bool bSimulateGravity;// simulate gravity for this pawn on network clients when predicting position (true if pawn is walking or falling)
    00056	var bool bUpdateEyeheight;      // if true, UpdateEyeheight will get called every tick
    00057	//var bool bIgnoreForces;         // if true, not affected by external forces
    00058	var const bool bNoVelocityUpdate; // used by C++ physics
    00059	var bool bCanWalkOffLedges;     // Can still fall off ledges, even when walking (for Player Controlled pawns)
    00060	//var bool bSteadyFiring;         // used for third person weapon anims/effects
    00061	// used by dead pawns (for bodies landing and changing collision box)
    00062	var bool bThumped;              // Used when falling/dying
    00063	var bool bInvulnerableBody;     // used when dying
    00064	var() bool bBoss;               // this is a boss,used to show name & health bar if target
    00065	var() bool bCanBeStunned;       // This pawn can be stunned using deco weapons
    00066
    00067	// AI related flags
    00068	var bool bIsFemale;
    00069	var bool bAutoActivate;         // if true, automatically activate Powerups which have their bAutoActivate==true
    00070	var bool bCanPickupInventory;   // if true, will pickup inventory when touching pickup actors
    00071	var bool bUpdatingDisplay;      // to avoid infinite recursion through inventory setdisplay
    00072	var bool bAmbientCreature;      // AIs will ignore me
    00073	var(AI) bool bLOSHearing;       // can hear sounds from line-of-sight sources (which are close enough to hear)
    00074	                                  // bLOSHearing=true is like UT/Unreal hearing
    00075	var(AI) bool bSameZoneHearing;        // can hear any sound in same zone (if close enough to hear)
    00076	var(AI) bool bAdjacentZoneHearing;    // can hear any sound in adjacent zone (if close enough to hear)
    00077	var(AI) bool bMuffledHearing;         // can hear sounds through walls (but muffled - sound distance increased to double plus 4x the distance through walls
    00078	var(AI) bool bAroundCornerHearing;    // Hear sounds around one corner (slightly more expensive, and bLOSHearing must also be true)
    00079	var(AI) bool bDontPossess;            // if true, Pawn won't be possessed at game start
    00080	var bool bIsDead;                     // if true, the pawn is considered as dead
    00081
    00082	var bool bSpineControl;         // if true and bPhysicsAnimUpdate, then orient upper part of pawn's body in controller direction
    00083	var bool bHeadControl;         // if true and bPhysicsAnimUpdate, then orient the Head of the pawn
    00084	var bool bSpineYaw;             // enable the Spine Yaw Control ( only if bPhysicsAnimUpdate & bSpineControl )
    00085	var bool bHeadYaw;             // enable the Spine Yaw Control ( only if bPhysicsAnimUpdate & bSpineControl )
    00086
    00087	var bool bHaveOnlyOneHandFree;  // Used to allow selection of 2H weapons (mean LHAnd is Active holding someone)
    00088
    00089	var bool bPrisonner;              // We have a prisonner in LaftHand to handle slower speed
    00090	var bool bDrawBreathtimer;        // For hud to draw timer
    00091	var bool bDBAnim;                 // ::DBUG:: Info
    00092	var bool bDBShowAutoAim;          // ::DBUG:: Info
    00093	var bool bDBCartoon;              // ::DBUG:: Info
    00094	var bool bEnTrainTirer;           //[FRD] Allo shooting after dying (last burst)
    00095	var bool bEnableSpineControl;     // to allow spine control
    00096	var bool bMoving;                 // we are moving
    00097	var bool bChangingWeapon;         // used for third person weapon anims/effects
    00098	var bool bReloadingWeapon;        // used for third person weapon anims/effects
    00099	var bool bWeaponFiring;           // used for third person weapon anims/effects
    00100	var bool bJumpImpulse;            // used for playing jump impulsion
    00101	var bool bAllowJump;              // to disable jump while holding prisonner
    00102	var() bool bDestroyWhenDead;      // i should be destroyed wxhen dead to optimize
    00103	var bool bPaf, bIsPafable;        // true if the player is hit by some weapon (Paf(fr) == Hit(En))
    00104	var() bool bCanBeGrabbed;         // to allow grab of myself like Corpse/Prisonner
    00105	var() bool bCauseEventOnStun;     // to allow event triggering when only stunned & not dead
    00106	var() bool bStunnedIfJumpedOn;    // to allow dogs not being stunned by jumping on their head (too easy)
    00107
    00108	var int BaffeCount, MemBaffeCount;// to play takehit on clients
    00109	var float BaffeTimer;             // to reset Baffe(tm) Channel
    00110
    00111	var int MaxSpineYaw;            // max range of the spine yaw
    00112	var int SpineYaw;               // current value of the spine yaw
    00113	var float SpineYawRotationSpeed;  // rotation speed in rad/s
    00114
    00115	var int MaxHeadYaw;            // max range of the spine Head
    00116	var int HeadYaw;               // current value of the spine Head
    00117	var float HeadYawRotationSpeed;  // rotation speed in rad/s
    00118
    00119	var float Angle;                // current angle (sin) for the SpineYaw
    00120
    00121	var byte FlashCount;            // used for third person weapon anims/effects
    00122	var byte AltFlashCount;         // used for third person weapon anims/effects
    00123	var byte ReloadClientCount;     // used for third person weapon anims/effects
    00124
    00125	// AI basics.
    00126	var byte Visibility;            //How visible is the pawn? 0=invisible, 128=normal, 255=highly visible
    00127	var float DesiredSpeed;
    00128	var float MaxDesiredSpeed;
    00129	//var(AI) name AIScriptTag;       // tag of AIScript which should be associated with this pawn
    00130	var(AI) float HearingThreshold; // max distance at which a makenoise(1.0) loudness sound can be heard
    00131	var(AI) float Alertness;        // -1 to 1 ->Used within specific states for varying reaction to stimuli
    00132	var(AI) float SightRadius;      // Maximum seeing distance.
    00133	var(AI) float PeripheralVision; // Cosine of limits of peripheral vision.
    00134	var const float AvgPhysicsTime; // Physics updating time monitoring (for AI monitoring reaching destinations)
    00135	//var float MeleeRange;           // Max range for melee attack (not including collision radii)
    00136	var NavigationPoint Anchor;     // current nearest path;
    00137	var const float UncrouchTime;   // when auto-crouch during movement, continually try to uncrouch once this decrements to zero
    00138
    00139	// Movement.
    00140	var float GroundSpeed;          // The maximum ground speed.
    00141	var float WaterSpeed;           // The maximum swimming speed.
    00142	var float AirSpeed;             // The maximum flying speed.
    00143	var float LadderSpeed;          // Ladder climbing speed
    00144	var float AccelRate;            // max acceleration rate
    00145	var float JumpZ;                // vertical acceleration w/ jump
    00146	var float AirControl;           // amount of AirControl available to the pawn
    00147	var float WalkingPct;           // pct. of running speed that walking speed is
    00148	var float CrouchingPct;         // pct. of running speed (GroundSpeed) that crouching speed is
    00149	var float MaxFallSpeed;         // max speed pawn can land without taking damage (also limits what paths AI can use)
    00150
    00151	// Player info.
    00152	//var  string      OwnerName;   // Name of owning player (for save games, coop)
    00153	var(Cine_Vars) string PawnName; // ELR to replace string above
    00154	var travel Weapon Weapon;       // The pawn's current weapon.
    00155	var Weapon PendingWeapon;       // Will become weapon once current weapon is put down
    00156	var travel Powerups SelectedItem;  // currently selected inventory item
    00157	var float BaseEyeHeight;        // Base eye height above collision center.
    00158	var float EyeHeight;            // Current eye height, adjusted for bobbing and stairs.
    00159	var const vector Floor;         // Normal of floor pawn is standing on (only used by PHYS_Spider and PHYS_Walking)
    00160	var float SplashTime;           // time of last splash
    00161	var float CrouchHeight;         // CollisionHeight when crouching
    00162	var float CrouchRadius;         // CollisionRadius when crouching
    00163	var float OldZ;                 // Old Z Location - used for eyeheight smoothing
    00164	var PhysicsVolume HeadVolume;   // physics volume of head
    00165	var(BaseSoldier) travel int Health;  // Health: 100 = normal maximum
    00166	var  float BreathTime;          // used for getting BreathTimer() messages (for no air, etc.)
    00167	var float UnderWaterTime;       // how much time pawn can go without air (in seconds)
    00168	var  float LastPainTime;        // last time pawn played a takehit animation (updated in PlayHit())
    00169	//var class<DamageType> ReducedDamageType; // which damagetype this creature is protected from (used by AI)
    00170
    00171	// Sound and noise management
    00172	// remember location and position of last noises propagated
    00173	var const vector noise1spot;
    00174	var const float noise1time;
    00175	var const pawn noise1other;
    00176	var const float noise1loudness;
    00177	var const vector noise2spot;
    00178	var const float noise2time;
    00179	var const pawn noise2other;
    00180	var const float noise2loudness;
    00181	var float LastPainSound;
    00182
    00183	// Common sounds
    00184	var sound HitSound[4];
    00185	var(Sound) int SoundStepCategory;
    00186
    00187	//var float SoundDampening;
    00188	//var float DamageScaling;
    00189
    00190	// ::TODO:: delete this
    00191	var localized string MenuName; // Name used for this pawn type in menus (e.g. player selection)
    00192
    00193	// shadow decal
    00194	var ShadowProjector Shadow;
    00195
    00196	// blood effect
    00197	/*
    00198	var class<Effects> BloodEffect;
    00199	var class<Effects> LowDetailBlood;
    00200	var class<Effects> LowGoreBlood;
    00201	*/
    00202
    00203	var class<AIController> ControllerClass;  // default class to use when pawn is controlled by AI (can be modified by an AIScript)
    00204
    00205	var float CarcassCollisionHeight;   // collision height of dead body lying on the ground
    00206	var PlayerReplicationInfo PlayerReplicationInfo;
    00207
    00208	var LadderVolume OnLadder;          // ladder currently being climbed
    00209
    00210	var name LandMovementState;         // PlayerControllerState to use when moving on land or air
    00211	var name WaterMovementState;        // PlayerControllerState to use when moving in water
    00212
    00213	// Animation status
    00214	var name AnimStatus;
    00215	var name AnimAction;                // use for replicating anims
    00216	var name WeaponAnim;                // Sub-animation to be played on SUBWEAPONCHANNEL
    00217	var name WaitWeaponAnim;            // Sub-animation to be played on SUBWEAPONCHANNEL
    00218
    00219	// Animation updating by physics FIXME - this should be handled as an animation object
    00220	// Note that animation channels 2 through 11 are used for animation updating
    00221	var vector TakeHitLocation;         // location of last hit (for playing hit/death anims)
    00222	var class<DamageType> HitDamageType;  // damage type of last hit (for playing hit/death anims)
    00223	var vector TearOffMomentum;         // momentum to apply when torn off (bTearOff == true)
    00224	var bool bPhysicsAnimUpdate;        // engine animation update using physics params
    00225	var bool bWasCrouched;
    00226	var bool bWasWalking;
    00227	var bool bWasFalling;
    00228	var bool bWasOnGround;
    00229	var bool bInitializeAnimation;
    00230	var bool bPlayedDeath;
    00231	var EPhysics OldPhysics;
    00232	var float OldRotYaw;                // used for determining if pawn is turning
    00233	var vector OldAcceleration;
    00234	var name MovementAnims[4];          // Forward, Left, Back, Right
    00235	var name TurnLeftAnim;              // turning left anim
    00236	var name TurnRightAnim;             // turning right anim when standing in place (scaled by turn speed)
    00237	var float MovementAnimRate[4];      // anim rate scaling for each direction (rate will be blended)
    00238	var(AnimTweaks) float BlendChangeTime;  // time to blend between animations
    00239	var float MovementBlendStartTime;   // used for delaying the start of run blending
    00240
    00241
var Actor ControlledActor; // Actor being controlled by Pawn e.g. KVehicle, WeaponTurret 00242 var byte ControllerPitch; // used for the net spine control 00243 00244 var Material LastCollidedMaterial; 00245 00246 // ::TO DELETE:: 00247 var PowerUps PendingItems; // NOT USED ANYMORE, NEED TO BE COMMENTED (but full engine rebuild necessary after). 00248 00249 var(Cine_Behavior) EGameOver GameOver; // Do shooting this guy will make pbs ? 00250 var(Alliances) name Alliance; // Alliance, used to make diff between factions. 00251 Var(BaseSoldier) int Skill; // niveau du pawn 1 a 5 00252 var float SpeedFactorLimit; // speed limit, used in one map only but need this (Plage01 == Beach01) 00253 var travel powerups PendingItem; // To switch between weapon and items modes. 00254 00255 var float DrownTimer; // Time underwater 00256 var float DTimerStep; // Steps for Breathtimer 00257 00258 const FIRINGCHANNEL=14; // To blend Fire anims 00259 const FIRINGBLENDBONE='X Spine'; // Bone to blend firing anims 00260 00261 var EDrawType DTMemorize; // Used when taken as a corpse 00262 //var bool bWarnedByDoor; // For enemies, to memorize that we already have checked an opened door 00263 00264 //var rotator rSpineRotation; // to be replicated to all clients ? 00265 00266 var name WeaponMode; // Got by weapon to play right anims 00267 00268 var int CrouchedVisibility; // Visibility to give a pawn if crouched 00269 var sound hStunFromAboveSound; 00270 00271 var vector MyOldAcceleration; // Because can't use OldAcceleration != Acceleration (engine modified) 00272 00273 var sound hJumpSound; // Jump Sound 00274 var sound hHitSound; // Hit Sound for XIII in solo game, else use Hitsound of the Skin 00275 var sound hLadderSound; // Climbing sound 00276 var sound hCrouchSound; // Crouching sound 00277 var sound hUnCrouchSound; // UnCrouching sound 00278 var sound hBodyFallSound; // falling body touched ground 00279 00280 var(sound) sound hSNDNotSound[30]; // Sounds for SNDNotif animation events 00281 var sound hSwimmingSound; 00282 var sound hNotifSwimSound; 00283 //var class<DamageType> DiedByDamage; 00284 var sound hBubbleSound; 00285 00286 var bool bRndAnimM16; // used for the Random Choice For the M16 Firing Animation 00287 var int AnimM16; // used for the Random Choice for the M16 Firing Animation 00288 var float HeadShotFactor; //damage multiplicator for the headshot 00289 var name LastBoneHit; // Used for Damage location 00290 var TriggerParticleEmitter UnderWaterSFX; 00291 var Emitter DrowningSFX; 00292 var Emitter MyDeathOno; // maybe used by CWndSFX to use same texture. 00293 var Projector MyBloodPool; 00294 00295 var float DeadPawnSightCounter; // once dead, this is the delay before the pawn signal himself to the other controllers 00296 00297 var travel Armor Vest; // The pawn's current armor. 00298 var travel Armor Helm; // The pawn's current Helm. 00299 00300 var() float DelayBeforeDestroyWhenDead; 00301 var() float DistanceBeforeDestroyWhenDead; 00302 var Pawn PawnKiller; 00303 00304 var int SkinID, OldSkinID; // Used to replicate skins 00305 00306 var const Pawn nextPawn; // chained Pawn list 00307 00308 //_____________________________________________________________________________ 00309 replication 00310 { 00311 // Variables the server should send to the client. 00312 reliable if( bNetDirty && (Role==ROLE_Authority) ) 00313 bSimulateGravity, bIsCrouched, bIsWalking, PlayerReplicationInfo, Controller, AnimStatus, AnimAction, HitDamageType, TakeHitLocation ; 00314 reliable if( bTearOff && bNetDirty && (Role==ROLE_Authority) ) 00315 TearOffMomentum; 00316 // reliable if ( bNetDirty && !bNetOwner && (Role==ROLE_Authority) ) 00317 // bSteadyFiring; 00318 reliable if( bNetDirty && bNetOwner && Role==ROLE_Authority ) 00319 SelectedItem, GroundSpeed, WaterSpeed, AirSpeed, AccelRate, JumpZ, AirControl; 00320 00321 // replicated functions sent to server by owning client 00322 reliable if( Role<ROLE_Authority ) 00323 ServerChangedWeapon; 00324 00325 // Variables the server should send to the client. 00326 reliable if( bNetDirty && (Role==ROLE_Authority) ) 00327 bIsDead, WeaponMode, SkinID, Health; 00328 unreliable if( !bNetOwner && bNetDirty && (Role==ROLE_Authority) ) 00329 ControllerPitch, BaffeCount; 00330 } 00331 00332 native final function AddPawnToList(); // Used to handle Level.PawnList 00333 native final function RemovePawnFromList(); // Used to handle Level.PawnList 00334 00335 simulated event ChangeSkin(); // Prototype, will use SkinID 00336 00337 //_____________________________________________________________________________ 00338 // reset actor to initial state - used when restarting level without reloading. 00339 function Reset() 00340 { 00341 if ( (Controller == None) || Controller.bIsPlayer ) 00342 Destroy(); 00343 else 00344 Super.Reset(); 00345 } 00346 00347 //_____________________________________________________________________________ 00348 function String GetHumanReadableName() 00349 { 00350 if ( PlayerReplicationInfo != None ) 00351 return PlayerReplicationInfo.PlayerName; 00352 return PawnName; 00353 } 00354 00355 //_____________________________________________________________________________ 00356 // Pawn is possessed by Controller 00357 function PossessedBy(Controller C) 00358 { 00359 Controller = C; 00360 NetPriority = 3; 00361 if ( C.PlayerReplicationInfo != None ) 00362 { 00363 PlayerReplicationInfo = C.PlayerReplicationInfo; 00364 PawnName = PlayerReplicationInfo.PlayerName; 00365 } 00366 if ( C.IsA('PlayerController') ) 00367 { 00368 if ( Level.NetMode != NM_Standalone ) 00369 RemoteRole = ROLE_AutonomousProxy; 00370 BecomeViewTarget(); 00371 } 00372 else 00373 RemoteRole = Default.RemoteRole; 00374 00375 SetOwner(Controller); // for network replication 00376 Eyeheight = BaseEyeHeight; 00377 ChangeAnimation(); 00378 } 00379 00380 //_____________________________________________________________________________ 00381 function UnPossessed() 00382 { 00383 PlayerReplicationInfo = None; 00384 SetOwner(None); 00385 Controller = None; 00386 } 00387 00388 //_____________________________________________________________________________ 00389 // called by controller when possessing this pawn 00390 // false = 1st person, true = 3rd person 00391 simulated function bool PointOfView() 00392 { 00393 return false; 00394 } 00395 00396 //_____________________________________________________________________________ 00397 function BecomeViewTarget() 00398 { 00399 bUpdateEyeHeight = true; 00400 } 00401 00402 //_____________________________________________________________________________ 00403 function DropToGround() 00404 { 00405 bCollideWorld = True; 00406 bInterpolating = false; 00407 if ( Health > 0 ) 00408 { 00409 SetCollision(true,true,true); 00410 SetPhysics(PHYS_Falling); 00411 AmbientSound = None; 00412 if ( IsHumanControlled() ) 00413 Controller.GotoState(LandMovementState); 00414 } 00415 } 00416 00417 //_____________________________________________________________________________ 00418 native function SetWalking(bool bNewIsWalking); 00419 /*function SetWalking(bool bNewIsWalking) 00420 { 00421 if ( bNewIsWalking != bIsWalking ) 00422 { 00423 bIsWalking = bNewIsWalking; 00424 ChangeAnimation(); 00425 } 00426 }*/ 00427 00428 //_____________________________________________________________________________ 00429 function bool CanSplash() 00430 { 00431 if ( (Level.TimeSeconds - SplashTime > 0.25) 00432 && ((Physics == PHYS_Falling) || (Physics == PHYS_Flying)) 00433 && (Abs(Velocity.Z) > 100) ) 00434 { 00435 SplashTime = Level.TimeSeconds; 00436 return true; 00437 } 00438 return false; 00439 } 00440 00441 //_____________________________________________________________________________ 00442 event EndClimbLadder(LadderVolume OldLadder) 00443 { 00444 if (Controller != None) 00445 Controller.EndClimbLadder(); 00446 if ( Physics == PHYS_Ladder ) 00447 SetPhysics(PHYS_Falling); 00448 } 00449 00450 //_____________________________________________________________________________ 00451 function ClimbLadder(LadderVolume L) 00452 { 00453 OnLadder = L; 00454 SetPhysics(PHYS_Ladder); 00455 if ( IsHumanControlled() ) 00456 Controller.GotoState('PlayerClimbing'); 00457 } 00458 00459 //_____________________________________________________________________________ 00460 // list important actor variable on canvas. Also show the pawn's controller and weapon info 00461 simulated function DisplayDebug(Canvas Canvas, out float YL, out float YPos) 00462 { 00463 local string T; 00464 Super.DisplayDebug(Canvas, YL, YPos); 00465 00466 Canvas.SetDrawColor(255,255,255); 00467 00468 Canvas.DrawText("Animation Action "$AnimAction$" Status "$AnimStatus); 00469 YPos += YL; 00470 Canvas.SetPos(4,YPos); 00471 00472 T = "Floor "$Floor$" DesiredSpeed "$DesiredSpeed$" Crouched "$bIsCrouched$" Try to uncrouch "$UncrouchTime; 00473 if ( (OnLadder != None) || (Physics == PHYS_Ladder) ) 00474 T=T$" on ladder "$OnLadder; 00475 Canvas.DrawText(T); 00476 YPos += YL; 00477 Canvas.SetPos(4,YPos); 00478 Canvas.DrawText("EyeHeight "$Eyeheight$" BaseEyeHeight "$BaseEyeHeight$" Physics Anim "$bPhysicsAnimUpdate); 00479 YPos += YL; 00480 Canvas.SetPos(4,YPos); 00481 Canvas.SetDrawColor(255,0,0); 00482 00483 if ( Controller == None ) 00484 { 00485 Canvas.DrawText("NO CONTROLLER"); 00486 YPos += YL; 00487 Canvas.SetPos(4,YPos); 00488 } 00489 else 00490 Controller.DisplayDebug(Canvas,YL,YPos); 00491 00492 Canvas.SetDrawColor(0,255,0); 00493 00494 if ( Weapon == None ) 00495 { 00496 Canvas.DrawText("NO WEAPON"); 00497 YPos += YL; 00498 Canvas.SetPos(4,YPos); 00499 } 00500 else 00501 { 00502 Canvas.DrawText("WEAPON ::"); 00503 YPos += YL; 00504 Canvas.SetPos(4,YPos); 00505 Weapon.DisplayDebug(Canvas,YL,YPos); 00506 } 00507 00508 Canvas.SetDrawColor(0,255,255); 00509 if ( PendingWeapon == None ) 00510 { 00511 Canvas.DrawText("NO PENDINGWEAPON"); 00512 YPos += YL; 00513 Canvas.SetPos(4,YPos); 00514 } 00515 else 00516 { 00517 Canvas.DrawText("PENDINGWEAPON ::"); 00518 YPos += YL; 00519 Canvas.SetPos(4,YPos); 00520 PendingWeapon.DisplayDebug(Canvas,YL,YPos); 00521 } 00522 00523 Canvas.SetDrawColor(0,255,0); 00524 if ( SelectedItem == None ) 00525 { 00526 Canvas.DrawText("NO ITEM"); 00527 YPos += YL; 00528 Canvas.SetPos(4,YPos); 00529 } 00530 else 00531 { 00532 Canvas.DrawText("ITEM ::"); 00533 YPos += YL; 00534 Canvas.SetPos(4,YPos); 00535 SelectedItem.DisplayDebug(Canvas,YL,YPos); 00536 } 00537 00538 Canvas.SetDrawColor(0,255,255); 00539 if ( PendingItem == None ) 00540 { 00541 Canvas.DrawText("NO PENDINGITEM"); 00542 YPos += YL; 00543 Canvas.SetPos(4,YPos); 00544 } 00545 else 00546 { 00547 Canvas.DrawText("PENDINGITEM ::"); 00548 YPos += YL; 00549 Canvas.SetPos(4,YPos); 00550 PendingItem.DisplayDebug(Canvas,YL,YPos); 00551 } 00552 } 00553 00554 //_____________________________________________________________________________ 00555 // Compute offset for drawing an inventory item. 00556 native simulated function vector CalcDrawOffset(inventory Inv); 00557 /*simulated function vector CalcDrawOffset(inventory Inv) 00558 { 00559 local vector DrawOffset; 00560 00561 if ( Controller == None ) 00562 return (Inv.PlayerViewOffset >> Rotation) + BaseEyeHeight * vect(0,0,1); 00563 00564 DrawOffset = ((0.9/Controller.FOVAngle * 100 * Inv.PlayerViewOffset) >> GetViewRotation() ); 00565 if ( !IsLocallyControlled() ) 00566 DrawOffset.Z += BaseEyeHeight; 00567 else 00568 { 00569 DrawOffset.Z += EyeHeight; 00570 DrawOffset += Controller.WeaponBob(Inv.BobDamping); 00571 } 00572 return DrawOffset; 00573 }*/ 00574 00575 00576 //*************************************** 00577 // Interface to Pawn's Controller 00578 00579 //_____________________________________________________________________________ 00580 // return true if controlled by a Player (AI or human) 00581 /*simulated function bool IsPlayerPawn() 00582 { 00583 return ( (Controller != None) && Controller.bIsPlayer ); 00584 }*/ 00585 native simulated function bool IsPlayerPawn(); 00586 00587 //_____________________________________________________________________________ 00588 // return true if controlled by a real live human 00589 /*simulated function bool IsHumanControlled() 00590 { 00591 return ( PlayerController(Controller) != None ); 00592 }*/ 00593 native simulated function bool IsHumanControlled(); 00594 00595 //_____________________________________________________________________________ 00596 // return true if controlled by local (not network) player 00597 /*simulated function bool IsLocallyControlled() 00598 { 00599 if ( Level.NetMode == NM_Standalone ) 00600 return true; 00601 if ( Controller == None ) 00602 return false; 00603 if ( PlayerController(Controller) == None ) 00604 return true; 00605 00606 return ( Viewport(PlayerController(Controller).Player) != None ); 00607 }*/ 00608 native simulated function bool IsLocallyControlled(); 00609 00610 //_____________________________________________________________________________ 00611 /*simulated function rotator GetViewRotation() 00612 { 00613 if ( Controller == None ) 00614 return Rotation; 00615 else 00616 return Controller.Rotation; 00617 }*/ 00618 native simulated function rotator GetViewRotation(); 00619 00620 //_____________________________________________________________________________ 00621 simulated function SetViewRotation(rotator NewRotation ) 00622 { 00623 if ( Controller != None ) 00624 Controller.SetRotation(NewRotation); 00625 } 00626 00627 //_____________________________________________________________________________ 00628 final function bool InGodMode() 00629 { 00630 return ( (Controller != None) && Controller.bGodMode ); 00631 } 00632 00633 //_____________________________________________________________________________ 00634 simulated function bool CanHoldDualWeapons() 00635 { 00636 return false; 00637 } 00638 00639 /* XIIIUNUSED 00640 //_____________________________________________________________________________ 00641 function bool NearMoveTarget() 00642 { 00643 if ( (Controller == None) || (Controller.MoveTarget == None) ) 00644 return false; 00645 return NearSpot(Controller.MoveTarget.Location); 00646 } 00647 */ 00648 00649 //_____________________________________________________________________________ 00650 /*simulated final function bool PressingFire() 00651 { 00652 return ( (Controller != None) && (Controller.bFire != 0) ); 00653 }*/ 00654 native simulated final function bool PressingFire(); 00655 00656 //_____________________________________________________________________________ 00657 native function SpineYawControl(bool IsControlled,int MaxValue, float RotationSpeed); 00658 native function HeadYawControl(bool IsControlled,int MaxValue, float RotationSpeed); 00659 00660 //_____________________________________________________________________________ 00661 simulated final function bool PressingAltFire() 00662 { 00663 return ( (Controller != None) && (Controller.bAltFire != 0) ); 00664 } 00665 00666 /* XIIIUNUSED 00667 function Actor GetMoveTarget() 00668 { 00669 if ( Controller == None ) 00670 return None; 00671 00672 return Controller.MoveTarget; 00673 } 00674 */ 00675 00676 //_____________________________________________________________________________ 00677 function SetMoveTarget(Actor NewTarget ) 00678 { 00679 if ( Controller != None ) 00680 Controller.MoveTarget = NewTarget; 00681 } 00682 00683 //_____________________________________________________________________________ 00684 function bool LineOfSightTo(actor Other) 00685 { 00686 return ( (Controller != None) && Controller.LineOfSightTo(Other) ); 00687 } 00688 00689 //_____________________________________________________________________________ 00690 simulated final function rotator AdjustAim(Ammunition FiredAmmunition, vector projStart, int aimerror) 00691 { 00692 if ( Controller == None ) 00693 return Rotation; 00694 return Controller.AdjustAim(FiredAmmunition, projStart, aimerror); 00695 } 00696 00697 //_____________________________________________________________________________ 00698 function Actor ShootSpecial(Actor A) 00699 { 00700 if ( !Controller.bCanDoSpecial || (Weapon == None) ) 00701 return None; 00702 00703 Controller.FireWeaponAt(A); 00704 Controller.bFire = 0; 00705 return A; 00706 } 00707 00708 //_____________________________________________________________________________ 00709 function HandlePickup(Pickup pick) 00710 { 00711 if ( Controller != None ) 00712 Controller.HandlePickup(pick); 00713 } 00714 00715 //_____________________________________________________________________________ 00716 function ReceiveLocalizedMessage( class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject ) 00717 { 00718 if ( PlayerController(Controller) != None ) 00719 PlayerController(Controller).ReceiveLocalizedMessage( Message, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject ); 00720 } 00721 00722 //_____________________________________________________________________________ 00723 event ClientMessage( coerce string S, optional Name Type ) 00724 { 00725 if ( PlayerController(Controller) != None ) 00726 PlayerController(Controller).ClientMessage( S, Type ); 00727 } 00728 00729 //_____________________________________________________________________________ 00730 function Trigger( actor Other, pawn EventInstigator ) 00731 { 00732 if ( Controller != None ) 00733 Controller.Trigger(Other, EventInstigator); 00734 } 00735 00736 //_____________________________________________________________________________ 00737 function GiveWeapon(string aClassName ) 00738 { 00739 local class<Weapon> WeaponClass; 00740 local Weapon NewWeapon; 00741 00742 if ( aClassName == "" ) 00743 return; 00744 WeaponClass = class<Weapon>(DynamicLoadObject(aClassName, class'Class')); 00745 00746 if( FindInventoryType(WeaponClass) != None ) 00747 return; 00748 newWeapon = Spawn(WeaponClass); 00749 if( newWeapon != None ) 00750 newWeapon.GiveTo(self); 00751 } 00752 00753 //_____________________________________________________________________________ 00754 function SetDisplayProperties(ERenderStyle NewStyle, Material NewTexture, bool bLighting ) 00755 { 00756 Style = NewStyle; 00757 Texture = NewTexture; 00758 bUnlit = bLighting; 00759 if ( Weapon != None ) 00760 Weapon.SetDisplayProperties(Style, Texture, bUnlit); 00761 00762 if ( !bUpdatingDisplay && (Inventory != None) ) 00763 { 00764 bUpdatingDisplay = true; 00765 Inventory.SetOwnerDisplay(); 00766 } 00767 bUpdatingDisplay = false; 00768 } 00769 00770 //_____________________________________________________________________________ 00771 function SetDefaultDisplayProperties() 00772 { 00773 Style = Default.Style; 00774 texture = Default.Texture; 00775 bUnlit = Default.bUnlit; 00776 if ( Weapon != None ) 00777 Weapon.SetDefaultDisplayProperties(); 00778 00779 if ( !bUpdatingDisplay && (Inventory != None) ) 00780 { 00781 bUpdatingDisplay = true; 00782 Inventory.SetOwnerDisplay(); 00783 } 00784 bUpdatingDisplay = false; 00785 } 00786 00787 //_____________________________________________________________________________ 00788 function FinishedInterpolation(InterpolationPoint Other) 00789 { 00790 DropToGround(); 00791 } 00792 00793 //_____________________________________________________________________________ 00794 function JumpOutOfWater(vector jumpDir) 00795 { 00796 Falling(); 00797 Velocity = jumpDir * WaterSpeed; 00798 Acceleration = jumpDir * AccelRate; 00799 velocity.Z = FMax(380,JumpZ); //set here so physics uses this for remainder of tick 00800 bUpAndOut = true; 00801 } 00802 00803 //_____________________________________________________________________________ 00804 event FellOutOfWorld() 00805 { 00806 if ( Role < ROLE_Authority ) 00807 return; 00808 Health = -1; 00809 SetPhysics(PHYS_None); 00810 Weapon = None; 00811 Died(None, class'Gibbed', Location); 00812 } 00813 00814 //_____________________________________________________________________________ 00815 // Controller is requesting that pawn crouch 00816 function ShouldCrouch(bool Crouch) 00817 { 00818 bWantsToCrouch = Crouch; 00819 } 00820 00821 00822 //_____________________________________________________________________________ 00823 event EndCrouch(float HeightAdjust) 00824 { 00825 if ( bDBAnim ) 00826 Log("@@@ EndCrouch call for "$self); 00827 00828 EyeHeight -= HeightAdjust; 00829 OldZ += HeightAdjust; 00830 BaseEyeHeight = Default.BaseEyeHeight; 00831 Visibility = default.Visibility; 00832 if ( IsPlayerPawn() ) 00833 PlaySound(hUnCrouchSound); 00834 if ( !bIsDead ) 00835 { 00836 PlayWaiting(); 00837 PlayMoving(); 00838 } 00839 } 00840 00841 //_____________________________________________________________________________ 00842 event StartCrouch(float HeightAdjust) 00843 { 00844 if ( bDBAnim ) 00845 Log("@@@ StartCrouch call for "$self); 00846 00847 EyeHeight += HeightAdjust; 00848 OldZ -= HeightAdjust; 00849 BaseEyeHeight = 0.8 * CrouchHeight; 00850 if (Physics == PHYS_Walking) 00851 Visibility = CrouchedVisibility; 00852 if ( IsPlayerPawn() ) 00853 PlaySound(hCrouchSound); 00854 if ( !bIsDead ) 00855 { 00856 PlayWaiting(); 00857 PlayMoving(); 00858 } 00859 } 00860 00861 //_____________________________________________________________________________ 00862 function RestartPlayer(); 00863 00864 //_____________________________________________________________________________ 00865 function AddVelocity( vector NewVelocity) 00866 { 00867 if ( (Physics == PHYS_Walking) 00868 || (((Physics == PHYS_Ladder) || (Physics == PHYS_Spider)) && (NewVelocity.Z > Default.JumpZ)) ) 00869 SetPhysics(PHYS_Falling); 00870 if ( (Velocity.Z > 380) && (NewVelocity.Z > 0) ) 00871 NewVelocity.Z *= 0.5; 00872 Velocity += NewVelocity; 00873 } 00874 00875 //_____________________________________________________________________________ 00876 function KilledBy( pawn EventInstigator ) 00877 { 00878 local Controller Killer; 00879 00880 Health = 0; 00881 if ( EventInstigator != None ) 00882 Killer = EventInstigator.Controller; 00883 Died( Killer, class'Suicided', Location ); 00884 } 00885 00886 function TakeFallingDamage() 00887 { 00888 local float Shake; 00889 00890 if (Velocity.Z < -0.5 * MaxFallSpeed) 00891 { 00892 MakeNoise(FMin(2.0,-0.5 * Velocity.Z/(FMax(JumpZ, 150.0)))); 00893 if (Velocity.Z < -1 * MaxFallSpeed) 00894 { 00895 if ( Role == ROLE_Authority ) 00896 TakeDamage(-100 * (Velocity.Z + MaxFallSpeed)/MaxFallSpeed, None, Location, vect(0,0,0), class'Fell'); 00897 } 00898 if ( Controller != None ) 00899 { 00900 Shake = FMin(1, -1 * Velocity.Z/MaxFallSpeed); 00901 Controller.ShakeView(0.175 + 0.1 * Shake, 850 * Shake, Shake * vect(0,0,1.5), 120000, vect(0,0,10), 1); 00902 } 00903 } 00904 } 00905 00906 function ClientReStart() 00907 { 00908 Velocity = vect(0,0,0); 00909 Acceleration = vect(0,0,0); 00910 BaseEyeHeight = Default.BaseEyeHeight; 00911 EyeHeight = BaseEyeHeight; 00912 PlayWaiting(); 00913 } 00914 00915 function ClientSetLocation( vector NewLocation, rotator NewRotation ) 00916 { 00917 if ( Controller != None ) 00918 Controller.ClientSetLocation(NewLocation, NewRotation); 00919 } 00920 00921 function ClientSetRotation( rotator NewRotation ) 00922 { 00923 if ( Controller != None ) 00924 Controller.ClientSetRotation(NewRotation); 00925 } 00926 00927 /*simulated function FaceRotation( rotator NewRotation, float DeltaTime ) 00928 { 00929 if ( Physics == PHYS_Ladder ) 00930 SetRotation(OnLadder.WallDir); 00931 else 00932 { 00933 if ( (Physics == PHYS_Walking) || (Physics == PHYS_Falling) ) 00934 NewRotation.Pitch = 0; 00935 SetRotation(NewRotation); 00936 } 00937 }*/ 00938 native simulated function FaceRotation( rotator NewRotation, float DeltaTime ); 00939 00940 00941 function ClientDying(class<DamageType> DamageType, vector HitLocation) 00942 { 00943 if ( Controller != None ) 00944 Controller.ClientDying(DamageType, HitLocation); 00945 } 00946 00947 //============================================================================= 00948 // Inventory related functions. 00949 00950 // toss out the weapon currently held 00951 function TossWeapon(vector TossVel) 00952 { 00953 local vector X,Y,Z; 00954 00955 Weapon.velocity = TossVel; 00956 GetAxes(Rotation,X,Y,Z); 00957 if ( Level.bLonePlayer && (Weapon.default.ReloadCount != 0) ) 00958 { 00959 if ( Weapon.AmmoType != none ) 00960 { 00961 Weapon.AmmoType.Velocity = TossVel*1.1 + vRand()*0.2*vSize(TossVel); 00962 Weapon.AmmoType.AmmoAmount -= Weapon.ReloadCount; 00963 if ( Weapon.AmmoType.AmmoAmount > 0 ) 00964 { 00965 Weapon.AmmoType.DropFrom(Location); 00966 Weapon.AmmoType = none; 00967 } 00968 else 00969 { 00970 DeleteInventory(Weapon.AmmoType); 00971 Weapon.AmmoType = none; 00972 } 00973 } 00974 /* 00975 if ( Weapon.AltAmmoType != none ) 00976 { 00977 Weapon.AltAmmoType.Velocity = TossVel + vRand()*0.2*vSize(TossVel); 00978 Weapon.AltAmmoType.DropFrom(Location); 00979 Weapon.AltAmmoType = none; 00980 } 00981 */ 00982 } 00983 debuglog("DROP weapon reloadcount="$Weapon.ReloadCount); 00984 Weapon.DropFrom(Location); 00985 } 00986 00987 // The player/bot wants to select next item 00988 exec function NextItem() 00989 { 00990 local Inventory Inv; 00991 00992 if (SelectedItem==None) { 00993 SelectedItem = Inventory.SelectNext(); 00994 Return; 00995 } 00996 if (SelectedItem.Inventory!=None) 00997 SelectedItem = SelectedItem.Inventory.SelectNext(); 00998 else 00999 SelectedItem = Inventory.SelectNext(); 01000 01001 if ( SelectedItem == None ) 01002 SelectedItem = Inventory.SelectNext(); 01003 } 01004 01005 // FindInventoryType() 01006 // returns the inventory item of the requested class 01007 // if it exists in this pawn's inventory 01008 /* 01009 function Inventory FindInventoryType( class DesiredClass ) 01010 { 01011 local Inventory Inv; 01012 01013 for( Inv=Inventory; Inv!=None; Inv=Inv.Inventory ) 01014 if ( Inv.class == DesiredClass ) 01015 return Inv; 01016 return None; 01017 } */ 01018 native function Inventory FindInventoryType( class DesiredClass ); 01019 native function Inventory FindInventoryKind( Name DesiredClassName ); 01020 01021 // Add Item to this pawn's inventory. 01022 // Returns true if successfully added, false if not. 01023 function bool AddInventory( inventory NewItem ) 01024 { 01025 // Skip if already in the inventory. 01026 local inventory Inv; 01027 local actor Last; 01028 01029 Last = self; 01030 01031 // The item should not have been destroyed if we get here. 01032 if (NewItem ==None ) 01033 log("tried to add none inventory to "$self); 01034 01035 for( Inv=Inventory; Inv!=None; Inv=Inv.Inventory ) 01036 { 01037 if( Inv == NewItem ) 01038 return false; 01039 Last = Inv; 01040 } 01041 01042 // Add to back of inventory chain (so minimizes net replication effect). 01043 NewItem.SetOwner(Self); 01044 NewItem.Inventory = None; 01045 Last.Inventory = NewItem; 01046 01047 if ( Controller != None ) 01048 Controller.NotifyAddInventory(NewItem); 01049 return true; 01050 } 01051 01052 // Remove Item from this pawn's inventory, if it exists. 01053 simulated function DeleteInventory( inventory Item ) 01054 { 01055 // If this item is in our inventory chain, unlink it. 01056 local actor Link; 01057 01058 if ( Item == Weapon ) 01059 Weapon = None; 01060 if ( Item == SelectedItem ) 01061 SelectedItem = None; 01062 for( Link = Self; Link!=None; Link=Link.Inventory ) 01063 { 01064 if( Link.Inventory == Item ) 01065 { 01066 Link.Inventory = Item.Inventory; 01067 Item.Inventory = none; 01068 break; 01069 } 01070 } 01071 Item.SetOwner(None); 01072 } 01073 01074 01075 //_____________________________________________________________________________ 01076 // insert/move Item to this pawn's inventory after RefItem 01077 // Returns true if successfully added, false if not. 01078 function bool InsertInventory( inventory NewItem , inventory RefItem) 01079 { 01080 // Skip if already in the inventory. 01081 local inventory Inv; 01082 01083 // Log("InsertInventory"@NewItem@"after"@RefItem@"(whos inv="$RefItem.Inventory); 01084 01085 // The item should not have been destroyed if we get here. 01086 if (NewItem == None ) 01087 { 01088 Warn("tried to add none inventory to "$self); 01089 return false; 01090 } 01091 else if ( NewItem == RefItem ) 01092 { 01093 Warn("tried to InsertInventory "$RefItem$" after same"); 01094 return false; 01095 } 01096 01097 // for( Inv=Inventory; Inv!=None; Inv=Inv.Inventory ) 01098 // { 01099 // if( Inv == NewItem ) 01100 // { // be sure we remove from own inventory, function can be used to move some inventory 01101 // // (moving ammo after weapon to make saves ok) 01102 DeleteInventory(NewItem); 01103 // } 01104 // } 01105 01106 // Add to back of inventory chain (so minimizes net replication effect). 01107 NewItem.SetOwner(Self); 01108 NewItem.Inventory = RefItem.Inventory; 01109 RefItem.Inventory = NewItem; 01110 01111 if ( Controller != None ) 01112 Controller.NotifyAddInventory(NewItem); 01113 return true; 01114 } 01115 01116 // Just changed to pendingWeapon 01117 function ChangedWeapon(); 01118 /* 01119 { 01120 local Weapon OldWeapon; 01121 01122 OldWeapon = Weapon; 01123 01124 if (Weapon == PendingWeapon) 01125 { 01126 if ( Weapon == None ) 01127 { 01128 Controller.SwitchToBestWeapon(); 01129 return; 01130 } 01131 else if ( Weapon.IsInState('DownWeapon') ) 01132 Weapon.GotoState('Idle'); 01133 PendingWeapon = None; 01134 ServerChangedWeapon(OldWeapon, Weapon); 01135 return; 01136 } 01137 if ( PendingWeapon == None ) 01138 PendingWeapon = Weapon; 01139 01140 Weapon = PendingWeapon; 01141 if ( (Weapon != None) && (Level.NetMode == NM_Client) ) 01142 Weapon.BringUp(); 01143 PendingWeapon = None; 01144 Weapon.Instigator = self; 01145 ServerChangedWeapon(OldWeapon, Weapon); 01146 if ( Controller != None ) 01147 Controller.ChangedWeapon(); 01148 } 01149 */ 01150 01151 function name GetWeaponBoneFor(Inventory I) 01152 { 01153 return 'righthand'; 01154 } 01155 01156 function ServerChangedWeapon(Weapon OldWeapon, Weapon W) 01157 { 01158 if ( OldWeapon != None ) 01159 { 01160 OldWeapon.SetDefaultDisplayProperties(); 01161 OldWeapon.DetachFromPawn(self); 01162 } 01163 Weapon = W; 01164 if ( Weapon == None ) 01165 return; 01166 01167 if ( Weapon != None ) 01168 { 01169 //log("ServerChangedWeapon: Attaching Weapon to actor bone."); 01170 Weapon.AttachToPawn(self); 01171 } 01172 01173 Weapon.SetRelativeLocation(Weapon.Default.RelativeLocation); 01174 Weapon.SetRelativeRotation(Weapon.Default.RelativeRotation); 01175 if ( OldWeapon == Weapon ) 01176 { 01177 if ( Weapon.IsInState('DownWeapon') ) 01178 Weapon.BringUp(); 01179 // Inventory.OwnerEvent('ChangedWeapon'); // tell inventory that weapon changed (in case any effect was being applied) 01180 return; 01181 } 01182 else if ( Level.Game != None ) 01183 MakeNoise(0.1 * Level.Game.Difficulty); 01184 // Inventory.OwnerEvent('ChangedWeapon'); // tell inventory that weapon changed (in case any effect was being applied) 01185 01186 PlayWeaponSwitch(W); 01187 Weapon.BringUp(); 01188 } 01189 01190 //============== 01191 // Encroachment 01192 event bool EncroachingOn( actor Other ) 01193 { 01194 if ( (Other.Brush != None) || (Brush(Other) != None) ) 01195 return true; 01196 01197 if ( ((Controller == None) || !Controller.bIsPlayer) && (Pawn(Other) != None) ) 01198 return true; 01199 01200 return false; 01201 } 01202 01203 event EncroachedBy( actor Other ) 01204 { 01205 if ( Pawn(Other) != None ) 01206 gibbedBy(Other); 01207 } 01208 01209 function gibbedBy(actor Other) 01210 { 01211 local Controller Killer; 01212 01213 if ( Role < ROLE_Authority ) 01214 return; 01215 if ( Pawn(Other) != None ) 01216 Killer = Pawn(Other).Controller; 01217 Died(Killer, class'Gibbed', Location); 01218 } 01219 01220 //Base change - if new base is pawn or decoration, damage based on relative mass and old velocity 01221 // Also, non-players will jump off pawns immediately 01222 function JumpOffPawn() 01223 { 01224 Velocity += (100 + CollisionRadius) * VRand(); 01225 Velocity.Z = 200 + CollisionHeight; 01226 SetPhysics(PHYS_Falling); 01227 Controller.SetFall(); 01228 } 01229 01230 singular event BaseChange() 01231 { 01232 local float decorMass; 01233 01234 if ( bInterpolating ) 01235 return; 01236 if ( (base == None) && (Physics == PHYS_None) ) 01237 SetPhysics(PHYS_Falling); 01238 else if ( Pawn(Base) != None ) 01239 { 01240 Base.TakeDamage( (1-Velocity.Z/400)* Mass/Base.Mass, Self,Location,0.5 * Velocity , class'Crushed'); 01241 JumpOffPawn(); 01242 } 01243 else if ( (Decoration(Base) != None) && (Velocity.Z < -400) ) 01244 { 01245 decorMass = FMax(Decoration(Base).Mass, 1); 01246 Base.TakeDamage((-2* Mass/decorMass * Velocity.Z/400), Self, Location, 0.5 * Velocity, class'Crushed'); 01247 } 01248 } 01249 01250 //_____________________________________________________________________________ 01251 event UpdateEyeHeight( float DeltaTime ) 01252 { 01253 local float smooth; 01254 local float OldEyeHeight; 01255 01256 if (Controller == None ) 01257 { 01258 EyeHeight = 0; 01259 return; 01260 } 01261 01262 // smooth up/down stairs 01263 smooth = FMin(1.0, 7.0 * DeltaTime/Level.TimeDilation); 01264 If( Controller.WantsSmoothedView() ) 01265 { 01266 // Log("UpdateEyeHeigth Smooth call for "$self$" smooth="$smooth); 01267 OldEyeHeight = EyeHeight; 01268 EyeHeight = OldEyeHeight * (1 - smooth) + BaseEyeHeight * smooth; 01269 } 01270 else 01271 { 01272 // Log("UpdateEyeHeigth NOT Smooth call for "$self); 01273 bJustLanded = false; 01274 EyeHeight = EyeHeight * ( 1 - smooth ) + BaseEyeHeight * smooth; 01275 } 01276 Controller.AdjustView(DeltaTime); 01277 } 01278 01279 /* EyePosition() 01280 Called by PlayerController to determine camera position in first person view. Returns 01281 the offset from the Pawn's location at which to place the camera 01282 */ 01283 /* 01284 function vector EyePosition() 01285 { 01286 return EyeHeight * vect(0,0,1); 01287 } 01288 */ 01289 native function vector EyePosition(); 01290 01291 //============================================================================= 01292 01293 simulated event Destroyed() 01294 { 01295 local Inventory I, Inv,Next; 01296 01297 Log("PAWN DESTROY"@self); 01298 if ( Shadow != None ) 01299 Shadow.Destroy(); 01300 if ( Controller != None ) 01301 Controller.PawnDied(); 01302 RemovePawnFromList(); 01303 01304 if ( Role < ROLE_Authority ) 01305 return; 01306 01307 /* 01308 Log("BEFDESTROY -- Begin Inventory List"); 01309 I=Inventory; 01310 while ( I != none ) 01311 { 01312 if ( Ammunition(I) != none ) 01313 log(" Inv="$I$" Ammo="$Ammunition(I).AmmoAmount); 01314 else if ( I.Isa('PowerUps') ) 01315 log(" Inv="$I$" charges="$PowerUps(I).Charge); 01316 else if ( I.Isa('Armor') ) 01317 log(" Inv="$I$" charges="$Armor(I).Charge); 01318 else if ( Weapon(I) != none ) 01319 log(" Inv="$I@" Ammo="$Weapon(I).AmmoType@"AltAmmo="$Weapon(I).AltAmmoType); 01320 else 01321 log(" Inv="$I); 01322 01323 I=I.Inventory; 01324 } 01325 log(" -- End Inventory List"); 01326 */ 01327 01328 /* 01329 while (Inventory != none) 01330 { // we want to be sure ALL the inventory is destroyed 01331 // Log(" Should destroy inventory"@Inventory); 01332 if ( Inventory.bDeleteMe ) 01333 Inventory = Inventory.Inventory; 01334 //DeleteInventory(Inventory); 01335 Inventory.Destroy(); 01336 } 01337 */ 01338 Inv = Inventory; 01339 while ( Inv != None ) 01340 { 01341 Next = Inv.Inventory; 01342 // Log(" Should destroy inventory"@Inv); 01343 Inv.bTossedOut = true; // this is to prevent destroying ammo for weapons thsu making Next unavailable. 01344 Inv.Destroy(); 01345 Inv = Next; 01346 } 01347 Weapon = None; 01348 Inventory = None; 01349 // Super.Destroyed(); 01350 } 01351 01352 //============================================================================= 01353 // 01354 // Called immediately before gameplay begins. 01355 // 01356 simulated event PreBeginPlay() 01357 { 01358 Super.PreBeginPlay(); 01359 Instigator = self; 01360 DesiredRotation = Rotation; 01361 if ( bDeleteMe ) 01362 return; 01363 01364 AddPawnToList(); 01365 PreSetMovement(); 01366 if ( DrawScale != Default.Drawscale ) 01367 { 01368 SetCollisionSize(CollisionRadius*DrawScale/Default.DrawScale, CollisionHeight*DrawScale/Default.DrawScale); 01369 Health = Health * DrawScale/Default.DrawScale; 01370 } 01371 01372 if ( BaseEyeHeight == 0 ) 01373 BaseEyeHeight = 0.8 * CollisionHeight; 01374 EyeHeight = BaseEyeHeight; 01375 01376 // if ( menuname == "" ) 01377 // menuname = GetItemName(string(class)); 01378 } 01379 01380 simulated event PostBeginPlay() 01381 { 01382 local AIScript A; 01383 01384 if ( bActorShadows && (Shadow==None) ) 01385 { 01386 Shadow = Spawn(class'ShadowProjector',Self,'',Location); 01387 } 01388 01389 Super.PostBeginPlay(); 01390 SplashTime = 0; 01391 EyeHeight = BaseEyeHeight; 01392 OldRotYaw = Rotation.Yaw; 01393 01394 // automatically add controller to pawns which were placed in level 01395 // NOTE: pawns spawned during gameplay are not automatically possessed by a controller 01396 if ( Level.bStartup && (Health > 0) && !bDontPossess ) 01397 { 01398 // check if I have an AI Script 01399 /* 01400 if ( (AIScriptTag != 'None') && (AIScriptTag != '') ) 01401 { 01402 ForEach AllActors(class'AIScript',A,AIScriptTag) 01403 break; 01404 // let the AIScript spawn and init my controller 01405 if ( A != None ) 01406 { 01407 A.SpawnControllerFor(self); 01408 if ( Controller != None ) 01409 return; 01410 } 01411 } 01412 */ 01413 if ( (ControllerClass != None) && (Controller == None) ) 01414 Controller = spawn(ControllerClass); 01415 if ( Controller != None ) 01416 Controller.Possess(self); 01417 } 01418 } 01419 01420 // called after PostBeginPlay on net client 01421 simulated event PostNetBeginPlay() 01422 { 01423 if ( Role == ROLE_Authority ) 01424 return; 01425 if ( Controller != None ) 01426 { 01427 Controller.Pawn = self; 01428 bUpdateEyeHeight = true; 01429 } 01430 01431 if ( (PlayerReplicationInfo != None) 01432 && (PlayerReplicationInfo.Owner == None) ) 01433 PlayerReplicationInfo.SetOwner(Controller); 01434 PlayWaiting(); 01435 } 01436 01437 /* PreSetMovement() 01438 default for walking creature. Re-implement in subclass 01439 for swimming/flying capability 01440 */ 01441 function PreSetMovement() 01442 { 01443 if (JumpZ > 0) 01444 bCanJump = true; 01445 bCanWalk = true; 01446 bCanSwim = false; 01447 bCanFly = false; 01448 } 01449 01450 simulated function SetMesh() 01451 { 01452 mesh = default.mesh; 01453 } 01454 01455 function Gasp(); 01456 function SetMovementPhysics(); 01457 01458 //_____________________________________________________________________________ 01459 // ELR 01460 function float HealthPercent() 01461 { 01462 return (100.0 * Health / Default.Health); 01463 } 01464 01465 function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, 01466 Vector momentum, class<DamageType> damageType) 01467 { 01468 local int actualDamage; 01469 local bool bAlreadyDead; 01470 local Controller Killer; 01471 01472 if ( Role < ROLE_Authority ) 01473 { 01474 log(self$" client damage type "$damageType$" by "$instigatedBy); 01475 return; 01476 } 01477 01478 bAlreadyDead = (Health <= 0); 01479 01480 if (Physics == PHYS_None) 01481 SetMovementPhysics(); 01482 if (Physics == PHYS_Walking) 01483 momentum.Z = FMax(momentum.Z, 0.4 * VSize(momentum)); 01484 if ( instigatedBy == self ) 01485 momentum *= 0.6; 01486 momentum = momentum/Mass; 01487 01488 actualDamage = Level.Game.ReduceDamage(Damage, self, instigatedBy, HitLocation, Momentum, DamageType); 01489 01490 Health -= actualDamage; 01491 if ( HitLocation == vect(0,0,0) ) 01492 HitLocation = Location; 01493 if ( bAlreadyDead ) 01494 { 01495 Warn(self$" took regular damage "$damagetype$" from "$instigatedby$" while already dead at "$Level.TimeSeconds); 01496 ChunkUp(-1 * Health); 01497 return; 01498 } 01499 01500 PlayHit(actualDamage, hitLocation, damageType, Momentum); 01501 if ( Health <= 0 ) 01502 { 01503 // pawn died 01504 if ( instigatedBy != None ) 01505 Killer = instigatedBy.Controller; //FIXME what if killer died before killing you 01506 if ( bPhysicsAnimUpdate ) 01507 TearOffMomentum = momentum; 01508 Died(Killer, damageType, HitLocation); 01509 } 01510 else 01511 { 01512 AddVelocity( momentum ); 01513 if ( Controller != None ) 01514 Controller.NotifyTakeHit(instigatedBy, HitLocation, actualDamage, DamageType, Momentum); 01515 } 01516 MakeNoise(1.0); 01517 } 01518 01519 function Died(Controller Killer, class<DamageType> damageType, vector HitLocation) 01520 { 01521 if ( bDeleteMe ) 01522 return; //already destroyed 01523 01524 // mutator hook to prevent deaths 01525 // WARNING - don't prevent bot suicides - they suicide when really needed 01526 if ( Level.Game.PreventDeath(self, Killer, damageType, HitLocation) ) 01527 { 01528 Health = max(Health, 1); //mutator should set this higher 01529 return; 01530 } 01531 Health = Min(0, Health); 01532 Level.Game.Killed(Killer, Controller, self, damageType); 01533 01534 if ( Killer != None ) 01535 TriggerEvent(Event, self, Killer.Pawn); 01536 else 01537 TriggerEvent(Event, self, None); 01538 01539 Velocity.Z *= 1.3; 01540 if ( IsHumanControlled() ) 01541 PlayerController(Controller).ForceDeathUpdate(); 01542 if ( (DamageType != None) && (DamageType.default.GibModifier >= 100) ) 01543 ChunkUp(-1 * Health); 01544 else 01545 { 01546 PlayDying(DamageType, HitLocation); 01547 if ( Level.Game.bGameEnded ) 01548 return; 01549 if ( !bPhysicsAnimUpdate && !IsLocallyControlled() ) 01550 ClientDying(DamageType, HitLocation); 01551 } 01552 } 01553 01554 function YouCantClimb(); // used to send message on-screen. 01555 01556 function bool Gibbed(class<DamageType> damageType) 01557 { 01558 if ( damageType.default.GibModifier == 0 ) 01559 return false; 01560 if ( damageType.default.GibModifier >= 100 ) 01561 return true; 01562 if ( (Health < -80) || ((Health < -40) && (FRand() < 0.6)) ) 01563 return true; 01564 return false; 01565 } 01566 01567 event Falling() 01568 { 01569 //SetPhysics(PHYS_Falling); //Note - physics changes type to PHYS_Falling by default 01570 if ( Controller != None ) 01571 Controller.SetFall(); 01572 } 01573 01574 event HitWall(vector HitNormal, actor Wall); 01575 01576 event Landed(vector HitNormal) 01577 { 01578 TakeFallingDamage(); 01579 if ( Health > 0 ) 01580 PlayLanded(Velocity.Z); 01581 if (Velocity.Z < -1.4 * JumpZ) 01582 MakeNoise(-0.5 * Velocity.Z/(FMax(JumpZ, 150.0))); 01583 bJustLanded = true; 01584 } 01585 01586 event HeadVolumeChange(PhysicsVolume newHeadVolume) 01587 { 01588 if ( (Level.NetMode == NM_Client) || (Controller == None) ) 01589 return; 01590 if ( HeadVolume.bWaterVolume ) 01591 { 01592 if (!newHeadVolume.bWaterVolume) 01593 { 01594 if ( Controller.bIsPlayer && (BreathTime > 0) && (BreathTime < 8) ) 01595 Gasp(); 01596 BreathTime = -1.0; 01597 } 01598 } 01599 else if ( newHeadVolume.bWaterVolume ) 01600 BreathTime = UnderWaterTime; 01601 } 01602 01603 function bool TouchingWaterVolume() 01604 { 01605 local PhysicsVolume V; 01606 01607 ForEach TouchingActors(class'PhysicsVolume',V) 01608 if ( V.bWaterVolume ) 01609 return true; 01610 01611 return false; 01612 } 01613 01614 //Pain timer just expired. 01615 //Check what zone I'm in (and which parts are) 01616 //based on that cause damage, and reset BreathTime 01617 01618 function bool IsInPain() 01619 { 01620 local PhysicsVolume V; 01621 01622 ForEach TouchingActors(class'PhysicsVolume',V) 01623 if ( V.bPainCausing && (V.DamagePerSec > 0) ) 01624 return true; 01625 return false; 01626 } 01627 01628 event BreathTimer() 01629 { 01630 if ( (Health < 0) || (Level.NetMode == NM_Client) ) 01631 return; 01632 TakeDrowningDamage(); 01633 if ( Health > 0 ) 01634 BreathTime = 2.0; 01635 } 01636 01637 function TakeDrowningDamage(); 01638 01639 function bool CheckWaterJump(out vector WallNormal) 01640 { 01641 local actor HitActor; 01642 local vector HitLocation, HitNormal, checkpoint, start, checkNorm, Extent; 01643 01644 checkpoint = vector(Rotation); 01645 checkpoint.Z = 0.0; 01646 checkNorm = Normal(checkpoint); 01647 checkPoint = Location + CollisionRadius * checkNorm; 01648 Extent = CollisionRadius * vect(1,1,0); 01649 Extent.Z = CollisionHeight; 01650 HitActor = Trace(HitLocation, HitNormal, checkpoint, Location, true, Extent); 01651 if ( (HitActor != None) && (Pawn(HitActor) == None) ) 01652 { 01653 WallNormal = -1 * HitNormal; 01654 start = Location; 01655 start.Z += 1.1 * MAXSTEPHEIGHT; 01656 checkPoint = start + 2 * CollisionRadius * checkNorm; 01657 HitActor = Trace(HitLocation, HitNormal, checkpoint, start, true); 01658 if (HitActor == None) 01659 return true; 01660 } 01661 01662 return false; 01663 } 01664 01665 //Player Jumped 01666 function DoJump( bool bUpdating ) 01667 { 01668 if ( !bIsCrouched && !bWantsToCrouch && ((Physics == PHYS_Walking) || (Physics == PHYS_Ladder) || (Physics == PHYS_Spider)) ) 01669 { 01670 if ( Role == ROLE_Authority ) 01671 { 01672 if ( (Level.Game != None) && (Level.Game.Difficulty > 0) ) 01673 MakeNoise(0.1 * Level.Game.Difficulty); 01674 // if ( bCountJumps && (Inventory != None) ) 01675 // Inventory.OwnerEvent('Jumped'); 01676 } 01677 if ( Physics == PHYS_Spider ) 01678 Velocity = JumpZ * Floor; 01679 else if ( bIsWalking ) 01680 Velocity.Z = Default.JumpZ; 01681 else 01682 Velocity.Z = JumpZ; 01683 if ( (Base != None) && !Base.bWorldGeometry ) 01684 Velocity.Z += Base.Velocity.Z; 01685 SetPhysics(PHYS_Falling); 01686 } 01687 } 01688 01689 function PlayHit(float Damage, vector HitLocation, class<DamageType> damageType, vector Momentum); 01690 /* 01691 { 01692 local vector BloodOffset, Mo; 01693 local class<Effects> DesiredEffect; 01694 01695 if ( (Damage <= 0) && !Controller.bGodMode ) 01696 return; 01697 if (Damage > 1) //spawn some blood 01698 { 01699 DesiredEffect = DamageType.static.GetPawnDamageEffect(HitLocation, Damage, Momentum, self, (Level.bDropDetail || !Level.bHighDetailMode)); 01700 01701 if ( DesiredEffect != None ) 01702 { 01703 BloodOffset = 0.2 * CollisionRadius * Normal(HitLocation - Location); 01704 BloodOffset.Z = BloodOffset.Z * 0.5; 01705 01706 Mo = Momentum; 01707 if ( Mo.Z > 0 ) 01708 Mo.Z *= 0.5; 01709 01710 spawn(DesiredEffect,self,,HitLocation + BloodOffset, rotator(Mo)); 01711 } 01712 } 01713 if ( Health <= 0 ) 01714 { 01715 if ( PhysicsVolume.bDestructive && (PhysicsVolume.ExitActor != None) ) 01716 Spawn(PhysicsVolume.ExitActor); 01717 return; 01718 } 01719 if ( Level.TimeSeconds - LastPainTime > 0.1 ) 01720 { 01721 PlayTakeHit(HitLocation,Damage,damageType); 01722 LastPainTime = Level.TimeSeconds; 01723 } 01724 } 01725 */ 01726 01727 /* 01728 Pawn was killed - detach any controller, and die 01729 */ 01730 01731 // blow up into little pieces (implemented in subclass) 01732 simulated function ChunkUp(int Damage) 01733 { 01734 if ( Controller != None ) 01735 { 01736 if ( Controller.bIsPlayer ) 01737 Controller.PawnDied(); 01738 else 01739 Controller.Destroy(); 01740 } 01741 destroy(); 01742 } 01743 01744 State Dying 01745 { 01746 ignores Trigger, Bump, HitWall, HeadVolumeChange, PhysicsVolumeChange, Falling, BreathTimer; 01747 01748 event ChangeAnimation() {} 01749 event StopPlayFiring() {} 01750 function PlayFiring(float Rate, name FiringMode) {} 01751 function PlayWeaponSwitch(Weapon NewWeapon) {} 01752 function PlayTakeHit(vector HitLoc, int Damage, class<DamageType> damageType) {} 01753 simulated function PlayNextAnimation() {} 01754 01755 function Died(Controller Killer, class<DamageType> damageType, vector HitLocation) 01756 { 01757 } 01758 01759 function Timer() 01760 { 01761 if ( !PlayerCanSeeMe() ) 01762 Destroy(); 01763 else 01764 SetTimer(2.0, false); 01765 } 01766 01767 function Landed(vector HitNormal) 01768 { 01769 local rotator finalRot; 01770 local float OldHeight; 01771 01772 if( Velocity.Z < -500 ) 01773 TakeDamage( (1-Velocity.Z/30),Instigator,Location,vect(0,0,0) , class'Crushed'); 01774 01775 finalRot = Rotation; 01776 finalRot.Roll = 0; 01777 finalRot.Pitch = 0; 01778 setRotation(finalRot); 01779 SetPhysics(PHYS_None); 01780 SetCollision(true, false, false); 01781 01782 if ( !IsAnimating(0) ) 01783 LieStill(); 01784 } 01785 01786 // prone body should have low height, wider radius 01787 function ReduceCylinder() 01788 { 01789 local float OldHeight, OldRadius; 01790 local vector OldLocation; 01791 01792 SetCollision(True,False,False); 01793 OldHeight = CollisionHeight; 01794 OldRadius = CollisionRadius; 01795 SetCollisionSize(1.5 * Default.CollisionRadius, CarcassCollisionHeight); 01796 PrePivot = vect(0,0,1) * (OldHeight - CollisionHeight); // FIXME - changing prepivot isn't safe w/ static meshes 01797 OldLocation = Location; 01798 if ( !SetLocation(OldLocation - PrePivot) ) 01799 { 01800 SetCollisionSize(OldRadius, CollisionHeight); 01801 if ( !SetLocation(OldLocation - PrePivot) ) 01802 { 01803 SetCollisionSize(CollisionRadius, OldHeight); 01804 SetCollision(false, false, false); 01805 PrePivot = vect(0,0,0); 01806 if ( !SetLocation(OldLocation) ) 01807 ChunkUp(200); 01808 } 01809 } 01810 PrePivot = PrePivot + vect(0,0,3); 01811 } 01812 01813 function LandThump() 01814 { 01815 // animation notify - play sound if actually landed, and animation also shows it 01816 if ( Physics == PHYS_None) 01817 { 01818 bThumped = true; 01819 } 01820 } 01821 01822 event AnimEnd(int Channel) 01823 { 01824 if ( Channel != 0 ) 01825 return; 01826 if ( Physics == PHYS_None ) 01827 LieStill(); 01828 else if ( PhysicsVolume.bWaterVolume ) 01829 { 01830 bThumped = true; 01831 LieStill(); 01832 } 01833 } 01834 01835 function LieStill() 01836 { 01837 if ( !bThumped ) 01838 LandThump(); 01839 if ( CollisionHeight != CarcassCollisionHeight ) 01840 ReduceCylinder(); 01841 } 01842 01843 singular function BaseChange() 01844 { 01845 if( base == None ) 01846 SetPhysics(PHYS_Falling); 01847 else if ( Pawn(base) != None ) 01848 ChunkUp(200); // don't let corpse ride around on someone's head 01849 } 01850 01851 function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, 01852 Vector momentum, class<DamageType> damageType) 01853 { 01854 SetPhysics(PHYS_Falling); 01855 if ( (Physics == PHYS_None) && (Momentum.Z < 0) ) 01856 Momentum.Z *= -1; 01857 Velocity += 3 * momentum/(Mass + 200); 01858 if ( bInvulnerableBody ) 01859 return; 01860 Damage *= DamageType.Default.GibModifier; 01861 Health -=Damage; 01862 if ( ((Damage > 30) || !IsAnimating()) && (Health < -80) ) 01863 ChunkUp(Damage); 01864 } 01865 01866 function BeginState() 01867 { 01868 if ( bTearOff && (Level.NetMode == NM_DedicatedServer) ) 01869 LifeSpan = 1.0; 01870 else 01871 SetTimer(18.0, false); 01872 SetPhysics(PHYS_Falling); 01873 bInvulnerableBody = true; 01874 if ( Controller != None ) 01875 { 01876 if ( Controller.bIsPlayer ) 01877 Controller.PawnDied(); 01878 else 01879 Controller.Destroy(); 01880 } 01881 } 01882 01883 Begin: 01884 Sleep(0.2); 01885 bInvulnerableBody = false; 01886 } 01887 01888 //============================================================================= 01889 // Animation interface for controllers 01890 01891 /* SetAnimStatus() 01892 Called by controller to set animation status (e.g. relaxed, alert, combat, etc. 01893 */ 01894 simulated function SetAnimStatus(name NewStatus) 01895 { 01896 if ( NewStatus != AnimStatus ) 01897 { 01898 // anim status change 01899 AnimStatus = NewStatus; 01900 ChangeAnimation(); 01901 } 01902 } 01903 01904 /* PlayXXX() function called by controller to play transient animation actions 01905 */ 01906 simulated event PlayDying(class<DamageType> DamageType, vector HitLoc) 01907 { 01908 GotoState('Dying'); 01909 if ( bPhysicsAnimUpdate ) 01910 { 01911 bReplicateMovement = false; 01912 bTearOff = true; 01913 Velocity += TearOffMomentum; 01914 SetPhysics(PHYS_Falling); 01915 } 01916 bPlayedDeath = true; 01917 } 01918 01919 simulated function PlayFiring(float Rate, name FiringMode); 01920 function PlayWeaponSwitch(Weapon NewWeapon); 01921 /* 01922 simulated event StopPlayFiring() 01923 { 01924 bSteadyFiring = false; 01925 } 01926 */ 01927 01928 //_____________________________________________________________________________ 01929 // network call from APawn::PostNetReceive on BaffeCount change 01930 simulated event PlayBaffed() 01931 { 01932 BaffeTimer = 0.2; 01933 PlayTakehit(vect(0,0,0), 1, none); 01934 } 01935 01936 01937 simulated function PlayTakeHit(vector HitLoc, int Damage, class<DamageType> damageType) 01938 { 01939 if ( Level.TimeSeconds - LastPainSound < 0.25 ) 01940 return; 01941 01942 // Log(self@"PlayTakeHit"@BaffeCount); 01943 if (HitSound[0] == None)return; 01944 LastPainSound = Level.TimeSeconds; 01945 if (FRand() < 0.5) 01946 PlaySound(HitSound[0]); 01947 else 01948 PlaySound(HitSound[1]); 01949 } 01950 01951 //============================================================================= 01952 // Pawn internal animation functions 01953 01954 simulated event ChangeAnimation() 01955 { 01956 if ( (Controller != None) && Controller.bControlAnimations ) 01957 return; 01958 // player animation - set up new idle and moving animations 01959 PlayWaiting(); 01960 PlayMoving(); 01961 } 01962 01963 simulated event AnimEnd(int Channel) 01964 { 01965 if ( Channel == 0 ) 01966 PlayWaiting(); 01967 } 01968 01969 // Animation group checks (usually implemented in subclass) 01970 01971 function bool CannotJumpNow() 01972 { 01973 return false; 01974 } 01975 01976 simulated event PlayJump(); 01977 simulated event PlayFalling(); 01978 simulated function PlayMoving(); 01979 simulated function PlayWaiting(); 01980 simulated function PlayReLoading(float Rate, name FiringMode); 01981 01982 function PlayLanded(float impactVel) 01983 { 01984 local float landVol; 01985 01986 //default - do nothing (keep playing existing animation) 01987 landVol = impactVel/JumpZ; 01988 landVol = 0.005 * Mass * landVol * landVol; 01989 //PlaySound(Land, SLOT_Interact, FMin(20, landVol)); MC : use PlayMaterialSound 01990 if ( !bPhysicsAnimUpdate ) 01991 PlayLandingAnimation(impactvel); 01992 } 01993 01994 simulated event PlayLandingAnimation(float ImpactVel); 01995 01996 01997 simulated event SetAnimAction(name NewAnimAction); 01998 01999 02000 02001 debugonly simulated function DumpContent(float TimeStamp, int tabulation) 02002 { 02003 local int j; 02004 local string Tab; 02005 02006 for (j=0; j<tabulation; j++) Tab = Tab$" "; 02007 02008 log(Tab$"Pawn's dump at "$TimeStamp$":"); 02009 //log(Tab$" bJustLanded:"$bJustLanded$" bUpAndOut:"$bUpAndOut$" bIsWalking:"$bIsWalking$" bWarping:"$bWarping$" bWantsToCrouch:"$bWantsToCrouch); 02010 //log(Tab$" bIsCrouched:"$bIsCrouched$" bTryToUncrouch:"$bTryToUncrouch$" bCanCrouch:"$bCanCrouch$" bCrawler:"$bCrawler$" bReducedSpeed:"$bReducedSpeed); 02011 //log(Tab$" bCanJump:"$bCanJump$" bCanWalk:"$bCanWalk$" bCanSwim:"$bCanSwim$" bCanFly:"$bCanFly$" bCanClimbLadders:"$bCanClimbLadders$" bCanStrafe:"$bCanStrafe); 02012 log(Tab$" bCanWalk:"$bCanWalk); 02013 //log(Tab$" bAvoidLedges:"$bAvoidLedges$" bStopAtLedges:"$bStopAtLedges$" bNoJumpAdjust:"$bNoJumpAdjust$" bCountJumps:"$bCountJumps$" bSimulateGravity:"$bSimulateGravity$" bUpdateEyeheight:"$bUpdateEyeheight); 02014 //log(Tab$" bIgnoreForces:"$bIgnoreForces$" bNoVelocityUpdate:"$bNoVelocityUpdate$" bCanWalkOffLedges:"$bCanWalkOffLedges$" bSteadyFiring:"$bSteadyFiring$" bThumped:"$bThumped$" bInvulnerableBody:"$bInvulnerableBody); 02015 //log(Tab$" bIsFemale:"$bIsFemale$" bAutoActivate:"$bAutoActivate$" bCanPickupInventory:"$bCanPickupInventory$" bUpdatingDisplay:"$bUpdatingDisplay$" bAmbientCreature:"$bAmbientCreature$" bLOSHearing:"$bLOSHearing); 02016 //log(Tab$" bSameZoneHearing:"$bSameZoneHearing$" bAdjacentZoneHearing:"$bAdjacentZoneHearing$" bMuffledHearing:"$bMuffledHearing$" bAroundCornerHearing:"$bAroundCornerHearing$" bDontPossess:"$bDontPossess$" FlashCount:"$FlashCount); 02017 //log(Tab$" Visibility:"$Visibility$" DesiredSpeed:"$DesiredSpeed$" MaxDesiredSpeed:"$MaxDesiredSpeed$" AIScriptTag:"$AIScriptTag); 02018 //log(Tab$" HearingThreshold:"$HearingThreshold$" Alertness:"$Alertness$" SightRadius:"$SightRadius$" PeripheralVision:"$PeripheralVision); 02019 //log(Tab$" AvgPhysicsTime:"$AvgPhysicsTime$" MeleeRange:"$MeleeRange$" Anchor:"$Anchor$" UncrouchTime:"$UncrouchTime); 02020 log(Tab$" AvgPhysicsTime:"$AvgPhysicsTime); 02021 log(Tab$" GroundSpeed:"$GroundSpeed$" WaterSpeed:"$WaterSpeed$" AirSpeed:"$AirSpeed$" LadderSpeed:"$LadderSpeed); 02022 log(Tab$" AccelRate:"$AccelRate$" JumpZ:"$JumpZ$" AirControl:"$AirControl$" WalkingPct:"$WalkingPct); 02023 //log(Tab$" CrouchingPct:"$CrouchingPct$" MaxFallSpeed:"$MaxFallSpeed$" PawnName:"$PawnName$" Weapon:"$Weapon); 02024 //log(Tab$" PendingWeapon:"$PendingWeapon$" SelectedItem:"$SelectedItem$" BaseEyeHeight:"$BaseEyeHeight$" EyeHeight:"$EyeHeight$" Floor:"$Floor); 02025 log(Tab$" BaseEyeHeight:"$BaseEyeHeight); 02026 //log(Tab$" SplashTime:"$SplashTime$" CrouchHeight:"$CrouchHeight$" CrouchRadius:"$CrouchRadius$" OldZ:"$OldZ$" HeadVolume:"$HeadVolume); 02027 log(Tab$" OldZ:"$OldZ); 02028 //log(Tab$" Health:"$Health$" BreathTime:"$BreathTime$" UnderWaterTime:"$UnderWaterTime$" LastPainTime:"$LastPainTime$" ReducedDamageType:"$ReducedDamageType); 02029 //log(Tab$" noise1spot:"$noise1spot$" noise1time:"$noise1time$" noise1other:"$noise1other$" noise1loudness:"$noise1loudness$" oise2spot:"$noise2spot$" noise2time:"$noise2time$" noise2other:"$noise2other$" noise2loudness:"$noise2loudness$" LastPainSound:"$LastPainSound); 02030 //log(Tab$" HitSound[0]:"$HitSound[0]$" HitSound[1]:"$HitSound[1]$" HitSound[2]:"$HitSound[2]$" HitSound[3]:"$HitSound[3]); 02031 //log(Tab$" SoundStepCategory:"$SoundStepCategory$" SoundDampening:"$SoundDampening$" DamageScaling:"$DamageScaling$" MenuName:"$MenuName); 02032 //log(Tab$" Shadow:"$Shadow$" BloodEffect:"$BloodEffect$" LowDetailBlood:"$LowDetailBlood$" LowGoreBlood:"$LowGoreBlood); 02033 //log(Tab$" ControllerClass:"$ControllerClass$" CarcassCollisionHeight:"$CarcassCollisionHeight$" OnLadder:"$OnLadder$" LandMovementState:"$LandMovementState$" WaterMovementState:"$WaterMovementState); 02034 //log(Tab$" AnimStatus:"$AnimStatus$" AnimAction:"$AnimAction$" TakeHitLocation:"$TakeHitLocation$" HitDamageType:"$HitDamageType$" TearOffMomentum:"$TearOffMomentum$" bPhysicsAnimUpdate:"$bPhysicsAnimUpdate); 02035 //log(Tab$" bWasCrouched:"$bWasCrouched$" bWasWalking:"$bWasWalking$" bWasFalling:"$bWasFalling$" bWasOnGround:"$bWasOnGround$" bInitializeAnimation:"$bInitializeAnimation); 02036 log(Tab$" bWasWalking:"$bWasWalking); 02037 //log(Tab$" bPlayedDeath:"$bPlayedDeath$" OldPhysics:"$OldPhysics$" OldRotYaw:"$OldRotYaw$" OldAcceleration:"$OldAcceleration); 02038 log(Tab$" OldRotYaw:"$OldRotYaw$" OldAcceleration:"$OldAcceleration); 02039 //log(Tab$" MovementAnims[0]:"$MovementAnims[0]$" MovementAnims[1]:"$MovementAnims[1]$" MovementAnims[2]:"$MovementAnims[2]$" MovementAnims[3]:"$MovementAnims[3]$" TurnLeftAnim:"$TurnLeftAnim$" TurnRightAnim:"$TurnRightAnim); 02040 //log(Tab$" MovementAnimRate[0]:"$MovementAnimRate[0]$" MovementAnimRate[1]:"$MovementAnimRate[1]$" MovementAnimRate[2]:"$MovementAnimRate[2]$" MovementAnimRate[3]:"$MovementAnimRate[3]$" BlendChangeTime:"$BlendChangeTime$" MovementBlendStartTime:"$MovementBlendStartTime); 02041 //log(Tab$" ControlledActor:"$ControlledActor); 02042 02043 /* 02044 var Controller Controller; 02045 var PlayerReplicationInfo PlayerReplicationInfo; 02046 */ 02047 02048 Super.DumpContent(TimeStamp, tabulation+2); 02049 } 02050 02051 02052 02053 // SoundDampening=+00001.000000 02054 // DamageScaling=+00001.000000 02055 02056 defaultproperties 02057 { 02058 bCanBeStunned=True 02059 bLOSHearing=True 02060 Visibility=128 02061 DesiredSpeed=1.000000 02062 MaxDesiredSpeed=1.000000 02063 HearingThreshold=2800.000000 02064 SightRadius=5000.000000 02065 AvgPhysicsTime=0.100000 02066 GroundSpeed=600.000000 02067 WaterSpeed=300.000000 02068 AirSpeed=600.000000 02069 LadderSpeed=200.000000 02070 AccelRate=2048.000000 02071 JumpZ=420.000000 02072 AirControl=0.050000 02073 MaxFallSpeed=1200.000000 02074 BaseEyeHeight=64.000000 02075 EyeHeight=54.000000 02076 CrouchHeight=40.000000 02077 CrouchRadius=34.000000 02078 Health=100 02079 noise1time=-10.000000 02080 noise2time=-10.000000 02081 ControllerClass=Class'Engine.AIController' 02082 CarcassCollisionHeight=23.000000 02083 LandMovementState="PlayerWalking" 02084 WaterMovementState="PlayerSwimming" 02085 MovementAnimRate(0)=1.000000 02086 MovementAnimRate(1)=1.000000 02087 MovementAnimRate(2)=1.000000 02088 MovementAnimRate(3)=1.000000 02089 BlendChangeTime=0.250000 02090 DeadPawnSightCounter=1.000000 02091 DelayBeforeDestroyWhenDead=5.000000 02092 DistanceBeforeDestroyWhenDead=2362.000000 02093 OldSkinID=-1 02094 bCanTeleport=True 02095 bOwnerNoSee=True 02096 bStasis=True 02097 bAcceptsProjectors=True 02098 bUpdateSimulatedPosition=True 02099 bIgnoreVignetteAlpha=True 02100 bIgnoreDynLight=False 02101 bTravel=True 02102 bCollideActors=True 02103 bCollideWorld=True 02104 bBlockActors=True 02105 bBlockPlayers=True 02106 bProjTarget=True 02107 bRotateToDesired=True 02108 RemoteRole=ROLE_SimulatedProxy 02109 DrawType=DT_Mesh 02110 Texture=Texture'Engine.S_Pawn' 02111 CollisionRadius=34.000000 02112 CollisionHeight=78.000000 02113 RotationRate=(Pitch=4096,Yaw=50000,Roll=3072) 02114 NetPriority=2.000000 02115 bDirectional=True 02116 }

End Source Code