mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +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)
|
if (!isObject(%obj) || %obj.getDamageState() !$= "Enabled" || !%damage)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
%rootObj = %obj;
|
%rootObj = %obj;
|
||||||
if (%obj.healthFromMount)
|
if (%obj.healthFromMount)
|
||||||
%rootObj = findRootObject(%obj);
|
%rootObj = findRootObject(%obj);
|
||||||
|
|
||||||
|
%this.setDamageDirection(%rootObj, %sourceObject, %position);
|
||||||
|
|
||||||
|
if (%damageType !$= "Suicide") {
|
||||||
|
%getDamageLoc = %rootObj.getDamageLocation(%position);
|
||||||
|
%damageLoc = firstWord(%getDamageLoc);
|
||||||
|
}
|
||||||
|
|
||||||
%rootObj.applyDamage(%damage);
|
%rootObj.applyDamage(%damage);
|
||||||
%this.onDamage(%rootObj, %damage);
|
%this.onDamage(%rootObj, %damage);
|
||||||
|
|
||||||
%this.setDamageDirection(%rootObj, %sourceObject, %position);
|
|
||||||
|
|
||||||
// Deal with client callbacks here because we don't have this
|
// Deal with client callbacks here because we don't have this
|
||||||
// information in the onDamage or onDisable methods
|
// information in the onDamage or onDisable methods
|
||||||
%client = %rootObj.client;
|
%client = %rootObj.client;
|
||||||
%sourceClient = %sourceObject ? %sourceObject.client : 0;
|
%sourceClient = %sourceObject ? %sourceObject.client : 0;
|
||||||
|
|
||||||
%location = "Body";
|
|
||||||
if (isObject(%client))
|
if (isObject(%client))
|
||||||
{
|
{
|
||||||
if (%rootObj.getDamageState() !$= "Enabled")
|
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)
|
function PlayerData::onDamage(%this, %obj, %delta)
|
||||||
{
|
{
|
||||||
Parent::onDamage(%this, %obj, %delta);
|
Parent::onDamage(%this, %obj, %delta);
|
||||||
|
|
||||||
// This method is invoked by the ShapeBase code whenever the
|
// This method is invoked by the ShapeBase code whenever the
|
||||||
// object's damage level changes.
|
// object's damage level changes.
|
||||||
if (%delta > 0 && %obj.getDamageState() !$= "Destroyed")
|
if (%delta > 0 && %obj.getDamageState() !$= "Destroyed")
|
||||||
|
|
@ -39,4 +43,4 @@ function PlayerData::onDamage(%this, %obj, %delta)
|
||||||
if (%delta > 10)
|
if (%delta > 10)
|
||||||
%obj.playPain();
|
%obj.playPain();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue