trying to fix menu for MP
This commit is contained in:
@@ -49,7 +49,7 @@ local function otherPlayerLocal(_, partName, action, surgeon, patient)
|
|||||||
ui.actionAct = action;
|
ui.actionAct = action;
|
||||||
ui.partNameAct = partName;
|
ui.partNameAct = partName;
|
||||||
ui.patient = patient;
|
ui.patient = patient;
|
||||||
--SetConfirmUIMP("Wait server")
|
SetConfirmUIMP("Wait server")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -139,8 +139,6 @@ function ISWorldObjectContextMenu.OnFillTOCMenu(player, context, worldObjects, t
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- why local?
|
|
||||||
function ISWorldObjectContextMenu.OnFillOperateWithOven(player, context, worldObjects, test)
|
function ISWorldObjectContextMenu.OnFillOperateWithOven(player, context, worldObjects, test)
|
||||||
local player_obj = getSpecificPlayer(player)
|
local player_obj = getSpecificPlayer(player)
|
||||||
--local clickedPlayer
|
--local clickedPlayer
|
||||||
@@ -181,23 +179,6 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- if instanceof(vtest, "IsoStove") and (player_obj:HasTrait("Brave") or player_obj:getPerkLevel(Perks.Strength) >= 6) then
|
|
||||||
-- --if v:getCurrentTemperature() > 250 then
|
|
||||||
-- local rootMenu = context:addOption(getText('UI_ContextMenu_OperateOven'), worldObjects, nil);
|
|
||||||
-- local subMenu = context:getNew(context);
|
|
||||||
-- context:addSubMenu(rootMenu, subMenu)
|
|
||||||
|
|
||||||
-- for k_bodypart, v_bodypart in pairs(GetBodyParts()) do
|
|
||||||
-- -- todo this is awful but it should work
|
|
||||||
-- if modData.TOC[v_bodypart].is_cut and not modData.TOC[v_bodypart].is_operated then
|
|
||||||
-- subMenu:addOption(getText('UI_ContextMenu_' .. v_bodypart), worldObjects, operateLocal, v_bodypart);
|
|
||||||
|
|
||||||
-- end
|
|
||||||
|
|
||||||
|
|
||||||
-- end
|
|
||||||
-- --end
|
|
||||||
-- end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -205,46 +186,5 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- for _,object in ipairs(worldobjects) do
|
|
||||||
-- local square = object:getSquare()
|
|
||||||
-- if square then
|
|
||||||
-- local movingObjects = square:getMovingObjects()
|
|
||||||
-- for i = 0, movingObjects:size() - 1 do
|
|
||||||
-- local o = movingObjects:get(i)
|
|
||||||
-- if instanceof(o, "IsoPlayer") then
|
|
||||||
-- clickedPlayer = o;
|
|
||||||
-- print("Found player")
|
|
||||||
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- if clickedPlayer then
|
|
||||||
-- -- Pretty sure this check is kinda broken
|
|
||||||
-- if not ((-1 < clickedPlayer:getX() - player:getX() and clickedPlayer:getX() - player:getX() < 1) and (-1 < clickedPlayer:getY() - player:getY() and clickedPlayer:getY() - player:getY() < 1)) then
|
|
||||||
-- return false;
|
|
||||||
-- end
|
|
||||||
-- local rootOption = context:addOption("The Only Cure on " .. clickedPlayer:getUsername());
|
|
||||||
-- local rootMenu = context:getNew(context);
|
|
||||||
-- local cutOption = rootMenu:addOption("Cut");
|
|
||||||
-- local operateOption = rootMenu:addOption("Operate");
|
|
||||||
-- local cutMenu = context:getNew(context);
|
|
||||||
-- local operateMenu = context:getNew(context);
|
|
||||||
|
|
||||||
-- context:addSubMenu(rootOption, rootMenu);
|
|
||||||
-- context:addSubMenu(cutOption, cutMenu);
|
|
||||||
-- context:addSubMenu(operateOption, operateMenu);
|
|
||||||
-- -- todo add checks so that we don't show these menus if a player has already beeen operated or amputated
|
|
||||||
-- for k, v in ipairs(GetBodyParts()) do
|
|
||||||
-- cutMenu:addOption(getText('UI_ContextMenu_' .. v), worldobjects, otherPlayerLocal, v, "Cut", clickedPlayer)
|
|
||||||
-- operateMenu:addOption(getText('UI_ContextMenu_' .. v), worldobjects, otherPlayerLocal, v, "Operate", clickedPlayer);
|
|
||||||
|
|
||||||
-- end
|
|
||||||
|
|
||||||
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
|
|
||||||
|
|
||||||
--Events.OnTick.Add(TheOnlyCure.CheckState);
|
|
||||||
Events.OnFillWorldObjectContextMenu.Add(ISWorldObjectContextMenu.OnFillOperateWithOven) -- this is probably too much
|
Events.OnFillWorldObjectContextMenu.Add(ISWorldObjectContextMenu.OnFillOperateWithOven) -- this is probably too much
|
||||||
Events.OnFillWorldObjectContextMenu.Add(ISWorldObjectContextMenu.OnFillTOCMenu)
|
Events.OnFillWorldObjectContextMenu.Add(ISWorldObjectContextMenu.OnFillTOCMenu)
|
||||||
@@ -130,8 +130,12 @@ end
|
|||||||
-- end Usefull
|
-- end Usefull
|
||||||
|
|
||||||
-- Function to update text/button of UIs
|
-- Function to update text/button of UIs
|
||||||
local function setDescUI(partName)
|
local function setDescUI(player, partName)
|
||||||
local modData = getPlayer():getModData().TOC;
|
|
||||||
|
--we can easily fix this crap from here for MP compat
|
||||||
|
|
||||||
|
-- TODO set correct player
|
||||||
|
local modData = player:getModData().TOC;
|
||||||
local partData = modData[partName];
|
local partData = modData[partName];
|
||||||
descUI["textTitle"]:setText(getDisplayText_TOC(partName));
|
descUI["textTitle"]:setText(getDisplayText_TOC(partName));
|
||||||
descUI.partNameAct = partName;
|
descUI.partNameAct = partName;
|
||||||
@@ -384,13 +388,16 @@ end
|
|||||||
local function mainPress(button, args)
|
local function mainPress(button, args)
|
||||||
descUI:open();
|
descUI:open();
|
||||||
descUI:setPositionPixel(mainUI:getRight(), mainUI:getY());
|
descUI:setPositionPixel(mainUI:getRight(), mainUI:getY());
|
||||||
setDescUI(args.part);
|
setDescUI(args.player, args.part)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function descPress(button, args)
|
local function descPress(button, args)
|
||||||
local player = getPlayer();
|
local player = getPlayer();
|
||||||
local playerInv = player:getInventory();
|
local playerInv = player:getInventory();
|
||||||
if args.option == "Cut" then
|
if args.option == "Cut" then
|
||||||
|
|
||||||
|
|
||||||
|
-- TODO Change to correct player
|
||||||
local modData = player:getModData().TOC;
|
local modData = player:getModData().TOC;
|
||||||
-- Do not cut if prothesis equip
|
-- Do not cut if prothesis equip
|
||||||
if (string.find(descUI.partNameAct, "Right") and (modData["RightHand"].has_prothesis_equipped or modData["RightForearm"].has_prothesis_equipped))
|
if (string.find(descUI.partNameAct, "Right") and (modData["RightHand"].has_prothesis_equipped or modData["RightForearm"].has_prothesis_equipped))
|
||||||
@@ -418,27 +425,42 @@ end
|
|||||||
|
|
||||||
|
|
||||||
-- Make the UIS
|
-- Make the UIS
|
||||||
local function makeMainUI()
|
local function makeMainUI(character)
|
||||||
|
|
||||||
|
|
||||||
mainUI = NewUI();
|
mainUI = NewUI();
|
||||||
mainUI:setTitle("The only cure main menu");
|
mainUI:setTitle("The Only Cure Menu");
|
||||||
mainUI:setWidthPercent(0.1);
|
mainUI:setWidthPercent(0.1);
|
||||||
|
|
||||||
mainUI:addImageButton("b11", "", mainPress);
|
mainUI:addImageButton("b11", "", mainPress)
|
||||||
mainUI["b11"]:addArg("part", "RightArm");
|
mainUI["b11"]:addArg("part", "RightArm")
|
||||||
|
mainUI["b11"]:addArg("player", character)
|
||||||
|
|
||||||
|
|
||||||
mainUI:addImageButton("b12", "", mainPress);
|
mainUI:addImageButton("b12", "", mainPress);
|
||||||
mainUI["b12"]:addArg("part", "LeftArm");
|
mainUI["b12"]:addArg("part", "LeftArm");
|
||||||
|
mainUI["b12"]:addArg("player", character)
|
||||||
|
|
||||||
mainUI:nextLine();
|
mainUI:nextLine();
|
||||||
|
|
||||||
mainUI:addImageButton("b21", "", mainPress);
|
mainUI:addImageButton("b21", "", mainPress);
|
||||||
mainUI["b21"]:addArg("part", "RightForearm");
|
mainUI["b21"]:addArg("part", "RightForearm");
|
||||||
|
mainUI["b21"]:addArg("player", character)
|
||||||
|
|
||||||
|
|
||||||
mainUI:addImageButton("b22", "", mainPress);
|
mainUI:addImageButton("b22", "", mainPress);
|
||||||
mainUI["b22"]:addArg("part", "LeftForearm");
|
mainUI["b22"]:addArg("part", "LeftForearm");
|
||||||
|
mainUI["b22"]:addArg("player", character)
|
||||||
|
|
||||||
mainUI:nextLine();
|
mainUI:nextLine();
|
||||||
|
|
||||||
mainUI:addImageButton("b31", "", mainPress);
|
mainUI:addImageButton("b31", "", mainPress);
|
||||||
mainUI["b31"]:addArg("part", "RightHand");
|
mainUI["b31"]:addArg("part", "RightHand");
|
||||||
|
mainUI["b31"]:addArg("player", character)
|
||||||
|
|
||||||
mainUI:addImageButton("b32", "", mainPress);
|
mainUI:addImageButton("b32", "", mainPress);
|
||||||
mainUI["b32"]:addArg("part", "LeftHand");
|
mainUI["b32"]:addArg("part", "LeftHand");
|
||||||
|
mainUI["b32"]:addArg("player", character)
|
||||||
|
|
||||||
mainUI:saveLayout();
|
mainUI:saveLayout();
|
||||||
end
|
end
|
||||||
@@ -547,6 +569,24 @@ function MakeConfirmUIMP()
|
|||||||
confirmUIMP:close();
|
confirmUIMP:close();
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function ISHealthPanel:OnCreateTheOnlyCureUI()
|
||||||
|
|
||||||
|
-- how do we pass the correct player here?
|
||||||
|
--print(self.character)
|
||||||
|
if ISHealthPanel.otherPlayer then
|
||||||
|
makeMainUI(ISHealthPanel.otherPlayer)
|
||||||
|
else
|
||||||
|
makeMainUI(getPlayer())
|
||||||
|
end
|
||||||
|
makeDescUI()
|
||||||
|
makeConfirmUI()
|
||||||
|
|
||||||
|
if isClient() then MakeConfirmUIMP() end
|
||||||
|
mainUI:close()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local function onCreateUI()
|
local function onCreateUI()
|
||||||
makeMainUI();
|
makeMainUI();
|
||||||
makeDescUI();
|
makeDescUI();
|
||||||
@@ -555,14 +595,15 @@ local function onCreateUI()
|
|||||||
mainUI:close();
|
mainUI:close();
|
||||||
end
|
end
|
||||||
|
|
||||||
Events.OnCreateUI.Add(onCreateUI)
|
Events.OnCreateUI.Add(ISHealthPanel.OnCreateTheOnlyCureUI)
|
||||||
|
|
||||||
|
|
||||||
-- Add button to health panel
|
-- Add button to health panel
|
||||||
function ISNewHealthPanel.onClick_TOC(button)
|
function ISNewHealthPanel.onClick_TOC(button)
|
||||||
mainUI:toggle();
|
|
||||||
mainUI:setInCenterOfScreen();
|
mainUI:toggle()
|
||||||
setImageMainUI();
|
mainUI:setInCenterOfScreen()
|
||||||
|
setImageMainUI()
|
||||||
end
|
end
|
||||||
|
|
||||||
local ISHealthPanel_createChildren = ISHealthPanel.createChildren
|
local ISHealthPanel_createChildren = ISHealthPanel.createChildren
|
||||||
@@ -572,8 +613,9 @@ function ISHealthPanel:createChildren()
|
|||||||
|
|
||||||
self.fitness:setWidth(self.fitness:getWidth()/1.5);
|
self.fitness:setWidth(self.fitness:getWidth()/1.5);
|
||||||
|
|
||||||
self.TOCButton = ISButton:new(self.fitness:getRight(), self.healthPanel.y, 20, 20, "", self, ISNewHealthPanel.onClick_TOC);
|
--TODO make it bigger
|
||||||
self.TOCButton:setImage(getTexture("media/ui/TOC/iconForMenu.png"));
|
self.TOCButton = ISButton:new(self.fitness:getRight(), self.healthPanel.y, 20, 20, "", self, ISNewHealthPanel.onClick_TOC)
|
||||||
|
self.TOCButton:setImage(getTexture("media/ui/TOC/iconForMenu.png"))
|
||||||
self.TOCButton.anchorTop = false
|
self.TOCButton.anchorTop = false
|
||||||
self.TOCButton.anchorBottom = true
|
self.TOCButton.anchorBottom = true
|
||||||
self.TOCButton:initialise();
|
self.TOCButton:initialise();
|
||||||
@@ -590,3 +632,7 @@ function ISHealthPanel:render()
|
|||||||
ISHealthPanel_render(self);
|
ISHealthPanel_render(self);
|
||||||
self.TOCButton:setY(self.fitness:getY());
|
self.TOCButton:setY(self.fitness:getY());
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
4
mod.info
4
mod.info
@@ -1,8 +1,8 @@
|
|||||||
name=The only cure second test
|
name=The only cure but better
|
||||||
poster=generic.png
|
poster=generic.png
|
||||||
require=UIAPI
|
require=UIAPI
|
||||||
description=Cut your arm and survive. TEST PAO
|
description=Cut your arm and survive. TEST PAO
|
||||||
id=Amputation2
|
id=Amputation3
|
||||||
icon=icon.png
|
icon=icon.png
|
||||||
url=xx
|
url=xx
|
||||||
modversion=0.4.1
|
modversion=0.4.1
|
||||||
|
|||||||
BIN
preview.png
Normal file
BIN
preview.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.4 KiB |
6
workshop.txt
Normal file
6
workshop.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
version=1
|
||||||
|
id=2916771109
|
||||||
|
title=The Only Cure but better DEV
|
||||||
|
description=Just for testing and shit
|
||||||
|
tags=
|
||||||
|
visibility=public
|
||||||
Reference in New Issue
Block a user