mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-07-12 14:44:34 +00:00
Armor::damageObject Optimizations
This commit is contained in:
parent
1f5a2a6160
commit
0bd11f7c39
3 changed files with 281 additions and 18 deletions
|
|
@ -18,7 +18,7 @@
|
|||
// maradona, pip, phantom jaguar, hilikus, the_ham, pip, wiggle, dragon, pancho villa, w/o, nectar and many others..
|
||||
//
|
||||
// v3.34 Febuary 2019
|
||||
// Coverted Else ifs to case in Armor::damageObject
|
||||
// Armor::damageObject rework
|
||||
// Added SetNextMission support
|
||||
// Indoor Spawning support
|
||||
//
|
||||
|
|
@ -706,7 +706,86 @@ function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %am
|
|||
else
|
||||
%amount *= 1.5;
|
||||
}
|
||||
parent::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType, %momVec, %mineSC);
|
||||
|
||||
//error("Armor::damageObject( "@%data@", "@%targetObject@", "@%sourceObject@", "@%position@", "@%amount@", "@%damageType@", "@%momVec@" )");
|
||||
if(%targetObject.invincible || %targetObject.getState() $= "Dead")
|
||||
return;
|
||||
|
||||
%targetClient = %targetObject.getOwnerClient();
|
||||
if(isObject(%mineSC))
|
||||
%sourceClient = %mineSC;
|
||||
else
|
||||
%sourceClient = isObject(%sourceObject) ? %sourceObject.getOwnerClient() : 0;
|
||||
|
||||
%targetTeam = %targetClient.team;
|
||||
|
||||
// if the source object is a player object, player's don't have sensor groups
|
||||
// if it's a turret, get the sensor group of the target
|
||||
// if its a vehicle (of any type) use the sensor group
|
||||
if (%sourceClient)
|
||||
%sourceTeam = %sourceClient.getSensorGroup();
|
||||
else if(%damageType == $DamageType::Suicide)
|
||||
%sourceTeam = 0;
|
||||
|
||||
// if teamdamage is off, and both parties are on the same team
|
||||
// (but are not the same person), apply no damage
|
||||
if(!$teamDamage && (%targetClient != %sourceClient) && (%targetTeam == %sourceTeam))
|
||||
return;
|
||||
|
||||
if(%amount == 0)
|
||||
return;
|
||||
|
||||
// Set the damage flash
|
||||
%damageScale = %data.damageScale[%damageType];
|
||||
if(%damageScale !$= "")
|
||||
%amount *= %damageScale;
|
||||
|
||||
%flash = %targetObject.getDamageFlash() + (%amount * 2);
|
||||
if (%flash > 0.75)
|
||||
%flash = 0.75;
|
||||
|
||||
%previousDamage = %targetObject.getDamagePercent();
|
||||
%targetObject.setDamageFlash(%flash);
|
||||
%targetObject.applyDamage(%amount);
|
||||
Game.onClientDamaged(%targetClient, %sourceClient, %damageType, %sourceObject);
|
||||
|
||||
%targetClient.lastDamagedBy = %damagingClient;
|
||||
%targetClient.lastDamaged = getSimTime();
|
||||
|
||||
//now call the "onKilled" function if the client was... you know...
|
||||
if(%targetObject.getState() $= "Dead")
|
||||
{
|
||||
// where did this guy get it?
|
||||
%damLoc = %targetObject.getDamageLocation(%position);
|
||||
|
||||
// should this guy be blown apart?
|
||||
if( %damageType == $DamageType::Explosion ||
|
||||
%damageType == $DamageType::Mortar ||
|
||||
%damageType == $DamageType::Missile )
|
||||
{
|
||||
if( %previousDamage >= 0.35 ) // only if <= 35 percent damage remaining
|
||||
{
|
||||
%targetObject.setMomentumVector(%momVec);
|
||||
%targetObject.blowup();
|
||||
}
|
||||
}
|
||||
|
||||
// If we were killed, max out the flash
|
||||
%targetObject.setDamageFlash(0.75);
|
||||
|
||||
%damLoc = %targetObject.getDamageLocation(%position);
|
||||
Game.onClientKilled(%targetClient, %sourceClient, %damageType, %sourceObject, %damLoc);
|
||||
}
|
||||
else if ( %amount > 0.1 )
|
||||
{
|
||||
if( %targetObject.station $= "" && %targetObject.isCloaked() )
|
||||
{
|
||||
%targetObject.setCloaked( false );
|
||||
%targetObject.reCloak = %targetObject.schedule( 500, "setCloaked", true );
|
||||
}
|
||||
|
||||
playPain( %targetObject );
|
||||
}
|
||||
}
|
||||
|
||||
function deployMineCheck(%mineObj, %player)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue