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
|
||||
@@ -42,15 +41,12 @@ function CheckIfProsthesisAlreadyInstalled(part_data, part_name)
|
||||
|
||||
if string.find(part_name, r) then
|
||||
return (part_data[r .. "_Hand"].is_prosthesis_equipped or part_data[r .. "_LowerArm"].is_prosthesis_equipped)
|
||||
|
||||
|
||||
elseif string.find(part_name, l) then
|
||||
return (part_data[l .. "_Hand"].is_prosthesis_equipped or part_data[l .. "_LowerArm"].is_prosthesis_equipped)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -18,7 +19,7 @@ function SendCutLimb(player, part_name, surgeon_factor, bandage_table, painkille
|
||||
arg["From"] = getPlayer():getOnlineID()
|
||||
arg["To"] = player:getOnlineID()
|
||||
arg["command"] = "CutLimb"
|
||||
arg["toSend"] = {part_name, surgeon_factor, bandage_table, painkiller_table}
|
||||
arg["toSend"] = { part_name, surgeon_factor, bandage_table, painkiller_table }
|
||||
sendClientCommand("TOC", "SendServer", arg)
|
||||
end
|
||||
|
||||
@@ -27,7 +28,7 @@ function SendOperateLimb(player, part_name, surgeon_factor, use_oven)
|
||||
arg["From"] = getPlayer():getOnlineID()
|
||||
arg["To"] = player:getOnlineID()
|
||||
arg["command"] = "OperateLimb"
|
||||
arg["toSend"] = {part_name, surgeon_factor, use_oven}
|
||||
arg["toSend"] = { part_name, surgeon_factor, use_oven }
|
||||
sendClientCommand("TOC", "SendServer", arg)
|
||||
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"]
|
||||
@@ -75,11 +75,11 @@ end
|
||||
|
||||
Commands["CanCutLimb"] = function(arg)
|
||||
local part_name = arg["toSend"]
|
||||
|
||||
|
||||
arg["To"] = arg["From"]
|
||||
arg["From"] = getPlayer():getOnlineID()
|
||||
arg["command"] = "ResponseCanAct"
|
||||
arg["toSend"] = {part_name, "Cut", CheckIfCanBeCut(part_name)}
|
||||
arg["toSend"] = { part_name, "Cut", CheckIfCanBeCut(part_name) }
|
||||
sendClientCommand("TOC", "SendServer", arg)
|
||||
end
|
||||
|
||||
@@ -89,7 +89,7 @@ Commands["CanOperateLimb"] = function(arg)
|
||||
arg["To"] = arg["From"]
|
||||
arg["From"] = getPlayer():getOnlineID()
|
||||
arg["command"] = "ResponseCanAct"
|
||||
arg["toSend"] = {part_name, "Operate", CheckIfCanBeOperated(part_name)}
|
||||
arg["toSend"] = { part_name, "Operate", CheckIfCanBeOperated(part_name) }
|
||||
sendClientCommand("TOC", "SendServer", arg)
|
||||
end
|
||||
|
||||
@@ -99,18 +99,18 @@ Commands["CanEquipProsthesis"] = function(arg)
|
||||
arg["To"] = arg["From"]
|
||||
arg["From"] = getPlayer():getOnlineID()
|
||||
arg["command"] = "ResponseCanAct"
|
||||
arg["toSend"] = {part_name, "Equip", CheckIfProsthesisCanBeEquipped(part_name)}
|
||||
arg["toSend"] = { part_name, "Equip", CheckIfProsthesisCanBeEquipped(part_name) }
|
||||
|
||||
end
|
||||
|
||||
|
||||
Commands["CanResetEverything"] = function(arg)
|
||||
local part_name = "RightHand" --useless
|
||||
|
||||
local part_name = "RightHand" --useless
|
||||
|
||||
arg["To"] = arg["From"]
|
||||
arg["From"] = getPlayer():getOnlineID()
|
||||
arg["command"] = "ResponseCanAct"
|
||||
arg["toSend"] = {part_name, "Cut", true}
|
||||
arg["toSend"] = { part_name, "Cut", true }
|
||||
sendClientCommand("TOC", "SendServer", arg)
|
||||
--TocResetEverything()
|
||||
end
|
||||
@@ -120,10 +120,10 @@ Commands["ResetEverything"] = function(arg)
|
||||
TocResetEverything()
|
||||
end
|
||||
|
||||
-- Cheating stuff
|
||||
-- Cheating stuff
|
||||
Commands["AcceptResetEverything"] = function(arg)
|
||||
|
||||
local clicked_player = getPlayerByOnlineID(arg[1]) -- TODO delete this
|
||||
local clicked_player = getPlayerByOnlineID(arg[1]) -- TODO delete this
|
||||
TocResetEverything()
|
||||
end
|
||||
|
||||
@@ -131,9 +131,9 @@ end
|
||||
-- Base stuff
|
||||
Commands["GivePlayerData"] = function(arg)
|
||||
local surgeon_id = arg[1]
|
||||
local patient = getPlayerByOnlineID(arg[2])
|
||||
local patient = getPlayerByOnlineID(arg[2])
|
||||
local toc_data = patient:getModData().TOC
|
||||
sendClientCommand(patient, "TOC", "SendPlayerData", {surgeon_id, toc_data})
|
||||
sendClientCommand(patient, "TOC", "SendPlayerData", { surgeon_id, toc_data })
|
||||
end
|
||||
|
||||
Commands["SendTocData"] = function(arg)
|
||||
@@ -162,7 +162,4 @@ local function OnTocServerCommand(module, command, args)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
Events.OnServerCommand.Add(OnTocServerCommand)
|
||||
Events.OnServerCommand.Add(OnTocServerCommand)
|
||||
|
||||
@@ -11,4 +11,4 @@ end
|
||||
|
||||
--Make a link
|
||||
TOC_Options = {}
|
||||
TOC_Options = options
|
||||
TOC_Options = options
|
||||
|
||||
@@ -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,70 +15,84 @@ 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
|
||||
if part_name == "Right_UpperArm" then return BodyPartType.UpperArm_R end
|
||||
if part_name == "Left_Hand" then return BodyPartType.Hand_L end
|
||||
if part_name == "Left_LowerArm" then return BodyPartType.ForeArm_L end
|
||||
if part_name == "Left_UpperArm" then return BodyPartType.UpperArm_L end
|
||||
if part_name == "Right_Hand" then return BodyPartType.Hand_R end
|
||||
if part_name == "Right_LowerArm" then return BodyPartType.ForeArm_R end
|
||||
if part_name == "Right_UpperArm" then return BodyPartType.UpperArm_R end
|
||||
if part_name == "Left_Hand" then return BodyPartType.Hand_L end
|
||||
if part_name == "Left_LowerArm" then return BodyPartType.ForeArm_L end
|
||||
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
|
||||
@@ -86,27 +102,24 @@ end
|
||||
|
||||
local function PartNameToBodyLocation(name)
|
||||
-- This is still correct but naming sucks
|
||||
if name == "Right_Hand" then return "ArmRight_Prot" end
|
||||
if name == "Right_LowerArm" then return "ArmRight_Prot" end
|
||||
if name == "Right_UpperArm" then return "ArmRight_Prot" end
|
||||
if name == "Left_Hand" then return "ArmLeft_Prot" end
|
||||
if name == "Left_LowerArm" then return "ArmLeft_Prot" end
|
||||
if name == "Left_UpperArm" then return "ArmLeft_Prot" end
|
||||
if name == "Right_Hand" then return "ArmRight_Prot" end
|
||||
if name == "Right_LowerArm" then return "ArmRight_Prot" end
|
||||
if name == "Right_UpperArm" then return "ArmRight_Prot" end
|
||||
if name == "Left_Hand" then return "ArmLeft_Prot" end
|
||||
if name == "Left_LowerArm" then return "ArmLeft_Prot" end
|
||||
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
|
||||
for i = 1, worn_items:size() - 1 do -- Maybe wornItems:size()-1
|
||||
local item = worn_items:get(i):getItem()
|
||||
if item:getBodyLocation() == PartNameToBodyLocation(part_name) then
|
||||
return item
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,8 +10,6 @@ function TocCheckCompatibilityWithOlderVersions(mod_data)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function TocMapOldDataToNew(mod_data)
|
||||
|
||||
local map_names = {
|
||||
@@ -24,8 +22,9 @@ function TocMapOldDataToNew(mod_data)
|
||||
Left_UpperArm = "LeftArm"
|
||||
}
|
||||
|
||||
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 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" }
|
||||
print("TOC: Trying to backup old data")
|
||||
local backup_old_data = mod_data.TOC
|
||||
|
||||
@@ -42,7 +41,7 @@ function TocMapOldDataToNew(mod_data)
|
||||
|
||||
|
||||
TocResetEverything()
|
||||
-- For some reasons pairs does not work here...
|
||||
-- For some reasons pairs does not work here...
|
||||
-- TODO ask why
|
||||
|
||||
|
||||
@@ -74,11 +73,11 @@ function TocMapOldDataToNew(mod_data)
|
||||
-- mod_data.TOC.Limbs[new_name].is_amputation_shown = backup_old_data[old_name].is_amputation_shown
|
||||
|
||||
-- mod_data.TOC.Limbs[new_name].cicatrization_time = backup_old_data[old_name].cicatrization_time
|
||||
|
||||
|
||||
|
||||
-- end
|
||||
|
||||
for i=1, #new_names_table do
|
||||
for i = 1, #new_names_table do
|
||||
print("TOC: Looping " .. i)
|
||||
print(backup_old_data[old_names_table[i]].is_cut)
|
||||
|
||||
@@ -99,11 +98,11 @@ function TocMapOldDataToNew(mod_data)
|
||||
mod_data.TOC.Limbs[new_name].is_cauterized = backup_old_data[old_name].is_cauterized
|
||||
mod_data.TOC.Limbs[new_name].is_amputation_shown = backup_old_data[old_name].is_amputation_shown
|
||||
|
||||
mod_data.TOC.Limbs[new_name].cicatrization_time = backup_old_data[old_name].cicatrization_time
|
||||
|
||||
mod_data.TOC.Limbs[new_name].cicatrization_time = backup_old_data[old_name].cicatrization_time
|
||||
|
||||
|
||||
end
|
||||
getPlayer():transmitModData()
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
|
||||
function TryToToResetEverythingOtherPlayer(_, patient, surgeon)
|
||||
sendClientCommand(surgeon, "TOC", "AskToResetEverything", {patient:getOnlineID()})
|
||||
sendClientCommand(surgeon, "TOC", "AskToResetEverything", { patient:getOnlineID() })
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----------------------------------------------------------------------------------------------------------
|
||||
|
||||
TocContextMenus = {}
|
||||
@@ -17,15 +12,15 @@ TocContextMenus.CreateMenus = function(player, context, worldObjects, test)
|
||||
local clicked_player = nil
|
||||
|
||||
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
|
||||
for x=v:getSquare():getX()-1,v:getSquare():getX()+1 do
|
||||
for y=v:getSquare():getY()-1,v:getSquare():getY()+1 do
|
||||
local sq = getCell():getGridSquare(x,y,v:getSquare():getZ())
|
||||
for x = v:getSquare():getX() - 1, v:getSquare():getX() + 1 do
|
||||
for y = v:getSquare():getY() - 1, v:getSquare():getY() + 1 do
|
||||
local sq = getCell():getGridSquare(x, y, v:getSquare():getZ())
|
||||
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)
|
||||
if instanceof(o, "IsoPlayer") then
|
||||
clicked_player = o
|
||||
@@ -34,16 +29,18 @@ TocContextMenus.CreateMenus = function(player, context, worldObjects, test)
|
||||
|
||||
-- FIXME this is to prevent context menu spamming. Find a better way
|
||||
clicked_players_table[clicked_player:getUsername()] = true
|
||||
|
||||
|
||||
local root_option = context:addOption("The Only Cure on " .. clicked_player:getUsername())
|
||||
local root_menu = 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)
|
||||
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
|
||||
@@ -65,7 +62,7 @@ TocContextMenus.CreateOperateWithOvenMenu = function(player, context, worldObjec
|
||||
|
||||
-- TODO Add a way to move the player towards the oven
|
||||
|
||||
|
||||
|
||||
local part_data = player_obj:getModData().TOC.Limbs
|
||||
|
||||
local is_main_menu_already_created = false
|
||||
@@ -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,12 +87,13 @@ 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
|
||||
|
||||
break -- stop searching for stoves
|
||||
break -- stop searching for stoves
|
||||
|
||||
end
|
||||
|
||||
@@ -130,18 +130,21 @@ TocContextMenus.FillCutAndOperateMenus = function(local_player, clicked_player,
|
||||
for _, v in ipairs(GetBodyParts()) do
|
||||
|
||||
|
||||
if local_player == clicked_player then -- Local player
|
||||
if local_player == clicked_player then -- Local player
|
||||
if CheckIfCanBeCut(v) then
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
@@ -179,5 +183,5 @@ TocContextMenus.FillCheatMenus = function(context, cheat_menu)
|
||||
end
|
||||
|
||||
|
||||
Events.OnFillWorldObjectContextMenu.Add(TocContextMenus.CreateOperateWithOvenMenu) -- this is probably too much
|
||||
Events.OnFillWorldObjectContextMenu.Add(TocContextMenus.CreateMenus)
|
||||
Events.OnFillWorldObjectContextMenu.Add(TocContextMenus.CreateOperateWithOvenMenu) -- this is probably too much
|
||||
Events.OnFillWorldObjectContextMenu.Add(TocContextMenus.CreateMenus)
|
||||
|
||||
@@ -6,7 +6,7 @@ function TocResetEverything()
|
||||
TheOnlyCure.InitTheOnlyCure(_, player)
|
||||
|
||||
-- Destroy the amputation model
|
||||
for _,v in ipairs(GetBodyParts()) do
|
||||
for _, v in ipairs(GetBodyParts()) do
|
||||
local cloth = player:getInventory():FindAndReturn(TocFindAmputatedClothingFromPartName(v))
|
||||
|
||||
if cloth ~= nil then
|
||||
|
||||
@@ -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))
|
||||
@@ -43,20 +37,20 @@ function TocCureInfection(body_damage, part_data, part_name)
|
||||
local body_part_types = body_damage:getBodyParts()
|
||||
|
||||
-- TODO I think this is enough... we should just cycle if with everything instead of that crap up there
|
||||
for i=body_part_types:size()-1, 0, -1 do
|
||||
for i = body_part_types:size() - 1, 0, -1 do
|
||||
local bodyPart = body_part_types:get(i);
|
||||
bodyPart:SetInfected(false);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if body_part_type:scratched() then body_part_type:setScratched(false, false) end
|
||||
if body_part_type:haveGlass() then body_part_type:setHaveGlass(false) end
|
||||
if body_part_type:haveBullet() then body_part_type:setHaveBullet(false, 0) end
|
||||
if body_part_type:isInfectedWound() then body_part_type:setInfectedWound(false) end
|
||||
if body_part_type:isBurnt() then body_part_type:setBurnTime(0) end
|
||||
if body_part_type:isCut() then body_part_type:setCut(false, false) end --Lacerations
|
||||
if body_part_type:getFractureTime()>0 then body_part_type:setFractureTime(0) end
|
||||
if body_part_type:scratched() then body_part_type:setScratched(false, false) end
|
||||
if body_part_type:haveGlass() then body_part_type:setHaveGlass(false) end
|
||||
if body_part_type:haveBullet() then body_part_type:setHaveBullet(false, 0) end
|
||||
if body_part_type:isInfectedWound() then body_part_type:setInfectedWound(false) end
|
||||
if body_part_type:isBurnt() then body_part_type:setBurnTime(0) end
|
||||
if body_part_type:isCut() then body_part_type:setCut(false, false) end --Lacerations
|
||||
if body_part_type:getFractureTime() > 0 then body_part_type:setFractureTime(0) end
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -76,23 +69,24 @@ function TocDeleteOtherAmputatedLimbs(side)
|
||||
if amputated_limb then
|
||||
getPlayer():getInventory():Remove(amputated_limb)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
@@ -112,22 +106,21 @@ function SetBodyPartsStatusAfterOperation(player, part_data, part_name, use_oven
|
||||
end
|
||||
|
||||
function FixSingleBodyPartType(body_part_type, use_oven)
|
||||
body_part_type:setDeepWounded(false) --Basically like stitching
|
||||
body_part_type:setDeepWounded(false) --Basically like stitching
|
||||
body_part_type:setDeepWoundTime(0)
|
||||
if use_oven then
|
||||
if use_oven then
|
||||
body_part_type:AddDamage(100)
|
||||
body_part_type:setAdditionalPain(100);
|
||||
body_part_type:setBleeding(false)
|
||||
body_part_type:setBleedingTime(0) -- no bleeding since it's been cauterized
|
||||
body_part_type:setBleedingTime(0) -- no bleeding since it's been cauterized
|
||||
else
|
||||
-- TODO Think a little better about this, do we want to trigger bleeding or not?
|
||||
body_part_type:setBleeding(false)
|
||||
|
||||
|
||||
--body_part_type:setBleedingTime(ZombRand(1, 5)) -- Reset the bleeding, maybe make it random
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------
|
||||
-- Override helper
|
||||
|
||||
@@ -146,7 +139,7 @@ function CheckIfItemIsAmputatedLimb(item)
|
||||
end
|
||||
|
||||
-- function CheckIfItemIsAmputatedLimb(item)
|
||||
|
||||
|
||||
|
||||
-- local item_full_type = item:getFullType()
|
||||
|
||||
@@ -200,4 +193,4 @@ function CheckIfItemIsInstalledProsthesis(item)
|
||||
return false
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,14 +22,15 @@ function TocOperateLocal(_, patient, surgeon, part_name, use_oven)
|
||||
end
|
||||
|
||||
function TocEquipProsthesisLocal(_, patient, surgeon, part_name)
|
||||
-- TODO probably completely broken for MP
|
||||
-- TODO probably completely broken for MP
|
||||
-- TODO this is really janky
|
||||
local surgeon_inventory = surgeon:getInventory()
|
||||
local prosthesis_to_equip = surgeon_inventory:getItemFromType('TOC.MetalHand') or
|
||||
surgeon_inventory:getItemFromType('TOC.MetalHook') or
|
||||
surgeon_inventory:getItemFromType('TOC.WoodenHook')
|
||||
local prosthesis_to_equip = surgeon_inventory:getItemFromType('TOC.MetalHand') or
|
||||
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))))
|
||||
end
|
||||
ISTimedActionQueue.add(ISUninstallProsthesis:new(patient, equipped_prosthesis,
|
||||
patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name))))
|
||||
end
|
||||
|
||||
@@ -11,58 +11,59 @@ function ISBaseTimedAction:adjustMaxTime(maxTime)
|
||||
-- TODO Make the malus for time a little less awful and add some other malus, like fitness and stuff
|
||||
|
||||
print("TOC: Input max time " .. tostring(maxTime))
|
||||
local original_max_time = og_ISEquipTimedActionAdjustMaxTime(self, maxTime)
|
||||
|
||||
local original_max_time = og_ISEquipTimedActionAdjustMaxTime(self, maxTime)
|
||||
|
||||
print("TOC: Return original max time: " .. tostring(original_max_time))
|
||||
|
||||
if original_max_time ~= -1 then
|
||||
|
||||
|
||||
local modified_max_time = original_max_time
|
||||
|
||||
local part_data = getPlayer():getModData().TOC.Limbs
|
||||
local burn_factor = 1.3
|
||||
local modified_max_time = original_max_time
|
||||
|
||||
local part_data = getPlayer():getModData().TOC.Limbs
|
||||
local burn_factor = 1.3
|
||||
|
||||
|
||||
|
||||
-- if it's -1, it should be instant.
|
||||
-- if it's -1, it should be instant.
|
||||
|
||||
|
||||
-- To make it faster, let's have everything already written in another func
|
||||
local all_body_parts = GetBodyParts()
|
||||
-- To make it faster, let's have everything already written in another func
|
||||
local all_body_parts = GetBodyParts()
|
||||
|
||||
|
||||
-- TODO this gets awfully slow really quick, doesn't even make much sense.
|
||||
for _, part_name in ipairs(all_body_parts) do
|
||||
-- TODO this gets awfully slow really quick, doesn't even make much sense.
|
||||
for _, part_name in ipairs(all_body_parts) do
|
||||
|
||||
if part_data[part_name].is_cut then
|
||||
|
||||
if part_data[part_name].is_prosthesis_equipped then
|
||||
modified_max_time = modified_max_time * part_data[part_name].equipped_prosthesis.prosthesis_factor
|
||||
if part_data[part_name].is_cut then
|
||||
|
||||
if part_data[part_name].is_prosthesis_equipped then
|
||||
modified_max_time = modified_max_time * part_data[part_name].equipped_prosthesis.prosthesis_factor
|
||||
|
||||
|
||||
else
|
||||
modified_max_time = modified_max_time * 1.5 -- TODO make this lower
|
||||
else
|
||||
modified_max_time = modified_max_time * 1.5 -- TODO make this lower
|
||||
end
|
||||
if part_data[part_name].is_cauterized then
|
||||
modified_max_time = modified_max_time * burn_factor
|
||||
end
|
||||
|
||||
|
||||
-- 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)
|
||||
end
|
||||
|
||||
end
|
||||
if part_data[part_name].is_cauterized then
|
||||
modified_max_time = modified_max_time * burn_factor
|
||||
end
|
||||
|
||||
|
||||
-- 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 )
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if modified_max_time > 10 * original_max_time then modified_max_time = 10 * original_max_time end
|
||||
if modified_max_time > 10 * original_max_time then modified_max_time = 10 * original_max_time end
|
||||
|
||||
|
||||
print("TOC: Modified Max Time " .. modified_max_time)
|
||||
print("TOC: Modified Max Time " .. modified_max_time)
|
||||
|
||||
return modified_max_time
|
||||
return modified_max_time
|
||||
else
|
||||
return original_max_time
|
||||
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
|
||||
@@ -81,11 +79,11 @@ function ISInventoryPane:onMouseDoubleClick(x, y)
|
||||
local item_to_check = self.items[self.mouseOverOption]
|
||||
local player_inventory = getPlayerInventory(self.player).inventory
|
||||
if instanceof(item_to_check, "InventoryItem") then
|
||||
og_ISInventoryPaneOnMouseDoubleClick(self, x,y)
|
||||
elseif CheckIfItemIsAmputatedLimb(item_to_check.items[1]) or CheckIfItemIsProsthesis(item_to_check.items[1]) then
|
||||
og_ISInventoryPaneOnMouseDoubleClick(self, x, y)
|
||||
elseif CheckIfItemIsAmputatedLimb(item_to_check.items[1]) or CheckIfItemIsProsthesis(item_to_check.items[1]) then
|
||||
print("TOC: Can't double click this item")
|
||||
else
|
||||
og_ISInventoryPaneOnMouseDoubleClick(self, x,y)
|
||||
og_ISInventoryPaneOnMouseDoubleClick(self, x, y)
|
||||
|
||||
end
|
||||
|
||||
@@ -93,17 +91,16 @@ function ISInventoryPane:onMouseDoubleClick(x, y)
|
||||
|
||||
end
|
||||
|
||||
|
||||
local og_ISInventoryPaneGetActualItems = ISInventoryPane.getActualItems
|
||||
function ISInventoryPane.getActualItems(items)
|
||||
|
||||
-- TODO add an exception for installed prosthesis, make them unequippable automatically from here and get the correct obj
|
||||
|
||||
|
||||
local ret = og_ISInventoryPaneGetActualItems(items)
|
||||
|
||||
-- This is gonna be slower than just overriding the function but hey it's more compatible
|
||||
|
||||
for i=1, #ret do
|
||||
for i = 1, #ret do
|
||||
local item_full_type = ret[i]:getFullType()
|
||||
if string.find(item_full_type, "Amputation_") or string.find(item_full_type, "Prost_") then
|
||||
table.remove(ret, i)
|
||||
@@ -112,17 +109,16 @@ function ISInventoryPane.getActualItems(items)
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
local og_ISInventoryPaneContextMenuOnInspectClothing = ISInventoryPaneContextMenu.onInspectClothing
|
||||
ISInventoryPaneContextMenu.onInspectClothing = function(playerObj, clothing)
|
||||
local og_ISInventoryPaneContextMenuOnInspectClothing = ISInventoryPaneContextMenu.onInspectClothing
|
||||
ISInventoryPaneContextMenu.onInspectClothing = function(playerObj, clothing)
|
||||
|
||||
-- Inspect menu bypasses getActualItems, so we need to add that workaround here too
|
||||
local clothing_full_type = clothing:getFullType()
|
||||
if not string.find(clothing_full_type, "Amputation_") then
|
||||
|
||||
|
||||
og_ISInventoryPaneContextMenuOnInspectClothing(playerObj, clothing)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -134,7 +130,7 @@ function ISEquipWeaponAction:perform()
|
||||
local part_data = self.character:getModData().TOC.Limbs
|
||||
local can_be_held = {}
|
||||
|
||||
for _, side in ipairs (TOC_sides) do
|
||||
for _, side in ipairs(TOC_sides) do
|
||||
can_be_held[side] = true
|
||||
|
||||
if part_data[side .. "_Hand"].is_cut then
|
||||
@@ -160,8 +156,8 @@ function ISEquipWeaponAction:perform()
|
||||
end
|
||||
else
|
||||
if (can_be_held["Right"] and not can_be_held["Left"]) or
|
||||
(not can_be_held["Right"] and can_be_held["Left"]) or
|
||||
(not can_be_held["Left"] and not can_be_held["Right"]) then
|
||||
(not can_be_held["Right"] and can_be_held["Left"]) or
|
||||
(not can_be_held["Left"] and not can_be_held["Right"]) then
|
||||
self.character:dropHandItems()
|
||||
|
||||
end
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -12,27 +12,23 @@ local function PrerenderFuncMP()
|
||||
if confirm_ui_mp.responseReceive then
|
||||
if not confirm_ui_mp.responseCan then
|
||||
getPlayer():Say("I can't do that !")
|
||||
confirm_ui_mp.responseReceive = false
|
||||
confirm_ui_mp:close()
|
||||
confirm_ui_mp.responseReceive = false
|
||||
confirm_ui_mp:close()
|
||||
return false;
|
||||
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,17 +41,20 @@ 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
|
||||
else -- Not cut
|
||||
name = "media/ui/TOC/" .. part_name .. "/Base.png"
|
||||
end
|
||||
|
||||
@@ -68,10 +67,6 @@ local function GetImageName(part_name, toc_data)
|
||||
return name
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------------------------
|
||||
-- Check functions
|
||||
|
||||
@@ -81,26 +76,24 @@ 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
|
||||
|
||||
local function IsAmputatedLimbHealed(part_data)
|
||||
return part_data.is_cut and not part_data.is_cicatrized and part_data.is_amputation_shown
|
||||
return part_data.is_cut and not part_data.is_cicatrized and part_data.is_amputation_shown
|
||||
|
||||
end
|
||||
|
||||
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()
|
||||
end
|
||||
|
||||
|
||||
|
||||
local function IsPartBitten(part_data, part_name)
|
||||
return not part_data.is_cut and
|
||||
getPlayer():getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name)):bitten()
|
||||
end
|
||||
|
||||
local function FindMinMax(lv)
|
||||
local min, max
|
||||
@@ -138,23 +131,18 @@ local function FindMinMax(lv)
|
||||
return min, max;
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------------------------------
|
||||
-- On Click Functions
|
||||
local function OnClickTocMainUI(button, args)
|
||||
|
||||
desc_ui:open()
|
||||
desc_ui:setPositionPixel(main_ui:getRight(), main_ui:getY())
|
||||
SetupTocDescUI(main_ui.surgeon, main_ui.patient, args.toc_data, args.part_name) -- surgeon is generic.
|
||||
|
||||
SetupTocDescUI(main_ui.surgeon, main_ui.patient, args.toc_data, args.part_name) -- surgeon is generic.
|
||||
|
||||
end
|
||||
|
||||
local function OnClickTocDescUI(button, args)
|
||||
-- Gets every arg from main
|
||||
-- Gets every arg from main
|
||||
|
||||
local patient = desc_ui.patient
|
||||
local surgeon = desc_ui.surgeon
|
||||
@@ -168,29 +156,30 @@ local function OnClickTocDescUI(button, args)
|
||||
|
||||
elseif args.option == "Equip" then
|
||||
TryTocAction(_, desc_ui.part_name, "Equip", surgeon, patient)
|
||||
-- TODO probably completely broken for MP
|
||||
-- TODO probably completely broken for MP
|
||||
-- TODO this is really janky
|
||||
|
||||
elseif args.option == "Unequip" then
|
||||
TryTocAction(_, desc_ui.part_name, "Unequip", surgeon, patient)
|
||||
|
||||
elseif args.option == "Nothing" then
|
||||
print("Just do nothing") -- TODO workaround
|
||||
print("Just do nothing") -- TODO workaround
|
||||
end
|
||||
main_ui:close()
|
||||
|
||||
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
|
||||
@@ -198,7 +187,7 @@ function OnClickTocConfirmUIMP(button, args)
|
||||
elseif confirm_ui_mp.actionAct == "Equip" and args.option == "yes" then
|
||||
print("Equip mp comp")
|
||||
|
||||
|
||||
|
||||
elseif confirm_ui_mp.actionAct == "Unequip" and args.option == "yes" then
|
||||
print("Unequip mp comp")
|
||||
|
||||
@@ -210,8 +199,6 @@ function OnClickTocConfirmUIMP(button, args)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------
|
||||
|
||||
-- CREATE UI SECTION
|
||||
@@ -260,7 +247,7 @@ function CreateTocDescUI()
|
||||
desc_ui:addText("textTitle", "Right arm", "Large", "Center")
|
||||
desc_ui:nextLine()
|
||||
|
||||
desc_ui:addText("textLV2", "Level 3/10", _, "Center")
|
||||
desc_ui:addText("textLV2", "Level 3/10", _, "Center")
|
||||
desc_ui:nextLine()
|
||||
|
||||
desc_ui:addText("textLV", "Next LV:", _, "Right")
|
||||
@@ -283,12 +270,11 @@ function CreateTocDescUI()
|
||||
desc_ui:addEmpty()
|
||||
desc_ui:nextLine()
|
||||
|
||||
desc_ui:addButton("b1", "Operate", OnClickTocDescUI) -- TODO this is just temporary
|
||||
desc_ui:addButton("b1", "Operate", OnClickTocDescUI) -- TODO this is just temporary
|
||||
|
||||
desc_ui:saveLayout()
|
||||
end
|
||||
|
||||
|
||||
function CreateTocConfirmUIMP()
|
||||
confirm_ui_mp = NewUI()
|
||||
confirm_ui_mp.responseReceive = false
|
||||
@@ -316,7 +302,7 @@ function CreateTocConfirmUIMP()
|
||||
confirm_ui_mp:addEmpty();
|
||||
confirm_ui_mp:addButton("b2", "No", OnClickTocConfirmUIMP);
|
||||
confirm_ui_mp:addEmpty();
|
||||
|
||||
|
||||
confirm_ui_mp:nextLine();
|
||||
confirm_ui_mp:addEmpty();
|
||||
|
||||
@@ -336,16 +322,15 @@ function OnCreateTheOnlyCureUI()
|
||||
main_ui:close()
|
||||
end
|
||||
|
||||
|
||||
-----------------------------------------
|
||||
-- Setup stuff with variables and shit
|
||||
-- Setup stuff with variables and shit
|
||||
|
||||
function SetupTocMainUI(surgeon, patient, toc_data)
|
||||
|
||||
main_ui.surgeon = surgeon -- we shouldn't need an arg for this
|
||||
main_ui.surgeon = surgeon -- we shouldn't need an arg for this
|
||||
main_ui.patient = patient
|
||||
|
||||
if toc_data then
|
||||
if toc_data then
|
||||
main_ui["b11"]:addArg("toc_data", toc_data)
|
||||
main_ui["b12"]:addArg("toc_data", toc_data)
|
||||
main_ui["b21"]:addArg("toc_data", toc_data)
|
||||
@@ -355,10 +340,10 @@ function SetupTocMainUI(surgeon, patient, toc_data)
|
||||
|
||||
main_ui["b11"]:setPath(GetImageName("Right_UpperArm", toc_data))
|
||||
main_ui["b12"]:setPath(GetImageName("Left_UpperArm", toc_data))
|
||||
|
||||
|
||||
main_ui["b21"]:setPath(GetImageName("Right_LowerArm", toc_data))
|
||||
main_ui["b22"]:setPath(GetImageName("Left_LowerArm", toc_data))
|
||||
|
||||
|
||||
main_ui["b31"]:setPath(GetImageName("Right_Hand", toc_data))
|
||||
main_ui["b32"]:setPath(GetImageName("Left_Hand", toc_data))
|
||||
|
||||
@@ -394,12 +379,12 @@ function SetupTocDescUI(surgeon, patient, toc_data, part_name)
|
||||
desc_ui["b1"]:addArg("option", "Equip")
|
||||
desc_ui["b1"]:setVisible(true)
|
||||
end
|
||||
-- Limb cut but still healing
|
||||
-- Limb cut but still healing
|
||||
elseif IsAmputatedLimbHealed(part_data) then
|
||||
-- Limb cut and healed, no prosthesis equipped
|
||||
if part_data.is_operated then
|
||||
|
||||
desc_ui["b1"]:setVisible(false) -- no operate prompt
|
||||
desc_ui["b1"]:setVisible(false) -- no operate prompt
|
||||
|
||||
if part_data.cicatrization_time > 1000 then
|
||||
desc_ui["status"]:setText("Still a long way to go")
|
||||
@@ -430,7 +415,7 @@ function SetupTocDescUI(surgeon, patient, toc_data, part_name)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
elseif IsAmputatedLimbToBeVisible(part_data) then
|
||||
-- Limb cut and not visible (ex: hand after having amputated forearm)
|
||||
desc_ui["status"]:setText("Nothing here")
|
||||
@@ -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
|
||||
@@ -527,14 +514,14 @@ function ISNewHealthPanel.onClick_TOC(button)
|
||||
--SetupTocConfirmUI(surgeon, surgeon)
|
||||
else
|
||||
-- MP stuff, try to get the other player data and display it on the surgeon display
|
||||
sendClientCommand(surgeon, "TOC", "GetPlayerData", {surgeon:getOnlineID(), patient:getOnlineID()})
|
||||
sendClientCommand(surgeon, "TOC", "GetPlayerData", { surgeon:getOnlineID(), patient:getOnlineID() })
|
||||
SetupTocMainUI(surgeon, patient, MP_other_player_toc_data)
|
||||
--SetupTocConfirmUI(surgeon, patient)
|
||||
end
|
||||
else
|
||||
-- This is when surgeon doesnt exist for some reason.
|
||||
SetupTocMainUI(patient, patient, patient:getModData().TOC)
|
||||
-- SetupTocConfirmUI(patient, patient)
|
||||
-- SetupTocConfirmUI(patient, patient)
|
||||
end
|
||||
|
||||
main_ui:toggle()
|
||||
@@ -542,14 +529,14 @@ function ISNewHealthPanel.onClick_TOC(button)
|
||||
|
||||
end
|
||||
|
||||
|
||||
function ISHealthPanel:createChildren()
|
||||
ISHealthPanel_createChildren(self)
|
||||
|
||||
self.fitness:setWidth(self.fitness:getWidth()/1.5)
|
||||
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)
|
||||
Events.OnCreateUI.Add(OnCreateTheOnlyCureUI)
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
-- Helper for DropItem
|
||||
function TheOnlyCure.CheckIfCanPickUpItem(toc_data, side, limb, secondary_limb)
|
||||
|
||||
|
||||
|
||||
-- TODO we can use this when uninstall prost or when cutting
|
||||
local full_primary_limb = side .. 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
|
||||
(toc_data[full_secondary_limb].is_cut and not toc_data[full_secondary_limb].is_prosthesis_equipped)
|
||||
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)
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
function TheOnlyCure.CheckIfPlayerIsInfected(player, toc_data)
|
||||
@@ -27,13 +28,13 @@ function TheOnlyCure.CheckIfPlayerIsInfected(player, toc_data)
|
||||
part_data.is_infected = true
|
||||
player:transmitModData()
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
for _, v in ipairs(GetOtherBodyPartTypes()) do
|
||||
if body_damage:getBodyPart(v):bitten() then
|
||||
toc_data.Limbs.is_other_bodypart_infected = true -- Even one is enough, stop cycling if we find it
|
||||
if body_damage:getBodyPart(v):bitten() then
|
||||
toc_data.Limbs.is_other_bodypart_infected = true -- Even one is enough, stop cycling if we find it
|
||||
player:transmitModData()
|
||||
break
|
||||
end
|
||||
@@ -50,7 +51,7 @@ function TheOnlyCure.UpdatePlayerHealth(player, part_data)
|
||||
for i, part_name in pairs(GetBodyParts()) do
|
||||
if part_data[part_name].is_cut then
|
||||
TheOnlyCure.SetHealthStatusForBodyPart(part_data, part_name, player)
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -78,7 +79,7 @@ function TheOnlyCure.SetHealthStatusForBodyPart(part_data, part_name, player)
|
||||
|
||||
-- TODO Bandages should have some disadvantage when not operated... Like getting drenched or something
|
||||
if body_part_type:bandaged() then
|
||||
is_bandaged = true -- this is useless
|
||||
is_bandaged = true -- this is useless
|
||||
bandage_life = body_part_type:getBandageLife()
|
||||
bandage_type = body_part_type:getBandageType()
|
||||
|
||||
@@ -133,7 +134,7 @@ function TheOnlyCure.CheckIfOtherLimbsAreInfected(part_data, part_name)
|
||||
local body_parts = GetBodyParts()
|
||||
body_parts[part_name] = nil
|
||||
|
||||
for _,v in pairs(body_parts) do
|
||||
for _, v in pairs(body_parts) do
|
||||
if part_data[v].is_infected then
|
||||
return true
|
||||
end
|
||||
@@ -141,7 +142,6 @@ function TheOnlyCure.CheckIfOtherLimbsAreInfected(part_data, part_name)
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
-- MAIN UPDATE FUNCTIONS
|
||||
|
||||
function TheOnlyCure.UpdateEveryOneMinute()
|
||||
@@ -182,15 +182,14 @@ function TheOnlyCure.UpdateEveryTenMinutes()
|
||||
-- Updates the cicatrization time
|
||||
for _, part_name in pairs(GetBodyParts()) do
|
||||
if part_data[part_name].is_cut and not part_data[part_name].is_cicatrized then
|
||||
part_data[part_name].cicatrization_time = part_data[part_name].cicatrization_time - 1 -- TODO Make it more "dynamic"
|
||||
part_data[part_name].cicatrization_time = part_data[part_name].cicatrization_time - 1 -- TODO Make it more "dynamic"
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
player:transmitModData()
|
||||
end
|
||||
|
||||
|
||||
Events.EveryTenMinutes.Add(TheOnlyCure.UpdateEveryTenMinutes)
|
||||
Events.EveryOneMinute.Add(TheOnlyCure.UpdateEveryOneMinute)
|
||||
Events.EveryOneMinute.Add(TheOnlyCure.UpdateEveryOneMinute)
|
||||
|
||||
@@ -5,7 +5,7 @@ function TocSetCorrectTextureForAmputation(item, player)
|
||||
local texture_string = human_visual:getSkinTexture()
|
||||
local matched_index = string.match(texture_string, "%d$")
|
||||
print("TOC: Setting texture " .. matched_index)
|
||||
item:getVisual():setTextureChoice(tonumber(matched_index - 1)) -- TODO why is it correct with -1?
|
||||
item:getVisual():setTextureChoice(tonumber(matched_index - 1)) -- TODO why is it correct with -1?
|
||||
end
|
||||
|
||||
function TocSetBloodOnAmputation(player, body_part)
|
||||
@@ -13,14 +13,14 @@ function TocSetBloodOnAmputation(player, body_part)
|
||||
|
||||
local body_part_type = body_part:getType()
|
||||
local blood_body_part_type
|
||||
if body_part_type == BodyPartType.Hand_R then
|
||||
if body_part_type == BodyPartType.Hand_R then
|
||||
blood_body_part_type = BloodBodyPartType.ForeArm_R
|
||||
elseif body_part_type == BodyPartType.Hand_L then
|
||||
blood_body_part_type = BloodBodyPartType.ForeArm_L
|
||||
elseif body_part_type == BodyPartType.Forearm_L or body_part_type == BodyPartType.UpperArm_L then
|
||||
blood_body_part_type = BloodBodyPartType.UpperArm_L
|
||||
elseif body_part_type == BodyPartType.Forearm_R or body_part_type == BodyPartType.UpperArm_R then
|
||||
blood_body_part_type= BloodBodyPartType.UpperArm_R
|
||||
blood_body_part_type = BloodBodyPartType.UpperArm_R
|
||||
end
|
||||
|
||||
|
||||
@@ -29,4 +29,4 @@ function TocSetBloodOnAmputation(player, body_part)
|
||||
player:addBlood(blood_body_part_type, false, true, false)
|
||||
player:addBlood(BloodBodyPartType.Torso_Lower, false, true, false)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,8 +2,8 @@ if not TheOnlyCure then
|
||||
TheOnlyCure = {}
|
||||
end
|
||||
|
||||
TOC_sides = {"Left", "Right"}
|
||||
TOC_limbs = {"Hand", "LowerArm", "UpperArm"}
|
||||
TOC_sides = { "Left", "Right" }
|
||||
TOC_limbs = { "Hand", "LowerArm", "UpperArm" }
|
||||
|
||||
|
||||
function TheOnlyCure.InitTheOnlyCure(_, player)
|
||||
@@ -13,7 +13,7 @@ function TheOnlyCure.InitTheOnlyCure(_, player)
|
||||
TocSetInitData(mod_data, player)
|
||||
else
|
||||
TocCheckCompatibilityWithOlderVersions(mod_data)
|
||||
TocUpdateBaseData(mod_data) -- Since it's gonna be common to update stuff
|
||||
TocUpdateBaseData(mod_data) -- Since it's gonna be common to update stuff
|
||||
end
|
||||
|
||||
end
|
||||
@@ -22,7 +22,7 @@ function TocSetInitData(mod_data, player)
|
||||
|
||||
print("TOC: Creating mod_data.TOC")
|
||||
|
||||
mod_data.TOC = {
|
||||
mod_data.TOC = {
|
||||
|
||||
Limbs = {
|
||||
Right_Hand = {},
|
||||
@@ -35,7 +35,7 @@ function TocSetInitData(mod_data, player)
|
||||
is_other_bodypart_infected = false
|
||||
},
|
||||
Prosthesis = {
|
||||
WoodenHook = {
|
||||
WoodenHook = {
|
||||
Right_Hand = {},
|
||||
Right_LowerArm = {},
|
||||
Right_UpperArm = {},
|
||||
@@ -98,10 +98,10 @@ function TocSetInitData(mod_data, player)
|
||||
mod_data.TOC.Limbs[part_name].is_cicatrized = false
|
||||
mod_data.TOC.Limbs[part_name].is_cauterized = false
|
||||
mod_data.TOC.Limbs[part_name].is_amputation_shown = false
|
||||
|
||||
|
||||
mod_data.TOC.Limbs[part_name].cicatrization_time = 0
|
||||
|
||||
|
||||
|
||||
|
||||
mod_data.TOC.Limbs[part_name].is_prosthesis_equipped = false
|
||||
mod_data.TOC.Limbs[part_name].equipped_prosthesis = {}
|
||||
|
||||
@@ -153,13 +153,13 @@ end
|
||||
|
||||
function TocUpdateBaseData(mod_data)
|
||||
|
||||
local prosthesis_list = {"WoodenHook", "MetalHook", "MetalHand"}
|
||||
local prosthesis_list = { "WoodenHook", "MetalHook", "MetalHand" }
|
||||
|
||||
|
||||
|
||||
local accepted_prosthesis_hand = {"WoodenHook", "MetalHook", "MetalHand"}
|
||||
local accepted_prosthesis_lowerarm = {"WoodenHook", "MetalHook", "MetalHand"}
|
||||
local accepted_prosthesis_upperarm = {} -- For future stuff
|
||||
local accepted_prosthesis_hand = { "WoodenHook", "MetalHook", "MetalHand" }
|
||||
local accepted_prosthesis_lowerarm = { "WoodenHook", "MetalHook", "MetalHand" }
|
||||
local accepted_prosthesis_upperarm = {} -- For future stuff
|
||||
|
||||
for _, side in ipairs(TOC_sides) do
|
||||
for _, limb in ipairs(TOC_limbs) do
|
||||
@@ -169,47 +169,51 @@ function TocUpdateBaseData(mod_data)
|
||||
if limb == "Hand" then
|
||||
mod_data.TOC.Limbs[part_name].cicatrization_base_time = 1700
|
||||
mod_data.TOC.Limbs[part_name].depends_on = {}
|
||||
|
||||
|
||||
|
||||
|
||||
mod_data.TOC.Prosthesis.Accepted_Prosthesis[part_name] = accepted_prosthesis_hand
|
||||
mod_data.TOC.Prosthesis["WoodenHook"][part_name].prosthesis_factor = 1.3
|
||||
mod_data.TOC.Prosthesis["MetalHook"][part_name].prosthesis_factor = 1.2
|
||||
mod_data.TOC.Prosthesis["MetalHand"][part_name].prosthesis_factor = 1.1
|
||||
|
||||
|
||||
|
||||
|
||||
elseif limb == "LowerArm" then
|
||||
mod_data.TOC.Limbs[part_name].cicatrization_base_time = 1800
|
||||
mod_data.TOC.Limbs[part_name].depends_on = {side .. "_Hand",}
|
||||
mod_data.TOC.Limbs[part_name].depends_on = { side .. "_Hand", }
|
||||
mod_data.TOC.Prosthesis.Accepted_Prosthesis[part_name] = accepted_prosthesis_lowerarm
|
||||
|
||||
|
||||
mod_data.TOC.Prosthesis["WoodenHook"][part_name].prosthesis_factor = 1.35
|
||||
mod_data.TOC.Prosthesis["MetalHook"][part_name].prosthesis_factor = 1.25
|
||||
mod_data.TOC.Prosthesis["MetalHand"][part_name].prosthesis_factor = 1.15
|
||||
elseif limb == "UpperArm" then
|
||||
mod_data.TOC.Limbs[part_name].cicatrization_base_time = 2000
|
||||
mod_data.TOC.Limbs[part_name].depends_on = {side .. "_Hand", side .. "_LowerArm",}
|
||||
mod_data.TOC.Limbs[part_name].depends_on = { side .. "_Hand", side .. "_LowerArm", }
|
||||
mod_data.TOC.Prosthesis.Accepted_Prosthesis[part_name] = accepted_prosthesis_upperarm
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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")
|
||||
@@ -261,7 +265,7 @@ function TheOnlyCure.CutLimb(part_name, surgeon_factor, bandage_table, painkille
|
||||
part_data[part_name].is_cut = true
|
||||
part_data[part_name].is_amputation_shown = true
|
||||
part_data[part_name].cicatrization_time = part_data[part_name].cicatrization_base_time - surgeon_factor * 50
|
||||
|
||||
|
||||
-- Heal the infection here
|
||||
local body_damage = player:getBodyDamage()
|
||||
if part_data[part_name].is_infected and body_damage:getInfectionLevel() < 20 then
|
||||
@@ -327,7 +331,7 @@ function TheOnlyCure.OperateLimb(part_name, surgeon_factor, use_oven)
|
||||
for _, depended_v in pairs(part_data[part_name].depends_on) do
|
||||
part_data[depended_v].is_operated = true
|
||||
part_data[depended_v].cicatrization_time = part_data[depended_v].cicatrization_time - (surgeon_factor * 200)
|
||||
if use_oven then part_data[depended_v].is_cauterized = true end -- TODO does this make sense?
|
||||
if use_oven then part_data[depended_v].is_cauterized = true end -- TODO does this make sense?
|
||||
|
||||
end
|
||||
|
||||
@@ -343,7 +347,7 @@ function TryTocAction(_, part_name, action, surgeon, patient)
|
||||
|
||||
-- Check if SinglePlayer
|
||||
if not isServer() and not isClient() then
|
||||
|
||||
|
||||
if action == "Cut" then
|
||||
TocCutLocal(_, surgeon, surgeon, part_name)
|
||||
elseif action == "Operate" then
|
||||
@@ -376,11 +380,12 @@ function TryTocAction(_, part_name, action, surgeon, patient)
|
||||
AskCanOperateLimb(patient, part_name)
|
||||
elseif action == "Equip" then
|
||||
local surgeon_inventory = surgeon:getInventory()
|
||||
local prosthesis_to_equip = surgeon_inventory:getItemFromType('TOC.MetalHand') or
|
||||
surgeon_inventory:getItemFromType('TOC.MetalHook') or
|
||||
surgeon_inventory:getItemFromType('TOC.WoodenHook')
|
||||
local prosthesis_to_equip = surgeon_inventory:getItemFromType('TOC.MetalHand') or
|
||||
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)
|
||||
Events.OnGameBoot.Add(TheOnlyCure.DeclareTraits)
|
||||
|
||||
@@ -51,13 +51,12 @@ function ISCutLimb:start()
|
||||
|
||||
body_damage_part:setBleeding(true)
|
||||
body_damage_part:setCut(true)
|
||||
body_damage_part:setBleedingTime(ZombRand(10,20))
|
||||
body_damage_part:setBleedingTime(ZombRand(10, 20))
|
||||
|
||||
|
||||
|
||||
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,10 +66,11 @@ function ISCutLimb:findArgs()
|
||||
local bandage_table = {
|
||||
use_bandage = false,
|
||||
bandage_type = nil,
|
||||
is_bandage_sterilized = nil}
|
||||
is_bandage_sterilized = nil
|
||||
}
|
||||
local painkiller_table = {}
|
||||
|
||||
|
||||
|
||||
local bandage = self.surgeon:getInventory():FindAndReturn('Bandage')
|
||||
local sterilized_bandage = self.surgeon:getInventory():FindAndReturn('AlcoholBandage')
|
||||
|
||||
@@ -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)
|
||||
@@ -146,4 +144,4 @@ function ISCutLimb:new(patient, surgeon, part_name)
|
||||
o.fromHotbar = true
|
||||
if o.patient:isTimedActionInstant() then o.maxTime = 1 end
|
||||
return o
|
||||
end
|
||||
end
|
||||
|
||||
@@ -47,9 +47,9 @@ function ISInstallProsthesis:perform()
|
||||
|
||||
|
||||
if part_name then
|
||||
toc_data.Limbs[part_name].is_prosthesis_equipped = true -- TODO should we show that the hand has a prost too if it's installed in the forearm?
|
||||
toc_data.Limbs[part_name].is_prosthesis_equipped = true -- TODO should we show that the hand has a prost too if it's installed in the forearm?
|
||||
toc_data.Limbs[part_name].equipped_prosthesis = toc_data.Prosthesis[prosthesis_base_name][part_name]
|
||||
|
||||
|
||||
self.character:getInventory():Remove(self.item)
|
||||
self.character:setWornItem(self.cloth:getBodyLocation(), self.cloth)
|
||||
end
|
||||
|
||||
@@ -44,7 +44,7 @@ function ISOperateLimb:findArgs()
|
||||
surgeon_factor = surgeon_factor + 6
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if self.surgeon:getDescriptor():getProfession() == "surgeon" then surgeon_factor = surgeon_factor + 10 end
|
||||
if self.surgeon:getDescriptor():getProfession() == "doctor" then surgeon_factor = surgeon_factor + 5 end
|
||||
if self.surgeon:getDescriptor():getProfession() == "nurse" then surgeon_factor = surgeon_factor + 2 end
|
||||
@@ -88,16 +88,16 @@ function ISOperateLimb:new(patient, surgeon, kit, part_name, use_oven)
|
||||
--o.use_oven = use_oven;
|
||||
if use_oven then
|
||||
o.maxTime = 30
|
||||
else
|
||||
else
|
||||
o.maxTime = 200 - (surgeon:getPerkLevel(Perks.Doctor) * 10)
|
||||
end
|
||||
o.stopOnWalk = true
|
||||
o.stopOnRun = true
|
||||
o.ignoreHandsWounds = false
|
||||
o.fromHotbar = true
|
||||
if o.patient:isTimedActionInstant()then
|
||||
o.maxTime = 1
|
||||
if o.patient:isTimedActionInstant() then
|
||||
o.maxTime = 1
|
||||
end
|
||||
|
||||
|
||||
return o
|
||||
end
|
||||
|
||||
@@ -46,7 +46,7 @@ function ISUninstallProsthesis:perform()
|
||||
local accepting_body_parts = GetAcceptingProsthesisBodyPartTypes()
|
||||
|
||||
if accepting_body_parts == nil then
|
||||
return -- should never happen
|
||||
return -- should never happen
|
||||
end
|
||||
|
||||
for _, v in ipairs(GetAcceptingProsthesisBodyPartTypes()) do
|
||||
@@ -54,7 +54,7 @@ function ISUninstallProsthesis:perform()
|
||||
local part_name = TocGetPartNameFromBodyPartType(v)
|
||||
|
||||
print("Found prost in " .. part_name)
|
||||
if part_name then
|
||||
if part_name then
|
||||
toc_data.Limbs[part_name].is_prosthesis_equipped = false
|
||||
local item_full_type = self.item:getFullType()
|
||||
print("Searching for " .. item_full_type)
|
||||
@@ -67,10 +67,10 @@ function ISUninstallProsthesis:perform()
|
||||
self.character:setWornItem(self.item:getBodyLocation(), nil)
|
||||
self.character:getInventory():Remove(self.item)
|
||||
self.character:transmitModData()
|
||||
|
||||
|
||||
-- needed to remove from queue / start next.
|
||||
ISBaseTimedAction.perform(self)
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -104,5 +104,3 @@ function ISUninstallProsthesis:new(character, item, bodyPart)
|
||||
if o.character:isTimedActionInstant() then o.maxTime = 1; end
|
||||
return o;
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -18,25 +18,25 @@ Commands["GetPlayerData"] = function(_, arg)
|
||||
local surgeon_id = arg[1]
|
||||
local patient_id = arg[2]
|
||||
local patient = getPlayerByOnlineID(arg[2])
|
||||
sendServerCommand(patient, "TOC", "GivePlayerData", {surgeon_id, patient_id})
|
||||
sendServerCommand(patient, "TOC", "GivePlayerData", { surgeon_id, patient_id })
|
||||
end
|
||||
|
||||
Commands["SendPlayerData"] = function(_, arg)
|
||||
local surgeon = getPlayerByOnlineID(arg[1])
|
||||
local surgeon_id = arg[1]
|
||||
local toc_data = arg[2]
|
||||
sendServerCommand(surgeon, "TOC", "SendTocData", {surgeon_id, toc_data})
|
||||
sendServerCommand(surgeon, "TOC", "SendTocData", { surgeon_id, toc_data })
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- CHEATING STUFF
|
||||
Commands["AskToResetEverything"] = function (_, arg)
|
||||
Commands["AskToResetEverything"] = function(_, arg)
|
||||
local clicked_player = getPlayerByOnlineID(arg[1])
|
||||
local clicked_player_id = arg[1]
|
||||
|
||||
|
||||
sendServerCommand(clicked_player, "TOC", "AcceptResetEverything", {clicked_player_id})
|
||||
sendServerCommand(clicked_player, "TOC", "AcceptResetEverything", { clicked_player_id })
|
||||
|
||||
end
|
||||
|
||||
@@ -52,4 +52,3 @@ local function OnTocClientCommand(module, command, player, args)
|
||||
end
|
||||
|
||||
Events.OnClientCommand.Add(OnTocClientCommand)
|
||||
|
||||
|
||||
@@ -6,4 +6,4 @@ Events.OnGameStart.Add(function()
|
||||
print("checkbox1 = ", options.box1)
|
||||
print("checkbox2 = ", options.box2)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user