Skip to content

Commit

Permalink
New bushcrafting recipe: paper lantern
Browse files Browse the repository at this point in the history
  • Loading branch information
jhaakma committed Apr 25, 2024
1 parent 325b287 commit 54db0cb
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 9 deletions.
Binary file modified Data Files/Ashfall.esp
Binary file not shown.
Binary file added Data Files/Icons/ashfall/craft/shoji_lamp_01.dds
Binary file not shown.
21 changes: 20 additions & 1 deletion Data Files/MWSE/mods/mer/ashfall/bushcrafting/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,14 @@ this.materials = {
ids = {
"ingred_raw_glass_01"
}
}
},
{
id = "paper",
name = "Paper",
ids = {
"sc_paper plain",
}
},
}
this.ingredMaterials = {}
for name, ingredient in pairs(this.materials) do
Expand Down Expand Up @@ -921,6 +928,18 @@ local bushCraftingRecipes = {
this.menuOptions.rename
},
},
{
id = "bushcraft:ashfall_shoji_lamp_01",
craftableId = "ashfall_shoji_lamp_01",
description = "A lantern made of paper and wood.",
materials = {
{ material = "wood", count = 2 },
{ material = "paper", count = 2 },
{ material = "resin", count = 1 }
},
category = this.categories.survival,
soundType = "wood",
}
},
journeyman = {
{
Expand Down
1 change: 1 addition & 0 deletions Data Files/MWSE/mods/mer/ashfall/items/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require("mer.ashfall.items.bugnet")
require("mer.ashfall.items.door")
require("mer.ashfall.items.dummy")
require("mer.ashfall.items.firewood")
require("mer.ashfall.items.lantern")
require("mer.ashfall.items.planter")
require("mer.ashfall.items.teaWarmer")
require("mer.ashfall.items.waterFilter")
Expand Down
7 changes: 7 additions & 0 deletions Data Files/MWSE/mods/mer/ashfall/items/lantern/config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
local lanternConfig = {}

lanternConfig.ids = {
ashfall_shoji_lamp_01 = true
}

return lanternConfig
21 changes: 21 additions & 0 deletions Data Files/MWSE/mods/mer/ashfall/items/lantern/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
local lanternConfig = require("mer.ashfall.items.lantern.config")
local SwitchNode = require("CraftingFramework.nodeVisuals.SwitchNode")
local NodeManager = require("CraftingFramework.nodeVisuals.NodeManager")
--Always turn off handle so it doesn't show when dropped
-- defaults to on when equipped
local switchConfig = {
id = "LANTERN_HANDLE_SWITCH",
getActiveIndex = function(self, e)
return self.getIndex(e.node, "OFF")
end
}

local switchNode = SwitchNode.new(switchConfig)

NodeManager.register{
id = "Ashfall_lantern_handle",
nodes = { switchNode },
referenceRequirements = function(reference)
return lanternConfig.ids[reference.object.id:lower()]
end
}
17 changes: 9 additions & 8 deletions Data Files/MWSE/mods/mer/ashfall/needs/thirstController.lua
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,12 @@ end
---@param source Ashfall.LiquidContainer
---@param item tes3item
---@param itemData tes3itemData
---@return boolean, string?
function this.canTransferFilter(source, item, itemData)
local target = LiquidContainer.createFromInventory(item, itemData)
if not target then return false end

local canTransfer, reason = source:canTransfer(target)
if not canTransfer then
--logger:warn("Can't transfer: %s", reason)
end
return canTransfer
return canTransfer, reason
end

function this.playerHasFillableContainers(source)
Expand Down Expand Up @@ -206,6 +203,7 @@ function this.playerHasFillableContainers(source)
return false
end


--Fill a bottle to max water capacity
function this.fillContainer(params)
params = params or {}
Expand All @@ -214,12 +212,15 @@ function this.fillContainer(params)
local source = params.source or LiquidContainer.createInfiniteWaterSource()
local callback = params.callback
timer.delayOneFrame(function()
local noResultsText = common.messages.noContainersToFill
common.helper.showInventorySelectMenu{
title = "Select Water Container",
noResultsText = noResultsText,
noResultsText = common.messages.noContainersToFill,
filter = function(e)
return this.canTransferFilter(source, e.item, e.itemData)
local canTransfer, reason = this.canTransferFilter(source, e.item, e.itemData)
if reason then
logger:trace(reason)
end
return canTransfer
end,
callback = function(e)
if e.item then
Expand Down
Binary file not shown.

0 comments on commit 54db0cb

Please sign in to comment.