@@ -59,7 +59,17 @@ function ISBaseTimedAction:adjustMaxTime(maxTime)
|
|||||||
|
|
||||||
local perkLevelScaled
|
local perkLevelScaled
|
||||||
if perkLevel ~= 0 then perkLevelScaled = perkLevel / 10 else perkLevelScaled = 0 end
|
if perkLevel ~= 0 then perkLevelScaled = perkLevel / 10 else perkLevelScaled = 0 end
|
||||||
time = time * (StaticData.LIMBS_TIME_MULTIPLIER_IND_NUM[limbName] - perkLevelScaled)
|
TOC_DEBUG.print("Perk Level: " .. tostring(perkLevel))
|
||||||
|
TOC_DEBUG.print("OG time: " .. tostring(time))
|
||||||
|
|
||||||
|
-- Modified Time shouldn't EVER be lower compared to the og one.
|
||||||
|
local modifiedTime = time * (StaticData.LIMBS_TIME_MULTIPLIER_IND_NUM[limbName] - perkLevelScaled)
|
||||||
|
|
||||||
|
if modifiedTime >= time then
|
||||||
|
time = modifiedTime
|
||||||
|
end
|
||||||
|
|
||||||
|
--TOC_DEBUG.print("Modified time: " .. tostring(time))
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
-- TODO This section must be overhauled
|
||||||
|
|
||||||
|
-- local DataController = require("TOC/Controllers/DataController")
|
||||||
|
-- local StaticData = require("TOC/StaticData")
|
||||||
|
|
||||||
---@diagnostic disable: duplicate-set-field
|
---@diagnostic disable: duplicate-set-field
|
||||||
-- Bunch of actions shouldn't be modified by the adjusted time
|
-- Bunch of actions shouldn't be modified by the adjusted time
|
||||||
|
|
||||||
@@ -8,51 +13,70 @@
|
|||||||
---ISEquipWeaponAction
|
---ISEquipWeaponAction
|
||||||
---ISUnequipAction
|
---ISUnequipAction
|
||||||
|
|
||||||
--- We're forced to re-run this crap to fix it
|
-- --- We're forced to re-run this crap to fix it
|
||||||
---@param action ISBaseTimedAction
|
-- ---@param action ISBaseTimedAction
|
||||||
local function HandleSpeedSpecificAction(action)
|
-- local function HandleSpeedSpecificAction(action, time)
|
||||||
action.skipTOC = true
|
-- action.skipTOC = true
|
||||||
action.animSpeed = action.maxTime / action:adjustMaxTime(action.maxTime)
|
-- action.maxTime = time
|
||||||
action.maxTime = -1
|
-- action.animSpeed = 1.0
|
||||||
end
|
-- end
|
||||||
|
|
||||||
local og_ISAttachItemHotbar_new = ISAttachItemHotbar.new
|
-- local og_ISAttachItemHotbar_new = ISAttachItemHotbar.new
|
||||||
function ISAttachItemHotbar:new(character, item, slot, slotIndex, slotDef)
|
-- function ISAttachItemHotbar:new(character, item, slot, slotIndex, slotDef)
|
||||||
local action = og_ISAttachItemHotbar_new(self, character, item, slot, slotIndex, slotDef)
|
-- local action = og_ISAttachItemHotbar_new(self, character, item, slot, slotIndex, slotDef)
|
||||||
HandleSpeedSpecificAction(action)
|
-- HandleSpeedSpecificAction(action, -1)
|
||||||
return action
|
-- return action
|
||||||
end
|
-- end
|
||||||
|
|
||||||
local og_ISDetachItemHotbar_new = ISDetachItemHotbar.new
|
-- local og_ISDetachItemHotbar_new = ISDetachItemHotbar.new
|
||||||
function ISDetachItemHotbar:new(character, item)
|
-- function ISDetachItemHotbar:new(character, item)
|
||||||
local action = og_ISDetachItemHotbar_new(self, character, item)
|
-- local action = og_ISDetachItemHotbar_new(self, character, item)
|
||||||
HandleSpeedSpecificAction(action)
|
-- HandleSpeedSpecificAction(action, -1)
|
||||||
return action
|
-- return action
|
||||||
end
|
-- end
|
||||||
|
|
||||||
local og_ISEquipWeaponAction_new = ISEquipWeaponAction.new
|
|
||||||
function ISEquipWeaponAction:new(character, item, time, primary, twoHands)
|
|
||||||
local action = og_ISEquipWeaponAction_new(self, character, item, time, primary, twoHands)
|
|
||||||
--TOC_DEBUG.print("Override ISEquipWeaponAction")
|
|
||||||
if not twoHands then
|
|
||||||
HandleSpeedSpecificAction(action)
|
|
||||||
end
|
|
||||||
return action
|
|
||||||
end
|
|
||||||
|
|
||||||
local og_ISUnequipAction_new = ISUnequipAction.new
|
-- local og_ISEquipWeaponAction_new = ISEquipWeaponAction.new
|
||||||
function ISUnequipAction:new(character, item, time)
|
-- function ISEquipWeaponAction:new(character, item, time, primary, twoHands)
|
||||||
local action = og_ISUnequipAction_new(self, character, item, time)
|
|
||||||
---@cast item InventoryItem
|
|
||||||
|
|
||||||
-- For some reason (I have no clue why), if we re-run the method it breaks basically every unequip clothing action. Not for weapons though.
|
-- local action = og_ISEquipWeaponAction_new(self, character, item, time, primary, twoHands)
|
||||||
if instanceof(item, 'HandWeapon') then
|
-- TOC_DEBUG.print("Override ISEquipWeaponAction New")
|
||||||
--print("Running handlespeedspecificaction")
|
|
||||||
HandleSpeedSpecificAction(action)
|
|
||||||
end
|
|
||||||
|
|
||||||
return action
|
|
||||||
end
|
-- -- check if right arm is cut off or not. if it is, penality shall apply
|
||||||
|
-- -- if we got here, the action is valid, so we know that we have a prosthesis.
|
||||||
|
|
||||||
|
|
||||||
|
-- local dcInst = DataController.GetInstance()
|
||||||
|
|
||||||
|
-- if not dcInst:getIsCut(StaticData.LIMBS_IND_STR.Hand_R) then
|
||||||
|
-- action.skipTOC = true
|
||||||
|
-- action.maxTime = time
|
||||||
|
-- action.animSpeed = 1.0
|
||||||
|
-- TOC_DEBUG.print("Skipping TOC for ISEquipWeaponAction new")
|
||||||
|
-- end
|
||||||
|
|
||||||
|
|
||||||
|
-- -- if not twoHands then
|
||||||
|
-- -- TOC_DEBUG.print("Not a two handed action, re-adding skip TOC")
|
||||||
|
-- -- HandleSpeedSpecificAction(action)
|
||||||
|
-- -- end
|
||||||
|
-- return action
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- local og_ISUnequipAction_new = ISUnequipAction.new
|
||||||
|
-- function ISUnequipAction:new(character, item, time)
|
||||||
|
-- local action = og_ISUnequipAction_new(self, character, item, time)
|
||||||
|
-- ---@cast item InventoryItem
|
||||||
|
|
||||||
|
-- -- For some reason (I have no clue why), if we re-run the method it breaks basically every unequip clothing action. Not for weapons though.
|
||||||
|
-- if instanceof(item, 'HandWeapon') then
|
||||||
|
-- --print("Running handlespeedspecificaction")
|
||||||
|
-- HandleSpeedSpecificAction(action)
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- return action
|
||||||
|
-- end
|
||||||
|
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
--- Normal cases
|
--- Normal cases
|
||||||
|
|||||||
116
media/lua/client/TOC/UI/ConfirmationPanel.lua
Normal file
116
media/lua/client/TOC/UI/ConfirmationPanel.lua
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
---@class ConfirmationPanel : ISPanel
|
||||||
|
local ConfirmationPanel = ISPanel:derive("ConfirmationPanel")
|
||||||
|
|
||||||
|
---Starts a new confirmation panel
|
||||||
|
---@param x number
|
||||||
|
---@param y number
|
||||||
|
---@param width number
|
||||||
|
---@param height number
|
||||||
|
---@param alertText string
|
||||||
|
---@param onConfirmFunc function
|
||||||
|
---@return ConfirmationPanel
|
||||||
|
function ConfirmationPanel:new(x, y, width, height, alertText, parentPanel, onConfirmFunc)
|
||||||
|
local o = ISPanel:new(x, y, width, height)
|
||||||
|
setmetatable(o, self)
|
||||||
|
self.__index = self
|
||||||
|
|
||||||
|
o:initialise()
|
||||||
|
o.alertText = alertText
|
||||||
|
o.onConfirmFunc = onConfirmFunc
|
||||||
|
o.parentPanel = parentPanel
|
||||||
|
ConfirmationPanel.instance = o
|
||||||
|
|
||||||
|
---@cast o ConfirmationPanel
|
||||||
|
return o
|
||||||
|
end
|
||||||
|
|
||||||
|
function ConfirmationPanel:createChildren()
|
||||||
|
ISPanel.createChildren(self)
|
||||||
|
self.borderColor = { r = 1, g = 0, b = 0, a = 1 }
|
||||||
|
|
||||||
|
self.textPanel = ISRichTextPanel:new(0, 0, self.width, self.height)
|
||||||
|
self.textPanel:initialise()
|
||||||
|
self:addChild(self.textPanel)
|
||||||
|
self.textPanel.defaultFont = UIFont.Medium
|
||||||
|
self.textPanel.anchorTop = true
|
||||||
|
self.textPanel.anchorLeft = false
|
||||||
|
self.textPanel.anchorBottom = true
|
||||||
|
self.textPanel.anchorRight = false
|
||||||
|
self.textPanel.marginLeft = 0
|
||||||
|
self.textPanel.marginTop = 10
|
||||||
|
self.textPanel.marginRight = 0
|
||||||
|
self.textPanel.marginBottom = 0
|
||||||
|
self.textPanel.autosetheight = false
|
||||||
|
self.textPanel.background = false
|
||||||
|
self.textPanel:setText(self.alertText)
|
||||||
|
self.textPanel:paginate()
|
||||||
|
|
||||||
|
local yPadding = 10
|
||||||
|
local xPadding = self:getWidth() / 4
|
||||||
|
local btnWidth = 100
|
||||||
|
local btnHeight = 25
|
||||||
|
|
||||||
|
|
||||||
|
local yButton = self:getHeight() - yPadding - btnHeight
|
||||||
|
|
||||||
|
self.btnYes = ISButton:new(xPadding, yButton, btnWidth, btnHeight, "Yes", self, self.onClick)
|
||||||
|
self.btnYes.internal = "YES"
|
||||||
|
self.btnYes:initialise()
|
||||||
|
self.btnYes.borderColor = { r = 1, g = 0, b = 0, a = 1 }
|
||||||
|
self.btnYes:setEnable(true)
|
||||||
|
self:addChild(self.btnYes)
|
||||||
|
|
||||||
|
self.btnNo = ISButton:new(self:getWidth() - xPadding - btnWidth, yButton, btnWidth, btnHeight, "No", self,
|
||||||
|
self.onClick)
|
||||||
|
self.btnNo.internal = "NO"
|
||||||
|
self.btnNo:initialise()
|
||||||
|
self.btnNo:setEnable(true)
|
||||||
|
self:addChild(self.btnNo)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ConfirmationPanel:onClick(btn)
|
||||||
|
if btn.internal == 'YES' then
|
||||||
|
self.onConfirmFunc(self.parentPanel)
|
||||||
|
self:close()
|
||||||
|
elseif btn.internal == 'NO' then
|
||||||
|
self:close()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
---@param alertText string
|
||||||
|
---@param x any
|
||||||
|
---@param y any
|
||||||
|
---@param parentPanel any
|
||||||
|
---@param onConfirmFunc any
|
||||||
|
---@return ConfirmationPanel
|
||||||
|
function ConfirmationPanel.Open(alertText, x, y, parentPanel, onConfirmFunc)
|
||||||
|
local width = 500
|
||||||
|
local height = 120
|
||||||
|
|
||||||
|
|
||||||
|
local screenWidth = getCore():getScreenWidth()
|
||||||
|
local screenHeight = getCore():getScreenHeight()
|
||||||
|
|
||||||
|
-- Check for oversize
|
||||||
|
if x+width > screenWidth then
|
||||||
|
x = screenWidth - width
|
||||||
|
end
|
||||||
|
|
||||||
|
if y+height > screenHeight then
|
||||||
|
y = screenHeight - height
|
||||||
|
end
|
||||||
|
|
||||||
|
local panel = ConfirmationPanel:new(x, y, width, height, alertText, parentPanel, onConfirmFunc)
|
||||||
|
panel:initialise()
|
||||||
|
panel:addToUIManager()
|
||||||
|
panel:bringToTop()
|
||||||
|
return panel
|
||||||
|
end
|
||||||
|
|
||||||
|
function ConfirmationPanel.Close()
|
||||||
|
ConfirmationPanel.instance:close()
|
||||||
|
end
|
||||||
|
|
||||||
|
return ConfirmationPanel
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
local BaseHandler = require("TOC/UI/Interactions/HealthPanelBaseHandler")
|
local BaseHandler = require("TOC/UI/Interactions/HealthPanelBaseHandler")
|
||||||
local StaticData = require("TOC/StaticData")
|
local StaticData = require("TOC/StaticData")
|
||||||
local DataController = require("TOC/Controllers/DataController")
|
local DataController = require("TOC/Controllers/DataController")
|
||||||
|
local ConfirmationPanel = require("TOC/UI/ConfirmationPanel")
|
||||||
|
|
||||||
local CutLimbAction = require("TOC/TimedActions/CutLimbAction")
|
local CutLimbAction = require("TOC/TimedActions/CutLimbAction")
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
-- TODO Add interaction to cut and bandage!
|
|
||||||
|
|
||||||
|
|
||||||
--* Various functions to help during these pesky checks
|
--* Various functions to help during these pesky checks
|
||||||
@@ -61,6 +62,12 @@ local function GetStitchesConsumableItem(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local textConfirmAmp = getText("IGUI_Confirmation_Amputate")
|
||||||
|
local textAmp = getText("ContextMenu_Amputate")
|
||||||
|
local textAmpBandage = getText("ContextMenu_Amputate_Bandage")
|
||||||
|
local textAmpStitch = getText("ContextMenu_Amputate_Stitch")
|
||||||
|
local textAmpStitchBandage = getText("ContextMenu_Amputate_Stitch_Bandage")
|
||||||
|
|
||||||
---Add the action to the queue
|
---Add the action to the queue
|
||||||
---@param limbName string
|
---@param limbName string
|
||||||
---@param surgeon IsoPlayer
|
---@param surgeon IsoPlayer
|
||||||
@@ -69,24 +76,32 @@ end
|
|||||||
---@param stitchesItem InventoryItem?
|
---@param stitchesItem InventoryItem?
|
||||||
---@param bandageItem InventoryItem?
|
---@param bandageItem InventoryItem?
|
||||||
local function PerformAction(surgeon, patient, limbName, sawItem, stitchesItem, bandageItem)
|
local function PerformAction(surgeon, patient, limbName, sawItem, stitchesItem, bandageItem)
|
||||||
-- get saw in hand
|
|
||||||
-- todo primary or secondary depending on amputation status of surgeon
|
|
||||||
ISTimedActionQueue.add(ISEquipWeaponAction:new(surgeon, sawItem, 50, true, false))
|
|
||||||
|
|
||||||
local lHandItem = surgeon:getSecondaryHandItem()
|
|
||||||
if lHandItem then
|
|
||||||
ISTimedActionQueue.add(ISUnequipAction:new(surgeon, lHandItem, 50))
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
ISTimedActionQueue.add(CutLimbAction:new(surgeon, patient, limbName, sawItem, stitchesItem, bandageItem))
|
local x = (getCore():getScreenWidth() - 500) / 2
|
||||||
|
local y = getCore():getScreenHeight() / 2
|
||||||
|
|
||||||
|
|
||||||
|
ConfirmationPanel.Open(textConfirmAmp, x, y, nil, function()
|
||||||
|
|
||||||
|
-- get saw in hand
|
||||||
|
-- todo primary or secondary depending on amputation status of surgeon
|
||||||
|
ISTimedActionQueue.add(ISEquipWeaponAction:new(surgeon, sawItem, 50, true, false))
|
||||||
|
|
||||||
|
local lHandItem = surgeon:getSecondaryHandItem()
|
||||||
|
if lHandItem then
|
||||||
|
ISTimedActionQueue.add(ISUnequipAction:new(surgeon, lHandItem, 50))
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
ISTimedActionQueue.add(CutLimbAction:new(surgeon, patient, limbName, sawItem, stitchesItem, bandageItem))
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local textAmp = getText("ContextMenu_Amputate")
|
|
||||||
local textAmpBandage = getText("ContextMenu_Amputate_Bandage")
|
|
||||||
local textAmpStitch = getText("ContextMenu_Amputate_Stitch")
|
|
||||||
local textAmpStitchBandage = getText("ContextMenu_Amputate_Stitch_Bandage")
|
|
||||||
|
|
||||||
---Adds the actions to the inventory context menu
|
---Adds the actions to the inventory context menu
|
||||||
---@param player IsoPlayer
|
---@param player IsoPlayer
|
||||||
@@ -214,6 +229,18 @@ function CutLimbInteractionHandler:checkItem(item)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---@param x number
|
||||||
|
---@param y number
|
||||||
|
---@param type any
|
||||||
|
function CutLimbInteractionHandler:openConfirmation(x, y, type)
|
||||||
|
ConfirmationPanel.Open(textConfirmAmp, x, y, nil, function()
|
||||||
|
self.onMenuOptionSelected(self, type)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---@param context ISContextMenu
|
---@param context ISContextMenu
|
||||||
function CutLimbInteractionHandler:addToMenu(context)
|
function CutLimbInteractionHandler:addToMenu(context)
|
||||||
--TOC_DEBUG.print("CutLimbInteractionHandler addToMenu")
|
--TOC_DEBUG.print("CutLimbInteractionHandler addToMenu")
|
||||||
@@ -221,8 +248,12 @@ function CutLimbInteractionHandler:addToMenu(context)
|
|||||||
local patientUsername = self:getPatient():getUsername()
|
local patientUsername = self:getPatient():getUsername()
|
||||||
if #types > 0 and StaticData.LIMBS_TO_BODYLOCS_IND_BPT[self.limbName] and not DataController.GetInstance(patientUsername):getIsCut(self.limbName) then
|
if #types > 0 and StaticData.LIMBS_TO_BODYLOCS_IND_BPT[self.limbName] and not DataController.GetInstance(patientUsername):getIsCut(self.limbName) then
|
||||||
TOC_DEBUG.print("addToMenu, types > 0")
|
TOC_DEBUG.print("addToMenu, types > 0")
|
||||||
|
|
||||||
|
local x = (getCore():getScreenWidth() - 500) / 2
|
||||||
|
local y = getCore():getScreenHeight() / 2
|
||||||
|
|
||||||
for i=1, #types do
|
for i=1, #types do
|
||||||
context:addOption(getText("ContextMenu_Amputate"), self, self.onMenuOptionSelected, types[i])
|
context:addOption(getText("ContextMenu_Amputate"), self, self.openConfirmation, x, y, types[i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,4 +15,6 @@ IG_UI_EN = {
|
|||||||
IGUI_HealthPanel_WoundDirtyness = "Wound Dirtyness",
|
IGUI_HealthPanel_WoundDirtyness = "Wound Dirtyness",
|
||||||
IGUI_HealthPanel_ProstEquipped = "Prosthesis Equipped",
|
IGUI_HealthPanel_ProstEquipped = "Prosthesis Equipped",
|
||||||
|
|
||||||
|
IGUI_Confirmation_Amputate = " <CENTRE> Do you really want to amputate that limb?"
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,5 +3,8 @@ Sandbox_UA = {
|
|||||||
Sandbox_TOC_CicatrizationSpeed = "Øâèäê³ñòü ðóáöþâàííÿ",
|
Sandbox_TOC_CicatrizationSpeed = "Øâèäê³ñòü ðóáöþâàííÿ",
|
||||||
Sandbox_TOC_WoundDirtynessMultiplier = "Ìíîæíèê çàáðóäíåííÿ ðàíè",
|
Sandbox_TOC_WoundDirtynessMultiplier = "Ìíîæíèê çàáðóäíåííÿ ðàíè",
|
||||||
Sandbox_TOC_SurgeonAbilityImportance = "Âàæëèâ³ñòü ìåäè÷íèõ íàâè÷îê ë³êàðÿ",
|
Sandbox_TOC_SurgeonAbilityImportance = "Âàæëèâ³ñòü ìåäè÷íèõ íàâè÷îê ë³êàðÿ",
|
||||||
|
Sandbox_TOC_EnableZombieAmputations = "Óâ³ìêíóòè àìïóòàö³¿ çîìá³",
|
||||||
|
Sandbox_TOC_ZombieAmputationDamageThreshold = "Ïîð³ã øêîäè ïðè àìïóòàö³¿ çîìá³",
|
||||||
|
Sandbox_TOC_ZombieAmputationDamageChance = "Øàíñ íàíåñåííÿ øêîäè ïðè àìïóòàö³¿ çîìá³",
|
||||||
|
|
||||||
}
|
}
|
||||||
16
media/lua/shared/Translate/UA/UI_UA.txt
Normal file
16
media/lua/shared/Translate/UA/UI_UA.txt
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
UI_UA = {
|
||||||
|
UI_trait_Amputee_Hand = "Àìïóòîâàíà ˳âà Ðóêà",
|
||||||
|
UI_trait_Amputee_Hand_desc = "",
|
||||||
|
|
||||||
|
UI_trait_Amputee_ForeArm = "Àìïóòîâàíå ˳âå Ïåðåäïë³÷÷ÿ",
|
||||||
|
UI_trait_Amputee_ForeArm_desc = "",
|
||||||
|
|
||||||
|
UI_trait_Amputee_UpperArm = "Àìïóòîâàíå ˳âå Ïëå÷å",
|
||||||
|
UI_trait_Amputee_UpperArm_desc = "",
|
||||||
|
|
||||||
|
UI_trait_Insensitive = "Íå÷óòëèâèé",
|
||||||
|
UI_trait_Insensitive_desc = "",
|
||||||
|
|
||||||
|
|
||||||
|
UI_Say_CantEquip = "ß íå ìîæó âñòàíîâèòè öå òàêèì ÷èíîì..."
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user