Untitled diff

Created Diff never expires
//=============================================================================
//=============================================================================
// ScriptedPawn.
// ScriptedPawn.
//=============================================================================
//=============================================================================
class ScriptedPawn expands Pawn
class ScriptedPawn expands Pawn
abstract
abstract
native;
native;


// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// Enumerations
// Enumerations


enum EDestinationType {
enum EDestinationType {
DEST_Failure,
DEST_Failure,
DEST_NewLocation,
DEST_NewLocation,
DEST_SameLocation
DEST_SameLocation
};
};




enum EAllianceType {
enum EAllianceType {
ALLIANCE_Friendly,
ALLIANCE_Friendly,
ALLIANCE_Neutral,
ALLIANCE_Neutral,
ALLIANCE_Hostile
ALLIANCE_Hostile
};
};




enum ERaiseAlarmType {
enum ERaiseAlarmType {
RAISEALARM_BeforeAttacking,
RAISEALARM_BeforeAttacking,
RAISEALARM_BeforeFleeing,
RAISEALARM_BeforeFleeing,
RAISEALARM_Never
RAISEALARM_Never
};
};




enum ESeekType {
enum ESeekType {
SEEKTYPE_None,
SEEKTYPE_None,
SEEKTYPE_Sound,
SEEKTYPE_Sound,
SEEKTYPE_Sight,
SEEKTYPE_Sight,
SEEKTYPE_Guess,
SEEKTYPE_Guess,
SEEKTYPE_Carcass
SEEKTYPE_Carcass
};
};




enum EHitLocation {
enum EHitLocation {
HITLOC_None,
HITLOC_None,
HITLOC_HeadFront,
HITLOC_HeadFront,
HITLOC_HeadBack,
HITLOC_HeadBack,
HITLOC_TorsoFront,
HITLOC_TorsoFront,
HITLOC_TorsoBack,
HITLOC_TorsoBack,
HITLOC_LeftLegFront,
HITLOC_LeftLegFront,
HITLOC_LeftLegBack,
HITLOC_LeftLegBack,
HITLOC_RightLegFront,
HITLOC_RightLegFront,
HITLOC_RightLegBack,
HITLOC_RightLegBack,
HITLOC_LeftArmFront,
HITLOC_LeftArmFront,
HITLOC_LeftArmBack,
HITLOC_LeftArmBack,
HITLOC_RightArmFront,
HITLOC_RightArmFront,
HITLOC_RightArmBack
HITLOC_RightArmBack
};
};




enum ETurning {
enum ETurning {
TURNING_None,
TURNING_None,
TURNING_Left,
TURNING_Left,
TURNING_Right
TURNING_Right
};
};




// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// Structures
// Structures


struct WanderCandidates {
struct WanderCandidates {
var WanderPoint point;
var WanderPoint point;
var Actor waypoint;
var Actor waypoint;
var float dist;
var float dist;
};
};


struct FleeCandidates {
struct FleeCandidates {
var HidePoint point;
var HidePoint point;
var Actor waypoint;
var Actor waypoint;
var Vector location;
var Vector location;
var float score;
var float score;
var float dist;
var float dist;
};
};


struct NearbyProjectile {
struct NearbyProjectile {
var DeusExProjectile projectile;
var DeusExProjectile projectile;
var vector location;
var vector location;
var float dist;
var float dist;
var float range;
var float range;
};
};


struct NearbyProjectileList {
struct NearbyProjectileList {
var NearbyProjectile list[8];
var NearbyProjectile list[8];
var vector center;
var vector center;
};
};




struct InitialAllianceInfo {
struct InitialAllianceInfo {
var() Name AllianceName;
var() Name AllianceName;
var() float AllianceLevel;
var() float AllianceLevel;
var() bool bPermanent;
var() bool bPermanent;
};
};


struct AllianceInfoEx {
struct AllianceInfoEx {
var Name AllianceName;
var Name AllianceName;
var float AllianceLevel;
var float AllianceLevel;
var float AgitationLevel;
var float AgitationLevel;
var bool bPermanent;
var bool bPermanent;
};
};


struct InventoryItem {
struct InventoryItem {
var() class<Inventory> Inventory;
var() class<Inventory> Inventory;
var() int Count;
var() int Count;
};
};




// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// Variables
// Variables


var WanderPoint lastPoints[2];
var WanderPoint lastPoints[2];
var float Restlessness; // 0-1
var float Restlessness; // 0-1
var float Wanderlust; // 0-1
var float Wanderlust; // 0-1
var float Cowardice; // 0-1
var float Cowardice; // 0-1


var(Combat) float BaseAccuracy; // 0-1 or thereabouts
var(Combat) float BaseAccuracy; // 0-1 or thereabouts
var(Combat) float MaxRange;
var(Combat) float MaxRange;
var(Combat) float MinRange;
var(Combat) float MinRange;
var(Combat) float MinHealth;
var(Combat) float MinHealth;


var(AI) float RandomWandering; // 0-1
var(AI) float RandomWandering; // 0-1


