Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7a920bc
Some first fixes
cat24max Dec 18, 2020
5775207
Temporarily adding ui.vuic
cat24max Dec 18, 2020
aa05972
Update the CapturePoint order (alphabetic)
FlashHit Dec 18, 2020
9d85114
fixed typo error
FlashHit Dec 18, 2020
449a3a6
clear objectives if there are no CapturePointEntities
FlashHit Dec 18, 2020
f104aaa
Add some issues
FlashHit Dec 18, 2020
e37fcb3
Update README.md
FlashHit Dec 18, 2020
ca6797b
Update README.md
FlashHit Dec 19, 2020
5f25953
Update README.md
FlashHit Dec 19, 2020
5dbde45
block vanilla killfeed
FlashHit Dec 19, 2020
8ea7d59
Update README.md
FlashHit Dec 19, 2020
9ec73a2
Update README.md
FlashHit Dec 19, 2020
f249a79
Dependency vext ^1.0.3
FlashHit Dec 19, 2020
001b697
Update README.md
FlashHit Dec 19, 2020
e503790
OnCreateKillMessage: need to verify if it works correct
FlashHit Dec 19, 2020
6f36b66
Update vanilla-ui.lua
FlashHit Dec 19, 2020
5a04cb5
Introducing Sentry for bug tracking
cat24max Dec 19, 2020
3fa4dd2
Fixing out of bounds UI crash
cat24max Dec 19, 2020
c8cf8a3
ui crash seems to be fixed
FlashHit Dec 19, 2020
7836ba8
fix for tiny ammo/nade icons
kapraran Dec 21, 2020
5c68c86
further css fixes for nade/ammo icons
kapraran Dec 21, 2020
7318956
Merge pull request #12 from kapraran/development
FlashHit Dec 22, 2020
51e00f0
not needed anymore
FlashHit Dec 23, 2020
096e680
fix image source
FlashHit Dec 23, 2020
6264372
delete ui.vuic
FlashHit Dec 23, 2020
7990c62
delete vuicc.exe
FlashHit Dec 23, 2020
956e125
revert sentry stuff
FlashHit Dec 23, 2020
aab3794
revert sentry stuff
FlashHit Dec 23, 2020
43eabd6
revert sentry stuff
FlashHit Dec 23, 2020
3ad4e7c
we use the issues tracker instead
FlashHit Dec 23, 2020
3efbbd4
fixed bottom bar cut in half
kapraran Dec 27, 2020
288dc9e
Merge pull request #14 from kapraran/development
FlashHit Dec 27, 2020
f6e843f
quick fix for the objectives bar not updating
kapraran Dec 27, 2020
e415011
Merge pull request #15 from kapraran/development
FlashHit Dec 27, 2020
59c9168
fix not all capturepoints showing after restart
FlashHit Dec 27, 2020
23d7220
a proper fix for the objectives bar not updating
kapraran Dec 27, 2020
bb176bd
Merge remote-tracking branch 'upstream/development' into development
kapraran Dec 27, 2020
9656e62
Merge pull request #16 from kapraran/development
FlashHit Dec 27, 2020
72e214c
fixed change team issue that broke the ui
kapraran Dec 27, 2020
8d47dcd
Merge pull request #17 from kapraran/development
FlashHit Dec 27, 2020
d15264f
adding some nil checks
FlashHit Jan 5, 2021
cb2b40c
Update mod.json
FlashHit Jan 5, 2021
aed7c0f
more nil checks
FlashHit Jan 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
203 changes: 152 additions & 51 deletions ext/Client/venice-spectator/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,12 @@ function SpectatorUI:OnUpdate(p_Delta, p_SimulationDelta)
self.m_InitialTimer = self.m_InitialTimer - p_Delta
return
end

for i = 1, self.m_KillCount do
if self.m_Kills[i]['delta'] ~= nil then
self.m_Kills[i]['delta'] = self.m_Kills[i]['delta'] - p_Delta
end
end
for i = 1, self.m_KillCount do
if self.m_Kills[i] ~= nil and self.m_Kills[i]['delta'] ~= nil then
self.m_Kills[i]['delta'] = self.m_Kills[i]['delta'] - p_Delta
end
end

if not self.m_PlayerStats then
self.m_PlayerStats = true
Expand All @@ -342,26 +342,76 @@ function SpectatorUI:OnUpdate(p_Delta, p_SimulationDelta)
end

