Skip to content

Commit

Permalink
Addition of basement exclusive rock walls to the housing catalogue #416
Browse files Browse the repository at this point in the history
  • Loading branch information
brightrim committed Jul 6, 2024
1 parent eb8fe7c commit 5fcd24c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
19 changes: 13 additions & 6 deletions housing/construction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ local function createItem(user, product, trowel, skill)
else
user:inform("Du bist nicht dazu berechtigt, hier zu bauen.","You do not have permission to build there.")
end
elseif utility.checkIfPlantOrTree(user, product.id) then
elseif utility.checkIfPlantOrTree(product.id) then
if utility.checkIfGardeningCriteriaMet(user, product.id) then
eraseIngredients(user, product)
world:createItemFromId(product.id, product.quantity, target, true, quality, nil)
Expand Down Expand Up @@ -562,17 +562,24 @@ function M.showDialog(user, skillName, overloaded)
end
end

if not utility.wallWindowPermissions(user, frontPos, product.id, product.tile) or not hasMaterials(user, product) or utility.checkIfEntrance(user, frontPos, product.tile) then
canWork = false
end

if utility.checkIfPlantOrTree(user, product.id) then
if utility.checkIfPlantOrTree(product.id) then
if not utility.checkIfGardeningCriteriaMet(user, product.id) then
canWork = false
user:inform("Das kannst du hier nicht pflanzen.","You can't plant this here.")
end
end

if utility.checkIfBasementExclusive(user, product.id) then
if not (user.pos.z < 0) then
canWork = false
user:inform("GERMAN TRANSLATION", "You can't build basement exclusive items above ground.")
end
end

if not utility.wallWindowPermissions(user, frontPos, product.id, product.tile) or not hasMaterials(user, product) or utility.checkIfEntrance(user, frontPos, product.tile) then
canWork = false
end

return canWork

