Merge branch 'healthtexthud' of https://github.com/T3DCE/CE-OSLab into T3DCE-healthtexthud

This commit is contained in:
DavidWyand-GG 2012-11-15 11:04:09 -05:00
commit fa1a0124a9
13 changed files with 261 additions and 246 deletions

View file

@ -45,26 +45,6 @@ function clientCmdSyncClock(%time)
// or when a client joins a game in progress.
}
//-----------------------------------------------------------------------------
// Numerical Health Counter
//-----------------------------------------------------------------------------
function clientCmdSetNumericalHealthHUD(%curHealth)
{
// Skip if the hud is missing.
if (!isObject(numericalHealthHUD))
return;
// The server has sent us our current health, display it on the HUD
numericalHealthHUD.setValue(%curHealth);
// Ensure the HUD is set to visible while we have health / are alive
if (%curHealth)
HealthHUD.setVisible(true);
else
HealthHUD.setVisible(false);
}
//-----------------------------------------------------------------------------
// Damage Direction Indicator
//-----------------------------------------------------------------------------

View file

@ -676,9 +676,6 @@ function GameCore::onDeath(%game, %client, %sourceObject, %sourceClient, %damage
// Clear out the name on the corpse
%client.player.setShapeName("");
// Update the numerical Health HUD
%client.player.updateHealth();
// Switch the client over to the death cam and unhook the player object.
if (isObject(%client.camera) && isObject(%client.player))
{

View file

@ -36,9 +36,6 @@ function HealthPatch::onCollision(%this, %obj, %col)
{
%col.applyRepair(%this.repairAmount);
// Update the Health GUI while repairing
%this.doHealthUpdate(%col);
%obj.respawn();
if (%col.client)
messageClient(%col.client, 'MsgHealthPatchUsed', '\c2Health Patch Applied');
@ -46,28 +43,6 @@ function HealthPatch::onCollision(%this, %obj, %col)
}
}
function HealthPatch::doHealthUpdate(%this, %obj)
{
// Would be better to add a onRepair() callback to shapeBase.cpp in order to
// prevent any excess/unneccesary schedules from this. But for the time
// being....
// This is just a rough timer to update the Health HUD every 250 ms. From
// my tests a large health pack will fully heal a player from 10 health in
// 36 iterations (ie. 9 seconds). If either the scheduling time, the repair
// amount, or the repair rate is changed then the healthTimer counter should
// be changed also.
if (%obj.healthTimer < 40) // 40 = 10 seconds at 1 iteration per 250 ms.
{
%obj.UpdateHealth();
%this.schedule(250, doHealthUpdate, %obj);
%obj.healthTimer++;
}
else
%obj.healthTimer = 0;
}
function ShapeBase::tossPatch(%this)
{
//error("ShapeBase::tossPatch(" SPC %this.client.nameBase SPC ")");

View file

@ -53,12 +53,6 @@ function Armor::onAdd(%this, %obj)
// Default dynamic armor stats
%obj.setRechargeRate(%this.rechargeRate);
%obj.setRepairRate(0);
// Set the numerical Health HUD
//%obj.updateHealth();
// Calling updateHealth() must be delayed now... for some reason
%obj.schedule(50, "updateHealth");
}
function Armor::onRemove(%this, %obj)
@ -227,9 +221,6 @@ function Armor::damage(%this, %obj, %sourceObject, %position, %damage, %damageTy
%location = "Body";
// Update the numerical Health HUD
%obj.updateHealth();
// Deal with client callbacks here because we don't have this
// information in the onDamage or onDisable methods
%client = %obj.client;
@ -435,23 +426,6 @@ function Player::playPain(%this)
}
// ----------------------------------------------------------------------------
// Numerical Health Counter
// ----------------------------------------------------------------------------
function Player::updateHealth(%player)
{
//echo("\c4Player::updateHealth() -> Player Health changed, updating HUD!");
// Calcualte player health
%maxDamage = %player.getDatablock().maxDamage;
%damageLevel = %player.getDamageLevel();
%curHealth = %maxDamage - %damageLevel;
%curHealth = mceil(%curHealth);
// Send the player object's current health level to the client, where it
// will Update the numericalHealth HUD.
commandToClient(%player.client, 'setNumericalHealthHUD', %curHealth);
}
function Player::setDamageDirection(%player, %sourceObject, %damagePos)
{