mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Removed the scripted numerical health hud in the Full Template and added the new GuiHealthTextHud control to the playGui.
This commit is contained in:
parent
d762ccd248
commit
00f72f1325
|
|
@ -240,57 +240,31 @@
|
|||
canSaveDynamicFields = "0";
|
||||
};
|
||||
};
|
||||
new GuiBitmapBorderCtrl(HealthHUD) {
|
||||
isContainer = "0";
|
||||
Profile = "ChatHudBorderProfile";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "top";
|
||||
position = "6 693";
|
||||
Extent = "72 72";
|
||||
MinExtent = "8 8";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
new GuiHealthTextHud() {
|
||||
fillColor = "0 0 0 0.65";
|
||||
frameColor = "0 0 0 1";
|
||||
textColor = "1 1 1 1";
|
||||
warningColor = "1 0 0 1";
|
||||
showFill = "1";
|
||||
showFrame = "1";
|
||||
showTrueValue = "0";
|
||||
showEnergy = "0";
|
||||
warnThreshold = "25";
|
||||
pulseThreshold = "15";
|
||||
pulseRate = "750";
|
||||
position = "5 693";
|
||||
extent = "72 72";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
profile = "GuiBigTextProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
bitmap = "core/art/gui/images/hudfill.png";
|
||||
wrap = "0";
|
||||
isContainer = "0";
|
||||
Profile = "GuiDefaultProfile";
|
||||
HorizSizing = "width";
|
||||
VertSizing = "height";
|
||||
position = "8 8";
|
||||
Extent = "56 56";
|
||||
MinExtent = "8 8";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextCtrl(numericalHealthHUD) {
|
||||
maxLength = "255";
|
||||
Margin = "0 0 0 0";
|
||||
Padding = "0 0 0 0";
|
||||
AnchorTop = "0";
|
||||
AnchorBottom = "0";
|
||||
AnchorLeft = "0";
|
||||
AnchorRight = "0";
|
||||
isContainer = "0";
|
||||
Profile = "NumericHealthProfile";
|
||||
HorizSizing = "center";
|
||||
VertSizing = "center";
|
||||
position = "0 22";
|
||||
Extent = "72 32";
|
||||
MinExtent = "8 8";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
tooltipprofile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
};
|
||||
new GuiBitmapCtrl(OOBSign) {
|
||||
bitmap = "art/gui/playHud/missionAreaWarning.png";
|
||||
|
|
|
|||
|
|
@ -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
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -681,9 +681,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))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 ")");
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue