Update player.tscript

This commit is contained in:
Sir-Skurpsalot 2026-05-12 23:22:30 -06:00 committed by GitHub
parent 11fd008515
commit dd438557d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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();
}
}
}