var float sleepTime;
var float sleepTime;
var Actor destPoint;
var Actor destPoint;
var Vector destLoc;
var Vector destLoc;
var Vector useLoc;
var Vector useLoc;
var Rotator useRot;
var Rotator useRot;
var float seekDistance; // OBSOLETE
var float seekDistance; // OBSOLETE
var int SeekLevel;
var int SeekLevel;
var ESeekType SeekType;
var ESeekType SeekType;
var Pawn SeekPawn;
var Pawn SeekPawn;
var float CarcassTimer;
var float CarcassTimer;
var float CarcassHateTimer; // OBSOLETE
var float CarcassHateTimer; // OBSOLETE
var float CarcassCheckTimer;
var float CarcassCheckTimer;
var name PotentialEnemyAlliance;
var name PotentialEnemyAlliance;
var float PotentialEnemyTimer;
var float PotentialEnemyTimer;
var float BeamCheckTimer;
var float BeamCheckTimer;
var bool bSeekPostCombat;
var bool bSeekPostCombat;
var bool bSeekLocation;
var bool bSeekLocation;
var bool bInterruptSeek;
var bool bInterruptSeek;
var bool bAlliancesChanged; // set to True whenever someone changes AlliancesEx[i].AllianceLevel to indicate we must do alliance updating
var bool bAlliancesChanged; // set to True whenever someone changes AlliancesEx[i].AllianceLevel to indicate we must do alliance updating
var bool bNoNegativeAlliances; // True means we know all alliances are currently +, allows us to skip CheckEnemyPresence's slow part
var bool bNoNegativeAlliances; // True means we know all alliances are currently +, allows us to skip CheckEnemyPresence's slow part
var bool bSitAnywhere;
var bool bSitAnywhere;


var bool bSitInterpolation;
var bool bSitInterpolation;
var bool bStandInterpolation;
var bool bStandInterpolation;
var float remainingSitTime;
var float remainingSitTime;
var float remainingStandTime;
var float remainingStandTime;
var vector StandRate;
var vector StandRate;
var float ReloadTimer;
var float ReloadTimer;
var bool bReadyToReload;
var bool bReadyToReload;


var(Pawn) class<carcass> CarcassType; // mesh to use when killed from the front
var(Pawn) class<carcass> CarcassType; // mesh to use when killed from the front


// Advanced AI attributes.
// Advanced AI attributes.
var(Orders) name Orders; // orders a creature is carrying out
var(Orders) name Orders; // orders a creature is carrying out
// will be initial state, plus creature will attempt
// will be initial state, plus creature will attempt
// to return to this state
// to return to this state
var(Orders) name OrderTag; // tag of object referred to by orders
var(Orders) name OrderTag; // tag of object referred to by orders
var(Orders) name HomeTag; // tag of object to use as home base
var(Orders) name HomeTag; // tag of object to use as home base
var(Orders) float HomeExtent; // extent of home base
var(Orders) float HomeExtent; // extent of home base
var actor OrderActor; // object referred to by orders (if applicable)
var actor OrderActor; // object referred to by orders (if applicable)
var name NextAnim; // used in states with multiple, sequenced animations
var name NextAnim; // used in states with multiple, sequenced animations
var float WalkingSpeed; // 0-1
var float WalkingSpeed; // 0-1


var(Combat) float ProjectileSpeed;
var(Combat) float ProjectileSpeed;
var name LastPainAnim;
var name LastPainAnim;
var float LastPainTime;
var float LastPainTime;


var vector DesiredPrePivot;
var vector DesiredPrePivot;
var float PrePivotTime;
var float PrePivotTime;
var vector PrePivotOffset;
var vector PrePivotOffset;


var bool bCanBleed; // true if an NPC can bleed
var bool bCanBleed; // true if an NPC can bleed
var float BleedRate; // how profusely the NPC is bleeding; 0-1
var float BleedRate; // how profusely the NPC is bleeding; 0-1
var float DropCounter; // internal; used in tick()
var float DropCounter; // internal; used in tick()
var() float ClotPeriod; // seconds it takes bleedRate to go from 1 to 0
var() float ClotPeriod; // seconds it takes bleedRate to go from 1 to 0


var bool bAcceptBump; // ugly hack
var bool bAcceptBump; // ugly hack
var bool bCanFire; // true if pawn is capable of shooting asynchronously
var bool bCanFire; // true if pawn is capable of shooting asynchronously
var(AI) bool bKeepWeaponDrawn; // true if pawn should always keep weapon drawn
var(AI) bool bKeepWeaponDrawn; // true if pawn should always keep weapon drawn
var(AI) bool bShowPain; // true if pawn should play pain animations
var(AI) bool bShowPain; // true if pawn should play pain animations
var(AI) bool bCanSit; // true if pawn can sit
var(AI) bool bCanSit; // true if pawn can sit
var(AI) bool bAlwaysPatrol; // true if stasis should be disabled during patrols
var(AI) bool bAlwaysPatrol; // true if stasis should be disabled during patrols
var(AI) bool bPlayIdle; // true if pawn should fidget while he's standing
var(AI) bool bPlayIdle; // true if pawn should fidget while he's standing
var(AI) bool bLeaveAfterFleeing; // true if pawn should disappear after fleeing
var(AI) bool bLeaveAfterFleeing; // true if pawn should disappear after fleeing
var(AI) bool bLikesNeutral; // true if pawn should treat neutrals as friendlies
var(AI) bool bLikesNeutral; // true if pawn should treat neutrals as friendlies
var(AI) bool bUseFirstSeatOnly; // true if only the nearest chair should be used for
var(AI) bool bUseFirstSeatOnly; // true if only the nearest chair should be used for
var(AI) bool bCower; // true if fearful pawns should cower instead of fleeing
var(AI) bool bCower; // true if fearful pawns should cower instead of fleeing
var(AI) bool bMakeFemale; // true if pawn is female
var(AI) bool bMakeFemale; // true if pawn is female


var HomeBase HomeActor; // home base
var HomeBase HomeActor; // home base
var Vector HomeLoc; // location of home base
var Vector HomeLoc; // location of home base
var Vector HomeRot; // rotation of home base
var Vector HomeRot; // rotation of home base
var bool bUseHome; // true if home base should be used
var bool bUseHome; // true if home base should be used


var bool bInterruptState; // true if the state can be interrupted
var bool bInterruptState; // true if the state can be interrupted
var bool bCanConverse; // true if the pawn can converse
var bool bCanConverse; // true if the pawn can converse


var() bool bImportant; // true if this pawn is game-critical
var() bool bImportant; // true if this pawn is game-critical
var() bool bInvincible; // true if this pawn cannot be killed
var() bool bInvincible; // true if this pawn cannot be killed


var bool bInitialized; // true if this pawn has been initialized
var bool bInitialized; // true if this pawn has been initialized


var(Combat) bool bAvoidAim; // avoid enemy's line of fire
var(Combat) bool bAvoidAim; // avoid enemy's line of fire
var(Combat) bool bAimForHead; // aim for the enemy's head
var(Combat) bool bAimForHead; // aim for the enemy's head
var(Combat) bool bDefendHome; // defend the home base
var(Combat) bool bDefendHome; // defend the home base
var bool bCanCrouch; // whether we should crouch when firing
var bool bCanCrouch; // whether we should crouch when firing
var bool bSeekCover; // seek cover
var bool bSeekCover; // seek cover
var bool bSprint; // sprint in random directions
var bool bSprint; // sprint in random directions
var(Combat) bool bUseFallbackWeapons; // use fallback weapons even when others are available
var(Combat) bool bUseFallbackWeapons; // use fallback weapons even when others are available
var float AvoidAccuracy; // how well we avoid enemy's line of fire; 0-1
var float AvoidAccuracy; // how well we avoid enemy's line of fire; 0-1
var bool bAvoidHarm; // avoid painful projectiles, gas clouds, etc.
var bool bAvoidHarm; // avoid painful projectiles, gas clouds, etc.
var float HarmAccuracy; // how well we avoid harm; 0-1
var float HarmAccuracy; // how well we avoid harm; 0-1
var float CrouchRate; // how often the NPC crouches, if bCrouch enabled; 0-1
var float CrouchRate; // how often the NPC crouches, if bCrouch enabled; 0-1
var float SprintRate; // how often the NPC randomly sprints if bSprint enabled; 0-1
var float SprintRate; // how often the NPC randomly sprints if bSprint enabled; 0-1
var float CloseCombatMult; // multiplier for how often the NPC sprints in close combat; 0-1
var float CloseCombatMult; // multiplier for how often the NPC sprints in close combat; 0-1


// If a stimulation is enabled, it causes an NPC to hate the stimulator
// If a stimulation is enabled, it causes an NPC to hate the stimulator
//var(Stimuli) bool bHateFutz;
//var(Stimuli) bool bHateFutz;
var(Stimuli) bool bHateHacking; // new
var(Stimuli) bool bHateHacking; // new
var(Stimuli) bool bHateWeapon;
var(Stimuli) bool bHateWeapon;
var(Stimuli) bool bHateShot;
var(Stimuli) bool bHateShot;
var(Stimuli) bool bHateInjury;
var(Stimuli) bool bHateInjury;
var(Stimuli) bool bHateIndirectInjury; // new
var(Stimuli) bool bHateIndirectInjury; // new
//var(Stimuli) bool bHateGore;
//var(Stimuli) bool bHateGore;
var(Stimuli) bool bHateCarcass; // new
var(Stimuli) bool bHateCarcass; // new
var(Stimuli) bool bHateDistress;
var(Stimuli) bool bHateDistress;
//var(Stimuli) bool bHateProjectiles;
//var(Stimuli) bool bHateProjectiles;


// If a reaction is enabled, the NPC will react appropriately to a stimulation
// If a reaction is enabled, the NPC will react appropriately to a stimulation
var(Reactions) bool bReactFutz; // new
var(Reactions) bool bReactFutz; // new
var(Reactions) bool bReactPresence; // React to the presence of an enemy (attacking)
var(Reactions) bool bReactPresence; // React to the presence of an enemy (attacking)
var(Reactions) bool bReactLoudNoise; // Seek the source of a loud noise (seeking)
var(Reactions) bool bReactLoudNoise; // Seek the source of a loud noise (seeking)
var(Reactions) bool bReactAlarm; // Seek the source of an alarm (seeking)
var(Reactions) bool bReactAlarm; // Seek the source of an alarm (seeking)
var(Reactions) bool bReactShot; // React to a gunshot fired by an enemy (attacking)
var(Reactions) bool bReactShot; // React to a gunshot fired by an enemy (attacking)
//var(Reactions) bool bReactGore; // React to gore appropriately (seeking)
//var(Reactions) bool bReactGore; // React to gore appropriately (seeking)
var(Reactions) bool bReactCarcass; // React to gore appropriately (seeking)
var(Reactions) bool bReactCarcass; // React to gore appropriately (seeking)
var(Reactions) bool bReactDistress; // React to distress appropriately (attacking)
var(Reactions) bool bReactDistress; // React to distress appropriately (attacking)
var(Reactions) bool bReactProjectiles; // React to harmful projectiles appropriately
var(Reactions) bool bReactProjectiles; // React to harmful projectiles appropriately


// If a fear is enabled, the NPC will run away from the stimulator
// If a fear is enabled, the NPC will run away from the stimulator
var(Fears) bool bFearHacking; // Run away from a hacker
var(Fears) bool bFearHacking; // Run away from a hacker
var(Fears) bool bFearWeapon; // Run away from a person holding a weapon
var(Fears) bool bFearWeapon; // Run away from a person holding a weapon
var(Fears) bool bFearShot; // Run away from a person who fires a shot
var(Fears) bool bFearShot; // Run away from a person who fires a shot
var(Fears) bool bFearInjury; // Run away from a person who causes injury
var(Fears) bool bFearInjury; // Run away from a person who causes injury
var(Fears) bool bFearIndirectInjury; // Run away from a person who causes indirect injury
var(Fears) bool bFearIndirectInjury; // Run away from a person who causes indirect injury
var(Fears) bool bFearCarcass; // Run away from a carcass
var(Fears) bool bFearCarcass; // Run away from a carcass
var(Fears) bool bFearDistress; // Run away from a person causing distress
var(Fears) bool bFearDistress; // Run away from a person causing distress
var(Fears) bool bFearAlarm; // Run away from the source of an alarm
var(Fears) bool bFearAlarm; // Run away from the source of an alarm
var(Fears) bool bFearProjectiles; // Run away from a projectile
var(Fears) bool bFearProjectiles; // Run away from a projectile


var(AI) bool bEmitDistress; // TRUE if NPC should emit distress
var(AI) bool bEmitDistress; // TRUE if NPC should emit distress


var(AI) ERaiseAlarmType RaiseAlarm; // When to raise an alarm
var(AI) ERaiseAlarmType RaiseAlarm; // When to raise an alarm


var bool bLookingForEnemy; // TRUE if we're actually looking for enemies
var bool bLookingForEnemy; // TRUE if we're actually looking for enemies
var bool bLookingForLoudNoise; // TRUE if we're listening for loud noises
var bool bLookingForLoudNoise; // TRUE if we're listening for loud noises
var bool bLookingForAlarm; // TRUE if we're listening for alarms
var bool bLookingForAlarm; // TRUE if we're listening for alarms
var bool bLookingForDistress; // TRUE if we're looking for signs of distress
var bool bLookingForDistress; // TRUE if we're looking for signs of distress
var bool bLookingForProjectiles; // TRUE if we're looking for projectiles that can harm us
var bool bLookingForProjectiles; // TRUE if we're looking for projectiles that can harm us
var bool bLookingForFutz; // TRUE if we're looking for people futzing with stuff
var bool bLookingForFutz; // TRUE if we're looking for people futzing with stuff
var bool bLookingForHacking; // TRUE if we're looking for people hacking stuff
var bool bLookingForHacking; // TRUE if we're looking for people hacking stuff
var bool bLookingForShot; // TRUE if we're listening for gunshots
var bool bLookingForShot; // TRUE if we're listening for gunshots
var bool bLookingForWeapon; // TRUE if we're looking for drawn weapons
var bool bLookingForWeapon; // TRUE if we're looking for drawn weapons
var bool bLookingForCarcass; // TRUE if we're looking for carcass events
var bool bLookingForCarcass; // TRUE if we're looking for carcass events
var bool bLookingForInjury; // TRUE if we're looking for injury events
var bool bLookingForInjury; // TRUE if we're looking for injury events
var bool bLookingForIndirectInjury; // TRUE if we're looking for secondary injury events
var bool bLookingForIndirectInjury; // TRUE if we're looking for secondary injury events


var bool bFacingTarget; // True if pawn is facing its target
var bool bFacingTarget; // True if pawn is facing its target
var(Combat) bool bMustFaceTarget; // True if an NPC must face his target to fire
var(Combat) bool bMustFaceTarget; // True if an NPC must face his target to fire
var(Combat) float FireAngle; // TOTAL angle (in degrees) in which a pawn may fire if bMustFaceTarget is false
var(Combat) float FireAngle; // TOTAL angle (in degrees) in which a pawn may fire if bMustFaceTarget is false
var(Combat) float FireElevation; // Max elevation distance required to attack (0=elevation doesn't matter)
var(Combat) float FireElevation; // Max elevation distance required to attack (0=elevation doesn't matter)


var(AI) int MaxProvocations;
var(AI) int MaxProvocations;
var float AgitationSustainTime;
var float AgitationSustainTime;
var float AgitationDecayRate;
var float AgitationDecayRate;
var float AgitationTimer;
var float AgitationTimer;
var float AgitationCheckTimer;
var float AgitationCheckTimer;
var float PlayerAgitationTimer; // hack
var float PlayerAgitationTimer; // hack


var float FearSustainTime;
var float FearSustainTime;
var float FearDecayRate;
var float FearDecayRate;
var float FearTimer;
var float FearTimer;
var float FearLevel;
var float FearLevel;


var float EnemyReadiness;
var float EnemyReadiness;
var float ReactionLevel;
var float ReactionLevel;
var float SurprisePeriod;
var float SurprisePeriod;
var float SightPercentage;
var float SightPercentage;
var float CycleTimer;
var float CycleTimer;
var float CyclePeriod;
var float CyclePeriod;
var float CycleCumulative;
var float CycleCumulative;
var Pawn CycleCandidate;
var Pawn CycleCandidate;
var float CycleDistance;
var float CycleDistance;


var AlarmUnit AlarmActor;
var AlarmUnit AlarmActor;


var float AlarmTimer;
var float AlarmTimer;
var float WeaponTimer;
var float WeaponTimer;
var float FireTimer;
var float FireTimer;
var float SpecialTimer;
var float SpecialTimer;
var float CrouchTimer;
var float CrouchTimer;
var float BackpedalTimer;
var float BackpedalTimer;


var bool bHasShadow;
var bool bHasShadow;
var float ShadowScale;
var float ShadowScale;


var bool bDisappear;
var bool bDisappear;


var bool bInTransientState; // true if the NPC is in a 3rd-tier (transient) state, like TakeHit
var bool bInTransientState; // true if the NPC is in a 3rd-tier (transient) state, like TakeHit


var(Alliances) InitialAllianceInfo InitialAlliances[8];
var(Alliances) InitialAllianceInfo InitialAlliances[8];
var AllianceInfoEx AlliancesEx[16];
var AllianceInfoEx AlliancesEx[16];
var bool bReverseAlliances;
var bool bReverseAlliances;


var(Pawn) float BaseAssHeight;
var(Pawn) float BaseAssHeight;


var(AI) float EnemyTimeout;
var(AI) float EnemyTimeout;
var float CheckPeriod;
var float CheckPeriod;
var float EnemyLastSeen;
var float EnemyLastSeen;
var int SeatSlot;
var int SeatSlot;
var Seat SeatActor;
var Seat SeatActor;
var int CycleIndex;
var int CycleIndex;
var int BodyIndex;
var int BodyIndex;
var bool bRunningStealthy;
var bool bRunningStealthy;
var bool bPausing;
var bool bPausing;
var bool bStaring;
var bool bStaring;
var bool bAttacking;
var bool bAttacking;
var bool bDistressed;
var bool bDistressed;
var bool bStunned;
var bool bStunned;
var bool bSitting;
var bool bSitting;
var bool bDancing;
var bool bDancing;
var bool bCrouching;
var bool bCrouching;


var bool bCanTurnHead;
var bool bCanTurnHead;


var(AI) bool bTickVisibleOnly; // Temporary?
var(AI) bool bTickVisibleOnly; // Temporary?
var() bool bInWorld;
var() bool bInWorld;
var vector WorldPosition;
var vector WorldPosition;
var bool bWorldCollideActors;
var bool bWorldCollideActors;
var bool bWorldBlockActors;
var bool bWorldBlockActors;
var bool bWorldBlockPlayers;
var bool bWorldBlockPlayers;


var() bool bHighlight; // should this object not highlight when focused?
var() bool bHighlight; // should this object not highlight when focused?


var(AI) bool bHokeyPokey;
var(AI) bool bHokeyPokey;


var bool bConvEndState;
var bool bConvEndState;


var(Inventory) InventoryItem InitialInventory[8]; // Initial inventory items carried by the pawn
var(Inventory) InventoryItem InitialInventory[8]; // Initial inventory items carried by the pawn


var Bool bConversationEndedNormally;
var Bool bConversationEndedNormally;
var Bool bInConversation;
var Bool bInConversation;
var Actor ConversationActor; // Actor currently speaking to or speaking to us
var Actor ConversationActor; // Actor currently speaking to or speaking to us


var() sound WalkSound;
var() sound WalkSound;
var float swimBubbleTimer;
var float swimBubbleTimer;
var bool bSpawnBubbles;
var bool bSpawnBubbles;


var bool bUseSecondaryAttack;
var bool bUseSecondaryAttack;


var bool bWalkAround;
var bool bWalkAround;
var bool bClearedObstacle;
var bool bClearedObstacle;
var bool bEnableCheckDest;
var bool bEnableCheckDest;
var ETurning TurnDirection;
var ETurning TurnDirection;
var ETurning NextDirection;
var ETurning NextDirection;
var Actor ActorAvoiding;
var Actor ActorAvoiding;
var float AvoidWallTimer;
var float AvoidWallTimer;
var float AvoidBumpTimer;
var float AvoidBumpTimer;
var float ObstacleTimer;
var float ObstacleTimer;
var vector LastDestLoc;
var vector LastDestLoc;
var vector LastDestPoint;
var vector LastDestPoint;
var int DestAttempts;
var int DestAttempts;


var float DeathTimer;
var float DeathTimer;
var float EnemyTimer;
var float EnemyTimer;
var float TakeHitTimer;
var float TakeHitTimer;


var name ConvOrders;
var name ConvOrders;
var name ConvOrderTag;
var name ConvOrderTag;


var float BurnPeriod;
var float BurnPeriod;


var float FutzTimer;
var float FutzTimer;


var float DistressTimer;
var float DistressTimer;


var vector SeatLocation;
var vector SeatLocation;
var Seat SeatHack;
var Seat SeatHack;
var bool bSeatLocationValid;
var bool bSeatLocationValid;
var bool bSeatHackUsed;
var bool bSeatHackUsed;


var bool bBurnedToDeath;
var bool bBurnedToDeath;


var bool bHasCloak;
var bool bHasCloak;
var bool bCloakOn;
var bool bCloakOn;
var int CloakThreshold;
var int CloakThreshold;
var float CloakEMPTimer;
var float CloakEMPTimer;


var float poisonTimer; // time remaining before next poison TakeDamage
var float poisonTimer; // time remaining before next poison TakeDamage
var int poisonCounter; // number of poison TakeDamages remaining
var int poisonCounter; // number of poison TakeDamages remaining
var int poisonDamage; // damage taken from poison effect
var int poisonDamage; // damage taken from poison effect
var Pawn Poisoner; // person who initiated PoisonEffect damage
var Pawn Poisoner; // person who initiated PoisonEffect damage


var Name Carcasses[4]; // list of carcasses seen
var Name Carcasses[4]; // list of carcasses seen
var int NumCarcasses; // number of carcasses seen
var int NumCarcasses; // number of carcasses seen


var float walkAnimMult;
var float walkAnimMult;
var float runAnimMult;
var float runAnimMult;


var bool bUsingHDTP;
var bool bUsingHDTP;
var string HDTPMeshName;
var string HDTPMeshName;
var string HDTPMeshTex[8];
var string HDTPMeshTex[8];
//GMDX
//GMDX
var bool bBurnedUp; //CyberP: for plasma rifle gibbing
var bool bBurnedUp; //CyberP: for plasma rifle gibbing
var bool bFlyer; //CyberP: for pawn knockback
var bool bFlyer; //CyberP: for pawn knockback
var bool bSetupPop; //CyberP: for headpop
var bool bSetupPop; //CyberP: for headpop
var int extraMult; //CyberP: variable headshot multiplier
var int extraMult; //CyberP: variable headshot multiplier
var bool bRadialBlastClamp; //CyberP: MiB radial attack
var bool bRadialBlastClamp; //CyberP: MiB radial attack
var bool bCanFlare; //CyberP: AI can throw flares if conditions are met
var bool bCanFlare; //CyberP: AI can throw flares if conditions are met
var bool bHasThrownFlare; //CyberP: has this NPC already thrown a flare?
var bool bHasThrownFlare; //CyberP: has this NPC already thrown a flare?
var bool bCanNade; //CyberP: AI can throw nades if conditions are met
var bool bCanNade; //CyberP: AI can throw nades if conditions are met
var bool bGrenadier; //CyberP: this pawn class can throw nades
var bool bGrenadier; //CyberP: this pawn class can throw nades
var bool bCommandoMelee;
var bool bCommandoMelee;
var bool bDefensiveStyle; //CyberP: this pawn doesn't always bum rush the player in close proximity
var bool bDefensiveStyle; //CyberP: this pawn doesn't always bum rush the player in close proximity
//var bool bFrontPop; //CyberP: for headpop
//var bool bFrontPop; //CyberP: for headpop
var int disturbanceCount; //CyberP: obsolete.
var int disturbanceCount; //CyberP: obsolete.
var bool bAlarmStatIncrease; //CyberP: AI get a one-time stat boost if alarm is triggered
var bool bAlarmStatIncrease; //CyberP: AI get a one-time stat boost if alarm is triggered
var bool bHasHelmet;
var bool bHasHelmet;
var bool bBiteClamp;
var bool bBiteClamp;
var bool bGreaselShould;
var bool bGreaselShould;
var(Filter) bool bHardcoreOnly; // CyberP: remove this pawn from world if we are not hardcore.
var(Filter) bool bHardcoreOnly; // CyberP: remove this pawn from world if we are not hardcore.
var(AI) bool bCanPop; //CyberP: if we can pop at all.
var(AI) bool bCanPop; //CyberP: if we can pop at all.
native(2102) final function ConBindEvents();
native(2102) final function ConBindEvents();


native(2105) final function bool IsValidEnemy(Pawn TestEnemy, optional bool bCheckAlliance);
native(2105) final function bool IsValidEnemy(Pawn TestEnemy, optional bool bCheckAlliance);
native(2106) final function EAllianceType GetAllianceType(Name AllianceName);
native(2106) final function EAllianceType GetAllianceType(Name AllianceName);
native(2107) final function EAllianceType GetPawnAllianceType(Pawn QueryPawn);
native(2107) final function EAllianceType GetPawnAllianceType(Pawn QueryPawn);


native(2108) final function bool HaveSeenCarcass(Name CarcassName);
native(2108) final function bool HaveSeenCarcass(Name CarcassName);
native(2109) final function AddCarcass(Name CarcassName);
native(2109) final function AddCarcass(Name CarcassName);


// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// PreBeginPlay()
// PreBeginPlay()
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------


function PreBeginPlay()
function PreBeginPlay()
{
{
local float saveBaseEyeHeight;
local float saveBaseEyeHeight;


// TODO:
// TODO:
//
//
// Okay, we need to save the base eye height right now becase it's
// Okay, we need to save the base eye height right now becase it's
// obliterated in Pawn.uc with the following:
// obliterated in Pawn.uc with the following:
//
//
// EyeHeight = 0.8 * CollisionHeight; //FIXME - if all baseeyeheights set right, use them
// EyeHeight = 0.8 * CollisionHeight; //FIXME - if all baseeyeheights set right, use them
// BaseEyeHeight = EyeHeight;
// BaseEyeHeight = EyeHeight;
//
//
// This must be fixed after ECTS.
// This must be fixed after ECTS.


saveBaseEyeHeight = BaseEyeHeight;
saveBaseEyeHeight = BaseEyeHeight;


Super.PreBeginPlay();
Super.PreBeginPlay();


if (!bIsFemale)
if (!bIsFemale)
bIsFemale = bMakeFemale; //GMDX
bIsFemale = bMakeFemale; //GMDX


BaseEyeHeight = saveBaseEyeHeight;
BaseEyeHeight = saveBaseEyeHeight;


// create our shadow
// create our shadow
CreateShadow();
CreateShadow();


// Set our alliance
// Set our alliance
SetAlliance(Alliance);
SetAlliance(Alliance);


// Set up callbacks
// Set up callbacks
UpdateReactionCallbacks();
UpdateReactionCallbacks();
}
}


function UpdateHDTPsettings()
function UpdateHDTPsettings()
{
{
local mesh tempmesh;
local mesh tempmesh;
local texture temptex;
local texture temptex;
local int i;
local int i;
local bool bSetHDTP;
local bool bSetHDTP;
local deusexplayer P;
local deusexplayer P;


P = deusexplayer(getplayerpawn());
P = deusexplayer(getplayerpawn());


if(P != none) //sigh, ok so...I guess I should've thought this through. Pawns fucked with in editor etc now also reset to defaults
if(P != none) //sigh, ok so...I guess I should've thought this through. Pawns fucked with in editor etc now also reset to defaults
{
{
bSetHDTP = P.GetHDTPSettings(self);
bSetHDTP = P.GetHDTPSettings(self);


if(bSetHDTP && !bUsingHDTP)
if(bSetHDTP && !bUsingHDTP)
{
{
if(HDTPMeshname != "")
if(HDTPMeshname != "")
{
{
tempmesh = lodmesh(dynamicloadobject(HDTPMeshname,class'mesh',true));
tempmesh = lodmesh(dynamicloadobject(HDTPMeshname,class'mesh',true));
if(tempmesh != none)
if(tempmesh != none)
{
{
mesh = tempmesh;
mesh = tempmesh;
texture=none;
texture=none;
skin=none;
skin=none;
for(i=0;i<=7;i++)
for(i=0;i<=7;i++)
{
{
if(HDTPMeshtex[i] != "")
if(HDTPMeshtex[i] != "")
{
{
temptex = texture(dynamicloadobject(HDTPMeshtex[i],class'texture',true));
temptex = texture(dynamicloadobject(HDTPMeshtex[i],class'texture',true));
if(temptex != none)
if(temptex != none)
multiskins[i] = temptex;
multiskins[i] = temptex;
}
}
}
}
}
}
}
}
bUsingHDTP=true;
bUsingHDTP=true;
}
}
else if(!bSetHDTP && bUsingHDTP)
else if(!bSetHDTP && bUsingHDTP)
{
{
mesh = default.mesh;
mesh = default.mesh;
texture=default.texture;
texture=default.texture;
skin=default.skin;
skin=default.skin;
for(i=0; i<=7;i++)
for(i=0; i<=7;i++)
{
{
multiskins[i]=default.multiskins[i];
multiskins[i]=default.multiskins[i];
}
}
bUsingHDTP=false;
bUsingHDTP=false;
}
}
}
}
}
}


// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// PostBeginPlay()
// PostBeginPlay()
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------


function PostBeginPlay()
function PostBeginPlay()
{
{


Super.PostBeginPlay();
Super.PostBeginPlay();


//sort out HDTP settings
//sort out HDTP settings
UpdateHDTPSettings();
UpdateHDTPSettings();
// Set up pain timer
// Set up pain timer
if (Region.Zone.bPainZone || HeadRegion.Zone.bPainZone ||
if (Region.Zone.bPainZone || HeadRegion.Zone.bPainZone ||
FootRegion.Zone.bPainZone)
FootRegion.Zone.bPainZone)
PainTime = 5.0;
PainTime = 5.0;
else if (HeadRegion.Zone.bWaterZone)
else if (HeadRegion.Zone.bWaterZone)
PainTime = UnderWaterTime;
PainTime = UnderWaterTime;


// Handle holograms
// Handle holograms
if ((Style != STY_Masked) && (Style != STY_Normal))
if ((Style != STY_Masked) && (Style != STY_Normal))
{
{
SetSkinStyle(Style, None);
SetSkinStyle(Style, None);
SetCollision(false, false, false);
SetCollision(false, false, false);
KillShadow();
KillShadow();
bHasShadow = False;
bHasShadow = False;
}
}
}
}




// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// PostPostBeginPlay()
// PostPostBeginPlay()
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------


function PostPostBeginPlay()
function PostPostBeginPlay()
{
{
Super.PostPostBeginPlay();
Super.PostPostBeginPlay();


// Bind any conversation events to this ScriptedPawn
// Bind any conversation events to this ScriptedPawn
ConBindEvents();
ConBindEvents();
}
}




// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// Destroyed()
// Destroyed()
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------


simulated function Destroyed()
simulated function Destroyed()
{
{
local DeusExPlayer player;
local DeusExPlayer player;


// Pass a message to conPlay, if it exists in the player, that
// Pass a message to conPlay, if it exists in the player, that
// this pawn has been destroyed. This is used to prevent
// this pawn has been destroyed. This is used to prevent
// bad things from happening in converseations.
// bad things from happening in converseations.


player = DeusExPlayer(GetPlayerPawn());
player = DeusExPlayer(GetPlayerPawn());


if ((player != None) && (player.conPlay != None))
if ((player != None) && (player.conPlay != None))
player.conPlay.ActorDestroyed(Self);
player.conPlay.ActorDestroyed(Self);


Super.Destroyed();
Super.Destroyed();
}
}


// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// GENERAL UTILITIES
// GENERAL UTILITIES
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------


// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// InitializePawn()
// InitializePawn()
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------


function InitializePawn()
function InitializePawn()
{
{
if (!bInitialized)
if (!bInitialized)
{
{
InitializeInventory();
InitializeInventory();
InitializeAlliances();
InitializeAlliances();
InitializeHomeBase();
InitializeHomeBase();


BlockReactions();
BlockReactions();


if (Alliance != '')
if (Alliance != '')
ChangeAlly(Alliance, 1.0, true);
ChangeAlly(Alliance, 1.0, true);


if (!bInWorld)
if (!bInWorld)
{
{
// tricky
// tricky
bInWorld = true;
bInWorld = true;
LeaveWorld();
LeaveWorld();
}
}


// hack!
// hack!
animTimer[1] = 20.0;
animTimer[1] = 20.0;
PlayTurnHead(LOOK_Forward, 1.0, 0.0001);
PlayTurnHead(LOOK_Forward, 1.0, 0.0001);


bInitialized = true;
bInitialized = true;
}
}
}
}




// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// InitializeInventory()
// InitializeInventory()
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------


