From 7e99423e58597a76d06eb43342c822607b962776 Mon Sep 17 00:00:00 2001 From: Jbleezy Date: Wed, 24 Jan 2024 02:30:11 -0800 Subject: [PATCH] HUD: character name displayed on all maps HUD: character name fades out on all maps HUD: make character name duration start once character name is visible --- README.md | 6 +- .../zombie/hudcompetitivescoreboardzombie.lua | 69 ++++++++++++++++--- 2 files changed, 64 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 3f35e4ab..f2822c24 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,8 @@ * Timer displayed on top right of screen * Health bar displayed on bottom left of screen * Zone name displayed on bottom left of screen -* Added proper game mode and map name to scoreboard -* Added icons on scoreboard when player is downed, bled out, in Who's Who mode, or in afterlife +* Character name displayed on all maps +* Character name fades out after 15 seconds on all maps * Moved points display, grenade icons, and keyboard & mouse dpad icons to their positions from Origins on all maps * Moved afterlife display to the right of points display * Weapon name is all capitalized on all maps @@ -36,6 +36,8 @@ * Weapon name and ammo no longer fade out * Grenade icons no longer fade based on how many the player currently has * Ammo counter no longer shows while scoped on all maps +* Added proper game mode and map name to scoreboard +* Added icons on scoreboard when player is downed, bled out, in Who's Who mode, or in afterlife * Increased waypoint offset from top of screen * Changed player waypoint location to be center of player instead of top of player * Increased distance between revive waypoint arrow and icon diff --git a/ui_mp/t6/zombie/hudcompetitivescoreboardzombie.lua b/ui_mp/t6/zombie/hudcompetitivescoreboardzombie.lua index 375d1a03..7467974d 100644 --- a/ui_mp/t6/zombie/hudcompetitivescoreboardzombie.lua +++ b/ui_mp/t6/zombie/hudcompetitivescoreboardzombie.lua @@ -6,6 +6,7 @@ CoD.CompetitiveScoreboard.FloatingLosePointsColor = { g = 0, b = 0, } +CoD.CompetitiveScoreboard.IsDLC1Map = CoD.Zombie.IsDLCMap(CoD.Zombie.DLC1Maps) CoD.CompetitiveScoreboard.IsDLC2Map = CoD.Zombie.IsDLCMap(CoD.Zombie.DLC2Maps) CoD.CompetitiveScoreboard.IsDLC3Map = CoD.Zombie.IsDLCMap(CoD.Zombie.DLC3Maps) CoD.CompetitiveScoreboard.IsDLC4Map = CoD.Zombie.IsDLCMap(CoD.Zombie.DLC4Maps) @@ -72,7 +73,49 @@ CoD.CompetitiveScoreboard.HAVE_SHOVEL = 1 CoD.CompetitiveScoreboard.HAVE_UG_SHOVEL = 2 CoD.CompetitiveScoreboard.NEED_HELMET = 0 CoD.CompetitiveScoreboard.HAVE_HELMET = 1 -if CoD.CompetitiveScoreboard.IsDLC2Map == true then +CoD.Zombie.CharacterNameDisplayMaps = {} +CoD.Zombie.CharacterNameDisplayMaps[1] = CoD.Zombie.MAP_ZM_TRANSIT +CoD.Zombie.CharacterNameDisplayMaps[2] = CoD.Zombie.MAP_ZM_HIGHRISE +CoD.Zombie.CharacterNameDisplayMaps[3] = CoD.Zombie.MAP_ZM_PRISON +CoD.Zombie.CharacterNameDisplayMaps[4] = CoD.Zombie.MAP_ZM_BURIED +CoD.Zombie.CharacterNameDisplayMaps[5] = CoD.Zombie.MAP_ZM_TOMB +if Dvar.ui_mapname:get() == CoD.Zombie.MAP_ZM_TRANSIT then + CoD.CompetitiveScoreboard.CharacterNames = {} + CoD.CompetitiveScoreboard.CharacterNames[1] = { + name = "Misty", + modelName = "c_zom_player_farmgirl_fb", + } + CoD.CompetitiveScoreboard.CharacterNames[2] = { + name = "Marlton", + modelName = "c_zom_player_engineer_fb", + } + CoD.CompetitiveScoreboard.CharacterNames[3] = { + name = "Stuhlinger", + modelName = "c_zom_player_reporter_fb", + } + CoD.CompetitiveScoreboard.CharacterNames[4] = { + name = "Russman", + modelName = "c_zom_player_oldman_fb", + } +elseif CoD.CompetitiveScoreboard.IsDLC1Map == true then + CoD.CompetitiveScoreboard.CharacterNames = {} + CoD.CompetitiveScoreboard.CharacterNames[1] = { + name = "Misty", + modelName = "c_zom_player_farmgirl_dlc1_fb", + } + CoD.CompetitiveScoreboard.CharacterNames[2] = { + name = "Marlton", + modelName = "c_zom_player_engineer_dlc1_fb", + } + CoD.CompetitiveScoreboard.CharacterNames[3] = { + name = "Stuhlinger", + modelName = "c_zom_player_reporter_dlc1_fb", + } + CoD.CompetitiveScoreboard.CharacterNames[4] = { + name = "Russman", + modelName = "c_zom_player_oldman_dlc1_fb", + } +elseif CoD.CompetitiveScoreboard.IsDLC2Map == true then CoD.CompetitiveScoreboard.CharacterNames = {} CoD.CompetitiveScoreboard.CharacterNames[1] = { name = "Finn", @@ -159,9 +202,7 @@ LUI.createMenu.CompetitiveScoreboard = function(LocalClientIndex) PlayerScoreListWidget.characterName:setTopBottom(false, false, -CharacterNameTextSize / 2, CharacterNameTextSize / 2) PlayerScoreListWidget.characterName:setFont(CoD.fonts[CharacterNameFont]) PlayerScoreListWidget.characterName:setAlignment(LUI.Alignment.Right) - if CoD.CompetitiveScoreboard.IsDLC3Map == true then - PlayerScoreListWidget.characterName:registerEventHandler("character_name_fade_out", CoD.CompetitiveScoreboard.FadeoutCharacterName) - end + PlayerScoreListWidget.characterName:registerEventHandler("character_name_fade_out", CoD.CompetitiveScoreboard.FadeoutCharacterName) PlayerScoreListWidget:addElement(PlayerScoreListWidget.characterName) end PlayerScoreListWidget.scoreText = LUI.UIText.new() @@ -405,7 +446,7 @@ CoD.CompetitiveScoreboard.Update = function(CompetitiveScoreboardWidget, ClientI if ClientIndex == ClientInstance.selfindex then CoD.CompetitiveScoreboard.CompetitiveScoreShowSelf(CompetitiveScoreboardWidget.Scores[ClientScoreIndex], ClientScoreIndex, 0) CompetitiveScoreboardWidget.Scores[ClientScoreIndex].scoreBg:setAlpha(1) - if CoD.Zombie.IsCharacterNameDisplayMap() == true then + if CoD.Zombie.IsCharacterNameDisplayMap() == true and CoD.CompetitiveScoreboard.ShouldUpdateCharacterName(CompetitiveScoreboardWidget, ClientInstance) then CoD.CompetitiveScoreboard.UpdateCharacterName(CompetitiveScoreboardWidget, ClientInstance.modelName, CompetitiveScoreboardWidget.Scores[ClientScoreIndex], ClientIndex) CoD.CompetitiveScoreboard.CompetitiveScoreTextShowPlayerColor(CompetitiveScoreboardWidget.Scores[ClientScoreIndex].characterName, ClientIndex, 0) end @@ -598,6 +639,18 @@ CoD.CompetitiveScoreboard.HasBit = function(ClientFieldValue, NavCardBit) return NavCardBit <= ClientFieldValue % (NavCardBit + NavCardBit) end +CoD.CompetitiveScoreboard.ShouldUpdateCharacterName = function(CompetitiveScoreboardWidget, ClientInstance) + local LocalClientIndex = ClientInstance.controller + + if UIExpression.IsVisibilityBitSet(LocalClientIndex, CoD.BIT_HUD_VISIBLE) == 0 then + return false + elseif UIExpression.IsVisibilityBitSet(LocalClientIndex, CoD.BIT_IS_PLAYER_IN_AFTERLIFE) == 1 then + return false + end + + return true +end + CoD.CompetitiveScoreboard.UpdateCharacterName = function(CompetitiveScoreboardWidget, ClientInstanceModelName, PlayerScoreListWidget, ClientIndex) if not ClientInstanceModelName and PlayerScoreListWidget.characterName then PlayerScoreListWidget.characterName:setText("") @@ -615,10 +668,8 @@ CoD.CompetitiveScoreboard.UpdateCharacterName = function(CompetitiveScoreboardWi if CharacterNameIndex > 0 and PlayerScoreListWidget.characterName then PlayerScoreListWidget.characterName:setText(CoD.CompetitiveScoreboard.CharacterNames[CharacterNameIndex].name) PlayerScoreListWidget.playerModelName = ClientInstanceModelName - if CoD.CompetitiveScoreboard.IsDLC3Map == true then - PlayerScoreListWidget.characterName.fadeOutTimer = LUI.UITimer.new(CoD.CompetitiveScoreboard.CHARACTER_NAME_ONSCREEN_DURATION, "character_name_fade_out", true, CompetitiveScoreboardWidget) - PlayerScoreListWidget.characterName:addElement(PlayerScoreListWidget.characterName.fadeOutTimer) - end + PlayerScoreListWidget.characterName.fadeOutTimer = LUI.UITimer.new(CoD.CompetitiveScoreboard.CHARACTER_NAME_ONSCREEN_DURATION, "character_name_fade_out", true, CompetitiveScoreboardWidget) + PlayerScoreListWidget.characterName:addElement(PlayerScoreListWidget.characterName.fadeOutTimer) end end end