Skip to content

Commit

Permalink
Merge pull request #24 from jose21crisis/master
Browse files Browse the repository at this point in the history
More Changes
  • Loading branch information
eezstreet authored Feb 9, 2017
2 parents f162198 + 57a4607 commit 4f2eded
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 5 deletions.
6 changes: 5 additions & 1 deletion Source/Game/SwatAICommon/Classes/Actions/AimAroundAction.uc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function initAction(AI_Resource r, AI_Goal goal)

if (bAimWeapon)
{
CurrentUpperBodyAnimBehavior = kUBAB_AimWeapon;
CurrentUpperBodyAnimBehavior = kUBAB_AimWeapon;
}
else
{
Expand Down Expand Up @@ -670,6 +670,10 @@ latent function AimAtBestPoint()
{
ISwatAI(m_pawn).AimAtActor(CurrentAimPoint);
SetCurrentUpperBodyAnimBehavior();
if (m_Pawn.IsA('SwatEnemy') && !ISwatEnemy(m_Pawn).IsAThreat())
{
ISwatEnemy(m_Pawn).BecomeAThreat();
}

// Hold this aim for the timed duration, or until our aim point is too
// close to us.
Expand Down
4 changes: 4 additions & 0 deletions Source/Game/SwatAICommon/Classes/Actions/AimAtPointAction.uc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ latent function AimAtDesiredPoint()
while (ISwatAI(m_pawn).AnimCanAimAtDesiredPoint(Point))
{
LatentAimAtPoint(Point);
if (m_Pawn.IsA('SwatEnemy') && !ISwatEnemy(m_Pawn).IsAThreat())
{
ISwatEnemy(m_Pawn).BecomeAThreat();
}

yield();
}
Expand Down
4 changes: 4 additions & 0 deletions Source/Game/SwatAICommon/Classes/Actions/AimAtTargetAction.uc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ latent function AimAtTarget()
while (!bOnlyWhenCanHitTarget || (m_Pawn.CanHit(Target) && ((MinDistanceToTargetToAim == 0.0) || (VSize(Target.Location - m_Pawn.Location) < MinDistanceToTargetToAim))))
{
LatentAimAtActor(Target);
if (m_Pawn.IsA('SwatEnemy') && !ISwatEnemy(m_Pawn).IsAThreat())
{
ISwatEnemy(m_Pawn).BecomeAThreat();
}
yield();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,14 @@ function NotifyNearbyEnemyKilled(Pawn NearbyEnemy, Pawn Officer)
if (Officer != None)
{
ChangeMorale(- GetNearbyEnemyKilledMoraleModification(), "Nearby Enemy " $ NearbyEnemy.Name $ " Killed By " $ Officer.Name);
// do some speech
ISwatEnemy(m_Pawn).GetEnemySpeechManagerAction().TriggerDownedSuspectSpeech();
}
else
{
ChangeMorale(- GetNearbyEnemyKilledMoraleModification(), "Nearby Enemy " $ NearbyEnemy.Name $ " Killed By an inanimate object");
// do some speech
ISwatEnemy(m_Pawn).GetEnemySpeechManagerAction().TriggerDownedSuspectSpeech();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ function TriggerDownedOfficerSpeech()
TriggerSpeech('ReactedDownOfficer');
}

function TriggerDownedSuspectSpeech()
{
TriggerSpeech('ReactedDownSuspect');
}
///////////////////////////////////////////////////////////////////////////////
defaultproperties
{
Expand Down
30 changes: 26 additions & 4 deletions Source/Game/SwatGame/Classes/AI/SwatAI.uc
Original file line number Diff line number Diff line change
Expand Up @@ -2035,14 +2035,36 @@ function FireMode GetDefaultAIFireModeForWeapon(FiredWeapon Weapon)
{
assert(Weapon != None);

if (Weapon.HasFireMode(FireMode_Single) || Weapon.HasFireMode(FireMode_SingleTaser))
{
return FireMode_Single;
if(Weapon.Owner.IsA('SwatEnemy')) {
// the thing holding me is a suspect
if (Weapon.HasFireMode(FireMode_Burst))
{
return FireMode_Burst;
}
else if (Weapon.HasFireMode(FireMode_Auto))
{
return FireMode_Auto;
}
if (Weapon.HasFireMode(FireMode_Single) || Weapon.HasFireMode(FireMode_SingleTaser))
{
return FireMode_Single;
}
else
{
// sanity check!
assert(Weapon.HasFireMode(FireMode_DoubleTaser));

return FireMode_DoubleTaser;
}
}
if (Weapon.HasFireMode(FireMode_Burst))
else if (Weapon.HasFireMode(FireMode_Burst))
{
return FireMode_Burst;
}
else if (Weapon.HasFireMode(FireMode_Single) || Weapon.HasFireMode(FireMode_SingleTaser))
{
return FireMode_Single;
}
else if (Weapon.HasFireMode(FireMode_Auto))
{
return FireMode_Auto;
Expand Down

0 comments on commit 4f2eded

Please sign in to comment.