From 00f72f13252215728d82e59c7dadf73b800772fa Mon Sep 17 00:00:00 2001 From: thecelloman Date: Thu, 4 Oct 2012 16:13:34 -0400 Subject: [PATCH] Removed the scripted numerical health hud in the Full Template and added the new GuiHealthTextHud control to the playGui. --- Templates/Full/game/art/gui/playGui.gui | 72 ++++++------------- Templates/Full/game/scripts/client/client.cs | 20 ------ .../Full/game/scripts/server/gameCore.cs | 3 - Templates/Full/game/scripts/server/health.cs | 25 ------- Templates/Full/game/scripts/server/player.cs | 26 ------- 5 files changed, 23 insertions(+), 123 deletions(-) diff --git a/Templates/Full/game/art/gui/playGui.gui b/Templates/Full/game/art/gui/playGui.gui index a9aab8a8d..26a7972b0 100644 --- a/Templates/Full/game/art/gui/playGui.gui +++ b/Templates/Full/game/art/gui/playGui.gui @@ -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"; diff --git a/Templates/Full/game/scripts/client/client.cs b/Templates/Full/game/scripts/client/client.cs index 5d5be25d5..eff6c923a 100644 --- a/Templates/Full/game/scripts/client/client.cs +++ b/Templates/Full/game/scripts/client/client.cs @@ -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 //----------------------------------------------------------------------------- diff --git a/Templates/Full/game/scripts/server/gameCore.cs b/Templates/Full/game/scripts/server/gameCore.cs index 9c1a7e231..bae700751 100644 --- a/Templates/Full/game/scripts/server/gameCore.cs +++ b/Templates/Full/game/scripts/server/gameCore.cs @@ -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)) { diff --git a/Templates/Full/game/scripts/server/health.cs b/Templates/Full/game/scripts/server/health.cs index 34b8acbc8..f56611184 100644 --- a/Templates/Full/game/scripts/server/health.cs +++ b/Templates/Full/game/scripts/server/health.cs @@ -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 ")"); diff --git a/Templates/Full/game/scripts/server/player.cs b/Templates/Full/game/scripts/server/player.cs index af7f499d5..d06ae8c65 100644 --- a/Templates/Full/game/scripts/server/player.cs +++ b/Templates/Full/game/scripts/server/player.cs @@ -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) {