mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Merge pull request #1643 from Azaezel/dmUI
Some checks failed
Windows Build / ${{matrix.config.name}} (map[build_type:Release cc:cl cxx:cl environment_script:C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat generator:Visual Studio 17 2022 name:Windows Latest MSVC]) (push) Has been cancelled
Linux Build / ${{matrix.config.name}} (map[build_type:Release cc:gcc cxx:g++ generator:Ninja name:Ubuntu Latest GCC]) (push) Has been cancelled
MacOSX Build / ${{matrix.config.name}} (map[build_type:Release cc:clang cxx:clang++ generator:Ninja name:MacOSX Latest Clang]) (push) Has been cancelled
Some checks failed
Windows Build / ${{matrix.config.name}} (map[build_type:Release cc:cl cxx:cl environment_script:C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat generator:Visual Studio 17 2022 name:Windows Latest MSVC]) (push) Has been cancelled
Linux Build / ${{matrix.config.name}} (map[build_type:Release cc:gcc cxx:g++ generator:Ninja name:Ubuntu Latest GCC]) (push) Has been cancelled
MacOSX Build / ${{matrix.config.name}} (map[build_type:Release cc:clang cxx:clang++ generator:Ninja name:MacOSX Latest Clang]) (push) Has been cancelled
offload weapon/ammo counter update commands to the generic damagemodel
This commit is contained in:
commit
f2a5b06803
|
|
@ -5,7 +5,6 @@
|
|||
scriptFile="DamageModel.tscript"
|
||||
CreateFunction="onCreate"
|
||||
DestroyFunction="onDestroy"
|
||||
Group="Game"
|
||||
Dependencies="UI=1">
|
||||
<DeclaredAssets
|
||||
Extension="asset.taml"
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ function DamageModel::onCreateGameServer(%this)
|
|||
%this.queueExec("./scripts/server/shapeBase");
|
||||
%this.queueExec("./scripts/server/vehicle");
|
||||
%this.queueExec("./scripts/server/player");
|
||||
%this.queueExec("./scripts/server/commands");
|
||||
}
|
||||
|
||||
//This is called when the server is shut down due to the game/map being exited
|
||||
|
|
@ -35,6 +36,7 @@ function DamageModel::initClient(%this)
|
|||
{
|
||||
%this.queueExec("./guis/damageGuiOverlay.gui");
|
||||
%this.queueExec("./scripts/client/playGui");
|
||||
%this.queueExec("./scripts/client/client");
|
||||
}
|
||||
|
||||
//This is called when a client connects to a server
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
|
||||
// ----------------------------------------------------------------------------
|
||||
// WeaponHUD
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Update the Ammo Counter with current ammo, if not any then hide the counter.
|
||||
function clientCmdSetAmmoAmountHud(%amount, %amountInClips)
|
||||
{
|
||||
if (!%amount)
|
||||
AmmoAmount.setVisible(false);
|
||||
else
|
||||
{
|
||||
AmmoAmount.setVisible(true);
|
||||
AmmoAmount.setText("Ammo: " @ %amount @ "/" @ %amountInClips);
|
||||
}
|
||||
}
|
||||
|
||||
// Here we update the Weapon Preview image & reticle for each weapon. We also
|
||||
// update the Ammo Counter (just so we don't have to call it separately).
|
||||
// Passing an empty parameter ("") hides the HUD component.
|
||||
|
||||
function clientCmdRefreshWeaponHUD(%amount, %preview, %ret, %zoomRet, %amountInClips)
|
||||
{
|
||||
if (!%amount)
|
||||
AmmoAmount.setVisible(false);
|
||||
else
|
||||
{
|
||||
AmmoAmount.setVisible(true);
|
||||
AmmoAmount.setText("Ammo: " @ %amount @ "/" @ %amountInClips);
|
||||
}
|
||||
|
||||
if (%preview $= "" || detag(%preview) $= "blank")
|
||||
{
|
||||
WeaponHUD.setVisible(false);
|
||||
PreviewImage.setBitmap("");
|
||||
}
|
||||
else
|
||||
{
|
||||
WeaponHUD.setVisible(true);
|
||||
PreviewImage.setbitmap(detag(%preview));
|
||||
}
|
||||
|
||||
if (%ret $= "" || detag(%ret) $= "blank")
|
||||
{
|
||||
Reticle.setVisible(false);
|
||||
Reticle.setBitmap("");
|
||||
}
|
||||
else
|
||||
{
|
||||
Reticle.setVisible(true);
|
||||
Reticle.setbitmap(detag(%ret));
|
||||
}
|
||||
|
||||
if (isObject(ZoomReticle) || detag(%zoomRet) $= "blank")
|
||||
{
|
||||
if (%zoomRet $= "" || detag(%zoomRet) $= "blank")
|
||||
{
|
||||
ZoomReticle.setVisible(false);
|
||||
ZoomReticle.setBitmap("");
|
||||
}
|
||||
else
|
||||
{
|
||||
ZoomReticle.setVisible(true);
|
||||
ZoomReticle.setBitmap(detag(%zoomRet));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// weapon HUD
|
||||
// ----------------------------------------------------------------------------
|
||||
function GameConnection::setAmmoAmountHud(%client, %amount, %amountInClips )
|
||||
{
|
||||
commandToClient(%client, 'SetAmmoAmountHud', %amount, %amountInClips);
|
||||
}
|
||||
|
||||
function GameConnection::RefreshWeaponHud(%client, %amount, %preview, %ret, %zoomRet, %amountInClips)
|
||||
{
|
||||
commandToClient(%client, 'RefreshWeaponHud', %amount, %preview, %ret, %zoomRet, %amountInClips);
|
||||
}
|
||||
Loading…
Reference in a new issue