From 4254d123bf1813d9eba4e1db66611ec1c8b3e5a9 Mon Sep 17 00:00:00 2001 From: ZioPao Date: Mon, 6 Nov 2023 18:27:08 +0100 Subject: [PATCH] Cleaning --- media/lua/client/UI/TOC_HealthPanel.lua | 138 +++--------------------- 1 file changed, 14 insertions(+), 124 deletions(-) diff --git a/media/lua/client/UI/TOC_HealthPanel.lua b/media/lua/client/UI/TOC_HealthPanel.lua index 4ad8712..e07d919 100644 --- a/media/lua/client/UI/TOC_HealthPanel.lua +++ b/media/lua/client/UI/TOC_HealthPanel.lua @@ -3,55 +3,15 @@ local CutLimbHandler = require("UI/TOC_CutLimbHandler") -- TODO Use this to replace the sprites once a limb is cut ISHealthBodyPartPanel = ISBodyPartPanel:derive("ISHealthBodyPartPanel") - ---ISBodyPartPanel - --- function ISHealthBodyPartPanel:onMouseUp(x, y) --- if self.selectedBp then --- local dragging = ISInventoryPane.getActualItems(ISMouseDrag.dragging) --- self.parent:dropItemsOnBodyPart(self.selectedBp.bodyPart, dragging) --- end --- end - --- function ISHealthBodyPartPanel:prerender() --- self.nodeAlpha = 0.0 --- self.selectedAlpha = 0.1 --- if self.selectedBp then --- for index,item in ipairs(self.parent.listbox.items) do --- if item.item.bodyPart == self.selectedBp.bodyPart then --- self.nodeAlpha = 1.0 --- self.selectedAlpha = 0.5 --- break --- end --- end --- end --- ISBodyPartPanel.prerender(self) --- end - --- function ISHealthBodyPartPanel:cbSetSelected(bp) --- if bp == nil then --- self.parent.listbox.selected = 0 --- return --- end --- for index,item in ipairs(self.parent.listbox.items) do --- if item.item.bodyPart == bp.bodyPart then --- self.parent.listbox.selected = index --- break --- end --- end --- end - +--* Handling drag n drop of the saw *-- local og_ISHealthPanel_dropItemsOnBodyPart = ISHealthPanel.dropItemsOnBodyPart - function ISHealthPanel:dropItemsOnBodyPart(bodyPart, items) og_ISHealthPanel_dropItemsOnBodyPart(self, bodyPart, items) local cutLimbHandler = CutLimbHandler:new(self, bodyPart) - for _,item in ipairs(items) do cutLimbHandler:checkItem(item) end - if cutLimbHandler:dropItems(items) then return end @@ -59,7 +19,6 @@ function ISHealthPanel:dropItemsOnBodyPart(bodyPart, items) end local og_ISHealthPanel_doBodyPartContextMenu = ISHealthPanel.doBodyPartContextMenu - function ISHealthPanel:doBodyPartContextMenu(bodyPart, x, y) og_ISHealthPanel_doBodyPartContextMenu(self, bodyPart, x, y) local playerNum = self.otherPlayer and self.otherPlayer:getPlayerNum() or self.character:getPlayerNum() @@ -69,98 +28,29 @@ function ISHealthPanel:doBodyPartContextMenu(bodyPart, x, y) end +--* Modification to handle visible amputation on the health menu *-- +local handL = getTexture("media/ui/Hand_L.png") +local forearmL = getTexture("media/ui/ForeArm_L.png") +local upperarmL = getTexture("media/ui/UpperArm_L.png") - - - - - - - - - - - ---------------------------------------------------------- local og_ISHealthPanel_render = ISHealthPanel.render - function ISHealthPanel:render() - og_ISHealthPanel_render(self) - - -- Left Texture - local handL = getTexture("media/ui/Hand_L.png") - local forearmL = getTexture("media/ui/ForeArm_L.png") - local upperarmL = getTexture("media/ui/UpperArm_L.png") - self:drawTextureScaled(forearmL, self.healthPanel.x/2 - 2, self.healthPanel.y/2, 123, 302, 1, 1, 0, 0) + -- Left Texture + + + --self:drawTextureScaled(forearmL, self.healthPanel.x/2 - 2, self.healthPanel.y/2, 123, 302, 1, 1, 0, 0) -- Right Texture - - - - end - -function ISCharacterInfoWindow:render() - ISCollapsableWindow.render(self) - +-- We need to override this to force the alpha to 1 +local og_ISCharacterInfoWindow_render = ISCharacterInfoWindow.prerender +function ISCharacterInfoWindow:prerender() + og_ISCharacterInfoWindow_render(self) self.backgroundColor.a = 1 - if JoypadState.players[self.playerNum+1] then - for _,view in pairs(self.panel.viewList) do - if JoypadState.players[self.playerNum+1].focus == view.view then - self:drawRectBorder(0, 0, self:getWidth(), self:getHeight(), 0.4, 0.2, 1.0, 1.0); - self:drawRectBorder(1, 1, self:getWidth()-2, self:getHeight()-2, 0.4, 0.2, 1.0, 1.0); - break - end - end - end -end --- function ISHealthPanel:createChildren() --- self.healthPanel = ISNewHealthPanel:new(0, 8, self.character) --- self.healthPanel:initialise() --- self.healthPanel:instantiate() --- self.healthPanel:setVisible(true) --- self:addChild(self.healthPanel) - --- self.listbox = ISHealthBodyPartListBox:new(180 - 15, 59, self.width - (180 - 15), self.height); --- self.listbox:initialise(); --- self.listbox:instantiate(); --- self.listbox:setAnchorLeft(true); --- self.listbox:setAnchorRight(true); --- self.listbox:setAnchorTop(true); --- self.listbox:setAnchorBottom(false); --- self.listbox.itemheight = 128; --- self.listbox.drawBorder = false --- self.listbox.backgroundColor.a = 0 --- self.listbox.drawText = ISHealthPanel.drawText; --- self:addChild(self.listbox) - --- self.bodyPartPanel = ISHealthBodyPartPanel:new(self.character, 0, 8); --- self.bodyPartPanel:initialise(); --- self.bodyPartPanel:setAlphas(0.0, 1.0, 0.5, 0.0, 0.0) --- -- self.bodyPartPanel:setEnableSelectLines( true, self.bpAnchorX, self.bpAnchorY ); --- self.bodyPartPanel:enableNodes( "media/ui/Client_Icon_On.png", "media/ui/Client_Icon_On.png" ) --- self.bodyPartPanel:overrideNodeTexture( BodyPartType.Torso_Upper, "media/ui/BodyParts/bps_node_big", "media/ui/BodyParts/bps_node_big_outline" ); --- -- self.bodyPartPanel:setColorScheme(self.colorScheme); --- self:addChild(self.bodyPartPanel); - --- self.fitness = ISButton:new(self.healthPanel.x + 165, self.healthPanel.y, 100, 20, getText("ContextMenu_Fitness"), self, ISNewHealthPanel.onClick); --- self.fitness.internal = "FITNESS"; --- self.fitness.anchorTop = false --- self.fitness.anchorBottom = true --- self.fitness:initialise(); --- self.fitness:instantiate(); --- -- self.fitness.borderColor = self.buttonBorderColor; --- self:addChild(self.fitness); --- if getCore():getGameMode() == "Tutorial" then --- self.fitness:setVisible(false); --- end --- self.blockingAlpha = 0.0; --- -- print "instant"; - --- end \ No newline at end of file +end \ No newline at end of file