Merge pull request #1735 from Sir-Skurpsalot/damageModel-fix

Damage model fix
This commit is contained in:
Brian Roberts 2026-05-13 12:08:48 -05:00 committed by GitHub
commit bcce7e7c09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 10 deletions

View file

@ -9,6 +9,7 @@ function DamageModel::onDestroy(%this)
//This is called when the server is initially set up by the game application //This is called when the server is initially set up by the game application
function DamageModel::initServer(%this) function DamageModel::initServer(%this)
{ {
%this.queueExec("./scripts/server/player");
} }
//This is called when the server is created for an actual game/map to be played //This is called when the server is created for an actual game/map to be played
@ -22,7 +23,6 @@ function DamageModel::onCreateGameServer(%this)
%this.queueExec("./scripts/server/weapon"); %this.queueExec("./scripts/server/weapon");
%this.queueExec("./scripts/server/shapeBase"); %this.queueExec("./scripts/server/shapeBase");
%this.queueExec("./scripts/server/vehicle"); %this.queueExec("./scripts/server/vehicle");
%this.queueExec("./scripts/server/player");
%this.queueExec("./scripts/server/commands"); %this.queueExec("./scripts/server/commands");
} }

View file

@ -7,22 +7,26 @@ function PlayerData::damage(%this, %obj, %sourceObject, %position, %damage, %dam
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);
} }
} }
} }