function InitializeInventory()
function InitializeInventory()
{
{
local int i, j;
local int i, j;
local Inventory inv;
local Inventory inv;
local Weapon weapons[8];
local Weapon weapons[8];
local int weaponCount;
local int weaponCount;
local Weapon firstWeapon;
local Weapon firstWeapon;


// Add initial inventory items
// Add initial inventory items
weaponCount = 0;
weaponCount = 0;
for (i=0; i<8; i++)
for (i=0; i<8; i++)
{
{
if ((InitialInventory[i].Inventory != None) && (InitialInventory[i].Count > 0))
if ((InitialInventory[i].Inventory != None) && (InitialInventory[i].Count > 0))
{
{
firstWeapon = None;
firstWeapon = None;
for (j=0; j<InitialInventory[i].Count; j++)
for (j=0; j<InitialInventory[i].Count; j++)
{
{
inv = None;
inv = None;
if (Class<Ammo>(InitialInventory[i].Inventory) != None)
if (Class<Ammo>(InitialInventory[i].Inventory) != None)
{
{
inv = FindInventoryType(InitialInventory[i].Inventory);
inv = FindInventoryType(InitialInventory[i].Inventory);
if (inv != None)
if (inv != None)
Ammo(inv).AmmoAmount += Class<Ammo>(InitialInventory[i].Inventory).default.AmmoAmount;
Ammo(inv).AmmoAmount += Class<Ammo>(InitialInventory[i].Inventory).default.AmmoAmount;
}
}
if (inv == None)
if (inv == None)
{
{
inv = spawn(InitialInventory[i].Inventory, self);
inv = spawn(InitialInventory[i].Inventory, self);
if (inv != None)
if (inv != None)
{
{
inv.InitialState='Idle2';
inv.InitialState='Idle2';
inv.GiveTo(Self);
inv.GiveTo(Self);
inv.SetBase(Self);
inv.SetBase(Self);
if ((firstWeapon == None) && (Weapon(inv) != None))
if ((firstWeapon == None) && (Weapon(inv) != None))
firstWeapon = Weapon(inv);
firstWeapon = Weapon(inv);
}
}
}
}
}
}
if (firstWeapon != None)
if (firstWeapon != None)
weapons[WeaponCount++] = firstWeapon;
weapons[WeaponCount++] = firstWeapon;
}
}
}
}
for (i=0; i<weaponCount; i++)
for (i=0; i<weaponCount; i++)
{
{
if ((weapons[i].AmmoType == None) && (weapons[i].AmmoName != None) &&
if ((weapons[i].AmmoType == None) && (weapons[i].AmmoName != None) &&
(weapons[i].AmmoName != Class'AmmoNone'))
(weapons[i].AmmoName != Class'AmmoNone'))
{
{
weapons[i].AmmoType = Ammo(FindInventoryType(weapons[i].AmmoName));
weapons[i].AmmoType = Ammo(FindInventoryType(weapons[i].AmmoName));
if (weapons[i].AmmoType == None)
if (weapons[i].AmmoType == None)
{
{
weapons[i].AmmoType = spawn(weapons[i].AmmoName);
weapons[i].AmmoType = spawn(weapons[i].AmmoName);
weapons[i].AmmoType.InitialState='Idle2';
weapons[i].AmmoType.InitialState='Idle2';
weapons[i].AmmoType.GiveTo(Self);
weapons[i].AmmoType.GiveTo(Self);
weapons[i].AmmoType.SetBase(Self);
weapons[i].AmmoType.SetBase(Self);
}
}
}
}
}
}


SetupWeapon(false);
SetupWeapon(false);


}
}




// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// InitializeAlliances()
// InitializeAlliances()
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------


function InitializeAlliances()
function InitializeAlliances()
{
{
local int i;
local int i;


for (i=0; i<8; i++)
for (i=0; i<8; i++)
if (InitialAlliances[i].AllianceName != '')
if (InitialAlliances[i].AllianceName != '')
ChangeAlly(InitialAlliances[i].AllianceName,
ChangeAlly(InitialAlliances[i].AllianceName,
InitialAlliances[i].AllianceLevel,
InitialAlliances[i].AllianceLevel,
InitialAlliances[i].bPermanent);
InitialAlliances[i].bPermanent);


}
}




// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// InitializeHomeBase()
// InitializeHomeBase()
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------


function InitializeHomeBase()
function InitializeHomeBase()
{
{
if (!bUseHome)
if (!bUseHome)
{
{
HomeActor = None;
HomeActor = None;
HomeLoc = Location;
HomeLoc = Location;
HomeRot = vector(Rotation);
HomeRot = vector(Rotation);
if (HomeTag == 'Start')
if (HomeTag == 'Start')
bUseHome = true;
bUseHome = true;
else
else
{
{
HomeActor = HomeBase(FindTaggedActor(HomeTag, , Class'HomeBase'));
HomeActor = HomeBase(FindTaggedActor(HomeTag, , Class'HomeBase'));
if (HomeActor != None)
if (HomeActor != None)
{
{
HomeLoc = HomeActor.Location;
HomeLoc = HomeActor.Location;
HomeRot = vector(HomeActor.Rotation);
HomeRot = vector(HomeActor.Rotation);
HomeExtent = HomeActor.Extent;
HomeExtent = HomeActor.Extent;
bUseHome = true;
bUseHome = true;
}
}
}
}
HomeRot *= 100;
HomeRot *= 100;
}
}
}
}




// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// AddInitialInventory()
// AddInitialInventory()
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------


function bool AddInitialInventory(class<Inventory> newInventory,
function bool AddInitialInventory(class<Inventory> newInventory,
optional int newCount)
optional int newCount)
{
{
local int i;
local int i;


if (newCount == 0)
if (newCount == 0)
newCount = 1;
newCount = 1;


for (i=0; i<8; i++)
for (i=0; i<8; i++)
if ((InitialInventory[i].Inventory == None) &&
if ((InitialInventory[i].Inventory == None) &&
(InitialInventory[i].Count <= 0))
(InitialInventory[i].Count <= 0))
break;
break;


if (i < 8)
if (i < 8)
{
{
InitialInventory[i].Inventory = newInventory;
InitialInventory[i].Inventory = newInventory;
InitialInventory[i].Count = newCount;
InitialInventory[i].Count = newCount;
return true;
return true;
}
}
else
else
return false;
return false;
}
}




// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// SetEnemy()
// SetEnemy()
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------


function bool SetEnemy(Pawn newEnemy, optional float newSeenTime,
function bool SetEnemy(Pawn newEnemy, optional float newSeenTime,
optional bool bForce)
optional bool bForce)
{
{
if (bForce || IsValidEnemy(newEnemy))
if (bForce || IsValidEnemy(newEnemy))
{
{
if (newEnemy != Enemy)
if (newEnemy != Enemy)
EnemyTimer = 0;
EnemyTimer = 0;
Enemy = newEnemy;
Enemy = newEnemy;
EnemyLastSeen = newSeenTime;
EnemyLastSeen = newSeenTime;


return True;
return True;
}
}
else
else
return False;
return False;
}
}




//
//