More basic stuff for prosthesis

This commit is contained in:
ZioPao
2023-11-10 19:00:21 +01:00
parent ca42c383d1
commit e8d4a37fdc
11 changed files with 125 additions and 11 deletions

View File

@@ -8,4 +8,4 @@
<m_AllowRandomTint>false</m_AllowRandomTint>
<textureChoices>metal_base</textureChoices>
<textureChoices>metal_base</textureChoices>
</clothingItem>
</clothingItem>

View File

@@ -0,0 +1,11 @@
<?xml version='1.0' encoding='UTF-8'?>
<clothingItem>
<m_MaleModel>Prosthesis\hookArm_R_F</m_MaleModel>
<m_FemaleModel>Prosthesis\hookArm_R_F</m_FemaleModel>
<m_GUID>8ee7e1bc-2c21-428e-a15d-760d98df973d</m_GUID>
<m_Static>false</m_Static>
<m_AllowRandomTint>false</m_AllowRandomTint>
<textureChoices>metal_base</textureChoices>
<textureChoices>metal_base</textureChoices>
</clothingItem>

View File

@@ -31,6 +31,9 @@
<path>media/clothing/clothingItems/Prost_Hook_L.xml</path>
<guid>05338f5e-e984-49c2-be79-81af9ae8e818</guid>
</files>
<files>
<path>media/clothing/clothingItems/Prost_Hook_R.xml</path>
<guid>8ee7e1bc-2c21-428e-a15d-760d98df973d</guid>
</files>
</fileGuidTable>

View File

@@ -1 +1,62 @@
local CommonMethods = require("TOC_Common")
local PlayerHandler = require("Handlers/TOC_PlayerHandler")
-------------------------
---@class ProsthesisHandler
local ProsthesisHandler = {}
function ProsthesisHandler.SetHealthPanelTexture()
-- TODO do it
end
---comment
---@param bodyLocation string
---@return boolean
function ProsthesisHandler.CheckIfEquippable(bodyLocation)
print("Current item is a prosthesis")
local side = CommonMethods.GetSide(bodyLocation)
for i=1, #PlayerHandler.amputatedLimbs do
local limbName = PlayerHandler.amputatedLimbs[i]
if string.contains(limbName, side) and not string.contains(limbName, "UpperArm") then
return true
end
end
-- No acceptable cut limbs
getPlayer():Say("I can't equip this")
return false
end
--* Overrides *--
function ISWearClothing:isValid()
local bodyLocation = self.item:getBodyLocation()
if not string.contains(bodyLocation, "TOC_ArmProst") then
return true
else
return ProsthesisHandler.CheckIfEquippable(bodyLocation)
end
end
local og_ISClothingExtraAction_isValid = ISClothingExtraAction.isValid
function ISClothingExtraAction:isValid()
local bodyLocation = self.item:getBodyLocation()
if og_ISClothingExtraAction_isValid(self) and not string.contains(bodyLocation, "TOC_ArmProst") then
return true
else
return ProsthesisHandler.CheckIfEquippable(bodyLocation)
end
end
return ProsthesisHandler

View File

@@ -1,10 +1,10 @@
local CommonMethods = {}
---Returns the side for a certain limb
---@param limbName string
---Returns the side for a certain limb or prosthesis
---@param name string
---@return string "L" or "R"
function CommonMethods.GetSide(limbName)
if string.find(limbName, "_L") then return "L" else return "R" end
function CommonMethods.GetSide(name)
if string.find(name, "_L") then return "L" else return "R" end
end
return CommonMethods

View File

@@ -28,7 +28,7 @@ function Main.SetupTraits()
t:addXPBoost(Perks.Strength, -1)
end
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_Insensitive_desc"), false, false)
TraitFactory.setMutualExclusive("Amputee_Hand", "Amputee_LowerArm")
TraitFactory.setMutualExclusive("Amputee_Hand", "Amputee_UpperArm")

View File

@@ -41,8 +41,8 @@ end
function ISHealthPanel.GetHighestAmputation()
-- TODO Cache this instead of doing it here!
ISHealthPanel.highestAmputations = {}
for i=1, #StaticData.LIMBS_STRINGS do
local limbName = StaticData.LIMBS_STRINGS[i]
for i=1, #PlayerHandler.amputatedLimbs do
local limbName = PlayerHandler.amputatedLimbs[i]
local index = CommonMethods.GetSide(limbName)
if PlayerHandler.modDataHandler:getIsCut(limbName) and PlayerHandler.modDataHandler:getIsVisible(limbName) then
ISHealthPanel.highestAmputations[index] = limbName

View File

@@ -1,4 +1,9 @@
ContextMenu_EN = {
ContextMenu_Amputate = "Amputate",
ContextMenu_InstallProstRight = "Install prosthesis on right arm",
ContextMenu_InstallProstLeft = "Install prosthesis on left arm",
}

View File

@@ -1,2 +1,13 @@
UI_EN = {
UI_trait_Amputee_Hand = "Amputated Left Hand",
UI_trait_Amputee_Hand_desc = "",
UI_trait_Amputee_LowerArm = "Amputated Left Forearm",
UI_trait_Amputee_LowerArm_desc = "",
UI_trait_Amputee_UpperArm = "Amputated Left Upper arm",
UI_trait_Amputee_UpperArm_desc = "",
UI_trait_Insensitive = "Insensitive",
UI_trait_Insensitive_desc = ""
}

Binary file not shown.

View File

@@ -120,13 +120,36 @@ module TOC
}
/****************** Clothing that look like a cut limb ******************/
item Prosthesis_Hook_L
item Prost_Hook_L
{
Type = Clothing,
DisplayCategory = Prosthesis,
DisplayName = Hook Arm Test,
DisplayName = Hook Arm Test Left,
ClothingItem = Prost_Hook_L,
ClothingItemExtra = Prost_Hook_R,
ClothingItemExtraOption = InstallProstRight,
clothingExtraSubmenu = InstallProstLeft,
BodyLocation = TOC_ArmProstLeft,
Weight = 0,
CombatSpeedModifier = 0.7,
BloodLocation = UpperArms;UpperBody,
Insulation = 1.0,
WindResistance = 1.0,
WaterResistance = 1.0,
Icon = genericAmputation,
CanHaveHoles = false,
}
item Prost_Hook_R
{
Type = Clothing,
DisplayCategory = Prosthesis,
DisplayName = Hook Arm Test Right,
ClothingItem = Prost_Hook_R,
ClothingItemExtra = Prost_Hook_L,
ClothingItemExtraOption = InstallProstLeft,
clothingExtraSubmenu = InstallProstRight,
BodyLocation = TOC_ArmProstRight,
Weight = 0,
CombatSpeedModifier = 0.7,