Fixed TOC UI not working in MP
This commit is contained in:
15
.vscode/settings.json
vendored
15
.vscode/settings.json
vendored
@@ -17,6 +17,19 @@
|
|||||||
"getPlayerInventory",
|
"getPlayerInventory",
|
||||||
"sendServerCommand",
|
"sendServerCommand",
|
||||||
"TraitFactory",
|
"TraitFactory",
|
||||||
"ISWorldObjectContextMenu"
|
"ISWorldObjectContextMenu",
|
||||||
|
"getCell",
|
||||||
|
"getSpecificPlayer",
|
||||||
|
"_",
|
||||||
|
"NewUI",
|
||||||
|
"getTextManager",
|
||||||
|
"isClient",
|
||||||
|
"ISHealthPanel",
|
||||||
|
"ModOptions",
|
||||||
|
"ISNewHealthPanel",
|
||||||
|
"ISButton",
|
||||||
|
"getCore",
|
||||||
|
"ProfessionFactory",
|
||||||
|
"BaseGameCharacterDetails"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
18
media/lua/client/TOC_Checks.lua
Normal file
18
media/lua/client/TOC_Checks.lua
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
-- VARIOUS CHECKS --
|
||||||
|
|
||||||
|
if TheOnlyCure == nil then
|
||||||
|
TheOnlyCure = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
function TheOnlyCure.CheckIfCanBeCut(toc_data, part_name)
|
||||||
|
|
||||||
|
return not toc_data[part_name].is_cut
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function TheOnlyCure.CheckIfCanBeOperated(toc_data, part_name)
|
||||||
|
|
||||||
|
return toc_data[part_name].is_operated == false and toc_data[part_name].is_amputation_shown
|
||||||
|
|
||||||
|
end
|
||||||
@@ -29,9 +29,10 @@ function TryToToResetEverythingOtherPlayer(_, patient, surgeon)
|
|||||||
sendClientCommand(surgeon, "TOC", "AskToResetEverything", {patient:getOnlineID()})
|
sendClientCommand(surgeon, "TOC", "AskToResetEverything", {patient:getOnlineID()})
|
||||||
end
|
end
|
||||||
|
|
||||||
--TODO Make the name more unique
|
|
||||||
function TryActionOnOtherPlayerLocal(_, part_name, action, surgeon, patient)
|
|
||||||
|
|
||||||
|
function TryTheOnlyCureActionOnAnotherPlayer(_, part_name, action, surgeon, patient)
|
||||||
|
-- TODO add checks so that we don't show these menus if a player has already beeen operated or amputated
|
||||||
|
-- TODO at this point surgeon doesnt do anything. We'll fix this later
|
||||||
local ui = GetConfirmUIMP()
|
local ui = GetConfirmUIMP()
|
||||||
if not ui then
|
if not ui then
|
||||||
MakeConfirmUIMP()
|
MakeConfirmUIMP()
|
||||||
@@ -94,83 +95,38 @@ TocContextMenus = {}
|
|||||||
|
|
||||||
|
|
||||||
TocContextMenus.CreateMenus = function(player, context, worldObjects, test)
|
TocContextMenus.CreateMenus = function(player, context, worldObjects, test)
|
||||||
local clickedPlayersTable = {} --todo awful workaround
|
local clicked_players_table = {}
|
||||||
local clickedPlayer = nil
|
local clicked_player = nil
|
||||||
|
|
||||||
local player_obj = getSpecificPlayer(player)
|
local local_player = getSpecificPlayer(player)
|
||||||
--local players = getOnlinePlayers()
|
--local players = getOnlinePlayers()
|
||||||
|
|
||||||
for k,v in ipairs(worldObjects) do
|
for k,v in ipairs(worldObjects) do
|
||||||
-- help detecting a player by checking nearby squares
|
-- help detecting a player by checking nearby squares
|
||||||
for x=v:getSquare():getX()-1,v:getSquare():getX()+1 do
|
for x=v:getSquare():getX()-1,v:getSquare():getX()+1 do
|
||||||
for y=v:getSquare():getY()-1,v:getSquare():getY()+1 do
|
for y=v:getSquare():getY()-1,v:getSquare():getY()+1 do
|
||||||
local sq = getCell():getGridSquare(x,y,v:getSquare():getZ());
|
local sq = getCell():getGridSquare(x,y,v:getSquare():getZ())
|
||||||
if sq then
|
if sq then
|
||||||
for i=0,sq:getMovingObjects():size()-1 do
|
for i=0,sq:getMovingObjects():size()-1 do
|
||||||
local o = sq:getMovingObjects():get(i)
|
local o = sq:getMovingObjects():get(i)
|
||||||
if instanceof(o, "IsoPlayer") then
|
if instanceof(o, "IsoPlayer") then
|
||||||
clickedPlayer = o
|
clicked_player = o
|
||||||
|
|
||||||
if clickedPlayersTable[clickedPlayer:getUsername()] == nil then
|
if clicked_players_table[clicked_player:getUsername()] == nil then
|
||||||
clickedPlayersTable[clickedPlayer:getUsername()] = true
|
|
||||||
|
-- FIXME this is to prevent context menu spamming. Find a better way
|
||||||
|
clicked_players_table[clicked_player:getUsername()] = true
|
||||||
|
|
||||||
local rootOption = context:addOption("The Only Cure on " .. clickedPlayer:getUsername())
|
local root_option = context:addOption("The Only Cure on " .. clicked_player:getUsername())
|
||||||
local rootMenu = context:getNew(context)
|
local root_menu = context:getNew(context)
|
||||||
local cutOption = rootMenu:addOption("Cut");
|
|
||||||
local operateOption = rootMenu:addOption("Operate");
|
|
||||||
local cutMenu = context:getNew(context);
|
|
||||||
local operateMenu = context:getNew(context);
|
|
||||||
|
|
||||||
|
local cut_menu = TocContextMenus.CreateNewMenu("Cut", context, root_menu)
|
||||||
|
local operate_menu = TocContextMenus.CreateNewMenu("Operate", context, root_menu)
|
||||||
|
local cheat_menu = TocContextMenus.CreateCheatMenu(context, root_menu, local_player, clicked_player)
|
||||||
|
context:addSubMenu(root_option, root_menu)
|
||||||
|
|
||||||
-- admin stuff
|
TocContextMenus.FillCutAndOperateMenus(local_player, clicked_player, worldObjects, cut_menu, operate_menu)
|
||||||
if player_obj:getAccessLevel() == "Admin" then
|
--TocContextMenus.FillCheatMenu(context, cheat_menu)
|
||||||
local cheat_option = rootMenu:addOption("Cheat")
|
|
||||||
local cheat_menu = context:getNew(context)
|
|
||||||
context:addSubMenu(cheat_option, cheat_menu)
|
|
||||||
|
|
||||||
|
|
||||||
if clickedPlayer == player_obj then
|
|
||||||
cheat_menu:addOption("Reset TOC for me", worldObjects, ResetEverything)
|
|
||||||
|
|
||||||
else
|
|
||||||
cheat_menu:addOption("Reset TOC for " .. clickedPlayer:getUsername(), worldObjects, TryToToResetEverythingOtherPlayer, clickedPlayer, player_obj)
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
local player_toc_data = getPlayer():getModData().TOC
|
|
||||||
|
|
||||||
for k_part, v_part in ipairs(GetBodyParts()) do
|
|
||||||
|
|
||||||
--todo right now it doesnt check for a saw.
|
|
||||||
if clickedPlayer == player_obj then
|
|
||||||
|
|
||||||
|
|
||||||
if player_toc_data[v_part].is_cut == false then
|
|
||||||
cutMenu:addOption(getText('UI_ContextMenu_' .. v_part), worldObjects, CutLocal, player_obj, player_obj, v_part)
|
|
||||||
elseif player_toc_data[v_part].is_operated == false and player_toc_data[v_part].is_amputation_shown then
|
|
||||||
operateMenu:addOption(getText('UI_ContextMenu_' .. v_part), worldObjects, OperateLocal, player_obj, player_obj, v_part)
|
|
||||||
|
|
||||||
end
|
|
||||||
else
|
|
||||||
--TODO Make it so cut limbs do not appear in the Cut Menu
|
|
||||||
--if clickedPlayer.getModData().TOC[v_part].is_cut == false then
|
|
||||||
cutMenu:addOption(getText('UI_ContextMenu_' .. v_part), worldObjects, TryActionOnOtherPlayerLocal, v_part, "Cut", player_obj, clickedPlayer)
|
|
||||||
--elseif clickedPlayer.getModData().TOC[v_part].is_operated == false then
|
|
||||||
operateMenu:addOption(getText('UI_ContextMenu_' .. v_part), worldObjects, TryActionOnOtherPlayerLocal, v_part, "Operate", player_obj, clickedPlayer);
|
|
||||||
--end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@@ -238,6 +194,70 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TocContextMenus.CreateNewMenu = function(name, context, root_menu)
|
||||||
|
|
||||||
|
local new_option = root_menu:addOption(name)
|
||||||
|
local new_menu = context:getNew(context)
|
||||||
|
context:addSubMenu(new_option, new_menu)
|
||||||
|
|
||||||
|
return new_menu
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TocContextMenus.FillCutAndOperateMenus = function(local_player, clicked_player, world_objects, cut_menu, operate_menu)
|
||||||
|
|
||||||
|
local local_toc_data = local_player:getModData().TOC
|
||||||
|
|
||||||
|
for _, v in ipairs(GetBodyParts()) do
|
||||||
|
|
||||||
|
|
||||||
|
if local_player == clicked_player then -- Local player
|
||||||
|
if TheOnlyCure.CheckIfCanBeCut(local_toc_data, v) then
|
||||||
|
cut_menu:addOption(getText('UI_ContextMenu_' .. v), _, CutLocal, local_player, local_player, v)
|
||||||
|
elseif TheOnlyCure.CheckIfCanBeOperated(local_toc_data, v) then
|
||||||
|
operate_menu:addOption(getText('UI_ContextMenu_' .. v), _, OperateLocal, local_player, local_player, v)
|
||||||
|
end
|
||||||
|
|
||||||
|
else -- Another player
|
||||||
|
cut_menu:addOption(getText('UI_ContextMenu_' .. v), world_objects, TryTheOnlyCureActionOnAnotherPlayer, v, "Cut", local_player, clicked_player)
|
||||||
|
operate_menu:addOption(getText('UI_ContextMenu_' .. v), world_objects, TryTheOnlyCureActionOnAnotherPlayer, v, "Operate", local_player, clicked_player)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TocContextMenus.CreateCheatMenu = function(context, root_menu, local_player, clicked_player)
|
||||||
|
if local_player:getAccessLevel() == "Admin" then
|
||||||
|
|
||||||
|
local cheat_menu = TocContextMenus.CreateNewMenu("Cheat", context, root_menu)
|
||||||
|
|
||||||
|
if clicked_player == local_player then
|
||||||
|
cheat_menu:addOption("Reset TOC for me", _, ResetEverything)
|
||||||
|
|
||||||
|
else
|
||||||
|
cheat_menu:addOption("Reset TOC for " .. clicked_player:getUsername(), _, TryToToResetEverythingOtherPlayer, clicked_player, local_player)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return cheat_menu
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
TocContextMenus.FillCheatMenus = function(context, cheat_menu)
|
||||||
|
|
||||||
|
if cheat_menu then
|
||||||
|
local cheat_cut_and_fix_menu = TocContextMenus.CreateNewMenu("Cut and Fix", context, cheat_menu)
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
Events.OnFillWorldObjectContextMenu.Add(TocContextMenus.CreateOperateWithOvenMenu) -- this is probably too much
|
Events.OnFillWorldObjectContextMenu.Add(TocContextMenus.CreateOperateWithOvenMenu) -- this is probably too much
|
||||||
Events.OnFillWorldObjectContextMenu.Add(TocContextMenus.CreateMenus)
|
Events.OnFillWorldObjectContextMenu.Add(TocContextMenus.CreateMenus)
|
||||||
@@ -82,6 +82,7 @@ end
|
|||||||
if name == "LeftArm" then return "ArmLeft_Prot" end
|
if name == "LeftArm" then return "ArmLeft_Prot" end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- TODO ew
|
||||||
function find_itemWorn_TOC(partName)
|
function find_itemWorn_TOC(partName)
|
||||||
local wornItems = getPlayer():getWornItems();
|
local wornItems = getPlayer():getWornItems();
|
||||||
for i=1,wornItems:size()-1 do -- Maybe wornItems:size()-1
|
for i=1,wornItems:size()-1 do -- Maybe wornItems:size()-1
|
||||||
@@ -256,10 +257,10 @@ local function setConfirmUI(action)
|
|||||||
confirmUI:open()
|
confirmUI:open()
|
||||||
if action == "Cut" then
|
if action == "Cut" then
|
||||||
if isPlayerHaveBandage() and isPlayerHavePainkiller() then
|
if isPlayerHaveBandage() and isPlayerHavePainkiller() then
|
||||||
confirmUI["text2"]:setText("You have bandage and painkiller");
|
confirmUI["text2"]:setText("You have a bandage and some painkillers");
|
||||||
confirmUI["text2"]:setColor(1, 0, 1, 0);
|
confirmUI["text2"]:setColor(1, 0, 1, 0);
|
||||||
else
|
else
|
||||||
confirmUI["text2"]:setText("You miss bandage or painkiller");
|
confirmUI["text2"]:setText("You do not have a bandage or painkillers");
|
||||||
confirmUI["text2"]:setColor(1, 1, 0, 0);
|
confirmUI["text2"]:setColor(1, 1, 0, 0);
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -329,25 +330,65 @@ function SetConfirmUIMP(action, isBitten, userName, partName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function setImageMainUI(toc_data)
|
local function setImageMainUI(toc_data)
|
||||||
mainUI["b11"]:setPath(getImageName("RightArm", toc_data));
|
|
||||||
mainUI["b12"]:setPath(getImageName("LeftArm", toc_data));
|
|
||||||
|
|
||||||
mainUI["b21"]:setPath(getImageName("RightForearm", toc_data));
|
if toc_data then
|
||||||
mainUI["b22"]:setPath(getImageName("LeftForearm", toc_data));
|
mainUI["b11"]:setPath(getImageName("RightArm", toc_data))
|
||||||
|
mainUI["b12"]:setPath(getImageName("LeftArm", toc_data))
|
||||||
|
|
||||||
|
mainUI["b21"]:setPath(getImageName("RightForearm", toc_data))
|
||||||
|
mainUI["b22"]:setPath(getImageName("LeftForearm", toc_data))
|
||||||
|
|
||||||
|
mainUI["b31"]:setPath(getImageName("RightHand", toc_data))
|
||||||
|
mainUI["b32"]:setPath(getImageName("LeftHand", toc_data))
|
||||||
|
end
|
||||||
|
|
||||||
mainUI["b31"]:setPath(getImageName("RightHand", toc_data));
|
|
||||||
mainUI["b32"]:setPath(getImageName("LeftHand", toc_data));
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local function ConfirmPress(button, args)
|
||||||
|
-- For both SP and MP
|
||||||
|
|
||||||
|
local surgeon, patient
|
||||||
|
|
||||||
|
if confirmUI.actionAct == "Cut" then
|
||||||
|
if args.option == "yes" then
|
||||||
|
ISTimedActionQueue.add(ISCutLimb:new(patient, surgeon, descUI.partNameAct))
|
||||||
|
|
||||||
|
else
|
||||||
|
surgeon:Say("Nevermind")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if confirmUI.actionAct == "Operate" then
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Functions for button of UIs
|
-- Functions for button of UIs
|
||||||
local function confirmPress(button, args)
|
local function confirmPress(button, args)
|
||||||
local player = getPlayer();
|
local player = getPlayer()
|
||||||
if confirmUI.actionAct == "Cut" then
|
if confirmUI.actionAct == "Cut" then
|
||||||
if args.option == "yes" then
|
if args.option == "yes" then
|
||||||
ISTimedActionQueue.add(ISCutLimb:new(player, player, descUI.partNameAct))
|
-- TODO this is wrong!
|
||||||
|
|
||||||
|
if args.patient ~= args.surgeon then
|
||||||
|
TryTheOnlyCureActionOnAnotherPlayer(_, descUI.partNameAct, "Cut", args.surgeon, args.patient)
|
||||||
|
else
|
||||||
|
ISTimedActionQueue.add(ISCutLimb:new(args.patient, args.surgeon, descUI.partNameAct))
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
getPlayer():Say("Never mind");
|
getPlayer():Say("Nevermind");
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if confirmUI.actionAct == "Operate" then
|
if confirmUI.actionAct == "Operate" then
|
||||||
@@ -355,7 +396,7 @@ local function confirmPress(button, args)
|
|||||||
local playerInv = player:getInventory();
|
local playerInv = player:getInventory();
|
||||||
local item = playerInv:getItemFromType('TOC.Real_surgeon_kit') or playerInv:getItemFromType('TOC.Surgeon_kit') or playerInv:getItemFromType('TOC.Improvised_surgeon_kit');
|
local item = playerInv:getItemFromType('TOC.Real_surgeon_kit') or playerInv:getItemFromType('TOC.Surgeon_kit') or playerInv:getItemFromType('TOC.Improvised_surgeon_kit');
|
||||||
if item then
|
if item then
|
||||||
ISTimedActionQueue.add(ISOperateArm:new(player, player, item, descUI.partNameAct, false));
|
ISTimedActionQueue.add(ISOperateLimb:new(patient, surgeon, item, descUI.partNameAct, false));
|
||||||
else
|
else
|
||||||
player:Say("I need a kit");
|
player:Say("I need a kit");
|
||||||
end
|
end
|
||||||
@@ -382,7 +423,7 @@ local function confirmPressMP(button, args)
|
|||||||
local item = playerInv:getItemFromType('TOC.Real_surgeon_kit') or playerInv:getItemFromType('TOC.Surgeon_kit') or playerInv:getItemFromType('TOC.Improvised_surgeon_kit');
|
local item = playerInv:getItemFromType('TOC.Real_surgeon_kit') or playerInv:getItemFromType('TOC.Surgeon_kit') or playerInv:getItemFromType('TOC.Improvised_surgeon_kit');
|
||||||
if item then
|
if item then
|
||||||
getPlayer():Say("Don't move! Ok?");
|
getPlayer():Say("Don't move! Ok?");
|
||||||
ISTimedActionQueue.add(ISOperateArm:new(confirmUIMP.patient, player, item, confirmUIMP.partNameAct, false));
|
ISTimedActionQueue.add(ISOperateLimb:new(confirmUIMP.patient, player, item, confirmUIMP.partNameAct, false));
|
||||||
else
|
else
|
||||||
player:Say("I need a kit");
|
player:Say("I need a kit");
|
||||||
end
|
end
|
||||||
@@ -428,21 +469,45 @@ local function descPress(button, args)
|
|||||||
end
|
end
|
||||||
mainUI:close();
|
mainUI:close();
|
||||||
elseif args.option == "Unequip" then
|
elseif args.option == "Unequip" then
|
||||||
ISTimedActionQueue.add(ISUninstallProthesis:new(player, find_itemWorn_TOC(descUI.partNameAct), player:getBodyDamage():getBodyPart(TOC_getBodyPart(descUI.partNameAct))));
|
ISTimedActionQueue.add(ISUninstallProsthesis:new(player, find_itemWorn_TOC(descUI.partNameAct), player:getBodyDamage():getBodyPart(TOC_getBodyPart(descUI.partNameAct))));
|
||||||
mainUI:close();
|
mainUI:close();
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Make the UIS
|
-- Make the UIS
|
||||||
local function SetCorrectArgsMainUI(toc_data)
|
local function SetCorrectArgsMainUI(surgeon, patient, toc_data)
|
||||||
-- TODO Make it less shitty
|
-- TODO Make it less shitty
|
||||||
mainUI["b11"]:addArg("toc_data", toc_data)
|
if toc_data then
|
||||||
mainUI["b12"]:addArg("toc_data", toc_data)
|
mainUI["b11"]:addArg("surgeon", surgeon)
|
||||||
mainUI["b21"]:addArg("toc_data", toc_data)
|
mainUI["b11"]:addArg("patient", patient)
|
||||||
mainUI["b22"]:addArg("toc_data", toc_data)
|
mainUI["b11"]:addArg("toc_data", toc_data)
|
||||||
mainUI["b31"]:addArg("toc_data", toc_data)
|
|
||||||
mainUI["b32"]:addArg("toc_data", toc_data)
|
|
||||||
|
|
||||||
|
mainUI["b12"]:addArg("toc_data", toc_data)
|
||||||
|
mainUI["b12"]:addArg("patient", patient)
|
||||||
|
mainUI["b12"]:addArg("surgeon", surgeon)
|
||||||
|
|
||||||
|
mainUI["b21"]:addArg("toc_data", toc_data)
|
||||||
|
mainUI["b21"]:addArg("patient", patient)
|
||||||
|
mainUI["b21"]:addArg("surgeon", surgeon)
|
||||||
|
|
||||||
|
mainUI["b22"]:addArg("toc_data", toc_data)
|
||||||
|
mainUI["b22"]:addArg("patient", patient)
|
||||||
|
mainUI["b22"]:addArg("surgeon", surgeon)
|
||||||
|
|
||||||
|
mainUI["b31"]:addArg("toc_data", toc_data)
|
||||||
|
mainUI["b31"]:addArg("patient", patient)
|
||||||
|
mainUI["b31"]:addArg("surgeon", surgeon)
|
||||||
|
|
||||||
|
mainUI["b32"]:addArg("toc_data", toc_data)
|
||||||
|
mainUI["b32"]:addArg("patient", patient)
|
||||||
|
mainUI["b32"]:addArg("surgeon", surgeon)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -525,9 +590,9 @@ local function makeDescUI()
|
|||||||
descUI:saveLayout();
|
descUI:saveLayout();
|
||||||
end
|
end
|
||||||
|
|
||||||
local function makeConfirmUI()
|
local function makeConfirmUI(surgeon, patient)
|
||||||
confirmUI = NewUI();
|
confirmUI = NewUI();
|
||||||
confirmUI:isSubUIOf(descUI);
|
confirmUI:isSubUIOf(descUI)
|
||||||
|
|
||||||
confirmUI:addText("text1", "Are you sure ?", "Title", "Center");
|
confirmUI:addText("text1", "Are you sure ?", "Title", "Center");
|
||||||
confirmUI:setLineHeightPixel(getTextManager():getFontHeight(confirmUI.text1.font) + 10)
|
confirmUI:setLineHeightPixel(getTextManager():getFontHeight(confirmUI.text1.font) + 10)
|
||||||
@@ -545,6 +610,8 @@ local function makeConfirmUI()
|
|||||||
confirmUI:addEmpty();
|
confirmUI:addEmpty();
|
||||||
confirmUI:addButton("b1", "Yes", confirmPress);
|
confirmUI:addButton("b1", "Yes", confirmPress);
|
||||||
confirmUI.b1:addArg("option", "yes");
|
confirmUI.b1:addArg("option", "yes");
|
||||||
|
|
||||||
|
|
||||||
confirmUI:addEmpty();
|
confirmUI:addEmpty();
|
||||||
confirmUI:addButton("b2", "No", confirmPress);
|
confirmUI:addButton("b2", "No", confirmPress);
|
||||||
confirmUI:addEmpty();
|
confirmUI:addEmpty();
|
||||||
@@ -597,9 +664,9 @@ function OnCreateTheOnlyCureUI()
|
|||||||
-- how do we pass the correct player here?
|
-- how do we pass the correct player here?
|
||||||
--print(self.character)
|
--print(self.character)
|
||||||
|
|
||||||
makeMainUI();
|
makeMainUI()
|
||||||
makeDescUI();
|
makeDescUI()
|
||||||
makeConfirmUI();
|
makeConfirmUI()
|
||||||
|
|
||||||
if isClient() then MakeConfirmUIMP() end
|
if isClient() then MakeConfirmUIMP() end
|
||||||
mainUI:close()
|
mainUI:close()
|
||||||
@@ -612,53 +679,46 @@ Events.OnCreateUI.Add(OnCreateTheOnlyCureUI)
|
|||||||
function ISNewHealthPanel.onClick_TOC(button)
|
function ISNewHealthPanel.onClick_TOC(button)
|
||||||
|
|
||||||
|
|
||||||
|
-- TODO only visuals work, right now you're gonna cut your own limbs
|
||||||
-- button.character is patient
|
-- button.character is patient
|
||||||
-- button.otherPlayer is surgeon
|
-- button.otherPlayer is surgeon
|
||||||
if button.otherPlayer then
|
if button.otherPlayer then
|
||||||
if button.character ~= button.otherPlayer then
|
if button.character ~= button.otherPlayer then
|
||||||
sendClientCommand(button.otherPlayer, "TOC", "GetPlayerData", {button.otherPlayer:getOnlineID(), button.character:getOnlineID()})
|
sendClientCommand(button.otherPlayer, "TOC", "GetPlayerData", {button.otherPlayer:getOnlineID(), button.character:getOnlineID()})
|
||||||
|
|
||||||
if MP_other_player_toc_data == nil then
|
SetCorrectArgsMainUI(button.otherPlayer, button.character, MP_other_player_toc_data) --other player is the surgeon
|
||||||
print("MP_other_player_toc_data is still nil")
|
setImageMainUI(MP_other_player_toc_data)
|
||||||
else
|
SetCorrectConfirmUI(button.otherPlayer, button.character)
|
||||||
SetCorrectArgsMainUI(MP_other_player_toc_data) --other player is the surgeon
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
SetCorrectArgsMainUI(getPlayer():getModData().TOC) --myself?
|
SetCorrectArgsMainUI(getPlayer():getModData().TOC) --myself
|
||||||
|
setImageMainUI(getPlayer():getModData().TOC)
|
||||||
|
|
||||||
|
-- TODO this is wrong, we're still checking for the other player... probably?
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
SetCorrectArgsMainUI(getPlayer():getModData().TOC) --myself?
|
SetCorrectArgsMainUI(getPlayer():getModData().TOC) --myself
|
||||||
|
setImageMainUI(getPlayer():getModData().TOC)
|
||||||
|
SetCorrectConfirmUI(getPlayer(), getPlayer()) -- TODO just for test
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
mainUI:toggle()
|
mainUI:toggle()
|
||||||
|
|
||||||
|
|
||||||
mainUI:setInCenterOfScreen()
|
mainUI:setInCenterOfScreen()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
if button.otherPlayer then
|
|
||||||
|
|
||||||
if button.character ~= button.otherPlayer then
|
function SetCorrectConfirmUI(surgeon, patient)
|
||||||
sendClientCommand(button.otherPlayer, "TOC", "GetPlayerData", {button.otherPlayer:getOnlineID(), button.character:getOnlineID()})
|
confirmUI.b1:addArg("surgeon", surgeon)
|
||||||
setImageMainUI(MP_other_player_toc_data)
|
confirmUI.b1:addArg("patient", patient)
|
||||||
|
|
||||||
else
|
|
||||||
setImageMainUI(getPlayer():getModData().TOC)
|
|
||||||
|
|
||||||
end
|
|
||||||
else
|
|
||||||
setImageMainUI(getPlayer():getModData().TOC)
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local ISHealthPanel_createChildren = ISHealthPanel.createChildren
|
local ISHealthPanel_createChildren = ISHealthPanel.createChildren
|
||||||
|
|
||||||
function ISHealthPanel:createChildren()
|
function ISHealthPanel:createChildren()
|
||||||
|
|||||||
@@ -2,7 +2,16 @@ if not TheOnlyCure then
|
|||||||
TheOnlyCure = {}
|
TheOnlyCure = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- TODO this is gonna break a lot of stuff, don't do this you ass
|
||||||
-- GLOBAL STRINGS
|
-- GLOBAL STRINGS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- TODO Unify Context Menus check with TOC Menu UI
|
||||||
|
|
||||||
|
|
||||||
Left = "Left"
|
Left = "Left"
|
||||||
Right = "Right"
|
Right = "Right"
|
||||||
|
|
||||||
@@ -116,10 +125,6 @@ function TheOnlyCure.DeclareTraits()
|
|||||||
TraitFactory.setMutualExclusive("amputee2", "amputee3")
|
TraitFactory.setMutualExclusive("amputee2", "amputee3")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ModOptions implement it you cuck
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
function TheOnlyCure.CutLimb(part_name, surgeon_factor, bandage_table, painkiller_table)
|
function TheOnlyCure.CutLimb(part_name, surgeon_factor, bandage_table, painkiller_table)
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ function ISCutLimb:start()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- TODO this doesn't work when doing it online
|
||||||
local body_part_type = TheOnlyCure.GetBodyPartTypeFromBodyPart(self.part_name)
|
local body_part_type = TheOnlyCure.GetBodyPartTypeFromBodyPart(self.part_name)
|
||||||
local body_damage = self.patient:getBodyDamage()
|
local body_damage = self.patient:getBodyDamage()
|
||||||
local body_damage_part = body_damage:getBodyPart(body_part_type)
|
local body_damage_part = body_damage:getBodyPart(body_part_type)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ function GetAcceptingProsthesisBodyParts()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- TODO ew
|
||||||
function find_clothName_TOC(bodyPart)
|
function find_clothName_TOC(bodyPart)
|
||||||
if bodyPart:getType() == BodyPartType.Hand_R then return "TOC.ArmRight_noHand"
|
if bodyPart:getType() == BodyPartType.Hand_R then return "TOC.ArmRight_noHand"
|
||||||
elseif bodyPart:getType() == BodyPartType.ForeArm_R then return "TOC.ArmRight_noForearm"
|
elseif bodyPart:getType() == BodyPartType.ForeArm_R then return "TOC.ArmRight_noForearm"
|
||||||
|
|||||||
Reference in New Issue
Block a user