local f0_local0 = module local f0_local1, f0_local2 = ... f0_local0( f0_local1, package.seeall ) CoD.PrintModuleLoad( _NAME ) function SendEventIfChanged( f1_arg0, f1_arg1 ) if f1_arg0.current_state ~= f1_arg1 then f1_arg0:processEvent( { name = f1_arg1 } ) f1_arg0.current_state = f1_arg1 end end function AnimateToStateIfChanged( f2_arg0, f2_arg1, f2_arg2 ) if f2_arg0.current_state ~= f2_arg1 then local f2_local0 = MBh.AnimateToState( f2_arg1, f2_arg2 ) f2_local0( f2_arg0 ) f2_arg0.current_state = f2_arg1 end end f0_local0 = function ( f3_arg0, f3_arg1 ) local f3_local0 = Game.GetOmnvar( "ui_bomb_timer" ) local f3_local1 = Game.GetOmnvar( "ui_carrying_bomb" ) local f3_local2 = nil if f3_local0 == 0 and f3_local1 then f3_local2 = "matchTimerBomber" elseif f3_local0 == 0 and not f3_local1 then f3_local2 = "matchTimer" elseif f3_local0 == 4 then f3_local2 = "nukeTimer" else f3_local2 = "bombTimer" end if f3_local0 == 0 then local f3_local3 = f3_arg0:getChildById( "match_timer" ) if f3_local3 then local f3_local4 = Game.GetTimeLeft() if f3_local4 <= 0 then AnimateToStateIfChanged( f3_local3, "inactive", 0 ) elseif f3_local4 <= 30000 then SendEventIfChanged( f3_local3, "flash" ) else AnimateToStateIfChanged( f3_local3, "default", 0 ) end end local f3_local4 = f3_arg0:getChildById( "bomb_timer" ) if f3_local4 then AnimateToStateIfChanged( f3_local4, "inactive", 0 ) local f3_local5 = f3_arg0:getChildById( "bomb_timer_image" ) if f3_local1 then AnimateToStateIfChanged( f3_local5, "bomb", 0 ) else AnimateToStateIfChanged( f3_local5, "inactive", 0 ) end end local f3_local5 = f3_arg0:getChildById( "paused_timer" ) if f3_local5 then AnimateToStateIfChanged( f3_local5, "inactive", 0 ) end elseif f3_local0 == 5 then local f3_local3 = f3_arg0:getChildById( "match_timer" ) if f3_local3 then AnimateToStateIfChanged( f3_local3, "inactive", 0 ) end local f3_local4 = f3_arg0:getChildById( "bomb_timer" ) if f3_local4 then AnimateToStateIfChanged( f3_local4, "inactive", 0 ) local f3_local5 = f3_arg0:getChildById( "bomb_timer_image" ) if f3_local1 then AnimateToStateIfChanged( f3_local5, "bomb", 0 ) else AnimateToStateIfChanged( f3_local5, "inactive", 0 ) end end local f3_local5 = f3_arg0:getChildById( "paused_timer" ) if f3_local5 then SendEventIfChanged( f3_local5, "flash" ) end else local f3_local3 = f3_arg0:getChildById( "match_timer" ) if f3_local3 then AnimateToStateIfChanged( f3_local3, "inactive", 0 ) end local f3_local4 = f3_arg0:getChildById( "paused_timer" ) if f3_local4 then AnimateToStateIfChanged( f3_local4, "inactive", 0 ) end local f3_local5 if f3_local0 == 4 then f3_local5 = Game.GetOmnvar( "ui_nuke_end_milliseconds" ) if not f3_local5 then else local f3_local6 = f3_local5 - Game.GetTime() local f3_local7 = f3_arg0:getChildById( "bomb_timer" ) if f3_local6 > 0 then f3_local7:setEndTime( f3_local5 ) end SendEventIfChanged( f3_local7, "flash" ) local f3_local8 = f3_arg0:getChildById( "bomb_timer_image" ) local f3_local9 = AnimateToStateIfChanged local f3_local10 = f3_local8 local f3_local11 if f3_local0 == 4 then f3_local11 = "nuke" if not f3_local11 then else f3_local9( f3_local10, f3_local11, 0 ) end end f3_local11 = "bomb" end end f3_local5 = Game.GetOmnvar( "ui_bomb_timer_endtime" ) end end f0_local1 = function ( f4_arg0, f4_arg1 ) local f4_local0 = Game.GetOmnvar( "ui_bomb_timer" ) local f4_local1 = f4_arg0:getChildById( "bomb_timer_image" ) if f4_arg1.name == "playerstate_client_changed" then f4_arg1.value = Game.GetOmnvar( "ui_carrying_bomb" ) end if f4_arg1.value == true then AnimateToStateIfChanged( f4_local1, "bomb", 250 ) elseif f4_local0 == 0 or f4_local0 == 5 then AnimateToStateIfChanged( f4_local1, "inactive", 0 ) else local f4_local2 = AnimateToStateIfChanged local f4_local3 = f4_local1 local f4_local4 if f4_local0 == 4 then f4_local4 = "nuke" if not f4_local4 then else f4_local2( f4_local3, f4_local4, 0 ) end end f4_local4 = "bomb" end end f0_local2 = function ( f5_arg0, f5_arg1 ) local f5_local0 = f5_arg0:getChildById( "match_timer" ) local f5_local1 = f5_arg0:getChildById( "bomb_timer" ) local f5_local2 = f5_arg0:getChildById( "bomb_timer_image" ) f5_local0.current_state = nil f5_local1.current_state = nil f5_local2.current_state = nil f0_local0( f5_arg0, f5_arg1 ) end local f0_local3 = function ( f6_arg0, f6_arg1 ) if Game.GetOmnvar( "ui_bomb_timer" ) == 0 then f0_local2( f6_arg0, f6_arg1 ) end end local f0_local4 = function ( f7_arg0, f7_arg1 ) if Game.GetOmnvar( "ui_bomb_timer" ) == 0 then local f7_local0 = f7_arg0:getChildById( "match_timer" ) SendEventIfChanged( f7_arg0, "flash" ) end end local f0_local5 = function ( f8_arg0 ) local f8_local0 = f8_arg0:getChildById( "cranked_warning_bg" ) local f8_local1 = MBh.AnimateToState( "default", 0 ) f8_local1( f8_local0 ) f8_local1 = f8_arg0:getChildById( "cranked_text" ) local f8_local2 = MBh.AnimateToState( "default", 0 ) f8_local2( f8_local1 ) f8_local2 = f8_arg0:getChildById( "cranked_countdown_bg" ) local f8_local3 = MBh.AnimateToState( "default", 0 ) f8_local3( f8_local2 ) f8_local3 = f8_arg0:getChildById( "cranked_countdown" ) local f8_local4 = MBh.AnimateToState( "default", 0 ) f8_local4( f8_local3 ) end local f0_local6 = function ( f9_arg0, f9_arg1 ) if f9_arg1.value > 0 then f9_arg0:animateToState( "active", 250 ) local f9_local0 = f9_arg0:getChildById( "cranked_countdown" ) f9_local0:setEndTime( f9_arg1.value ) f9_local0:animateToState( "default", 0 ) elseif f9_arg0.current_state ~= "default" then f9_arg0:animateToState( "default", 250 ) end f0_local5( f9_arg0 ) end local f0_local7 = function ( f10_arg0 ) local f10_local0 = MBh.AnimateLoop( { { "default", 350 }, { "flashing", 350 } } ) f10_local0( f10_arg0 ) end local f0_local8 = function ( f11_arg0, f11_arg1 ) f0_local7( f11_arg0:getChildById( "cranked_warning_bg" ) ) f0_local7( f11_arg0:getChildById( "cranked_text" ) ) f0_local7( f11_arg0:getChildById( "cranked_countdown_bg" ) ) f0_local7( f11_arg0:getChildById( "cranked_countdown" ) ) end local f0_local9 = function ( f12_arg0, f12_arg1 ) if f12_arg1.value == "round_time" then f12_arg0:setText( Engine.Localize( "@MP_HORDE_SPECIAL_ROUND_TIME" ) ) elseif f12_arg1.value == "start_time" then f12_arg0:setText( Engine.Localize( "@MP_HORDE_ROUND_START_TIMER" ) ) else f12_arg0:setText( Engine.Localize( "@LUA_MENU_CRANKED_CAPS" ) ) end end local f0_local10 = function ( f13_arg0, f13_arg1 ) local f13_local0 = Game.GetOmnvar( "ui_cranked_bomb_timer_end_milliseconds" ) f0_local6( f13_arg0, { name = "ui_cranked_bomb_timer_end_milliseconds", value = f13_local0 } ) if f13_local0 <= 5000 + Game.GetTime() then f0_local8( f13_arg0 ) end end local f0_local11 = function () local f14_local0 = RegisterMaterial( "hud_suitcase_bomb" ) local f14_local1 = RegisterMaterial( "icon_ks_level_hud" ) local self = LUI.UIElement.new() self.id = "timersHud" self:registerAnimationState( "default", { bottomAnchor = true, leftAnchor = true, bottom = MLG.IsMLGSpectator() and -75 or -30, left = MLG.IsMLGSpectator() and 195 or 320, alpha = 1 } ) self:animateToState( "default", 0 ) self:registerAnimationState( "inactive", { alpha = 0 } ) self:registerEventHandler( "menu_create", f0_local0 ) self:registerOmnvarHandler( "ui_bomb_timer", f0_local0 ) self:registerEventHandler( "timeBeingReset", f0_local3 ) self:registerOmnvarHandler( "ui_carrying_bomb", f0_local1 ) self:registerEventHandler( "playerstate_client_changed", f0_local1 ) local f14_local3 = LUI.UICountdown.new( { endTime = "round_end" } ) f14_local3.id = "match_timer" f14_local3:setTextStyle( CoD.TextStyle.Shadowed ) f14_local3:registerAnimationState( "default", { bottomAnchor = true, leftAnchor = true, bottom = 0, left = 0, width = 60, height = CoD.TextSettings.HudDigitalNormalFont.Height, font = CoD.TextSettings.HudDigitalNormalFont.Font, alignment = LUI.Alignment.Right, red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = 1 } ) f14_local3:animateToState( "default", 0 ) f14_local3:registerAnimationState( "white", { red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = 1 } ) f14_local3:registerAnimationState( "red", { red = Colors.red.r, green = Colors.red.g, blue = Colors.red.b, alpha = 1 } ) f14_local3:registerAnimationState( "inactive", { alpha = 0 } ) f14_local3:registerEventHandler( "flash", MBh.AnimateLoop( { { "red", 1000 }, { "white", 0 } } ) ) f14_local3:registerEventHandler( "timeout", MBh.AnimateToState( "inactive", 0 ) ) f14_local3:registerEventHandler( "time30sec", f0_local4 ) f14_local3:registerEventHandler( "timeReset", MBh.EmitEventToParent( "timeBeingReset" ) ) local f14_local4 = LUI.UICountdown.new( {} ) f14_local4.id = "bomb_timer" f14_local4:setTextStyle( CoD.TextStyle.Shadowed ) f14_local4:registerAnimationState( "default", { bottomAnchor = true, leftAnchor = true, bottom = 0, left = 0, width = 60, height = CoD.TextSettings.HudDigitalNormalFont.Height, font = CoD.TextSettings.HudDigitalNormalFont.Font, alignment = LUI.Alignment.Right, red = 1, green = 1, blue = 1, alpha = 0 } ) f14_local4:animateToState( "default", 0 ) f14_local4:registerAnimationState( "white", { red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = 1 } ) f14_local4:registerAnimationState( "red", { red = Colors.red.r, green = Colors.red.g, blue = Colors.red.b, alpha = 1 } ) f14_local4:registerAnimationState( "inactive", { alpha = 0 } ) f14_local4:registerEventHandler( "flash", MBh.AnimateLoop( { { "red", 1000 }, { "white", 0 } } ) ) local f14_local5 = LUI.UIImage.new() f14_local5.id = "bomb_timer_image" f14_local5:registerAnimationState( "default", { bottomAnchor = true, leftAnchor = true, bottom = -22, left = 0, height = 64, width = 64, material = f14_local0, alpha = 0 } ) f14_local5:animateToState( "default", 0 ) f14_local5:registerAnimationState( "bomb", { material = f14_local0, alpha = 1 } ) f14_local5:registerAnimationState( "nuke", { material = f14_local1, alpha = 1 } ) f14_local5:registerAnimationState( "inactive", { alpha = 0 } ) local f14_local6 = LUI.UIText.new() f14_local6.id = "paused_timer" f14_local6:setTextStyle( CoD.TextStyle.Shadowed ) f14_local6:setText( Engine.Localize( "@LUA_MENU_MP_COUNTDOWN_PAUSED" ) ) f14_local6:registerAnimationState( "default", { bottomAnchor = true, leftAnchor = true, bottom = 0, left = -10, width = 200, height = CoD.TextSettings.HudDigitalSmallFont.Height, font = CoD.TextSettings.HudDigitalSmallFont.Font, alignment = LUI.Alignment.Left, red = 1, green = 1, blue = 1, alpha = 0 } ) f14_local6:animateToState( "default", 0 ) f14_local6:registerAnimationState( "white", { red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = 1 } ) f14_local6:registerAnimationState( "red", { red = Colors.red.r, green = Colors.red.g, blue = Colors.red.b, alpha = 1 } ) f14_local6:registerAnimationState( "inactive", { alpha = 0 } ) f14_local6:registerEventHandler( "flash", MBh.AnimateLoop( { { "red", 500 }, { "white", 0 } } ) ) if not MLG.IsMLGSpectator() then self:addElement( f14_local3 ) end self:addElement( f14_local4 ) self:addElement( f14_local5 ) self:addElement( f14_local6 ) return self end local f0_local12 = { topAnchor = false, leftAnchor = true, bottomAnchor = true, rightAnchor = false, bottom = -200, left = 250, height = 128, width = 256, alpha = 0 } if Engine.UsingSplitscreenUpscaling() then f0_local12.bottom = -100 f0_local12.left = 350 end local f0_local13 = { alpha = 1 } local f0_local14 = function () local f15_local0 = RegisterMaterial( "cranked_back_1" ) local f15_local1 = RegisterMaterial( "cranked_back_2" ) local self = LUI.UIElement.new() self.id = "crankedBombTimerHudIdContainerWrapper" self:registerAnimationState( "default", { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, left = 0, right = 0, top = 0, bottom = 0, alpha = 1 } ) self:animateToState( "default", 0 ) self:registerAnimationState( "hidden", { alpha = 0 } ) self:registerEventHandler( "cod_caster_view_free", MBh.AnimateToState( "hidden", 250 ) ) self:registerEventHandler( "cod_caster_view_player", MBh.AnimateToState( "default", 0 ) ) local f15_local3 = LUI.UIElement.new() f15_local3.id = "crankedBombTimerHudId" f15_local3:registerAnimationState( "default", f0_local12 ) f15_local3:animateToState( "default", 0 ) f15_local3:registerAnimationState( "active", f0_local13 ) f15_local3:registerOmnvarHandler( "ui_cranked_bomb_timer_end_milliseconds", f0_local6 ) f15_local3:registerOmnvarHandler( "ui_cranked_bomb_timer_final_seconds", f0_local8 ) f15_local3:registerEventHandler( "playerstate_client_changed", f0_local10 ) local f15_local4 = LUI.UIImage.new() f15_local4.id = "cranked_bg" f15_local4:registerAnimationState( "default", { topAnchor = true, leftAnchor = true, bottomAnchor = true, rightAnchor = true, material = f15_local0, alpha = 1 } ) f15_local4:animateToState( "default", 0 ) local f15_local5 = LUI.UIImage.new() f15_local5.id = "cranked_warning_bg" f15_local5:registerAnimationState( "default", { topAnchor = true, leftAnchor = true, bottomAnchor = true, rightAnchor = true, material = f15_local1, alpha = 0 } ) f15_local5:animateToState( "default", 0 ) f15_local5:registerAnimationState( "flashing", { alpha = 1 } ) local f15_local6 = LUI.UIText.new() f15_local6.id = "cranked_text" f15_local6:setText( Engine.Localize( "@LUA_MENU_CRANKED_CAPS" ) ) f15_local6:registerAnimationState( "default", { topAnchor = false, leftAnchor = false, bottomAnchor = true, rightAnchor = true, bottom = -35, right = -38, height = CoD.TextSettings.HudEuroConRegSmallFont.Height, width = 256, font = CoD.TextSettings.HudEuroConRegSmallFont.Font, alignment = LUI.Alignment.Right, red = Colors.yellow.r, green = Colors.yellow.g, blue = Colors.yellow.b, alpha = 1 } ) f15_local6:animateToState( "default", 0 ) f15_local6:registerOmnvarHandler( "ui_cranked_bomb_timer_text", f0_local9 ) local f15_local7 = LUI.UIText.new() f15_local7.id = "cranked_countdown_bg" f15_local7:setText( "8:88.8" ) f15_local7:registerAnimationState( "default", { topAnchor = true, leftAnchor = true, bottomAnchor = false, rightAnchor = false, top = 33, left = 30, height = CoD.TextSettings.HudDigitalExtraBigFont.Height, width = 128, font = CoD.TextSettings.HudDigitalExtraBigFont.Font, alignment = LUI.Alignment.Right, red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = 0.15 } ) f15_local7:animateToState( "default", 0 ) f15_local7:registerAnimationState( "flashing", { red = Colors.black.r, green = Colors.black.g, blue = Colors.black.b } ) local f15_local8 = LUI.UICountdown.new( {} ) f15_local8.id = "cranked_countdown" f15_local8:registerAnimationState( "default", { topAnchor = true, leftAnchor = true, bottomAnchor = false, rightAnchor = false, top = 33, left = 30, height = CoD.TextSettings.HudDigitalExtraBigFont.Height, width = 128, font = CoD.TextSettings.HudDigitalExtraBigFont.Font, alignment = LUI.Alignment.Right, red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = 1 } ) f15_local8:animateToState( "default", 0 ) f15_local8:registerAnimationState( "flashing", { red = Colors.black.r, green = Colors.black.g, blue = Colors.black.b } ) self:addElement( f15_local3 ) f15_local3:addElement( f15_local4 ) f15_local3:addElement( f15_local5 ) f15_local3:addElement( f15_local6 ) f15_local3:addElement( f15_local7 ) f15_local3:addElement( f15_local8 ) return self end LUI.MenuBuilder.registerType( "timersHudDef", f0_local11 ) LUI.MenuBuilder.registerType( "crankedBombTimerHudDef", f0_local14 ) LockTable( _M )