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", "todo-tree.tree.scanMode": "workspace",
"zomboid_user_folder": "C:/Users/picch/Zomboid", "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", "zomboid_server_folder": "E:\\Steam\\steamapps\\common\\Project Zomboid Dedicated Server",
"Lua.diagnostics.globals": [ "Lua.diagnostics.globals": [
"ModOptions", "ModOptions",

View File

@@ -88,6 +88,8 @@ end
local og_ISWearClothing_isValid = ISWearClothing.isValid local og_ISWearClothing_isValid = ISWearClothing.isValid
function ISWearClothing:isValid() function ISWearClothing:isValid()
local isEquippable = og_ISWearClothing_isValid(self) local isEquippable = og_ISWearClothing_isValid(self)
-- TODO Do we actually need this?
local isProst = ProsthesisHandler.CheckIfProst(self.item) local isProst = ProsthesisHandler.CheckIfProst(self.item)
if not isProst then return isEquippable end if not isProst then return isEquippable end
@@ -111,27 +113,29 @@ local og_ISClothingExtraAction_isValid = ISClothingExtraAction.isValid
---@diagnostic disable-next-line: duplicate-set-field ---@diagnostic disable-next-line: duplicate-set-field
function ISClothingExtraAction:isValid() function ISClothingExtraAction:isValid()
local isEquippable = og_ISClothingExtraAction_isValid(self) local isEquippable = og_ISClothingExtraAction_isValid(self)
local isProst = ProsthesisHandler.CheckIfProst(self.itemExtra)
--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 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 if isEquippable and isProst then
local testItem = InventoryItemFactory.CreateItem(self.extra) local bodyLocation = testItem:getBodyLocation()
local bodyLocation = testItem:getBodyLocation()
if isEquippable and string.contains(bodyLocation, bodyLocArmProst) then
isEquippable = ProsthesisHandler.CheckIfEquippable(bodyLocation) 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 end
return isEquippable return isEquippable
end 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 local og_ISClothingExtraAction_perform = ISClothingExtraAction.perform
function 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, Icon = genericAmputation,
CanHaveHoles = false, 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*******************/ /*************Craft Prosthetics*******************/
recipe Craft Prosthetic Arm recipe Craft Prosthetic Arm
{ {
ProstPart_WoodenBase, MetalPipe=4,
ProstPart_WoodenHook, Plank=2,
keep [Recipe.GetItemTypes.WeldingMask],
Time: 10.0, Result:Prost_NormalArm_L,
Result: Prost_NormalArm_L, Time:150.0,
NeedToBeLearn: true, Category:Welding,
CanBeDoneFromFloor: false, OnGiveXP:Recipe.OnGiveXP.MetalWelding10,
OnGiveXP: NoXP_OnGiveXP, NeedToBeLearn:true,
SkillRequired: FirstAid=2,
Category: Surgeon,
OnCreate:ProsthesisRecipes.OnCreateProsthesis,
Tooltip: Recipe_Tooltip_AssembleProsthesis,
} }
recipe Craft Prosthetic Hook recipe Craft Prosthetic Hook
{ {
ProstPart_WoodenBase, MetalPipe=2,
ProstPart_WoodenHook, Plank=2,
keep [Recipe.GetItemTypes.WeldingMask],
Time: 10.0, Result:Prost_HookArm_L,
Result: Prost_HookArm_L, Time:150.0,
NeedToBeLearn: true, Category:Welding,
CanBeDoneFromFloor: false, OnGiveXP:Recipe.OnGiveXP.MetalWelding10,
OnGiveXP: NoXP_OnGiveXP, NeedToBeLearn:false,
SkillRequired: FirstAid=2,
Category: Surgeon,
OnCreate:ProsthesisRecipes.OnCreateProsthesis,
Tooltip: Recipe_Tooltip_AssembleProsthesis,
} }
} }