1
0
mirror of https://github.com/JezuzLizard/BO2-Reimagined.git synced 2025-06-09 23:02:53 -05:00

Jet Gun and Paralyzer: add heat percentage on HUD

This commit is contained in:
Jbleezy
2024-01-13 00:32:46 -08:00
parent 4ed3ad4c56
commit 6337a23ad9
3 changed files with 166 additions and 17 deletions

View File

@ -323,6 +323,7 @@
* No longer disassembles when overheated
* Weapon is taken when overheated
* Buildable table model no longer shows when player has weapon
* Added heat percentage on HUD
* Changed weapon name on HUD from "Thrustodyne Aeronautics Model 23" to "Jet Gun"
### Sliquifier
@ -341,6 +342,7 @@
### Paralyzer
* Kills on any round
* Decreased max player fly height
* Added heat percentage on HUD
### Blundergat
* Kills on any round in 1-2 shots

View File

@ -144,6 +144,8 @@ LUI.createMenu.AmmoAreaZombie = function (f1_arg0)
f1_local0:registerEventHandler("hud_update_weapon", CoD.AmmoAreaZombie.UpdateWeapon)
f1_local0:registerEventHandler("hud_update_weapon_select", CoD.AmmoAreaZombie.UpdateWeaponSelect)
f1_local0:registerEventHandler("hud_update_refresh", CoD.AmmoAreaZombie.UpdateVisibility)
f1_local0:registerEventHandler("hud_update_overheat", CoD.AmmoAreaZombie.UpdateOverheat)
f1_local0:registerEventHandler("hud_update_fuel", CoD.AmmoAreaZombie.UpdateFuel)
f1_local0:registerEventHandler("hud_update_bit_" .. CoD.BIT_HUD_VISIBLE, CoD.AmmoAreaZombie.UpdateVisibility)
f1_local0:registerEventHandler("hud_update_bit_" .. CoD.BIT_IS_PLAYER_IN_AFTERLIFE, CoD.AmmoAreaZombie.UpdateVisibility)
f1_local0:registerEventHandler("hud_update_bit_" .. CoD.BIT_EMP_ACTIVE, CoD.AmmoAreaZombie.UpdateVisibility)
@ -488,25 +490,54 @@ CoD.AmmoAreaZombie.UpdateOverheat = function (f8_arg0, f8_arg1)
local f8_local6 = CoD.HUDDigit.BigNumbersHeight
local f8_local7, f8_local8, f8_local9 = CoD.AmmoAreaZombie.GetThreeDigits(f8_arg1.heatPercent)
local f8_local10 = 1
f8_arg0.ammoDigits[1]:setDigit(f8_local9, f8_local0)
f8_arg0.ammoDigits[1]:setLeftRight(false, true, f8_local2 - f8_local3, f8_local2)
f8_arg0.ammoDigits[1]:setTopBottom(false, true, f8_local5, f8_local5 + f8_local6)
f8_local2 = f8_local2 + (f8_local4 / 2)
f8_arg0.ammoDigits[f8_local10]:setDigit(10, f8_local0)
f8_arg0.ammoDigits[f8_local10]:setLeftRight(false, true, f8_local2 - f8_local3, f8_local2)
f8_arg0.ammoDigits[f8_local10]:setTopBottom(false, true, f8_local5, f8_local5 + f8_local6)
f8_local10 = f8_local10 + 1
local digitRatio = 2.5
local offsetLeftRight = 15
local offsetTopBottom = 7
f8_arg0.ammoDigits[f8_local10]:setDigit(0, f8_local0)
f8_arg0.ammoDigits[f8_local10]:setLeftRight(false, true, f8_local2 - (f8_local3 / digitRatio) - offsetLeftRight, f8_local2 - offsetLeftRight)
f8_arg0.ammoDigits[f8_local10]:setTopBottom(false, true, f8_local5 + offsetTopBottom, f8_local5 + (f8_local6 / digitRatio) + offsetTopBottom)
f8_local10 = f8_local10 + 1
offsetLeftRight = 4
offsetTopBottom = 31
f8_arg0.ammoDigits[f8_local10]:setDigit(0, f8_local0)
f8_arg0.ammoDigits[f8_local10]:setLeftRight(false, true, f8_local2 - (f8_local3 / digitRatio) - offsetLeftRight, f8_local2 - offsetLeftRight)
f8_arg0.ammoDigits[f8_local10]:setTopBottom(false, true, f8_local5 + offsetTopBottom, f8_local5 + (f8_local6 / digitRatio) + offsetTopBottom)
f8_local10 = f8_local10 + 1
f8_local2 = f8_local2 - f8_local4
f8_arg0.ammoDigits[f8_local10]:setDigit(f8_local9, f8_local0)
f8_arg0.ammoDigits[f8_local10]:setLeftRight(false, true, f8_local2 - f8_local3, f8_local2)
f8_arg0.ammoDigits[f8_local10]:setTopBottom(false, true, f8_local5, f8_local5 + f8_local6)
f8_local2 = f8_local2 - f8_local4
f8_local10 = f8_local10 + 1
if f8_local7 > 0 or f8_local8 > 0 then
f8_arg0.ammoDigits[2]:setDigit(f8_local8, f8_local0)
f8_arg0.ammoDigits[2]:setLeftRight(false, true, f8_local2 - f8_local3, f8_local2)
f8_arg0.ammoDigits[2]:setTopBottom(false, true, f8_local5, f8_local5 + f8_local6)
f8_arg0.ammoDigits[f8_local10]:setDigit(f8_local8, f8_local0)
f8_arg0.ammoDigits[f8_local10]:setLeftRight(false, true, f8_local2 - f8_local3, f8_local2)
f8_arg0.ammoDigits[f8_local10]:setTopBottom(false, true, f8_local5, f8_local5 + f8_local6)
f8_local2 = f8_local2 - f8_local4
f8_local10 = 2
f8_local10 = f8_local10 + 1
end
if f8_local7 > 0 then
f8_arg0.ammoDigits[3]:setDigit(f8_local7, f8_local0)
f8_arg0.ammoDigits[3]:setLeftRight(false, true, f8_local2 - f8_local3, f8_local2)
f8_arg0.ammoDigits[3]:setTopBottom(false, true, f8_local5, f8_local5 + f8_local6)
f8_arg0.ammoDigits[f8_local10]:setDigit(f8_local7, f8_local0)
f8_arg0.ammoDigits[f8_local10]:setLeftRight(false, true, f8_local2 - f8_local3, f8_local2)
f8_arg0.ammoDigits[f8_local10]:setTopBottom(false, true, f8_local5, f8_local5 + f8_local6)
f8_local2 = f8_local2 - f8_local4
f8_local10 = 3
f8_local10 = f8_local10 + 1
end
for f8_local11 = f8_local10 + 1, f8_local1, 1 do
for f8_local11 = f8_local10, f8_local1, 1 do
f8_arg0.ammoDigits[f8_local11]:setAlpha(0)
end
f8_arg0:dispatchEventToChildren(f8_arg1)
@ -530,11 +561,7 @@ end
CoD.AmmoAreaZombie.ShouldHideAmmoCounter = function (f10_arg0, f10_arg1)
if f10_arg0.weapon ~= nil then
if Engine.IsWeaponType(f10_arg0.weapon, "melee") then
return true
elseif CoD.isZombie == true and (f10_arg1.inventorytype == 1 or f10_arg1.inventorytype == 2) then
return true
elseif CoD.isZombie == true and (Engine.IsWeaponType(f10_arg0.weapon, "gas") or Engine.IsOverheatWeapon(f10_arg0.weapon)) then
if CoD.isZombie == true and (Engine.IsWeaponType(f10_arg0.weapon, "gas") or Engine.IsOverheatWeapon(f10_arg0.weapon)) then
return false
end
end