local s_ObjectiveIndex = 1
local s_ObjectiveCounter = 1

local gameMode = SharedUtils:GetCurrentGameMode()
if gameMode == nil then
-- while maploading this can be nil
return
elseif gameMode:match("Conquest") or gameMode:match("Superiority") or gameMode == "Domination0" or gameMode == "Scavenger0" then

local s_TicketIterator = EntityManager:GetIterator('ClientTicketCounterEntity')

local s_NeedsTeamUpdate = false

if s_TicketIterator ~= nil then
local s_Entity = s_TicketIterator:Next()

while s_Entity ~= nil do
local s_TicketCounter = TicketCounterEntity(s_Entity)

if self.m_Tickets[s_TicketCounter.team] ~= s_TicketCounter.ticketCount then
self.m_Tickets[s_TicketCounter.team] = s_TicketCounter.ticketCount
s_NeedsTeamUpdate = true
end

local s_TicketIterator = EntityManager:GetIterator('TicketCounterEntity')

local s_NeedsTeamUpdate = false

if s_TicketIterator ~= nil then
local s_Entity = s_TicketIterator:Next()

while s_Entity ~= nil do
local s_TicketCounter = TicketCounterEntity(s_Entity)
s_Entity = s_TicketIterator:Next()
end
end

elseif gameMode:match("Rush") then

local s_TicketIterator = EntityManager:GetIterator('ClientLifeCounterEntity')

local s_NeedsTeamUpdate = false

if s_TicketIterator ~= nil then
local s_Entity = s_TicketIterator:Next()

while s_Entity ~= nil do
local s_TicketCounter = LifeCounterEntity(s_Entity)

if self.m_Tickets[LifeCounterEntityData(s_TicketCounter.data).teamId] ~= s_TicketCounter.lifeCounter then
self.m_Tickets[LifeCounterEntityData(s_TicketCounter.data).teamId] = s_TicketCounter.lifeCounter
s_NeedsTeamUpdate = true
end

if self.m_Tickets[s_TicketCounter.team] ~= s_TicketCounter.ticketCount then
self.m_Tickets[s_TicketCounter.team] = s_TicketCounter.ticketCount
s_NeedsTeamUpdate = true
s_Entity = s_TicketIterator:Next()
end
end

elseif gameMode:match("TeamDeathMatch") or gameMode == "SquadDeathMatch0" then

local s_TicketIterator = EntityManager:GetIterator('ClientKillCounterEntity')

local s_NeedsTeamUpdate = false

if s_TicketIterator ~= nil then
local s_Entity = s_TicketIterator:Next()

while s_Entity ~= nil do
local s_TicketCounter = KillCounterEntity(s_Entity)

if self.m_Tickets[KillCounterEntityData(s_TicketCounter.data).teamId] ~= s_TicketCounter.killCount then
self.m_Tickets[KillCounterEntityData(s_TicketCounter.data).teamId] = s_TicketCounter.killCount
s_NeedsTeamUpdate = true
end

s_Entity = s_TicketIterator:Next()
s_Entity = s_TicketIterator:Next()
end
end

end

if s_NeedsTeamUpdate then
local s_Teams = {}

Expand All @@ -375,11 +425,18 @@ function SpectatorUI:OnUpdate(p_Delta, p_SimulationDelta)
self:SendUIAction(SET_TEAM_NAME, { team = 2, name = self.m_TeamNames[2] })
end

local s_Iterator = EntityManager:GetIterator('CapturePointEntity')

if s_Iterator ~= nil then
local s_Iterator = EntityManager:GetIterator('ClientCapturePointEntity')
if s_Iterator ~= nil then
local s_Entity = s_Iterator:Next()

local s_AddObjectives = false

if s_Entity == nil then
-- if we don't find any CapturePointEntity in the beginning we clear our objectives
self:SendUIAction(CLEAR_OBJECTIVES, {})
end

while s_Entity ~= nil do
local s_CaptureEntity = CapturePointEntity(s_Entity)

Expand All @@ -392,23 +449,44 @@ function SpectatorUI:OnUpdate(p_Delta, p_SimulationDelta)
if not s_CaptureEntity.controlled then
s_Team = TeamId.TeamNeutral
end

local s_Label = s_CaptureEntity.name
s_Label = s_Label:gsub('ID_H_US_', '')
s_Label = s_Label:gsub('ID_H_RU_', '')


-- Order the CapturePoints alphabetic
if s_Label == "A" then
s_ObjectiveIndex = 1
elseif s_Label == "B" then
s_ObjectiveIndex = 2
elseif s_Label == "C" then
s_ObjectiveIndex = 3
elseif s_Label == "D" then
s_ObjectiveIndex = 4
elseif s_Label == "E" then
s_ObjectiveIndex = 5
elseif s_Label == "F" then
s_ObjectiveIndex = 6
elseif s_Label == "G" then
s_ObjectiveIndex = 7
elseif s_Label == "H" then
s_ObjectiveIndex = 8
elseif s_Label == "I" then
s_ObjectiveIndex = 9
elseif s_Label == "J" then
s_ObjectiveIndex = 10
elseif s_Label == "K" then
s_ObjectiveIndex = 11
elseif s_Label == "L" then
s_ObjectiveIndex = 12
end

local s_Transform = s_CaptureEntity.transform.trans

if self.m_Objectives[s_ObjectiveIndex] == nil then
self:SendUIAction(ADD_OBJECTIVE, {
objective = {
label = s_Label,
currentTeam = s_Team,
contested = s_Contested,
position = { s_Transform.x, s_Transform.y, s_Transform.z }
}
})


s_AddObjectives = true

elseif self.m_Objectives[s_ObjectiveIndex]['label'] ~= s_Label or
self.m_Objectives[s_ObjectiveIndex]['currentTeam'] ~= s_Team or
self.m_Objectives[s_ObjectiveIndex]['contested'] ~= s_Contested then
Expand All @@ -430,20 +508,36 @@ function SpectatorUI:OnUpdate(p_Delta, p_SimulationDelta)
position = { s_Transform.x, s_Transform.y, s_Transform.z }
}

s_ObjectiveIndex = s_ObjectiveIndex + 1
s_ObjectiveCounter = s_ObjectiveCounter + 1
end

s_Entity = s_Iterator:Next()
end

-- Add the Objectives here so the order is correct
if s_AddObjectives == true then

self:SendUIAction(CLEAR_OBJECTIVES, {})
for s_ObjectiveIndex,m_Objective in pairs(self.m_Objectives) do

self:SendUIAction(ADD_OBJECTIVE, {
objective = {
label = m_Objective.label,
currentTeam = m_Objective.currentTeam,
contested = m_Objective.contested,
position = m_Objective.position
}
})
end
end
s_AddObjectives = false

end

-- Refresh all objectives if there are now less.
if s_ObjectiveIndex > 1 and self.m_Objectives[s_ObjectiveIndex] ~= nil then
if s_ObjectiveCounter > 1 and self.m_Objectives[s_ObjectiveCounter] ~= nil then
self:SendUIAction(CLEAR_OBJECTIVES, {})

for i = 1, s_ObjectiveIndex - 1 do
self:SendUIAction(ADD_OBJECTIVE, { objective = self.m_Objectives[i] })
end
self.m_Objectives = {}
end


Expand Down Expand Up @@ -504,7 +598,7 @@ function SpectatorUI:OnUpdate(p_Delta, p_SimulationDelta)
local s_NewKillCount = 0

for i = 1, s_KillCount do
if self.m_Kills[i]['delta'] <= 0 then
if self.m_Kills[i] ~= nil and self.m_Kills[i]['delta'] ~= nil and self.m_Kills[i]['delta'] <= 0 then
self.m_Kills[i] = nil
s_UpdateKills = true
else
Expand Down Expand Up @@ -562,6 +656,10 @@ function SpectatorUI:OnUpdate(p_Delta, p_SimulationDelta)
end

function SpectatorUI:ShouldUpdatePlayer(p_OldData, p_NewData)
if p_OldData == nil then
return true
end

if p_OldData['team'] ~= p_NewData['team'] then
return true
end
Expand Down Expand Up @@ -694,19 +792,22 @@ function SpectatorUI:GetPlayerData(p_Player)
local s_WeaponsComponent = s_Soldier.weaponsComponent

if s_WeaponsComponent ~= nil then
s_PlayerData['currentWeapon'] = s_WeaponsComponent.currentWeaponIndex
s_PlayerData['currentWeapon'] = s_WeaponsComponent.currentWeaponSlot

