mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-05-18 03:36:29 +00:00
Update player.tscript
This commit is contained in:
parent
11fd008515
commit
dd438557d5
1 changed files with 13 additions and 9 deletions
|
|
@ -2,27 +2,31 @@ function PlayerData::damage(%this, %obj, %sourceObject, %position, %damage, %dam
|
|||
{
|
||||
if (!isObject(%obj) || %obj.getDamageState() !$= "Enabled" || !%damage)
|
||||
return;
|
||||
|
||||
|
||||
%rootObj = %obj;
|
||||
if (%obj.healthFromMount)
|
||||
%rootObj = findRootObject(%obj);
|
||||
|
||||
|
||||
%this.setDamageDirection(%rootObj, %sourceObject, %position);
|
||||
|
||||
if (%damageType !$= "Suicide") {
|
||||
%getDamageLoc = %rootObj.getDamageLocation(%position);
|
||||
%damageLoc = firstWord(%getDamageLoc);
|
||||
}
|
||||
|
||||
%rootObj.applyDamage(%damage);
|
||||
%this.onDamage(%rootObj, %damage);
|
||||
|
||||
%this.setDamageDirection(%rootObj, %sourceObject, %position);
|
||||
|
||||
|
||||
// Deal with client callbacks here because we don't have this
|
||||
// information in the onDamage or onDisable methods
|
||||
%client = %rootObj.client;
|
||||
%sourceClient = %sourceObject ? %sourceObject.client : 0;
|
||||
|
||||
%location = "Body";
|
||||
if (isObject(%client))
|
||||
{
|
||||
if (%rootObj.getDamageState() !$= "Enabled")
|
||||
{
|
||||
callGamemodeFunction("onDeath", %client, %sourceObject, %sourceClient, %damageType, %location);
|
||||
callGamemodeFunction("onDeath", %client, %sourceObject, %sourceClient, %damageType, %damageLoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -30,7 +34,7 @@ function PlayerData::damage(%this, %obj, %sourceObject, %position, %damage, %dam
|
|||
function PlayerData::onDamage(%this, %obj, %delta)
|
||||
{
|
||||
Parent::onDamage(%this, %obj, %delta);
|
||||
|
||||
|
||||
// This method is invoked by the ShapeBase code whenever the
|
||||
// object's damage level changes.
|
||||
if (%delta > 0 && %obj.getDamageState() !$= "Destroyed")
|
||||
|
|
@ -39,4 +43,4 @@ function PlayerData::onDamage(%this, %obj, %delta)
|
|||
if (%delta > 10)
|
||||
%obj.playPain();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue