Hello,
I've been looking for a good way to add a new tab to the info panel window that has the character info, skills, health, protection, and temperature panel tabs. I came up with a solution, but I'm not entirely satisfied with it. I did some searching on the forums and I didn't see a solution. Sorry if I missed it.
I tried the following and it works for the most part except when you take over player 1 with a controller. The game recreates their info panel window and the new one won't have the new tab. Otherwise, starting a new character with either keyboard or controller will work.
local function createTestPanel(playerNum)
local infoPanel = getPlayerInfoPanel(playerNum)
if not infoPanel then return end
infoPanel.testView = ISTestPanel:new(getSpecificPlayer(playerNum), 0, 8, infoPanel.width, infoPanel.height - 8)
infoPanel.testView:initialise()
infoPanel.testView.infoText = "Test"
infoPanel.panel:addView("Test", infoPanel.testView)
end
local function createTestJoypadPanel()
local playerNum = 0
local joypadData = JoypadState.joypads[playerNum + 1]
if joypadData.controller then
createTestPanel(playerNum)
end
end
-----
Events.OnCreatePlayer.Add(createTestPanel)
Events.OnGameStart.Add(createTestJoypadPanel)
I found the following solution that will always work every time the info panel window is created, but overwriting a function just feels bad.
local oldCreateChildren = ISCharacterInfoWindow.createChildren
function ISCharacterInfoWindow:createChildren()
oldCreateChildren(self)
self.testView = ISTestPanel:new(getSpecificPlayer(self.playerNum), 0, 8, self.width, self.height - 8)
self.testView:initialise()
self.testView.infoText = "Test"
self.panel:addView("Test", self.testView)
end
Does anyone have a better solution they're willing to share?
Thanks in advance!