diff --git a/Templates/BaseGame/game/data/DamageModel/DamageModel.tscript b/Templates/BaseGame/game/data/DamageModel/DamageModel.tscript index f3932781d..63b4ad4c1 100644 --- a/Templates/BaseGame/game/data/DamageModel/DamageModel.tscript +++ b/Templates/BaseGame/game/data/DamageModel/DamageModel.tscript @@ -9,13 +9,6 @@ function DamageModel::onDestroy(%this) //This is called when the server is initially set up by the game application function DamageModel::initServer(%this) { -} - -//This is called when the server is created for an actual game/map to be played -function DamageModel::onCreateGameServer(%this) -{ - %this.registerDatablock("./scripts/managedData/managedParticleData"); - %this.registerDatablock("./scripts/managedData/managedParticleEmitterData"); %this.queueExec("./scripts/server/utility"); %this.queueExec("./scripts/server/radiusDamage"); %this.queueExec("./scripts/server/projectile"); @@ -26,6 +19,13 @@ function DamageModel::onCreateGameServer(%this) %this.queueExec("./scripts/server/commands"); } +//This is called when the server is created for an actual game/map to be played +function DamageModel::onCreateGameServer(%this) +{ + %this.registerDatablock("./scripts/managedData/managedParticleData"); + %this.registerDatablock("./scripts/managedData/managedParticleEmitterData"); +} + //This is called when the server is shut down due to the game/map being exited function DamageModel::onDestroyGameServer(%this) { diff --git a/Templates/BaseGame/game/data/DamageModel/scripts/server/player.tscript b/Templates/BaseGame/game/data/DamageModel/scripts/server/player.tscript index b874c9f5c..72ebeeefe 100644 --- a/Templates/BaseGame/game/data/DamageModel/scripts/server/player.tscript +++ b/Templates/BaseGame/game/data/DamageModel/scripts/server/player.tscript @@ -2,27 +2,33 @@ function PlayerData::damage(%this, %obj, %sourceObject, %position, %damage, %dam { if (!isObject(%obj) || %obj.getDamageState() !$= "Enabled" || !%damage) return; - + %rootObj = %obj; - if (%obj.healthFromMount) + + %damageLoc = ""; + //if we're not commiting sudoku, nor mounted and get our health there... + if (%damageType !$= "Suicide" && !(%obj.healthFromMount && isObject(%obj.getObjectMount()))) + { %rootObj = findRootObject(%obj); - - %rootObj.applyDamage(%damage); - %this.onDamage(%rootObj, %damage); - + %getDamageLoc = %obj.getDamageLocation(%position); + %damageLoc = firstWord(%getDamageLoc); + } + %this.setDamageDirection(%rootObj, %sourceObject, %position); - + + %rootObj.applyDamage(%damage); + %rootObj.getDatablock().onDamage(%rootObj, %damage); + // 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 +36,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 +45,4 @@ function PlayerData::onDamage(%this, %obj, %delta) if (%delta > 10) %obj.playPain(); } -} \ No newline at end of file +}