Fixes to extra equip and recipes

This commit is contained in:
ZioPao
2023-12-22 23:04:36 -05:00
parent 97b51e1bcf
commit 2606f664bc
6 changed files with 38 additions and 76 deletions

1
.gitignore vendored
View File

@@ -0,0 +1 @@
.vscode/settings.json

View File

@@ -1,7 +1,7 @@
{
"todo-tree.tree.scanMode": "workspace",
"zomboid_user_folder": "C:/Users/picch/Zomboid",
"zomboid_folder": "E:\\Steam\\steamapps\\common\\ProjectZomboid",
"zomboid_folder": "C:\\Program Files (x86)\\Steam\\steamapps\\common\\ProjectZomboid",
"zomboid_server_folder": "E:\\Steam\\steamapps\\common\\Project Zomboid Dedicated Server",
"Lua.diagnostics.globals": [
"ModOptions",

View File

@@ -88,6 +88,8 @@ end
local og_ISWearClothing_isValid = ISWearClothing.isValid
function ISWearClothing:isValid()
local isEquippable = og_ISWearClothing_isValid(self)
-- TODO Do we actually need this?
local isProst = ProsthesisHandler.CheckIfProst(self.item)
if not isProst then return isEquippable end
@@ -111,27 +113,29 @@ local og_ISClothingExtraAction_isValid = ISClothingExtraAction.isValid
---@diagnostic disable-next-line: duplicate-set-field
function ISClothingExtraAction:isValid()
local isEquippable = og_ISClothingExtraAction_isValid(self)
local isProst = ProsthesisHandler.CheckIfProst(self.itemExtra)
if not isProst then return isEquippable end
--the item that we gets is the OG one, so if we're coming from the left one and wanna switch to the right one we're still gonna get the Left bodylocation
local testItem = InventoryItemFactory.CreateItem(self.extra)
local isProst = ProsthesisHandler.CheckIfProst(testItem)
-- Early exit if it's not a prostheesis
if not isProst then return isEquippable end
if isEquippable and isProst then
local bodyLocation = testItem:getBodyLocation()
if isEquippable and string.contains(bodyLocation, bodyLocArmProst) then
isEquippable = ProsthesisHandler.CheckIfEquippable(bodyLocation)
-- Just to let the player know
if not isEquippable then
-- TODO if its in here then it's gonna run at least 2 times
getPlayer():Say(getText("UI_Say_CantEquip"))
end
end
return isEquippable
end
local og_ISClothingExtraAction_stop = ISClothingExtraAction.stop
function ISClothingExtraAction:stop()
og_ISClothingExtraAction_stop(self)
if ProsthesisHandler.CheckIfProst(self.item) then
getPlayer():Say(getText("UI_Say_CantEquip"))
end
end
local og_ISClothingExtraAction_perform = ISClothingExtraAction.perform
function ISClothingExtraAction:perform()

View File

@@ -0,0 +1,4 @@
Recipes_EN = {
Recipe_Craft_Prosthetic_Arm = "Craft Prosthetic Arm",
Recipe_Craft_Prosthetic_Hook = "Craft Prosthetic Hook",
}

View File

@@ -118,46 +118,5 @@ module TOC
Icon = genericAmputation,
CanHaveHoles = false,
}
/****************** Clothing that look like a cut limb ******************/
item Prost_Hook_L
{
Type = Clothing,
DisplayCategory = Prosthesis,
DisplayName = ProstArmHook,
ClothingItem = Prost_Hook_L,
ClothingItemExtra = Prost_Hook_R,
ClothingItemExtraOption = InstallProstRight,
clothingExtraSubmenu = InstallProstLeft,
BodyLocation = TOC_ArmProst_L,
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 = ProstArmHook,
ClothingItem = Prost_Hook_R,
ClothingItemExtra = Prost_Hook_L,
ClothingItemExtraOption = InstallProstLeft,
clothingExtraSubmenu = InstallProstRight,
BodyLocation = TOC_ArmProst_R,
Weight = 0,
CombatSpeedModifier = 0.7,
BloodLocation = UpperArms;UpperBody,
Insulation = 1.0,
WindResistance = 1.0,
WaterResistance = 1.0,
Icon = genericAmputation,
CanHaveHoles = false,
}
}

View File

@@ -7,33 +7,27 @@ module TOC
/*************Craft Prosthetics*******************/
recipe Craft Prosthetic Arm
{
ProstPart_WoodenBase,
ProstPart_WoodenHook,
MetalPipe=4,
Plank=2,
keep [Recipe.GetItemTypes.WeldingMask],
Time: 10.0,
Result: Prost_NormalArm_L,
NeedToBeLearn: true,
CanBeDoneFromFloor: false,
OnGiveXP: NoXP_OnGiveXP,
SkillRequired: FirstAid=2,
Category: Surgeon,
OnCreate:ProsthesisRecipes.OnCreateProsthesis,
Tooltip: Recipe_Tooltip_AssembleProsthesis,
Result:Prost_NormalArm_L,
Time:150.0,
Category:Welding,
OnGiveXP:Recipe.OnGiveXP.MetalWelding10,
NeedToBeLearn:true,
}
recipe Craft Prosthetic Hook
{
ProstPart_WoodenBase,
ProstPart_WoodenHook,
MetalPipe=2,
Plank=2,
keep [Recipe.GetItemTypes.WeldingMask],
Time: 10.0,
Result: Prost_HookArm_L,
NeedToBeLearn: true,
CanBeDoneFromFloor: false,
OnGiveXP: NoXP_OnGiveXP,
SkillRequired: FirstAid=2,
Category: Surgeon,
OnCreate:ProsthesisRecipes.OnCreateProsthesis,
Tooltip: Recipe_Tooltip_AssembleProsthesis,
Result:Prost_HookArm_L,
Time:150.0,
Category:Welding,
OnGiveXP:Recipe.OnGiveXP.MetalWelding10,
NeedToBeLearn:false,
}
}