reformatted everything
This commit is contained in:
@@ -9,14 +9,13 @@ end
|
||||
function CheckIfCanBeCut(part_name)
|
||||
|
||||
local toc_data = getPlayer():getModData().TOC
|
||||
local check = (not toc_data.Limbs[part_name].is_cut) and (not CheckIfProsthesisAlreadyInstalled(toc_data.Limbs, part_name))
|
||||
local check = (not toc_data.Limbs[part_name].is_cut) and
|
||||
(not CheckIfProsthesisAlreadyInstalled(toc_data.Limbs, part_name))
|
||||
|
||||
return check
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function CheckIfCanBeOperated(part_name)
|
||||
|
||||
local part_data = getPlayer():getModData().TOC.Limbs
|
||||
@@ -51,6 +50,3 @@ function CheckIfProsthesisAlreadyInstalled(part_data, part_name)
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ Commands["ResponseCanAct"] = function(arg)
|
||||
ui.responsePartName = arg["toSend"][1]
|
||||
ui.responseCan = arg["toSend"][3]
|
||||
ui.responseUserName = getPlayerByOnlineID(arg["From"]):getUsername()
|
||||
ui.responseActionIsBitten = getPlayerByOnlineID(arg["From"]):getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(ui.responsePartName)):bitten()
|
||||
ui.responseActionIsBitten = getPlayerByOnlineID(arg["From"]):getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(ui
|
||||
.responsePartName)):bitten()
|
||||
end
|
||||
|
||||
|
||||
@@ -61,7 +62,6 @@ function AskCanEquipProsthesis(player, part_name)
|
||||
sendClientCommand("TOC", "SendServer", arg)
|
||||
end
|
||||
|
||||
|
||||
-- Patient (receive)
|
||||
Commands["CutLimb"] = function(arg)
|
||||
local arg = arg["toSend"]
|
||||
@@ -162,7 +162,4 @@ local function OnTocServerCommand(module, command, args)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
Events.OnServerCommand.Add(OnTocServerCommand)
|
||||
@@ -1,6 +1,8 @@
|
||||
function GetBodyParts()
|
||||
local bodyparts = { "Right_Hand", "Right_LowerArm", "Right_UpperArm",
|
||||
"Left_Hand", "Left_LowerArm", "Left_UpperArm"}
|
||||
local bodyparts = {
|
||||
"Right_Hand", "Right_LowerArm", "Right_UpperArm", "Left_Hand",
|
||||
"Left_LowerArm", "Left_UpperArm"
|
||||
}
|
||||
return bodyparts
|
||||
end
|
||||
|
||||
@@ -13,60 +15,75 @@ function TocFindAmputatedClothingFromPartName(part_name)
|
||||
return "TOC.Amputation_" .. part_name
|
||||
end
|
||||
|
||||
|
||||
function GetLimbsBodyPartTypes()
|
||||
|
||||
return {BodyPartType.Hand_R, BodyPartType.ForeArm_R, BodyPartType.UpperArm_R,
|
||||
BodyPartType.Hand_L, BodyPartType.ForeArm_L, BodyPartType.UpperArm_L}
|
||||
return {
|
||||
BodyPartType.Hand_R, BodyPartType.ForeArm_R, BodyPartType.UpperArm_R,
|
||||
BodyPartType.Hand_L, BodyPartType.ForeArm_L, BodyPartType.UpperArm_L
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
function GetOtherBodyPartTypes()
|
||||
|
||||
return {BodyPartType.Torso_Upper, BodyPartType.Torso_Lower, BodyPartType.Head, BodyPartType.Neck,
|
||||
BodyPartType.Groin, BodyPartType.UpperLeg_L, BodyPartType.UpperLeg_R, BodyPartType.LowerLeg_L,
|
||||
BodyPartType.LowerLeg_R, BodyPartType.Foot_L, BodyPartType.Foot_R, BodyPartType.Back}
|
||||
return {
|
||||
BodyPartType.Torso_Upper, BodyPartType.Torso_Lower, BodyPartType.Head,
|
||||
BodyPartType.Neck, BodyPartType.Groin, BodyPartType.UpperLeg_L,
|
||||
BodyPartType.UpperLeg_R, BodyPartType.LowerLeg_L,
|
||||
BodyPartType.LowerLeg_R, BodyPartType.Foot_L, BodyPartType.Foot_R,
|
||||
BodyPartType.Back
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
function GetAcceptingProsthesisBodyPartTypes()
|
||||
|
||||
|
||||
return {BodyPartType.Hand_R, BodyPartType.ForeArm_R,
|
||||
BodyPartType.Hand_L, BodyPartType.ForeArm_L}
|
||||
|
||||
return {
|
||||
BodyPartType.Hand_R, BodyPartType.ForeArm_R, BodyPartType.Hand_L,
|
||||
BodyPartType.ForeArm_L
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
-- TODO This is just convoluted. Do not use this
|
||||
function FindTocDataPartNameFromBodyPartType(toc_limbs_data, bodyPartType)
|
||||
if bodyPartType == BodyPartType.Hand_R then return toc_limbs_data.Right_Hand
|
||||
elseif bodyPartType == BodyPartType.ForeArm_R then return toc_limbs_data.Right_LowerArm
|
||||
elseif bodyPartType == BodyPartType.UpperArm_R then return toc_limbs_data.Right_UpperArm
|
||||
elseif bodyPartType == BodyPartType.Hand_L then return toc_limbs_data.Left_Hand
|
||||
elseif bodyPartType == BodyPartType.ForeArm_L then return toc_limbs_data.Left_LowerArm
|
||||
elseif bodyPartType == BodyPartType.UpperArm_L then return toc_limbs_data.Left_UpperArm
|
||||
else return nil
|
||||
if bodyPartType == BodyPartType.Hand_R then
|
||||
return toc_limbs_data.Right_Hand
|
||||
elseif bodyPartType == BodyPartType.ForeArm_R then
|
||||
return toc_limbs_data.Right_LowerArm
|
||||
elseif bodyPartType == BodyPartType.UpperArm_R then
|
||||
return toc_limbs_data.Right_UpperArm
|
||||
elseif bodyPartType == BodyPartType.Hand_L then
|
||||
return toc_limbs_data.Left_Hand
|
||||
elseif bodyPartType == BodyPartType.ForeArm_L then
|
||||
return toc_limbs_data.Left_LowerArm
|
||||
elseif bodyPartType == BodyPartType.UpperArm_L then
|
||||
return toc_limbs_data.Left_UpperArm
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function TocGetPartNameFromBodyPartType(body_part)
|
||||
|
||||
if body_part == BodyPartType.Hand_R then return "Right_Hand"
|
||||
elseif body_part == BodyPartType.ForeArm_R then return "Right_LowerArm"
|
||||
elseif body_part == BodyPartType.UpperArm_R then return "Right_UpperArm"
|
||||
elseif body_part == BodyPartType.Hand_L then return "Left_Hand"
|
||||
elseif body_part == BodyPartType.ForeArm_L then return "Left_LowerArm"
|
||||
elseif body_part == BodyPartType.UpperArm_L then return "Left_UpperArm"
|
||||
else return nil
|
||||
if body_part == BodyPartType.Hand_R then
|
||||
return "Right_Hand"
|
||||
elseif body_part == BodyPartType.ForeArm_R then
|
||||
return "Right_LowerArm"
|
||||
elseif body_part == BodyPartType.UpperArm_R then
|
||||
return "Right_UpperArm"
|
||||
elseif body_part == BodyPartType.Hand_L then
|
||||
return "Left_Hand"
|
||||
elseif body_part == BodyPartType.ForeArm_L then
|
||||
return "Left_LowerArm"
|
||||
elseif body_part == BodyPartType.UpperArm_L then
|
||||
return "Left_UpperArm"
|
||||
else
|
||||
return nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function TocGetBodyPartTypeFromPartName(part_name)
|
||||
if part_name == "Right_Hand" then return BodyPartType.Hand_R end
|
||||
if part_name == "Right_LowerArm" then return BodyPartType.ForeArm_R end
|
||||
@@ -76,7 +93,6 @@ function TocGetBodyPartTypeFromPartName(part_name)
|
||||
if part_name == "Left_UpperArm" then return BodyPartType.UpperArm_L end
|
||||
end
|
||||
|
||||
|
||||
function TocFindCorrectClothingProsthesis(item_name, part_name)
|
||||
|
||||
local correct_name = "TOC.Prost_" .. part_name .. "_" .. item_name
|
||||
@@ -94,12 +110,9 @@ local function PartNameToBodyLocation(name)
|
||||
if name == "Left_UpperArm" then return "ArmLeft_Prot" end
|
||||
end
|
||||
|
||||
|
||||
function TocFindItemInProstBodyLocation(part_name, patient)
|
||||
-- FIXME this can return even amputated limbs, and we're using it only for prosthetics. This is gonna break sooner or later
|
||||
|
||||
|
||||
|
||||
local worn_items = patient:getWornItems()
|
||||
|
||||
for i = 1, worn_items:size() - 1 do -- Maybe wornItems:size()-1
|
||||
|
||||
@@ -10,8 +10,6 @@ function TocCheckCompatibilityWithOlderVersions(mod_data)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function TocMapOldDataToNew(mod_data)
|
||||
|
||||
local map_names = {
|
||||
@@ -25,7 +23,8 @@ function TocMapOldDataToNew(mod_data)
|
||||
}
|
||||
|
||||
local old_names_table = { "RightHand", "RightForearm", "RightArm", "LeftHand", "LeftForearm", "LeftArm" }
|
||||
local new_names_table = {"Right_Hand", "Right_LowerArm", "Right_UpperArm", "Left_Hand", "Left_LowerArm", "Left_UpperArm"}
|
||||
local new_names_table = { "Right_Hand", "Right_LowerArm", "Right_UpperArm", "Left_Hand", "Left_LowerArm",
|
||||
"Left_UpperArm" }
|
||||
print("TOC: Trying to backup old data")
|
||||
local backup_old_data = mod_data.TOC
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
|
||||
function TryToToResetEverythingOtherPlayer(_, patient, surgeon)
|
||||
sendClientCommand(surgeon, "TOC", "AskToResetEverything", { patient:getOnlineID() })
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----------------------------------------------------------------------------------------------------------
|
||||
|
||||
TocContextMenus = {}
|
||||
@@ -40,10 +35,12 @@ TocContextMenus.CreateMenus = function(player, context, worldObjects, test)
|
||||
|
||||
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)
|
||||
local cheat_menu = TocContextMenus.CreateCheatMenu(context, root_menu, local_player,
|
||||
clicked_player)
|
||||
context:addSubMenu(root_option, root_menu)
|
||||
|
||||
TocContextMenus.FillCutAndOperateMenus(local_player, clicked_player, worldObjects, cut_menu, operate_menu)
|
||||
TocContextMenus.FillCutAndOperateMenus(local_player, clicked_player, worldObjects,
|
||||
cut_menu, operate_menu)
|
||||
--TocContextMenus.FillCheatMenu(context, cheat_menu)
|
||||
|
||||
break
|
||||
@@ -74,13 +71,15 @@ TocContextMenus.CreateOperateWithOvenMenu = function(player, context, worldObjec
|
||||
--local props = v:getSprite() and v:getSprite():getProperties() or nil
|
||||
|
||||
for _, v_stove in pairs(worldObjects) do
|
||||
if instanceof(v_stove, "IsoStove") and (player_obj:HasTrait("Brave") or player_obj:getPerkLevel(Perks.Strength) >= 6) then
|
||||
if instanceof(v_stove, "IsoStove") and
|
||||
(player_obj:HasTrait("Brave") or player_obj:getPerkLevel(Perks.Strength) >= 6) then
|
||||
|
||||
-- Check temperature
|
||||
if v_stove:getCurrentTemperature() > 250 then
|
||||
|
||||
for _, v_bodypart in ipairs(GetBodyParts()) do
|
||||
if part_data[v_bodypart].is_cut and part_data[v_bodypart].is_amputation_shown and not part_data[v_bodypart].is_operated then
|
||||
if part_data[v_bodypart].is_cut and part_data[v_bodypart].is_amputation_shown and
|
||||
not part_data[v_bodypart].is_operated then
|
||||
local subMenu = context:getNew(context);
|
||||
|
||||
if is_main_menu_already_created == false then
|
||||
@@ -88,7 +87,8 @@ TocContextMenus.CreateOperateWithOvenMenu = function(player, context, worldObjec
|
||||
context:addSubMenu(rootMenu, subMenu)
|
||||
is_main_menu_already_created = true
|
||||
end
|
||||
subMenu:addOption(getText('UI_ContextMenu_' .. v_bodypart), worldObjects, TocOperateLocal, getSpecificPlayer(player), getSpecificPlayer(player), v_bodypart, true)
|
||||
subMenu:addOption(getText('UI_ContextMenu_' .. v_bodypart), worldObjects, TocOperateLocal,
|
||||
getSpecificPlayer(player), getSpecificPlayer(player), v_bodypart, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -135,13 +135,16 @@ TocContextMenus.FillCutAndOperateMenus = function(local_player, clicked_player,
|
||||
cut_menu:addOption(getText('UI_ContextMenu_' .. v), _, TryTocAction, v, "Cut", local_player, local_player)
|
||||
|
||||
elseif CheckIfCanBeOperated(v) then
|
||||
operate_menu:addOption(getText('UI_ContextMenu_' .. v), _, TryTocAction, v, "Operate", local_player, local_player)
|
||||
operate_menu:addOption(getText('UI_ContextMenu_' .. v), _, TryTocAction, v, "Operate", local_player,
|
||||
local_player)
|
||||
end
|
||||
|
||||
else -- Another player
|
||||
-- TODO add way to prevent cutting already cut parts of another player
|
||||
cut_menu:addOption(getText('UI_ContextMenu_' .. v), world_objects, TryTocAction, v, "Cut", local_player, clicked_player)
|
||||
operate_menu:addOption(getText('UI_ContextMenu_' .. v), world_objects, TryTocAction, v, "Operate", local_player, clicked_player)
|
||||
cut_menu:addOption(getText('UI_ContextMenu_' .. v), world_objects, TryTocAction, v, "Cut", local_player,
|
||||
clicked_player)
|
||||
operate_menu:addOption(getText('UI_ContextMenu_' .. v), world_objects, TryTocAction, v, "Operate",
|
||||
local_player, clicked_player)
|
||||
|
||||
end
|
||||
|
||||
@@ -161,7 +164,8 @@ TocContextMenus.CreateCheatMenu = function(context, root_menu, local_player, cli
|
||||
cheat_menu:addOption("Reset TOC for me", _, TocResetEverything)
|
||||
|
||||
else
|
||||
cheat_menu:addOption("Reset TOC for " .. clicked_player:getUsername(), _, TryToToResetEverythingOtherPlayer, clicked_player, local_player)
|
||||
cheat_menu:addOption("Reset TOC for " .. clicked_player:getUsername(), _, TryToToResetEverythingOtherPlayer,
|
||||
clicked_player, local_player)
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
|
||||
|
||||
|
||||
|
||||
-- CutLimb
|
||||
-- TODO if TheONlyCure. triggers an errors
|
||||
function TocCheckIfStillInfected(part_data)
|
||||
@@ -25,8 +21,6 @@ function TocCheckIfStillInfected(part_data)
|
||||
return check
|
||||
end
|
||||
|
||||
|
||||
|
||||
function TocCureInfection(body_damage, part_data, part_name)
|
||||
|
||||
local body_part_type = body_damage:getBodyPart(TocGetBodyPartTypeFromPartName(part_name))
|
||||
@@ -64,7 +58,6 @@ function TocCureInfection(body_damage, part_data, part_name)
|
||||
|
||||
end
|
||||
|
||||
|
||||
function TocDeleteOtherAmputatedLimbs(side)
|
||||
|
||||
-- if left hand is cut and we cut left lowerarm, then delete hand
|
||||
@@ -83,16 +76,17 @@ end
|
||||
|
||||
function TocGetKitInInventory(surgeon)
|
||||
local playerInv = surgeon: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')
|
||||
return item
|
||||
|
||||
end
|
||||
|
||||
|
||||
function TocGetSawInInventory(surgeon)
|
||||
|
||||
local player_inv = surgeon:getInventory()
|
||||
local item = player_inv:getItemFromType("Saw") or player_inv:getItemFromType("GardenSaw") or player_inv:getItemFromType("Chainsaw")
|
||||
local item = player_inv:getItemFromType("Saw") or player_inv:getItemFromType("GardenSaw") or
|
||||
player_inv:getItemFromType("Chainsaw")
|
||||
return item
|
||||
end
|
||||
|
||||
@@ -127,7 +121,6 @@ function FixSingleBodyPartType(body_part_type, use_oven)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------
|
||||
-- Override helper
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@ function TocEquipProsthesisLocal(_, patient, surgeon, part_name)
|
||||
surgeon_inventory:getItemFromType('TOC.MetalHook') or
|
||||
surgeon_inventory:getItemFromType('TOC.WoodenHook')
|
||||
if prosthesis_to_equip then
|
||||
ISTimedActionQueue.add(ISInstallProsthesis:new(patient, prosthesis_to_equip, patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name))))
|
||||
ISTimedActionQueue.add(ISInstallProsthesis:new(patient, prosthesis_to_equip,
|
||||
patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name))))
|
||||
else
|
||||
surgeon:Say("I need a prosthesis")
|
||||
end
|
||||
@@ -37,5 +38,6 @@ end
|
||||
|
||||
function TocUnequipProsthesisLocal(_, patient, part_name)
|
||||
local equipped_prosthesis = TocFindItemInProstBodyLocation(part_name, patient)
|
||||
ISTimedActionQueue.add(ISUninstallProsthesis:new(patient, equipped_prosthesis, patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name))))
|
||||
ISTimedActionQueue.add(ISUninstallProsthesis:new(patient, equipped_prosthesis,
|
||||
patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name))))
|
||||
end
|
||||
@@ -51,7 +51,8 @@ function ISBaseTimedAction:adjustMaxTime(maxTime)
|
||||
|
||||
-- Perk scaling
|
||||
if part_name == "Right_Hand" or part_name == "Left_Hand" then
|
||||
modified_max_time = modified_max_time * (1 + (9 - self.character:getPerkLevel(Perks[part_name])) / 20 )
|
||||
modified_max_time = modified_max_time *
|
||||
(1 + (9 - self.character:getPerkLevel(Perks[part_name])) / 20)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -70,9 +71,6 @@ function ISBaseTimedAction:adjustMaxTime(maxTime)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
-------------------------------------------------
|
||||
-- Block access to drag, picking, inspecting, etc to amputated limbs
|
||||
local og_ISInventoryPaneOnMouseDoubleClick = ISInventoryPane.onMouseDoubleClick
|
||||
@@ -93,7 +91,6 @@ function ISInventoryPane:onMouseDoubleClick(x, y)
|
||||
|
||||
end
|
||||
|
||||
|
||||
local og_ISInventoryPaneGetActualItems = ISInventoryPane.getActualItems
|
||||
function ISInventoryPane.getActualItems(items)
|
||||
|
||||
@@ -112,7 +109,6 @@ function ISInventoryPane.getActualItems(items)
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
local og_ISInventoryPaneContextMenuOnInspectClothing = ISInventoryPaneContextMenu.onInspectClothing
|
||||
ISInventoryPaneContextMenu.onInspectClothing = function(playerObj, clothing)
|
||||
|
||||
@@ -171,7 +167,6 @@ function ISEquipWeaponAction:perform()
|
||||
|
||||
end
|
||||
|
||||
|
||||
local og_ISInventoryPaneContextMenuUnequipItem = ISInventoryPaneContextMenu.unequipItem
|
||||
function ISInventoryPaneContextMenu.unequipItem(item, player)
|
||||
|
||||
@@ -191,4 +186,3 @@ function ISInventoryPaneContextMenu.dropItem(item, player)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -18,21 +18,17 @@ local function PrerenderFuncMP()
|
||||
end
|
||||
|
||||
-- Prerender basically hooks onto SendCommandToConfirmUI, dunno how but it does
|
||||
SendCommandToConfirmUIMP(confirm_ui_mp.responseAction, confirm_ui_mp.responseIsBitten, confirm_ui_mp.responseUserName, confirm_ui_mp.responsePartName);
|
||||
SendCommandToConfirmUIMP(confirm_ui_mp.responseAction, confirm_ui_mp.responseIsBitten,
|
||||
confirm_ui_mp.responseUserName, confirm_ui_mp.responsePartName);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
-----------------------
|
||||
-- Getters
|
||||
function GetConfirmUIMP()
|
||||
return confirm_ui_mp;
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------------
|
||||
-- UI Visible stuff functions
|
||||
local function GetImageName(part_name, toc_data)
|
||||
@@ -45,15 +41,18 @@ local function GetImageName(part_name, toc_data)
|
||||
else
|
||||
name = "media/ui/TOC/" .. part_name .. "/Prothesis.png"
|
||||
end
|
||||
elseif part_data.is_cut and part_data.is_cicatrized and not part_data.is_prosthesis_equipped and part_data.is_amputation_shown then -- Cut and heal
|
||||
elseif part_data.is_cut and part_data.is_cicatrized and not part_data.is_prosthesis_equipped and
|
||||
part_data.is_amputation_shown then -- Cut and heal
|
||||
name = "media/ui/TOC/" .. part_name .. "/Cut.png"
|
||||
elseif part_data.is_cut and not part_data.is_cicatrized and part_data.is_amputation_shown and not part_data.is_operated then -- Cut not heal
|
||||
elseif part_data.is_cut and not part_data.is_cicatrized and part_data.is_amputation_shown and
|
||||
not part_data.is_operated then -- Cut not heal
|
||||
name = "media/ui/TOC/" .. part_name .. "/Bleed.png"
|
||||
elseif part_data.is_cut and not part_data.is_cicatrized and part_data.is_amputation_shown and part_data.is_operated then -- Cut not heal
|
||||
name = "media/ui/TOC/" .. part_name .. "/Operate.png"
|
||||
elseif part_data.is_cut and not part_data.is_amputation_shown then -- Empty (like hand if forearm cut)
|
||||
name = "media/ui/TOC/Empty.png"
|
||||
elseif not part_data.is_cut and getPlayer():getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name)):bitten() then -- Not cut but bitten
|
||||
elseif not part_data.is_cut and
|
||||
getPlayer():getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name)):bitten() then -- Not cut but bitten
|
||||
name = "media/ui/TOC/" .. part_name .. "/Bite.png"
|
||||
else -- Not cut
|
||||
name = "media/ui/TOC/" .. part_name .. "/Base.png"
|
||||
@@ -68,10 +67,6 @@ local function GetImageName(part_name, toc_data)
|
||||
return name
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------------------------
|
||||
-- Check functions
|
||||
|
||||
@@ -81,7 +76,8 @@ end
|
||||
|
||||
local function CanProsthesisBeEquipped(part_data)
|
||||
|
||||
return part_data.is_cut and part_data.is_cicatrized and not part_data.is_prosthesis_equipped and part_data.is_amputation_shown
|
||||
return part_data.is_cut and part_data.is_cicatrized and not part_data.is_prosthesis_equipped and
|
||||
part_data.is_amputation_shown
|
||||
|
||||
end
|
||||
|
||||
@@ -94,14 +90,11 @@ local function IsAmputatedLimbToBeVisible(part_data)
|
||||
return part_data.is_cut and not part_data.is_amputation_shown
|
||||
end
|
||||
|
||||
|
||||
local function IsPartBitten(part_data, part_name)
|
||||
return not part_data.is_cut and getPlayer():getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name)):bitten()
|
||||
return not part_data.is_cut and
|
||||
getPlayer():getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name)):bitten()
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
local function FindMinMax(lv)
|
||||
local min, max
|
||||
if lv == 1 then
|
||||
@@ -138,11 +131,6 @@ local function FindMinMax(lv)
|
||||
return min, max;
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------------------------------
|
||||
-- On Click Functions
|
||||
local function OnClickTocMainUI(button, args)
|
||||
@@ -181,16 +169,17 @@ local function OnClickTocDescUI(button, args)
|
||||
|
||||
end
|
||||
|
||||
|
||||
function OnClickTocConfirmUIMP(button, args)
|
||||
local player = getPlayer()
|
||||
if confirm_ui_mp.actionAct == "Cut" and args.option == "yes" then
|
||||
ISTimedActionQueue.add(ISCutLimb:new(confirm_ui_mp.patient, player, confirm_ui_mp.partNameAct))
|
||||
elseif confirm_ui_mp.actionAct == "Operate" and args.option == "yes" then
|
||||
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
|
||||
ISTimedActionQueue.add(ISOperateLimb:new(confirm_ui_mp.patient, player, item, confirm_ui_mp.partNameAct, false))
|
||||
ISTimedActionQueue.add(ISOperateLimb:new(confirm_ui_mp.patient, player, item, confirm_ui_mp.partNameAct,
|
||||
false))
|
||||
else
|
||||
player:Say("I need a kit")
|
||||
end
|
||||
@@ -210,8 +199,6 @@ function OnClickTocConfirmUIMP(button, args)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------
|
||||
|
||||
-- CREATE UI SECTION
|
||||
@@ -288,7 +275,6 @@ function CreateTocDescUI()
|
||||
desc_ui:saveLayout()
|
||||
end
|
||||
|
||||
|
||||
function CreateTocConfirmUIMP()
|
||||
confirm_ui_mp = NewUI()
|
||||
confirm_ui_mp.responseReceive = false
|
||||
@@ -336,7 +322,6 @@ function OnCreateTheOnlyCureUI()
|
||||
main_ui:close()
|
||||
end
|
||||
|
||||
|
||||
-----------------------------------------
|
||||
-- Setup stuff with variables and shit
|
||||
|
||||
@@ -493,7 +478,8 @@ function SendCommandToConfirmUIMP(action, isBitten, userName, partName)
|
||||
confirm_ui_mp:open()
|
||||
|
||||
if action == "Cut" or action == "Operate" then
|
||||
confirm_ui_mp["text4"]:setText("You're gonna " .. action .. " the " .. getText("UI_ContextMenu_" .. partName) .. " of " .. userName)
|
||||
confirm_ui_mp["text4"]:setText("You're gonna " ..
|
||||
action .. " the " .. getText("UI_ContextMenu_" .. partName) .. " of " .. userName)
|
||||
confirm_ui_mp["text2"]:setText("Are you sure?")
|
||||
confirm_ui_mp["text2"]:setColor(1, 0, 0, 0)
|
||||
confirm_ui_mp["b1"]:setVisible(true);
|
||||
@@ -509,6 +495,7 @@ function SendCommandToConfirmUIMP(action, isBitten, userName, partName)
|
||||
|
||||
|
||||
end
|
||||
|
||||
--------------------------------------------
|
||||
-- Add TOC element to Health Panel
|
||||
local ISHealthPanel_createChildren = ISHealthPanel.createChildren
|
||||
@@ -542,14 +529,14 @@ function ISNewHealthPanel.onClick_TOC(button)
|
||||
|
||||
end
|
||||
|
||||
|
||||
function ISHealthPanel:createChildren()
|
||||
ISHealthPanel_createChildren(self)
|
||||
|
||||
self.fitness:setWidth(self.fitness:getWidth() / 1.5)
|
||||
|
||||
--TODO make it bigger
|
||||
self.TOCButton = ISButton:new(self.fitness:getRight(), self.healthPanel.y, 20, 20, "", self, ISNewHealthPanel.onClick_TOC)
|
||||
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.anchorBottom = true
|
||||
@@ -566,8 +553,5 @@ function ISHealthPanel:render()
|
||||
self.TOCButton:setY(self.fitness:getY());
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
-- EVENTS
|
||||
Events.OnCreateUI.Add(OnCreateTheOnlyCureUI)
|
||||
@@ -7,7 +7,8 @@ function TheOnlyCure.CheckIfCanPickUpItem(toc_data, side, limb, secondary_limb)
|
||||
local full_secondary_limb = side .. secondary_limb
|
||||
|
||||
|
||||
return toc_data[full_primary_limb].is_cut and not (toc_data[full_primary_limb].is_prosthesis_equipped or toc_data[full_secondary_limb]) or
|
||||
return toc_data[full_primary_limb].is_cut and
|
||||
not (toc_data[full_primary_limb].is_prosthesis_equipped or toc_data[full_secondary_limb]) or
|
||||
(toc_data[full_secondary_limb].is_cut and not toc_data[full_secondary_limb].is_prosthesis_equipped)
|
||||
|
||||
|
||||
@@ -141,7 +142,6 @@ function TheOnlyCure.CheckIfOtherLimbsAreInfected(part_data, part_name)
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
-- MAIN UPDATE FUNCTIONS
|
||||
|
||||
function TheOnlyCure.UpdateEveryOneMinute()
|
||||
@@ -191,6 +191,5 @@ function TheOnlyCure.UpdateEveryTenMinutes()
|
||||
player:transmitModData()
|
||||
end
|
||||
|
||||
|
||||
Events.EveryTenMinutes.Add(TheOnlyCure.UpdateEveryTenMinutes)
|
||||
Events.EveryOneMinute.Add(TheOnlyCure.UpdateEveryOneMinute)
|
||||
@@ -200,16 +200,20 @@ function TocUpdateBaseData(mod_data)
|
||||
end
|
||||
|
||||
function TheOnlyCure.DeclareTraits()
|
||||
local amp1 = TraitFactory.addTrait("Amputee_Hand", getText("UI_trait_Amputee_Hand"), -8, getText("UI_trait_Amputee_Hand_desc"), false, false)
|
||||
local amp1 = TraitFactory.addTrait("Amputee_Hand", getText("UI_trait_Amputee_Hand"), -8,
|
||||
getText("UI_trait_Amputee_Hand_desc"), false, false)
|
||||
amp1:addXPBoost(Perks.Left_Hand, 4)
|
||||
|
||||
local amp2 = TraitFactory.addTrait("Amputee_LowerArm", getText("UI_trait_Amputee_LowerArm"), -10, getText("UI_trait_Amputee_LowerArm_desc"), false, false)
|
||||
local amp2 = TraitFactory.addTrait("Amputee_LowerArm", getText("UI_trait_Amputee_LowerArm"), -10,
|
||||
getText("UI_trait_Amputee_LowerArm_desc"), false, false)
|
||||
amp2:addXPBoost(Perks.Left_Hand, 4)
|
||||
|
||||
local amp3 = TraitFactory.addTrait("Amputee_UpperArm", getText("UI_trait_Amputee_UpperArm"), -20, getText("UI_trait_Amputee_UpperArm_desc"), false, false)
|
||||
local amp3 = TraitFactory.addTrait("Amputee_UpperArm", getText("UI_trait_Amputee_UpperArm"), -20,
|
||||
getText("UI_trait_Amputee_UpperArm_desc"), false, false)
|
||||
amp3:addXPBoost(Perks.Left_Hand, 4)
|
||||
|
||||
TraitFactory.addTrait("Insensitive", getText("UI_trait_Insensitive"), 6, getText("UI_trait_Insensitivedesc"), false, false)
|
||||
TraitFactory.addTrait("Insensitive", getText("UI_trait_Insensitive"), 6, getText("UI_trait_Insensitivedesc"), false,
|
||||
false)
|
||||
TraitFactory.setMutualExclusive("Amputee_Hand", "Amputee_LowerArm")
|
||||
TraitFactory.setMutualExclusive("Amputee_Hand", "Amputee_UpperArm")
|
||||
TraitFactory.setMutualExclusive("Amputee_LowerArm", "Amputee_UpperArm")
|
||||
@@ -380,7 +384,8 @@ function TryTocAction(_, part_name, action, surgeon, patient)
|
||||
surgeon_inventory:getItemFromType('TOC.MetalHook') or
|
||||
surgeon_inventory:getItemFromType('TOC.WoodenHook')
|
||||
if prosthesis_to_equip then
|
||||
ISTimedActionQueue.add(ISInstallProsthesis:new(patient, prosthesis_to_equip, patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name))))
|
||||
ISTimedActionQueue.add(ISInstallProsthesis:new(patient, prosthesis_to_equip,
|
||||
patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name))))
|
||||
else
|
||||
surgeon:Say("I need a prosthesis")
|
||||
end
|
||||
@@ -392,7 +397,8 @@ function TryTocAction(_, part_name, action, surgeon, patient)
|
||||
elseif action == "Unequip" then
|
||||
--AskCanUnequipProsthesis(patient, part_name)
|
||||
local equipped_prosthesis = TocFindItemInProstBodyLocation(part_name, patient)
|
||||
ISTimedActionQueue.add(ISUninstallProsthesis:new(patient, equipped_prosthesis, patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name))))
|
||||
ISTimedActionQueue.add(ISUninstallProsthesis:new(patient, equipped_prosthesis,
|
||||
patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name))))
|
||||
end
|
||||
ui.actionAct = action
|
||||
ui.partNameAct = part_name
|
||||
@@ -405,6 +411,5 @@ function TryTocAction(_, part_name, action, surgeon, patient)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Events.OnCreatePlayer.Add(TheOnlyCure.InitTheOnlyCure)
|
||||
Events.OnGameBoot.Add(TheOnlyCure.DeclareTraits)
|
||||
@@ -57,7 +57,6 @@ function ISCutLimb:start()
|
||||
|
||||
end
|
||||
|
||||
|
||||
function ISCutLimb:findArgs()
|
||||
local surgeon_factor = self.surgeon:getPerkLevel(Perks.Doctor)
|
||||
if self.surgeon:getDescriptor():getProfession() == "surgeon" then surgeon_factor = surgeon_factor + 15 end
|
||||
@@ -67,7 +66,8 @@ function ISCutLimb:findArgs()
|
||||
local bandage_table = {
|
||||
use_bandage = false,
|
||||
bandage_type = nil,
|
||||
is_bandage_sterilized = nil}
|
||||
is_bandage_sterilized = nil
|
||||
}
|
||||
local painkiller_table = {}
|
||||
|
||||
|
||||
@@ -102,7 +102,6 @@ function ISCutLimb:findArgs()
|
||||
return surgeon_factor, bandage_table, painkiller_table
|
||||
end
|
||||
|
||||
|
||||
function ISCutLimb:perform()
|
||||
local surgeon_factor, bandage_table, painkiller_table = self:findArgs()
|
||||
|
||||
@@ -125,7 +124,6 @@ function ISCutLimb:perform()
|
||||
|
||||
end
|
||||
|
||||
|
||||
function ISCutLimb:new(patient, surgeon, part_name)
|
||||
local o = {}
|
||||
setmetatable(o, self)
|
||||
|
||||
@@ -104,5 +104,3 @@ function ISUninstallProsthesis:new(character, item, bodyPart)
|
||||
if o.character:isTimedActionInstant() then o.maxTime = 1; end
|
||||
return o;
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -52,4 +52,3 @@ local function OnTocClientCommand(module, command, player, args)
|
||||
end
|
||||
|
||||
Events.OnClientCommand.Add(OnTocClientCommand)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user