iw6-lui/lui/mp_hud/damagefeedbackhud.dec.lua
2024-09-12 17:25:45 +02:00

631 lines
15 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = function ( f1_arg0, f1_arg1 )
Engine.NotifyServer( "gambler_anim_complete", 1 )
end
f0_local1 = function ( f2_arg0 )
if Game.GetOmnvar( f2_arg0 ) >= 0 then
return true
else
return false
end
end
f0_local2 = function ( f3_arg0, f3_arg1 )
local f3_local0 = f3_arg1.value
if f3_local0 ~= nil then
if Game.IsCinematicCameraActive() then
return
end
local f3_local1 = 500
local f3_local2 = f3_arg0:getChildById( "damageFeedbackImageId" )
if f3_local0 == "hitblastshield" then
f3_local2:animateToState( "blastshield", 0 )
elseif f3_local0 == "thermobaric_debuff" then
f3_local2:animateToState( "thermoDebuff", 0 )
f3_local1 = 1000
elseif f3_local0 == "hitlightarmor" then
f3_local2:animateToState( "light_armor", 0 )
elseif f3_local0 == "hitmorehealth" then
f3_local2:animateToState( "more_health", 0 )
elseif f3_local0 == "hitmotionsensor" then
f3_local2:animateToState( "motion_sensor", 0 )
f3_local1 = 2500
elseif f3_local0 == "hitalienarmor" then
f3_local2:animateToState( "alienarmor", 0 )
elseif f3_local0 == "hitaliensoft" then
f3_local2:animateToState( "aliensoft", 0 )
elseif f3_local0 == "hitjuggernaut" then
f3_local2:animateToState( "juggernaut", 0 )
elseif f3_local0 == "hitkill" then
f3_local2:animateToState( "hitkill", 0 )
elseif f3_local0 == "hitkilljugg" then
f3_local2:animateToState( "hitkilljugg", 0 )
elseif f3_local0 == "hitdeadeyekill" then
f3_local2:animateToState( "hitdeadeyekill", 0 )
elseif f3_local0 == "hitkillblast" then
f3_local2:animateToState( "hitkillblast", 0 )
elseif f3_local0 == "thermodebuff_kill" then
f3_local2:animateToState( "thermodebuff_kill", 0 )
else
f3_local2:animateToState( "default", 0 )
end
local f3_local3 = MBh.AnimateSequence( {
{
"active",
0
},
{
"default",
f3_local1
}
} )
f3_local3( f3_arg0 )
end
end
local f0_local3 = function ( f4_arg0, f4_arg1 )
local f4_local0 = f4_arg1.value
if f4_local0 ~= nil then
if Game.IsCinematicCameraActive() then
return
end
local f4_local1 = f4_arg0:getChildById( "deadeyeBaseContainer" )
local f4_local2 = f4_arg0:getChildById( "deadeyePulseContainer" )
if f4_local0 == "hitcritical" or f4_local0 == "hitdeadeyekill" then
local f4_local3 = MBh.AnimateSequence( {
{
"default",
100
},
{
"active",
20
},
{
"close",
50
}
} )
f4_local3( f4_local1 )
f4_local3 = MBh.AnimateSequence( {
{
"default",
0
},
{
"active",
50
},
{
"close",
90
}
} )
f4_local3( f4_local2 )
end
end
end
local f0_local4 = function ( f5_arg0, f5_arg1 )
if f5_arg1.value ~= -1 then
local f5_local0 = f5_arg0:getChildById( "gamblerIconId" )
local f5_local1 = f5_arg0:getChildById( "gamblerTextId" )
local f5_local2 = Engine.TableLookupByRow( PerkTable.File, f5_arg1.value, PerkTable.Cols.Image )
local f5_local3 = Engine.TableLookupByRow( PerkTable.File, f5_arg1.value, PerkTable.Cols.Name )
local f5_local4 = RegisterMaterial( f5_local2 )
f5_local1:setText( Engine.Localize( f5_local3 ) )
CoD.SetMaterial( f5_local0, f5_local4 )
local f5_local5 = MBh.AnimateSequence( {
{
"active",
0
},
{
"inactive",
2500
}
} )
f5_local5( f5_arg0 )
end
end
local f0_local5 = function ()
local self = LUI.UIElement.new()
self:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = -16,
bottom = 16,
left = -16,
right = 16,
alpha = 1
} )
self:animateToState( "default" )
self:registerOmnvarHandler( "damage_feedback", f0_local3 )
local f6_local1 = LUI.UIElement.new()
f6_local1.id = "deadeyeBaseContainer"
f6_local1:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = -16,
left = -16,
right = 16,
height = 64,
alpha = 0
} )
f6_local1:registerAnimationState( "active", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = -20,
left = -20,
right = 20,
height = 70,
alpha = 0.5
} )
f6_local1:registerAnimationState( "close", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = -22,
left = -22,
right = 22,
height = 72,
alpha = 0
} )
f6_local1:animateToState( "default" )
local f6_local2 = LUI.UIImage.new()
f6_local2.id = "deadeyeBaseImage"
f6_local2:registerAnimationState( "default", {
material = RegisterMaterial( "damage_feedback_deadeye" ),
topAnchor = true,
leftAnchor = true,
rightAnchor = true,
bottomAnchor = true,
alpha = 1
} )
f6_local2:animateToState( "default" )
f6_local1:addElement( f6_local2 )
local f6_local3 = LUI.UIElement.new()
f6_local3.id = "deadeyePulseContainer"
f6_local3:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = -16,
left = -16,
right = 16,
height = 64,
alpha = 0
} )
f6_local3:registerAnimationState( "active", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = -32,
left = -32,
right = 32,
height = 128,
alpha = 1
} )
f6_local3:registerAnimationState( "close", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = -64,
left = -64,
right = 64,
height = 256,
alpha = 0
} )
f6_local3:animateToState( "default" )
local f6_local4 = LUI.UIImage.new()
f6_local4.id = "deadeyePulseImage"
f6_local4:registerAnimationState( "default", {
material = RegisterMaterial( "damage_feedback_deadeye" ),
topAnchor = true,
leftAnchor = true,
rightAnchor = true,
bottomAnchor = true,
alpha = 1
} )
f6_local4:animateToState( "default" )
f6_local3:addElement( f6_local4 )
self:addElement( f6_local1 )
self:addElement( f6_local3 )
return self
end
local f0_local6 = function ()
local self = LUI.UIElement.new()
self.id = "gamblerHudId"
self:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = -16,
bottom = 16,
left = -16,
right = 16,
alpha = 0
} )
self:registerAnimationState( "active", {
alpha = 1
} )
self:registerAnimationState( "inactive", {
alpha = 0
} )
self:animateToState( "default" )
self:registerOmnvarHandler( "ui_gambler_show", f0_local4 )
self:registerEventHandler( "transition_complete_inactive", f0_local0 )
local f7_local1 = LUI.UIImage.new()
f7_local1.id = "gamblerIconId"
f7_local1:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = 95,
left = -20,
right = 20,
height = 40
} )
f7_local1:animateToState( "default" )
local f7_local2 = LUI.UIText.new()
f7_local2.id = "gamblerTextId"
f7_local2:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
bottom = 160,
left = -100,
right = 100,
height = CoD.TextSettings.SmallFont.Height,
font = CoD.TextSettings.SmallFont.Font,
alignment = LUI.Alignment.Center,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = 1
} )
f7_local2:animateToState( "default" )
f7_local2:setText( "Enter Ability Name Here" )
f7_local2:setTextStyle( CoD.TextStyle.Shadowed )
self:addElement( f7_local1 )
self:addElement( f7_local2 )
return self
end
function damageFeedbackHudDef()
local f8_local0 = RegisterMaterial( "damage_feedback" )
local self = LUI.UIElement.new()
self.id = "damageFeedbackHud"
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
right = 0,
bottom = 0
} )
self:animateToState( "default" )
local f8_local2 = LUI.UIElement.new()
f8_local2:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = -16,
bottom = 16,
left = -16,
right = 16,
alpha = 0
} )
f8_local2:registerAnimationState( "active", {
alpha = 1
} )
f8_local2:animateToState( "default" )
f8_local2:registerOmnvarHandler( "damage_feedback", f0_local2 )
local f8_local3 = {
{
name = "default",
material = f8_local0
}
}
if not Engine.IsAliensMode() then
local f8_local4 = Engine.UsingSplitscreenUpscaling() and 137 or 100
local f8_local5 = RegisterMaterial( "damage_feedback_blastshield" )
local f8_local6 = RegisterMaterial( "damage_feedback_thermodebuff" )
local f8_local7 = RegisterMaterial( "damage_feedback_juggernaut" )
LUI.ConcatenateToTable( f8_local3, {
{
name = "blastshield",
material = f8_local5
},
{
name = "thermoDebuff",
material = f8_local6
},
{
name = "juggernaut",
material = f8_local7
},
{
name = "light_armor",
material = RegisterMaterial( "damage_feedback_lightarmor" )
},
{
name = "more_health",
material = RegisterMaterial( "damage_feedback_morehealth" )
},
{
name = "motion_sensor",
material = RegisterMaterial( "damage_feedback_motionsensor" )
},
{
name = "hitkill",
material = f8_local0,
red = 0.9,
green = 0.63,
blue = 0
},
{
name = "hitkilljugg",
material = f8_local7,
red = 0.9,
green = 0.63,
blue = 0
},
{
name = "hitkillblast",
material = f8_local5,
red = 0.9,
green = 0.63,
blue = 0
},
{
name = "hitdeadeyekill",
material = f8_local0,
red = 0.9,
green = 0.63,
blue = 0
},
{
name = "thermodebuff_kill",
material = f8_local6,
red = 0.9,
green = 0.63,
blue = 0
}
} )
else
LUI.ConcatenateToTable( f8_local3, {
{
name = "alienarmor",
material = RegisterMaterial( "damage_feedback_alienarmor" )
},
{
name = "aliensoft",
material = RegisterMaterial( "damage_feedback_aliensoft" )
}
} )
end
local f8_local4 = LUI.UIImage.new()
f8_local4.id = "damageFeedbackImageId"
for f8_local9, f8_local10 in ipairs( f8_local3 ) do
local f8_local11 = f8_local4
local f8_local12 = f8_local4.registerAnimationState
local f8_local13 = f8_local10.name
local f8_local14 = {
material = f8_local10.material,
topAnchor = true,
bottomAnchor = false
}
local f8_local8
if f8_local10.leftAnchor ~= nil then
f8_local8 = f8_local10.leftAnchor
else
f8_local8 = true
end
f8_local14.leftAnchor = f8_local8
if f8_local10.rightAnchor ~= nil then
f8_local8 = f8_local10.rightAnchor
else
f8_local8 = true
end
f8_local14.rightAnchor = f8_local8
f8_local14.top = f8_local10.top or 0
f8_local14.height = f8_local10.height or 64
f8_local14.left = f8_local10.left
f8_local14.right = f8_local10.right
f8_local14.red = f8_local10.red or 1
f8_local14.blue = f8_local10.blue or 1
f8_local14.green = f8_local10.green or 1
f8_local12( f8_local11, f8_local13, f8_local14 )
end
f8_local4:animateToState( "default" )
f8_local2:addElement( f8_local4 )
self:addElement( f8_local2 )
self:addElement( f0_local5() )
self:addElement( f0_local6() )
return self
end
local f0_local7 = function ( f9_arg0, f9_arg1 )
local f9_local0 = f9_arg1.value
if f9_local0 ~= nil then
if Game.IsCinematicCameraActive() then
return
end
local f9_local1 = 500
local f9_local2 = f9_arg0:getChildById( "hudIconTypeImageId" )
if f9_local0 == "scavenger" and f0_local1( "ui_gambler_show" ) == false then
f9_local2:animateToState( "scavenger", 0 )
f9_local1 = 2500
elseif f9_local0 == "boxofguns" and f0_local1( "ui_gambler_show" ) == false then
f9_local2:animateToState( "boxofguns", 0 )
f9_local1 = 2500
elseif f9_local0 == "throwingknife" and f0_local1( "ui_gambler_show" ) == false then
f9_local2:animateToState( "throwingknife", 0 )
f9_local1 = 2500
elseif f9_local0 == "oracle" and f0_local1( "ui_gambler_show" ) == false then
f9_local2:animateToState( "oracle", 0 )
f9_local1 = 2500
else
f9_local2:animateToState( "default", 0 )
end
local f9_local3 = MBh.AnimateSequence( {
{
"active",
0
},
{
"default",
f9_local1
}
} )
f9_local3( f9_arg0 )
end
end
function hudIconTypeHudDef()
local self = LUI.UIElement.new()
self.id = "hudIconTypeHud"
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
right = 0,
bottom = 0
} )
self:animateToState( "default" )
local f10_local1 = LUI.UIElement.new()
f10_local1:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = -16,
bottom = 16,
left = -16,
right = 16,
alpha = 0
} )
f10_local1:registerAnimationState( "active", {
alpha = 1
} )
f10_local1:animateToState( "default" )
f10_local1:registerOmnvarHandler( "damage_feedback_other", f0_local7 )
local f10_local2 = {}
if not Engine.IsAliensMode() then
local f10_local3 = Engine.UsingSplitscreenUpscaling() and 137 or 100
LUI.ConcatenateToTable( f10_local2, {
{
name = "scavenger",
material = RegisterMaterial( "scavenger_pickup" ),
leftAnchor = false,
rightAnchor = false,
top = f10_local3,
left = -36,
right = 36,
height = 36
},
{
name = "boxofguns",
material = RegisterMaterial( "boxofguns_pickup" ),
leftAnchor = false,
rightAnchor = false,
top = f10_local3,
left = -36,
right = 36,
height = 36
},
{
name = "throwingknife",
material = RegisterMaterial( "throwingknife_pickup" ),
leftAnchor = false,
rightAnchor = false,
top = f10_local3,
left = -36,
right = 36,
height = 36
},
{
name = "oracle",
material = RegisterMaterial( "icon_ks_skylark_uav_hud" ),
leftAnchor = true,
rightAnchor = false,
top = f10_local3,
left = 0,
height = 36,
width = 36,
red = 0.9,
green = 0.63,
blue = 0
}
} )
end
local f10_local3 = LUI.UIImage.new()
f10_local3.id = "hudIconTypeImageId"
for f10_local8, f10_local9 in ipairs( f10_local2 ) do
local f10_local10 = f10_local3
local f10_local11 = f10_local3.registerAnimationState
local f10_local12 = f10_local9.name
local f10_local13 = {
material = f10_local9.material,
topAnchor = true,
bottomAnchor = false
}
local f10_local7
if f10_local9.leftAnchor ~= nil then
f10_local7 = f10_local9.leftAnchor
else
f10_local7 = true
end
f10_local13.leftAnchor = f10_local7
if f10_local9.rightAnchor ~= nil then
f10_local7 = f10_local9.rightAnchor
else
f10_local7 = true
end
f10_local13.rightAnchor = f10_local7
f10_local13.top = f10_local9.top or 0
f10_local13.height = f10_local9.height or 64
f10_local13.width = f10_local9.width
f10_local13.left = f10_local9.left
f10_local13.right = f10_local9.right
f10_local13.red = f10_local9.red or 1
f10_local13.blue = f10_local9.blue or 1
f10_local13.green = f10_local9.green or 1
f10_local11( f10_local10, f10_local12, f10_local13 )
end
f10_local3:animateToState( "default" )
f10_local1:addElement( f10_local3 )
self:addElement( f10_local1 )
return self
end
LUI.MenuBuilder.registerType( "damageFeedbackHudDef", damageFeedbackHudDef )
LUI.MenuBuilder.registerType( "hudIconTypeHudDef", hudIconTypeHudDef )
LockTable( _M )