diff --git a/Templates/BaseGame/game/data/DamageModel/scripts/server/player.tscript b/Templates/BaseGame/game/data/DamageModel/scripts/server/player.tscript index b874c9f5c..0d53904fd 100644 --- a/Templates/BaseGame/game/data/DamageModel/scripts/server/player.tscript +++ b/Templates/BaseGame/game/data/DamageModel/scripts/server/player.tscript @@ -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(); } -} \ No newline at end of file +}