for i = 1, s_WeaponsComponent.weaponCount do
for i,s_Weapon in pairs(s_WeaponsComponent.weapons) do
s_PlayerData['weapons'][i] = {}
local s_Weapon = s_WeaponsComponent:GetWeapon(i - 1)


if s_Weapon ~= nil then
local s_SoldierWeaponData = SoldierWeaponData(s_Weapon.data)
local s_SoldierWeaponBlueprint = SoldierWeaponBlueprint(s_SoldierWeaponData.soldierWeaponBlueprint)
s_PlayerData['weapons'][i]['name'] = s_SoldierWeaponBlueprint.name or s_Weapon.name -- Old: GetWeaponEntityNameByIndex
s_PlayerData['weapons'][i]['displayName'] = s_Weapon.name -- Old: GetWeaponNameByIndex
s_PlayerData['weapons'][i]['ammo'] = s_Weapon.primaryAmmo
s_PlayerData['weapons'][i]['ammoMags'] = s_Weapon.secondaryAmmo
local s_SoldierWeaponBlueprint = s_SoldierWeaponData.soldierWeaponBlueprint
if s_SoldierWeaponBlueprint ~= nil then
s_SoldierWeaponBlueprint = SoldierWeaponBlueprint(s_SoldierWeaponBlueprint)
end
s_PlayerData['weapons'][i]['name'] = s_SoldierWeaponBlueprint.name or s_Weapon.name -- Old: GetWeaponEntityNameByIndex
s_PlayerData['weapons'][i]['displayName'] = s_Weapon.name -- Old: GetWeaponNameByIndex
s_PlayerData['weapons'][i]['ammo'] = s_Weapon.primaryAmmo
s_PlayerData['weapons'][i]['ammoMags'] = s_Weapon.secondaryAmmo

end
end

Expand All @@ -725,4 +826,4 @@ function SpectatorUI:GetPlayerData(p_Player)
return s_PlayerData
end

return SpectatorUI
return SpectatorUI
15 changes: 12 additions & 3 deletions ext/Client/venice-spectator/vanilla-ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ function SpectatorVanillaUI:__init()
-- Install our hooks.
-- TODO: Re-enable push screen hook when our UI is ready.
self.m_UIPushScreenHook = Hooks:Install('UI:PushScreen', 420, self, self.OnPushScreen)
self.m_UICreateKillMessageHook = Hooks:Install('UI:CreateKillMessage', 420, self, self.OnCreateKillMessage)
end

function SpectatorVanillaUI:OnUpdate(p_Delta, p_SimDelta)
Expand All @@ -12,7 +13,7 @@ end

function SpectatorVanillaUI:OnPushScreen(p_Hook, p_Screen, p_GraphPriority, p_ParentGraph)
if SpectatorManager:GetCameraMode() == SpectatorCameraMode.Disabled then
p_Hook:Next()
--p_Hook:Next()
return
end

Expand All @@ -28,7 +29,7 @@ function SpectatorVanillaUI:OnPushScreen(p_Hook, p_Screen, p_GraphPriority, p_Pa
s_Screen.name ~= "UI/Flow/Screen/SpawnScreen" and
s_Screen.name ~= "UI/Flow/Screen/SpawnScreenTicketCounterTDMScreen" and
s_Screen.name ~= "UI/Flow/Screen/HudTDMScreen" then
p_Hook:Next()
--p_Hook:Next()
return
end

Expand Down Expand Up @@ -73,4 +74,12 @@ function SpectatorVanillaUI:OnPushScreen(p_Hook, p_Screen, p_GraphPriority, p_Pa
p_Hook:Pass(s_Screen, p_GraphPriority, p_ParentGraph)
end

return SpectatorVanillaUI
function SpectatorVanillaUI:OnCreateKillMessage(p_Hook)
if SpectatorManager:GetCameraMode() == SpectatorCameraMode.Disabled then
return
end
-- Block the kill feed
p_Hook:Return()
end

return SpectatorVanillaUI
9 changes: 6 additions & 3 deletions mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"Authors": [ "Venice Unleashed" ],
"Description": "Venice Unleashed Spectator Functionality",
"URL": "http://veniceunleashed.net",
"Version": "1.1",
"Version": "1.2.1",
"HasWebUI": true,
"HasVeniceEXT": true
}
"HasVeniceEXT": true ,
"Dependencies": {
"veniceext": "^1.0.3"
}
}
Loading