elseif result == CraftingDialog.playerLooksAtItem then
Expand Down
10 changes: 9 additions & 1 deletion housing/itemList.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,14 @@ table.insert(M.items, {itemId = 3754, typeOf = "Estate", category = "Doors", nam
table.insert(M.items, {itemId = 3756, typeOf = "Estate", category = "Doors", nameDe = "Tür - Norden", nameEn = "Door North", skill = "blacksmithing", level = 50, ingredient1 = Item.ironPlate, ingredient1Amount = 20, ingredient2 = Item.stoneBlock, ingredient2Amount = 10, ingredient3 = Item.clay, ingredient3Amount = 5, ingredient4 = nil, ingredient4Amount = nil})
table.insert(M.items, {itemId = 3758, typeOf = "Estate", category = "Doors", nameDe = "Tür - Osten", nameEn = "Door East", skill = "carpentry", level = 50, ingredient1 = Item.cherryWoodBoards, ingredient1Amount = 20, ingredient2 = Item.stoneBlock, ingredient2Amount = 10, ingredient3 = Item.clay, ingredient3Amount = 5, ingredient4 = nil, ingredient4Amount = nil})
table.insert(M.items, {itemId = 3760, typeOf = "Estate", category = "Doors", nameDe = "Tür - Norden", nameEn = "Door North", skill = "carpentry", level = 50, ingredient1 = Item.cherryWoodBoards, ingredient1Amount = 20, ingredient2 = Item.stoneBlock, ingredient2Amount = 10, ingredient3 = Item.clay, ingredient3Amount = 5, ingredient4 = nil, ingredient4Amount = nil})

table.insert(M.items, {itemId = 3092, typeOf = "Estate", category = "Basement Exclusive", skill = "mining", level = 80, ingredient1 = Item.rawStone, ingredient1Amount = 70, ingredient2 = nil, ingredient2Amount = nil, ingredient3 = nil, ingredient3Amount = nil, ingredient4 = nil, ingredient4Amount = nil})
table.insert(M.items, {itemId = 3091, typeOf = "Estate", category = "Basement Exclusive", skill = "mining", level = 80, ingredient1 = Item.rawStone, ingredient1Amount = 70, ingredient2 = nil, ingredient2Amount = nil, ingredient3 = nil, ingredient3Amount = nil, ingredient4 = nil, ingredient4Amount = nil})
table.insert(M.items, {itemId = 3090, typeOf = "Estate", category = "Basement Exclusive", skill = "mining", level = 80, ingredient1 = Item.rawStone, ingredient1Amount = 70, ingredient2 = nil, ingredient2Amount = nil, ingredient3 = nil, ingredient3Amount = nil, ingredient4 = nil, ingredient4Amount = nil})
table.insert(M.items, {itemId = 3089, typeOf = "Estate", category = "Basement Exclusive", skill = "mining", level = 80, ingredient1 = Item.rawStone, ingredient1Amount = 70, ingredient2 = nil, ingredient2Amount = nil, ingredient3 = nil, ingredient3Amount = nil, ingredient4 = nil, ingredient4Amount = nil})
table.insert(M.items, {itemId = 3088, typeOf = "Estate", category = "Basement Exclusive", skill = "mining", level = 80, ingredient1 = Item.rawStone, ingredient1Amount = 70, ingredient2 = nil, ingredient2Amount = nil, ingredient3 = nil, ingredient3Amount = nil, ingredient4 = nil, ingredient4Amount = nil})
table.insert(M.items, {itemId = 3087, typeOf = "Estate", category = "Basement Exclusive", skill = "mining", level = 80, ingredient1 = Item.rawStone, ingredient1Amount = 70, ingredient2 = nil, ingredient2Amount = nil, ingredient3 = nil, ingredient3Amount = nil, ingredient4 = nil, ingredient4Amount = nil})
table.insert(M.items, {itemId = 3086, typeOf = "Estate", category = "Basement Exclusive", skill = "mining", level = 80, ingredient1 = Item.rawStone, ingredient1Amount = 70, ingredient2 = nil, ingredient2Amount = nil, ingredient3 = nil, ingredient3Amount = nil, ingredient4 = nil, ingredient4Amount = nil})
table.insert(M.items, {itemId = 3085, typeOf = "Estate", category = "Basement Exclusive", skill = "mining", level = 80, ingredient1 = Item.rawStone, ingredient1Amount = 70, ingredient2 = nil, ingredient2Amount = nil, ingredient3 = nil, ingredient3Amount = nil, ingredient4 = nil, ingredient4Amount = nil})

M.tiles = {}
table.insert(M.tiles, {displayId = Item.parquet , tileId = 40, typeOf = "House", category = "Parquet", skill = "carpentry", level = 0, ingredient1 = 2716, ingredient1Amount = 25})
Expand Down Expand Up @@ -1195,6 +1202,7 @@ table.insert(M.categories, {categoryEn = "Gates", categoryDe = "Tore", Estate =
table.insert(M.categories, {categoryEn = "Decorations", categoryDe = "Dekorationen"})
table.insert(M.categories, {categoryEn = "Trees", categoryDe = "Bäume", Estate = true})
table.insert(M.categories, {categoryEn = "Plants", categoryDe = "Pflanzen"})
table.insert(M.categories, {categoryEn = "Basement Exclusive", categoryDe = "GERMAN TRANSLATION"})
table.insert(M.categories, {categoryEn = "Altars", categoryDe = "Altäre"})
table.insert(M.categories, {categoryEn = "Beds", categoryDe = "Betten"})
table.insert(M.categories, {categoryEn = "Benches", categoryDe = "Bänke"})
Expand Down
11 changes: 10 additions & 1 deletion housing/utility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ local function isGrass(itemId)
return false
end

function M.checkIfPlantOrTree(user, itemId)
function M.checkIfPlantOrTree(itemId)
for _, item in pairs(itemList.items) do
if item.category == "Plants" or item.category == "Trees" then
if item.itemId == itemId and not isIvy(itemId) and not isGrass(itemId) then
Expand All @@ -190,6 +190,15 @@ function M.checkIfPlantOrTree(user, itemId)
return false
end

function M.checkIfBasementExclusive(itemId)
for _, item in pairs(itemList.items) do
if item.category == "Basement Exclusive" then
return true
end
end
return false
end

function M.checkRequiredFood(user, time)
local neededFood = time*4 --One second of crafting takes 40 food points, same as in crafts

Expand Down

0 comments on commit 5fcd24c

Please sign in to comment.