mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
Merge remote-tracking branch 'upstream/development' into development
This commit is contained in:
commit
86cb84efc8
2 changed files with 24 additions and 18 deletions
|
|
@ -9,13 +9,6 @@ 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 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/utility");
|
||||||
%this.queueExec("./scripts/server/radiusDamage");
|
%this.queueExec("./scripts/server/radiusDamage");
|
||||||
%this.queueExec("./scripts/server/projectile");
|
%this.queueExec("./scripts/server/projectile");
|
||||||
|
|
@ -26,6 +19,13 @@ function DamageModel::onCreateGameServer(%this)
|
||||||
%this.queueExec("./scripts/server/commands");
|
%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
|
//This is called when the server is shut down due to the game/map being exited
|
||||||
function DamageModel::onDestroyGameServer(%this)
|
function DamageModel::onDestroyGameServer(%this)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,27 +2,33 @@ 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)
|
|
||||||
|
%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 = findRootObject(%obj);
|
||||||
|
%getDamageLoc = %obj.getDamageLocation(%position);
|
||||||
%rootObj.applyDamage(%damage);
|
%damageLoc = firstWord(%getDamageLoc);
|
||||||
%this.onDamage(%rootObj, %damage);
|
}
|
||||||
|
|
||||||
%this.setDamageDirection(%rootObj, %sourceObject, %position);
|
%this.setDamageDirection(%rootObj, %sourceObject, %position);
|
||||||
|
|
||||||
|
%rootObj.applyDamage(%damage);
|
||||||
|
%rootObj.getDatablock().onDamage(%rootObj, %damage);
|
||||||
|
|
||||||
// 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 +36,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 +45,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