View File

@ -0,0 +1,120 @@
CoD.OtherAmmoCounters = {}
CoD.OtherAmmoCounters.TextHeight = 28
CoD.OtherAmmoCounters.LowAmmoFadeTime = 500
CoD.OtherAmmoCounters.PulseDuration = 500
CoD.OtherAmmoCounters.NormalColor = {
r = 1,
g = 1,
b = 1
}
CoD.OtherAmmoCounters.OverheatColor = {
r = 1,
g = 0,
b = 0
}
CoD.OtherAmmoCounters.LowFuelColor = {
r = 1,
g = 1,
b = 0
}
CoD.OtherAmmoCounters.new = function ()
local Widget = LUI.UIElement.new()
Widget:setLeftRight(true, true, 0, 0)
Widget:setTopBottom(true, true, 0, 0)
Widget:setAlpha(0)
local f1_local1 = 36
local f1_local2 = 40
local Widget_1 = LUI.UIElement.new()
Widget_1:setLeftRight(true, false, -90, 10)
Widget_1:setTopBottom(true, false, f1_local1, f1_local1 + f1_local2)
Widget:addElement(Widget_1)
local f1_local4 = CoD.OtherAmmoCounters.TextHeight
Widget.ammoLabel = LUI.UIText.new()
Widget.ammoLabel:setLeftRight(false, true, -1, 0)
Widget.ammoLabel:setTopBottom(true, true, -4, 4)
Widget.ammoLabel:setFont(CoD.fonts.Big)
Widget.ammoLabel:registerEventHandler("transition_complete_pulse_high", CoD.OtherAmmoCounters.Ammo_PulseHigh)
Widget.ammoLabel:registerEventHandler("transition_complete_pulse_low", CoD.OtherAmmoCounters.Ammo_PulseLow)
Widget_1:addElement(Widget.ammoLabel)
Widget:registerEventHandler("hud_update_refresh", CoD.OtherAmmoCounters.UpdateVisibility)
Widget:registerEventHandler("hud_update_weapon", CoD.OtherAmmoCounters.UpdateVisibility)
Widget:registerEventHandler("hud_update_overheat", CoD.OtherAmmoCounters.UpdateHeat)
Widget:registerEventHandler("hud_update_fuel", CoD.OtherAmmoCounters.UpdateFuel)
return Widget
end
CoD.OtherAmmoCounters.UpdateHeat = function (f2_arg0, f2_arg1)
f2_arg0.ammoLabel:setText(f2_arg1.heatPercent .. "%")
if f2_arg1.overheat and f2_arg0.overheat ~= true then
f2_arg0.overheat = true
f2_arg0.ammoLabel:beginAnimation("pulse_high", CoD.OtherAmmoCounters.LowAmmoFadeTime)
f2_arg0.ammoLabel:setAlpha(0.5)
elseif f2_arg1.overheat ~= true and f2_arg0.overheat == true then
f2_arg0.overheat = nil
f2_arg0.ammoLabel:beingAnimation("default", CoD.OtherAmmoCounters.LowAmmoFadeTime)
f2_arg0.ammoLabel:setAlpha(1)
end
if f2_arg1.overheat then
f2_arg0.ammoLabel:setRGB(CoD.OtherAmmoCounters.OverheatColor.r, CoD.OtherAmmoCounters.OverheatColor.g, CoD.OtherAmmoCounters.OverheatColor.b)
else
f2_arg0.ammoLabel:setRGB(CoD.OtherAmmoCounters.NormalColor.r, CoD.OtherAmmoCounters.NormalColor.g, CoD.OtherAmmoCounters.NormalColor.b)
end
end
CoD.OtherAmmoCounters.UpdateFuel = function (f3_arg0, f3_arg1)
f3_arg0.ammoLabel:setText(f3_arg1.fuelPercent .. "%")
if f3_arg1.lowFuel and f3_arg0.lowFuel ~= true then
f3_arg0.lowFuel = true
elseif f3_arg1.lowFuel ~= true and f3_arg0.lowFuel == true then
f3_arg0.lowFuel = nil
f3_arg0.ammoLabel:animateToState("default", CoD.OtherAmmoCounters.LowAmmoFadeTime)
f3_arg0.ammoLabel:setAlpha(1)
end
if f3_arg1.lowFuel then
f3_arg0.ammoLabel:setRGB(CoD.OtherAmmoCounters.LowFuelColor.r, CoD.OtherAmmoCounters.LowFuelColor.g, CoD.OtherAmmoCounters.LowFuelColor.b)
else
f3_arg0.ammoLabel:setRGB(CoD.OtherAmmoCounters.NormalColor.r, CoD.OtherAmmoCounters.NormalColor.g, CoD.OtherAmmoCounters.NormalColor.b)
end
end
CoD.OtherAmmoCounters.ShouldHideAmmoCounter = function (f4_arg0, f4_arg1)
if f4_arg0.weapon ~= nil then
if CoD.isZombie == true and (Engine.IsWeaponType(f4_arg0.weapon, "gas") or Engine.IsOverheatWeapon(f4_arg0.weapon)) then
return false
end
end
return true
end
CoD.OtherAmmoCounters.UpdateVisibility = function (f5_arg0, f5_arg1)
local f5_local0 = f5_arg1.controller
if f5_arg1.weapon ~= nil then
f5_arg0.weapon = f5_arg1.weapon
end
if CoD.OtherAmmoCounters.ShouldHideAmmoCounter(f5_arg0, f5_arg1) then
if f5_arg0.visible == true then
f5_arg0:beginAnimation("hide")
f5_arg0:setAlpha(0)
f5_arg0.visible = nil
end
f5_arg0:dispatchEventToChildren(f5_arg1)
elseif f5_arg0.visible ~= true then
f5_arg0:beginAnimation("show")
f5_arg0:setAlpha(1)
f5_arg0.visible = true
end
end
CoD.OtherAmmoCounters.Ammo_PulseHigh = function (f6_arg0, f6_arg1)
if f6_arg1.interrupted ~= true then
f6_arg0:beginAnimation("pluse_low", CoD.OtherAmmoCounters.LowAmmoFadeTime, true, false)
f6_arg0:setAlpha(1)
end
end
CoD.OtherAmmoCounters.Ammo_PulseLow = function (f7_arg0, f7_arg1)
if f7_arg1.interrupted ~= true then
f7_arg0:beginAnimation("pulse_high", CoD.OtherAmmoCounters.LowAmmoFadeTime, false, true)
f7_arg0:setAlpha(0.5)
end
end