diff --git a/Data Files/Ashfall.esp b/Data Files/Ashfall.esp index 7517d6d2..31226fe9 100644 Binary files a/Data Files/Ashfall.esp and b/Data Files/Ashfall.esp differ diff --git a/Data Files/Icons/ashfall/cookingPot.dds b/Data Files/Icons/ashfall/cookingPot.dds deleted file mode 100644 index a270a248..00000000 Binary files a/Data Files/Icons/ashfall/cookingPot.dds and /dev/null differ diff --git a/Data Files/Icons/ashfall/cooking_pot.dds b/Data Files/Icons/ashfall/cooking_pot.dds new file mode 100644 index 00000000..efc51f13 Binary files /dev/null and b/Data Files/Icons/ashfall/cooking_pot.dds differ diff --git a/Data Files/MWSE/mods/mer/ashfall/camping/boilerController.lua b/Data Files/MWSE/mods/mer/ashfall/camping/boilerController.lua index e8b31675..1825aaa9 100644 --- a/Data Files/MWSE/mods/mer/ashfall/camping/boilerController.lua +++ b/Data Files/MWSE/mods/mer/ashfall/camping/boilerController.lua @@ -45,7 +45,7 @@ local function updateBoilers(e) end --Amount of water determines how quickly it boils - local filledAmount = boilerRef.data.waterAmount / common.staticConfigs.capacities[boilerRef.data.utensil] + local filledAmount = boilerRef.data.waterAmount / boilerRef.data.waterCapacity common.log:trace("BOILER filledAmount: %s", filledAmount) local filledAmountEffect = math.remap(filledAmount, 0.0, 1.0, maxSpeedForCapacity, 1.0) common.log:trace("BOILER filledAmountEffect: %s", filledAmountEffect) diff --git a/Data Files/MWSE/mods/mer/ashfall/camping/campfire/campfireInit.lua b/Data Files/MWSE/mods/mer/ashfall/camping/campfire/campfireInit.lua index dd3b82bc..5dad2111 100644 --- a/Data Files/MWSE/mods/mer/ashfall/camping/campfire/campfireInit.lua +++ b/Data Files/MWSE/mods/mer/ashfall/camping/campfire/campfireInit.lua @@ -26,6 +26,33 @@ end local function registerCampfire(e) if e.reference.disabled then return end + + --Do some stuff to update old campfires + if e.reference.data then + if e.reference.data.kettleId then + common.log:info("Found campfire with kettleId, replacing with utensilId") + e.reference.data.utensilId = e.reference.data.kettleId + e.reference.data.kettleId = nil + end + + if e.reference.data.utensil ~= nil and e.reference.data.utensilId == nil then + if e.reference.data.utensil == "kettle" then + e.reference.data.utensilId = "ashfall_kettle" + else + e.reference.data.utensilId = table.choice{"misc_com_bucket_metal", "misc_com_bucket_01", "ashfall_cooking_pot"} + end + common.log:info("Found campfire with a utensil and no utensilId, setting to %s", + e.reference.data.utensilId) + end + + if e.reference.data.utensilId ~= nil and e.reference.data.waterCapacity == nil then + local data = common.staticConfigs.utensils[e.reference.data.utensilId] + local capacity = data and data.capacity or 100 + e.reference.data.waterCapacity = capacity + common.log:info("Found campfire with a utensil and no water capacity, setting to %s. utensilID: %s", + capacity, e.reference.data.utensilId) + end + end local dynamicConfig = campfireConfig.getConfig(e.reference.object.id) local isActivator = activatorConfig.list.campfire:isActivator(e.reference.object.id) local initialised = e.reference.data and e.reference.data.campfireInitialised diff --git a/Data Files/MWSE/mods/mer/ashfall/camping/campfire/campfireMenu.lua b/Data Files/MWSE/mods/mer/ashfall/camping/campfire/campfireMenu.lua index f099d96a..861bab5b 100644 --- a/Data Files/MWSE/mods/mer/ashfall/camping/campfire/campfireMenu.lua +++ b/Data Files/MWSE/mods/mer/ashfall/camping/campfire/campfireMenu.lua @@ -17,7 +17,8 @@ local buttonMapping = { "addIngredient", "addWater", "emptyPot", - "removePot", + -- "removePot", + "removeUtensil", }, ["Kettle"] = { "drink", @@ -25,13 +26,16 @@ local buttonMapping = { "addWater", "fillContainer", "emptyKettle", - "removeKettle", + -- "removeKettle", + "removeUtensil", }, ["Supports"] = { - "addKettle", - "addPot", - "removeKettle", - "removePot", + "addUtensil", + -- "addKettle", + -- "addPot", + -- "removeKettle", + "removeUtensil", + -- "removePot", "removeSupports", }, ["Campfire"] = { @@ -41,10 +45,12 @@ local buttonMapping = { "removeSupports", "addGrill", "removeGrill", - "addKettle", - "addPot", - "removeKettle", - "removePot", + "addUtensil", + -- "addKettle", + -- "addPot", + -- "removeKettle", + "removeUtensil", + -- "removePot", --"wait", -- replaced by cushions "extinguish", "destroy", diff --git a/Data Files/MWSE/mods/mer/ashfall/camping/campfire/campfireTooltip.lua b/Data Files/MWSE/mods/mer/ashfall/camping/campfire/campfireTooltip.lua index 4b79260d..4d96959d 100644 --- a/Data Files/MWSE/mods/mer/ashfall/camping/campfire/campfireTooltip.lua +++ b/Data Files/MWSE/mods/mer/ashfall/camping/campfire/campfireTooltip.lua @@ -39,7 +39,7 @@ local function updateTooltip(e) centerText(fuelLabel) end elseif label.text == "Kettle" or label.text == "Cooking Pot" then - local waterAmount = campfire.data.waterAmount + local waterAmount = campfire.data.waterAmount or 0 if waterAmount then --WATER local waterHeat = campfire.data.waterHeat or 0 @@ -47,7 +47,7 @@ local function updateTooltip(e) text = string.format( "Water: %d/%d %s| Heat: %d/100", math.ceil(waterAmount), - common.staticConfigs.capacities[campfire.data.utensil], + campfire.data.waterCapacity, ( campfire.data.waterType == "dirty" and "(Dirty) " or ""), waterHeat) } diff --git a/Data Files/MWSE/mods/mer/ashfall/camping/campfire/campfireVisuals.lua b/Data Files/MWSE/mods/mer/ashfall/camping/campfire/campfireVisuals.lua index 0fa5b583..18d4832e 100644 --- a/Data Files/MWSE/mods/mer/ashfall/camping/campfire/campfireVisuals.lua +++ b/Data Files/MWSE/mods/mer/ashfall/camping/campfire/campfireVisuals.lua @@ -111,11 +111,12 @@ end --Update the water level of the cooking pot local function updateWaterHeight(campfire) + if not campfire.data.waterCapacity then return end local scaleMax = 1.3 local heightMax = 28 local waterLevel = campfire.data.waterAmount or 0 - local scale = math.min(math.remap(waterLevel, 0, common.staticConfigs.capacities.cookingPot, 1, scaleMax), scaleMax ) - local height = math.min(math.remap(waterLevel, 0, common.staticConfigs.capacities.cookingPot, 0, heightMax), heightMax) + local scale = math.min(math.remap(waterLevel, 0, campfire.data.waterCapacity, 1, scaleMax), scaleMax ) + local height = math.min(math.remap(waterLevel, 0, campfire.data.waterCapacity, 0, heightMax), heightMax) local waterNode = campfire.sceneNode:getObjectByName("POT_WATER") if waterNode then @@ -127,22 +128,33 @@ local function updateWaterHeight(campfire) stewNode.translation.z = height stewNode.scale = scale end + local steamNode = campfire.sceneNode:getObjectByName("POT_STEAM") + if steamNode then + steamNode.translation.z = height + end end --Update the size of the steam coming off a cooking pot local function updateSteamScale(campfire) - local hasSteam = ( - campfire.data.utensil == "cookingPot" and - campfire.data.waterHeat and - campfire.data.waterHeat >= common.staticConfigs.hotWaterHeatValue - ) - if hasSteam then - local steamScale = math.min(math.remap(campfire.data.waterHeat, common.staticConfigs.hotWaterHeatValue - , 100, 0.5, 1.0), 1.0) - local steamNode = campfire.sceneNode:getObjectByName("POT_STEAM") - if steamNode then steamNode = steamNode.children[1] end - steamNode.scale = steamScale - end + -- local hasSteam = ( + -- campfire.data.utensil == "cookingPot" and + -- campfire.data.waterHeat and + -- campfire.data.waterHeat >= common.staticConfigs.hotWaterHeatValue + -- ) + -- if hasSteam then + -- local steamScale = math.min(math.remap(campfire.data.waterHeat, common.staticConfigs.hotWaterHeatValue + -- , 100, 0.5, 1.0), 1.0) + -- local steamNode = campfire.sceneNode:getObjectByName("POT_STEAM") + -- if steamNode then steamNode = steamNode.children[1] end + -- steamNode.scale = steamScale + + -- local potSteam = campfire.sceneNode:getObjectByName("POT_STEAM") + -- if potSteam then + -- local steamScale = math.min(math.remap(campfire.data.waterHeat, common.staticConfigs.hotWaterHeatValue, 100, 0.1, 1.0), 1.0) + -- local materialProperty = potSteam:getObjectByName("SuperSpray"):getProperty(0x2) + -- materialProperty.alpha = steamScale + -- end + -- end end --Update the collision box of the campfire @@ -212,17 +224,17 @@ local function moveOriginToAttachPoint(node) end local function updateAttachNodes(e) - common.log:debug("Ashfall:UpdateAttachNodes") + common.log:trace("Ashfall:UpdateAttachNodes") local campfire = e.campfire local sceneNode = campfire.sceneNode local hangNode = sceneNode:getObjectByName("HANG_UTENSIL") - local utensil = campfire.data.kettleId or "ashfall_kettle" + local utensil = campfire.data.utensilId if hangNode then common.log:trace("has hangNode") common.log:trace("children: %s", #hangNode.children) - if campfire.data.utensil == "kettle" then + if campfire.data.utensil and utensil then if not idToNameMappings[campfire.data.utensil] then - common.log:trace("No valid utensil type set on data.utensil") + common.log:error("No valid utensil type set on data.utensil") return end common.log:trace("Has utensil") @@ -233,7 +245,12 @@ local function updateAttachNodes(e) end common.log:trace("utensil is a valid object") - local mesh = tes3.loadMesh(utensilObj.mesh):clone() + local utensilData = common.staticConfigs.utensils[utensil:lower()] + if not utensilData then + common.log:error("%s is not a valid utensil, but was set to campfire.data.utensilId") + end + local meshId = utensilData and utensilData.meshOverride or utensilObj.mesh + local mesh = tes3.loadMesh(meshId):clone() mesh.name = idToNameMappings[campfire.data.utensil] moveOriginToAttachPoint(mesh) hangNode:attachChild(mesh) diff --git a/Data Files/MWSE/mods/mer/ashfall/camping/campfire/vanillaCampfireReplacer.lua b/Data Files/MWSE/mods/mer/ashfall/camping/campfire/vanillaCampfireReplacer.lua index 8705e40e..694dcdaf 100644 --- a/Data Files/MWSE/mods/mer/ashfall/camping/campfire/vanillaCampfireReplacer.lua +++ b/Data Files/MWSE/mods/mer/ashfall/camping/campfire/vanillaCampfireReplacer.lua @@ -95,6 +95,20 @@ local ignorePatterns = { } +local function addCookingPot(campfire) + campfire.data.utensil = "cookingPot" + campfire.data.utensilId = table.choice{"misc_com_bucket_metal", "misc_com_bucket_01", "ashfall_cooking_pot"} + campfire.data.waterCapacity = common.staticConfigs.utensils[campfire.data.utensilId].capacity + campfire.data.dynamicConfig.cookingPot = "static" +end + +local function addKettle(campfire) + campfire.data.dynamicConfig.kettle = "static" + campfire.data.utensil = "kettle" + campfire.data.utensilId = table.choice{"ashfall_kettle", "ashfall_kettle_02"} + campfire.data.waterCapacity = common.staticConfigs.utensils[campfire.data.utensilId].capacity +end + local function attachRandomStuff(campfire) if string.find(campfire.cell.id:lower(), "tomb") then return end if campfire.data.staticCampfireInitialised then return end @@ -109,11 +123,10 @@ local function attachRandomStuff(campfire) campfire.data.hasSupports = true end if campfire.data.dynamicConfig.kettle == "static" then - campfire.data.utensil = "kettle" - campfire.data.kettleId = "ashfall_kettle" + addKettle(campfire) end if campfire.data.dynamicConfig.cookingPot == "static" then - campfire.data.utensil = "cookingPot" + addCookingPot(campfire) end if campfire.data.dynamicConfig.grill == "static" then campfire.data.hasGrill = true @@ -138,7 +151,7 @@ local function attachRandomStuff(campfire) end --add tea to kettleswaterHeat if campfire.data.utensil == "kettle" then - campfire.data.kettleId = "ashfall_kettle" + addKettle(campfire) if math.random() < randomStuffChances.tea then local teaType = table.choice(common.staticConfigs.teaConfig.validTeas) campfire.data.waterType = teaType @@ -146,6 +159,7 @@ local function attachRandomStuff(campfire) end --add random stew to cooking pots elseif campfire.data.utensil == "cookingPot" then + addCookingPot(campfire) if math.random() < randomStuffChances.stew then campfire.data.ladle = true campfire.data.stewLevels = {} @@ -176,7 +190,7 @@ local function setInitialState(campfire, vanillaRef, data, hasSupports) --prevent removal of supports for kitbashing reasons campfire.data.dynamicConfig.supports = "static" if data.hasCookingPot then - campfire.data.utensil = "cookingPot" + addCookingPot(campfire) end elseif data.hasPlatform == true then campfire.data.dynamicConfig.supports = "none" @@ -195,7 +209,7 @@ local function setInitialState(campfire, vanillaRef, data, hasSupports) else campfire:deleteDynamicLightAttachment() end - event.trigger("Ashfall:UpdateAttachNodes", { campfire = campfire }) + timer.delayOneFrame(function() event.trigger("Ashfall:registerReference", { reference = campfire} ) end) @@ -381,7 +395,7 @@ local function replaceCampfire(e) setInitialState(campfire, e.reference, data, vanillaConfig.supports) attachRandomStuff(campfire) - + event.trigger("Ashfall:UpdateAttachNodes", { campfire = campfire }) campfire.scale = e.reference.scale if vanillaConfig.scale then diff --git a/Data Files/MWSE/mods/mer/ashfall/camping/cooking.lua b/Data Files/MWSE/mods/mer/ashfall/camping/cooking.lua index 585fa42b..3fd88824 100644 --- a/Data Files/MWSE/mods/mer/ashfall/camping/cooking.lua +++ b/Data Files/MWSE/mods/mer/ashfall/camping/cooking.lua @@ -202,6 +202,7 @@ local function clearUtensilData(e) if e.removeUtensil then campfire.data.utensil = nil campfire.data.ladle = nil + campfire.data.utensilId = nil end if not e.isContainer then tes3.removeSound{ diff --git a/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/addIngredient.lua b/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/addIngredient.lua index a7dee00f..df63b2b2 100644 --- a/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/addIngredient.lua +++ b/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/addIngredient.lua @@ -29,21 +29,22 @@ end local function addIngredient(e) + local campfire = e.campfire --Cool down stew - e.campfire.data.stewProgress = e.campfire.data.stewProgress or 0 - e.campfire.data.stewProgress = math.max(( e.campfire.data.stewProgress - stewIngredientCooldownAmount ), 0) + campfire.data.stewProgress = campfire.data.stewProgress or 0 + campfire.data.stewProgress = math.max(( campfire.data.stewProgress - stewIngredientCooldownAmount ), 0) --initialise stew levels - e.campfire.data.stewLevels = e.campfire.data.stewLevels or {} - e.campfire.data.stewLevels[e.foodType] = e.campfire.data.stewLevels[e.foodType] or 0 + campfire.data.stewLevels = campfire.data.stewLevels or {} + campfire.data.stewLevels[e.foodType] = campfire.data.stewLevels[e.foodType] or 0 --Add ingredient to stew - common.log:trace("old stewLevel: %s", e.campfire.data.stewLevels[e.foodType]) - local waterRatio = e.campfire.data.waterAmount / common.staticConfigs.capacities.cookingPot + common.log:trace("old stewLevel: %s", campfire.data.stewLevels[e.foodType]) + local waterRatio = campfire.data.waterAmount / campfire.data.waterCapacity common.log:trace("waterRatio: %s", waterRatio) local ingredAmountToAdd = e.amount * common.staticConfigs.stewIngredAddAmount / waterRatio common.log:trace("ingredAmountToAdd: %s", ingredAmountToAdd) - e.campfire.data.stewLevels[e.foodType] = math.min(e.campfire.data.stewLevels[e.foodType] + ingredAmountToAdd, 100) - common.log:trace("new stewLevel: %s", e.campfire.data.stewLevels[e.foodType]) + campfire.data.stewLevels[e.foodType] = math.min(campfire.data.stewLevels[e.foodType] + ingredAmountToAdd, 100) + common.log:trace("new stewLevel: %s", campfire.data.stewLevels[e.foodType]) common.skills.survival:progressSkill(skillSurvivalStewIngredIncrement*e.amount) tes3.player.object.inventory:removeItem{ @@ -76,7 +77,7 @@ local function ingredientSelect(campfire, foodType) common.data.inventorySelectStew = nil if e.item then common.log:debug("Selecting ingredient amount for stew") - local waterRatio = campfire.data.waterAmount / common.staticConfigs.capacities.cookingPot + local waterRatio = campfire.data.waterAmount / campfire.data.waterCapacity local stewLevel = (campfire.data.stewLevels and campfire.data.stewLevels[foodType] or 0) local adjustedIngredAmount = common.staticConfigs.stewIngredAddAmount / waterRatio common.log:debug("adjustedIngredAmount: %s", adjustedIngredAmount) diff --git a/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/addKettle.lua b/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/addKettle.lua deleted file mode 100644 index c704746d..00000000 --- a/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/addKettle.lua +++ /dev/null @@ -1,53 +0,0 @@ -local common = require ("mer.ashfall.common.common") - -local function addKettle(kettle, campfire) - mwscript.removeItem{ reference = tes3.player, item = kettle } - campfire.data.utensil = "kettle" - tes3.playSound{ reference = tes3.player, sound = "Item Misc Down" } - - campfire.data.kettleId = kettle.id:lower() - event.trigger("Ashfall:UpdateAttachNodes", {campfire = campfire}) - --event.trigger("Ashfall:Campfire_Update_Visuals", { campfire = campfire, all = true}) -end - -local function kettleSelect(campfire) - timer.delayOneFrame(function() - tes3ui.showInventorySelectMenu{ - title = "Select Kettle", - noResultsText = "You do not have a kettle.", - filter = function(e) - return common.staticConfigs.kettles[e.item.id:lower()] ~= nil - end, - callback = function(e) - if e.item then - addKettle(e.item, campfire) - end - end - } - end) -end - -return { - text = "Attach Kettle", - showRequirements = function(campfire) - return ( - campfire.data.hasSupports and - not campfire.data.utensil and - campfire.data.dynamicConfig and - campfire.data.dynamicConfig.kettle == "dynamic" - ) - end, - enableRequirements = function() - - for kettleId, _ in pairs(common.staticConfigs.kettles) do - if mwscript.getItemCount{ reference = tes3.player, item = kettleId} > 0 then - return true - end - end - return false - end, - tooltipDisabled = { - text = "Requires 1 Kettle." - }, - callback = kettleSelect -} \ No newline at end of file diff --git a/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/addPot.lua b/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/addPot.lua deleted file mode 100644 index d34ce9c6..00000000 --- a/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/addPot.lua +++ /dev/null @@ -1,29 +0,0 @@ -local common = require ("mer.ashfall.common.common") - -return { - text = "Attach Cooking Pot", - showRequirements = function(campfire) - return ( - campfire.data.hasSupports and - campfire.data.utensil == nil and - campfire.data.dynamicConfig and - campfire.data.dynamicConfig.cookingPot == "dynamic" - ) - end, - enableRequirements = function() - return mwscript.getItemCount{ reference = tes3.player, item = "Misc_Com_Bucket_Metal" } > 0 - end, - tooltipDisabled = { - text = "Requires 1 Metal Bucket." - }, - callback = function(campfire) - mwscript.removeItem{ reference = tes3.player, item = "Misc_Com_Bucket_Metal" } - campfire.data.utensil = "cookingPot" - tes3.playSound{ reference = tes3.player, sound = "Item Misc Down" } - if mwscript.getItemCount{ reference = tes3.player, item = "misc_com_iron_ladle"} > 0 then - mwscript.removeItem{ reference = tes3.player, item = "misc_com_iron_ladle" } - campfire.data.ladle = true - end - --event.trigger("Ashfall:Campfire_Update_Visuals", { campfire = campfire, all = true}) - end -} \ No newline at end of file diff --git a/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/addUtensil.lua b/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/addUtensil.lua new file mode 100644 index 00000000..8ff7caee --- /dev/null +++ b/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/addUtensil.lua @@ -0,0 +1,63 @@ +local common = require ("mer.ashfall.common.common") + +local function addUtensil(item, campfire) + mwscript.removeItem{ reference = tes3.player, item = item } + local utensilData = common.staticConfigs.utensils[item.id:lower()] + + tes3.playSound{ reference = tes3.player, sound = "Item Misc Down" } + + if utensilData.type == "cookingPot" then + if mwscript.getItemCount{ reference = tes3.player, item = "misc_com_iron_ladle"} > 0 then + mwscript.removeItem{ reference = tes3.player, item = "misc_com_iron_ladle" } + campfire.data.ladle = true + end + end + campfire.data.utensil = utensilData.type + campfire.data.utensilId = item.id:lower() + campfire.data.waterCapacity = utensilData.capacity or 100 + common.log:debug("Set water capacity to %s", campfire.data.waterCapacity) + event.trigger("Ashfall:UpdateAttachNodes", {campfire = campfire}) + --event.trigger("Ashfall:Campfire_Update_Visuals", { campfire = campfire, all = true}) +end + +local function utensilSelect(campfire) + timer.delayOneFrame(function() + tes3ui.showInventorySelectMenu{ + title = "Select Utensil", + noResultsText = "You do not have any utensils.", + filter = function(e) + return common.staticConfigs.utensils[e.item.id:lower()] ~= nil + end, + callback = function(e) + if e.item then + addUtensil(e.item, campfire) + end + end + } + end) +end + +return { + text = "Attach Utensil", + showRequirements = function(campfire) + return ( + campfire.data.hasSupports and + not campfire.data.utensil and + campfire.data.dynamicConfig and + (campfire.data.dynamicConfig.kettle == "dynamic" + or campfire.data.dynamicConfig.cookingPot == "dynamic") + ) + end, + enableRequirements = function() + for id, _ in pairs(common.staticConfigs.utensils) do + if mwscript.getItemCount{ reference = tes3.player, item = id} > 0 then + return true + end + end + return false + end, + tooltipDisabled = { + text = "Requires a kettle or cooking pot." + }, + callback = utensilSelect +} \ No newline at end of file diff --git a/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/addWater.lua b/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/addWater.lua index c9349e2b..9cf76cde 100644 --- a/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/addWater.lua +++ b/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/addWater.lua @@ -5,7 +5,7 @@ return { showRequirements = function(campfire) local needsWater = ( not campfire.data.waterAmount or - campfire.data.waterAmount < common.staticConfigs.capacities[campfire.data.utensil] + campfire.data.waterAmount < campfire.data.waterCapacity ) local hasUtensil = ( campfire.data.utensil == "kettle" or @@ -36,7 +36,7 @@ return { callback = function(e) if e.item then local waterInbottle = e.itemData.data.waterAmount or 0 - local potCapacity = common.staticConfigs.capacities[campfire.data.utensil] + local potCapacity = campfire.data.waterCapacity local waterInPot = campfire.data.waterAmount or 0 local capacityRemainingInPot = potCapacity - waterInPot local maxAmount = math.min(waterInbottle,capacityRemainingInPot) diff --git a/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/drink.lua b/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/drink.lua index e0c07d08..d3e90779 100644 --- a/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/drink.lua +++ b/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/drink.lua @@ -33,7 +33,7 @@ return { local tooHotToDrink = hasWaterAmount(campfire) and (not hasStew(campfire)) and isBoiling(campfire) - if tooHotToDrink then + if tooHotToDrink and not campfire.data.ladle then return false end return true @@ -45,7 +45,7 @@ return { local function doDrink() --tes3.playSound{ reference = tes3.player, sound = "Swallow" } - local amountToDrink = math.min(common.staticConfigs.capacities[campfire.data.utensil], campfire.data.waterAmount) + local amountToDrink = math.min(campfire.data.waterCapacity, campfire.data.waterAmount) local amountDrank = thirstController.drinkAmount{ amount = amountToDrink, waterType = campfire.data.waterType,} campfire.data.waterAmount = campfire.data.waterAmount - amountDrank if campfire.data.teaProgress and campfire.data.teaProgress >= 100 then diff --git a/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/removeKettle.lua b/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/removeKettle.lua deleted file mode 100644 index aeadd7a8..00000000 --- a/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/removeKettle.lua +++ /dev/null @@ -1,27 +0,0 @@ -return { - text = "Remove Kettle", - showRequirements = function(campfire) - return ( - campfire.data.dynamicConfig and - campfire.data.dynamicConfig.kettle == "dynamic" and - campfire.data.utensil == "kettle" - ) - end, - enableRequirements = function(campfire) - return ( not campfire.data.waterAmount or - campfire.data.waterAmount == 0 ) - end, - tooltipDisabled = { - text = "Kettle must be emptied before it can be removed." - }, - callback = function(campfire) - local kettleId = campfire.data.kettleId or "ashfall_kettle" - mwscript.addItem{ reference = tes3.player, item = kettleId } - event.trigger("Ashfall:Campfire_clear_utensils", { campfire = campfire, removeUtensil = true}) - tes3.playSound{ reference = tes3.player, sound = "Item Misc Up" } - --event.trigger("Ashfall:Campfire_Update_Visuals", { campfire = campfire, all = true}) - - campfire.data.kettleId = nil - event.trigger("Ashfall:UpdateAttachNodes", {campfire = campfire,}) - end -} \ No newline at end of file diff --git a/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/removePot.lua b/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/removeUtensil.lua similarity index 59% rename from Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/removePot.lua rename to Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/removeUtensil.lua index 3b06afc0..5991e146 100644 --- a/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/removePot.lua +++ b/Data Files/MWSE/mods/mer/ashfall/camping/menuFunctions/removeUtensil.lua @@ -1,29 +1,30 @@ local common = require ("mer.ashfall.common.common") +local function checkDynamicStatus(campfire) + return campfire.data.dynamicConfig[campfire.data.utensil] ~= "static" +end + return { - text = "Remove Pot", + text = "Remove Utensil", showRequirements = function(campfire) - return ( - campfire.data.dynamicConfig and - campfire.data.dynamicConfig.cookingPot == "dynamic" and - campfire.data.utensil == "cookingPot" and - ( not campfire.data.waterAmount or - campfire.data.waterAmount == 0 ) - ) + return campfire.data.utensilId ~= nil + and campfire.data.dynamicConfig + and checkDynamicStatus(campfire) end, enableRequirements = function(campfire) return ( not campfire.data.waterAmount or campfire.data.waterAmount == 0 ) end, tooltipDisabled = { - text = "Cooking Pot must be emptied before it can be removed." + text = "Utensil must be emptied before it can be removed." }, callback = function(campfire) - mwscript.addItem{ reference = tes3.player, item = "Misc_Com_Bucket_Metal" } + mwscript.addItem{ reference = tes3.player, item = campfire.data.utensilId } if campfire.data.ladle == true then mwscript.addItem{ reference = tes3.player, item = "misc_com_iron_ladle" } end event.trigger("Ashfall:Campfire_clear_utensils", { campfire = campfire, removeUtensil = true}) + event.trigger("Ashfall:UpdateAttachNodes", {campfire = campfire,}) tes3.playSound{ reference = tes3.player, sound = "Item Misc Up" } --event.trigger("Ashfall:Campfire_Update_Visuals", { campfire = campfire, all = true}) end diff --git a/Data Files/MWSE/mods/mer/ashfall/common/common.lua b/Data Files/MWSE/mods/mer/ashfall/common/common.lua index 9d645f8d..af3d66af 100644 --- a/Data Files/MWSE/mods/mer/ashfall/common/common.lua +++ b/Data Files/MWSE/mods/mer/ashfall/common/common.lua @@ -144,15 +144,7 @@ local function initData() end local function doUpgrades() - this.log:debug("Doing upgrades from previous version") - local cookingPotCount = mwscript.getItemCount{ reference = tes3.player, item = "ashfall_cooking_pot"} - if cookingPotCount and cookingPotCount >= 1 then - this.log:debug("Found cooking pots in inventory") - mwscript.removeItem{ reference = tes3.player, item = "ashfall_cooking_pot", count = cookingPotCount } - mwscript.addItem{ reference = tes3.player, item = "Misc_Com_Bucket_Metal", count = cookingPotCount } - mwscript.addItem{ reference = tes3.player, item = "misc_com_iron_ladle", count = cookingPotCount } - tes3.messageBox("[Ashfall] Your cooking pots have been replaced with a metal bucket and ladle.") - end + --this.log:debug("Doing upgrades from previous version") end --INITIALISE COMMON-- diff --git a/Data Files/MWSE/mods/mer/ashfall/config/overrides.lua b/Data Files/MWSE/mods/mer/ashfall/config/overrides.lua index 3c89fcd8..a3030152 100644 --- a/Data Files/MWSE/mods/mer/ashfall/config/overrides.lua +++ b/Data Files/MWSE/mods/mer/ashfall/config/overrides.lua @@ -46,7 +46,11 @@ local overrides = { --cooking equipment ["misc_com_bucket_metal"] = { - weight = 7, + name = "Bucket: Metal", + value = 15 + }, + ["misc_com_bucket_01"] = { + name = "Bucket: Wood", value = 15 }, ["misc_com_iron_ladle"] = { diff --git a/Data Files/MWSE/mods/mer/ashfall/config/staticConfigs.lua b/Data Files/MWSE/mods/mer/ashfall/config/staticConfigs.lua index e90004ea..aabb27c4 100644 --- a/Data Files/MWSE/mods/mer/ashfall/config/staticConfigs.lua +++ b/Data Files/MWSE/mods/mer/ashfall/config/staticConfigs.lua @@ -116,7 +116,7 @@ this.placementConfig = { } this.capacities = { - cookingPot = 120, + --cookingPot = 120, kettle = 100, potion = 15, MAX = 240 @@ -567,10 +567,36 @@ this.heatSourceValues = { volcano_steam = 80, } -this.kettles = { - ashfall_kettle = true, - ashfall_kettle_01 = true, - ashfall_kettle_02 = true, + + +this.utensils = { + ashfall_kettle = { + type = "kettle", + capacity = 120 + }, + ashfall_kettle_01 = { + type = "kettle", + capacity = 120 + }, + ashfall_kettle_02 = { + type = "kettle", + capacity = 120 + }, + misc_com_bucket_metal = { + type = "cookingPot", + meshOverride = "ashfall\\bucket_metal.nif", + capacity = 150 + }, + misc_com_bucket_01 = { + type = "cookingPot", + meshOverride = "ashfall\\bucket_wooden.nif", + capacity = 140 + }, + ashfall_cooking_pot = { + type = "cookingPot", + capacity = 200 + }, } + return this \ No newline at end of file diff --git a/Data Files/MWSE/mods/mer/ashfall/intro.lua b/Data Files/MWSE/mods/mer/ashfall/intro.lua index 56aa57a9..1b706b7c 100644 --- a/Data Files/MWSE/mods/mer/ashfall/intro.lua +++ b/Data Files/MWSE/mods/mer/ashfall/intro.lua @@ -28,6 +28,7 @@ function this.doOverrides() local item = tes3.getObject(id) if item then common.log:trace("Overriding values for %s", item.id) + item.name = override.name or item.name item.value = override.value or item.value item.weight = override.weight or item.weight else @@ -168,7 +169,7 @@ local function checkCharGen() callback = this.startAshfall } if config.startingEquipment then - mwscript.addItem{reference=tes3.player, item="misc_com_bucket_metal"} + mwscript.addItem{reference=tes3.player, item="misc_com_bucket_01"} mwscript.addItem{reference=tes3.player, item="misc_com_bottle_10"} mwscript.addItem{reference=tes3.player, item="ashfall_bedroll"} mwscript.addItem{reference=tes3.player, item="ashfall_woodaxe"} diff --git a/Data Files/MWSE/mods/mer/ashfall/merchants/merchantController.lua b/Data Files/MWSE/mods/mer/ashfall/merchants/merchantController.lua index 52311228..66114542 100644 --- a/Data Files/MWSE/mods/mer/ashfall/merchants/merchantController.lua +++ b/Data Files/MWSE/mods/mer/ashfall/merchants/merchantController.lua @@ -1,6 +1,6 @@ local gearId = 'ashfall_crate_rnd' local hasGearId = "ashfallGearAdded_v" -local gearVersion = 20210716 --set to the date you added new gear +local gearVersion = 20210717 --set to the date you added new gear local function hasGearAdded(reference) return reference.data[hasGearId .. gearVersion] == true end diff --git a/Data Files/MWSE/mods/mer/ashfall/needs/needsTooltips.lua b/Data Files/MWSE/mods/mer/ashfall/needs/needsTooltips.lua index 85147b5c..93b270c7 100644 --- a/Data Files/MWSE/mods/mer/ashfall/needs/needsTooltips.lua +++ b/Data Files/MWSE/mods/mer/ashfall/needs/needsTooltips.lua @@ -298,6 +298,12 @@ local function createNeedsTooltip(e) end end end + + --Utensil tooltips + local utensilData = common.staticConfigs.utensils[e.object.id:lower()] + if utensilData and utensilData.capacity then + common.helper.addLabelToTooltip(tooltip, string.format("Capacity: %d", utensilData.capacity)) + end end event.register('uiObjectTooltip', createNeedsTooltip) diff --git a/Data Files/Meshes/ashfall/bucket_metal.nif b/Data Files/Meshes/ashfall/bucket_metal.nif new file mode 100644 index 00000000..03ceafd3 Binary files /dev/null and b/Data Files/Meshes/ashfall/bucket_metal.nif differ diff --git a/Data Files/Meshes/ashfall/bucket_wooden.nif b/Data Files/Meshes/ashfall/bucket_wooden.nif new file mode 100644 index 00000000..604de6b1 Binary files /dev/null and b/Data Files/Meshes/ashfall/bucket_wooden.nif differ diff --git a/Data Files/Meshes/ashfall/campfire.nif b/Data Files/Meshes/ashfall/campfire.nif index 65303c7e..c770b1d0 100644 Binary files a/Data Files/Meshes/ashfall/campfire.nif and b/Data Files/Meshes/ashfall/campfire.nif differ diff --git a/Data Files/Meshes/ashfall/campfire_grill.nif b/Data Files/Meshes/ashfall/campfire_grill.nif index ce3d892d..51e58c41 100644 Binary files a/Data Files/Meshes/ashfall/campfire_grill.nif and b/Data Files/Meshes/ashfall/campfire_grill.nif differ diff --git a/Data Files/Meshes/ashfall/campfire_static.nif b/Data Files/Meshes/ashfall/campfire_static.nif index 3d86aa5f..25d2bed7 100644 Binary files a/Data Files/Meshes/ashfall/campfire_static.nif and b/Data Files/Meshes/ashfall/campfire_static.nif differ diff --git a/Data Files/Meshes/ashfall/campfire_supports.nif b/Data Files/Meshes/ashfall/campfire_supports.nif index 85245a10..99d0508c 100644 Binary files a/Data Files/Meshes/ashfall/campfire_supports.nif and b/Data Files/Meshes/ashfall/campfire_supports.nif differ diff --git a/Data Files/Meshes/ashfall/cooking_pot.nif b/Data Files/Meshes/ashfall/cooking_pot.nif index 0b439dce..53dbefba 100644 Binary files a/Data Files/Meshes/ashfall/cooking_pot.nif and b/Data Files/Meshes/ashfall/cooking_pot.nif differ diff --git a/Data Files/Meshes/ashfall/kettle.nif b/Data Files/Meshes/ashfall/kettle.nif deleted file mode 100644 index f27806c6..00000000 Binary files a/Data Files/Meshes/ashfall/kettle.nif and /dev/null differ diff --git a/Data Files/Meshes/ashfall/kettle_iron.nif b/Data Files/Meshes/ashfall/kettle_iron.nif index f27806c6..a1fb162b 100644 Binary files a/Data Files/Meshes/ashfall/kettle_iron.nif and b/Data Files/Meshes/ashfall/kettle_iron.nif differ diff --git a/Data Files/Meshes/ashfall/kettle_steel.nif b/Data Files/Meshes/ashfall/kettle_steel.nif index 1420ebe2..442ba00b 100644 Binary files a/Data Files/Meshes/ashfall/kettle_steel.nif and b/Data Files/Meshes/ashfall/kettle_steel.nif differ