summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorheav-4 <heavpoot@gmail.com>2022-03-30 22:40:25 +0100
committerheav-4 <heavpoot@gmail.com>2022-03-30 22:40:25 +0100
commit673ef2f9f9a52ba4f4a141ab0376fe20c2bbbd51 (patch)
tree49768a6a8813dca2aff27b3af3fe0346b814c515
parent6e3a2b8da715d0d15c165e6df8791a55e0a961c8 (diff)
improve things, stone tool crafting,e tcHEADmaster
-rw-r--r--mods/vzxv/nodes.lua15
-rw-r--r--mods/vzxv/textures/vzxvstoneaxehead.pngbin0 -> 5206 bytes
-rw-r--r--mods/vzxv/textures/vzxvstonepickhead.pngbin0 -> 5144 bytes
-rw-r--r--mods/vzxv/textures/vzxvstonespadehead.pngbin0 -> 5282 bytes
-rw-r--r--mods/vzxv_itemstacks/container.lua1
-rw-r--r--mods/vzxv_pummel/init.lua69
-rw-r--r--mods/vzxv_pummel/recipes.lua52
7 files changed, 116 insertions, 21 deletions
diff --git a/mods/vzxv/nodes.lua b/mods/vzxv/nodes.lua
index b10acd2..d64b47b 100644
--- a/mods/vzxv/nodes.lua
+++ b/mods/vzxv/nodes.lua
@@ -42,6 +42,21 @@ minetest.register_craftitem("vzxv:stoneplate", {
groups = { cracky = 1, stone = 1 },
inventory_image = "vzxvstoneplate.png",
})
+minetest.register_craftitem("vzxv:stonespadehead", {
+ description = "Stone spade head",
+ groups = { cracky = 1, stone = 1 },
+ inventory_image = "vzxvstonespadehead.png",
+})
+minetest.register_craftitem("vzxv:stoneaxehead", {
+ description = "Stone axe head",
+ groups = { cracky = 1, stone = 1 },
+ inventory_image = "vzxvstoneaxehead.png",
+})
+minetest.register_craftitem("vzxv:stonepickhead", {
+ description = "Stone pick head",
+ groups = { cracky = 1, stone = 1 },
+ inventory_image = "vzxvstonepickhead.png",
+})
vzxv.mundane_block("vzxv:planks","Planks",nil, {groups = {choppy = 1}})
diff --git a/mods/vzxv/textures/vzxvstoneaxehead.png b/mods/vzxv/textures/vzxvstoneaxehead.png
new file mode 100644
index 0000000..2d8a224
--- /dev/null
+++ b/mods/vzxv/textures/vzxvstoneaxehead.png
Binary files differ
diff --git a/mods/vzxv/textures/vzxvstonepickhead.png b/mods/vzxv/textures/vzxvstonepickhead.png
new file mode 100644
index 0000000..068c886
--- /dev/null
+++ b/mods/vzxv/textures/vzxvstonepickhead.png
Binary files differ
diff --git a/mods/vzxv/textures/vzxvstonespadehead.png b/mods/vzxv/textures/vzxvstonespadehead.png
new file mode 100644
index 0000000..7b15b9e
--- /dev/null
+++ b/mods/vzxv/textures/vzxvstonespadehead.png
Binary files differ
diff --git a/mods/vzxv_itemstacks/container.lua b/mods/vzxv_itemstacks/container.lua
index a8fb4d9..c3ca486 100644
--- a/mods/vzxv_itemstacks/container.lua
+++ b/mods/vzxv_itemstacks/container.lua
@@ -71,7 +71,6 @@ end
function vzxv.set_container_stack(pos, stack)
pos = vzxv.round_pos(pos)
-
local entity = get_container_entity(pos)
if stack and not entity then
add_container_entity(pos)
diff --git a/mods/vzxv_pummel/init.lua b/mods/vzxv_pummel/init.lua
index c2ad767..6552d89 100644
--- a/mods/vzxv_pummel/init.lua
+++ b/mods/vzxv_pummel/init.lua
@@ -38,32 +38,54 @@ local function toolcheck(tools,tool)
end
return false
end
- return singletoolcheck(tool)
+ return singletoolcheck(tools)
end
function vzxv.can_pummel(pos,node,tool,side)
- if vzxv_pummel_recipes[node.name] then
- for _,r in ipairs(vzxv_pummel_recipes[node.name]) do
- if not sidecheck(r.side,sidename(side)) then return false end
- if not toolcheck(r.tool,tool) then return false end
- if r.othernodes then
- for _,node in ipairs(r.othernodes) do
- local outputpos = deepclone(pos)
- outputpos.x = outputpos.x + (node.x or 0)
- outputpos.y = outputpos.y + (node.y or 0)
- outputpos.z = outputpos.z + (node.z or 0)
- if node.item then
- error("sorry no item inputs yet")
- else
- local node_at = minetest.get_node(outputpos).name
- if not toolcheck(node.node,node_at) then
- return false
- end
+ local recipe = vzxv_pummel_recipes[node.name]
+ if node.name == "vzxv_itemstacks:item" then
+ local stack = vzxv.get_container_stack(pos)
+ if not stack or not vzxv_pummel_recipes[stack:get_name()] then
+ return false
+ end
+ recipe = vzxv_pummel_recipes[stack:get_name()]
+ else
+ if not recipe then return false end
+ end
+ for _,r in ipairs(recipe) do
+
+ local function check(node)
+ local outputpos = deepclone(pos)
+ outputpos.x = outputpos.x + (node.x or 0)
+ outputpos.y = outputpos.y + (node.y or 0)
+ outputpos.z = outputpos.z + (node.z or 0)
+ if node.item then
+ local stack = vzxv.get_container_stack(outputpos)
+ if stack:get_count() == (node.count or 1) then
+ if toolcheck(node.item,stack:get_name()) then
+ return true
end
end
+ return false
+ elseif node.node then
+ local node_at = minetest.get_node(outputpos).name
+ if not toolcheck(node.node,node_at) then
+ return false
+ end
+ return true
end
- return r
+ return false
end
+ local res = true
+ if not sidecheck(r.side,sidename(side)) then res=false end
+ if not toolcheck(r.tool,tool) then res=false end
+ res = res and check(r.node)
+ if r.othernodes and res then
+ for _,node in ipairs(r.othernodes) do
+ res = res and check(node)
+ end
+ end
+ if res then return r end
end
return false
end
@@ -83,7 +105,14 @@ function vzxv.pummel(pos,node,tool,side)
outputpos.y = outputpos.y + (node.y or 0)
outputpos.z = outputpos.z + (node.z or 0)
if node.item then
- error("no item inputs yet sorry")
+ if node.consume then
+ local stack = vzxv.get_container_stack(outputpos)
+ stack:take_item(node.count)
+ vzxv.set_container_stack(outputpos,stack)
+ if stack:is_empty() then
+ minetest.set_node(outputpos,{name="air"})
+ end
+ end
else
if node.consume then
minetest.set_node(outputpos,{name="air"})
diff --git a/mods/vzxv_pummel/recipes.lua b/mods/vzxv_pummel/recipes.lua
index a8fbb77..f0cd97e 100644
--- a/mods/vzxv_pummel/recipes.lua
+++ b/mods/vzxv_pummel/recipes.lua
@@ -49,3 +49,55 @@ vzxv.add_pummel_recipe{
outputs = {{node="vzxv:grass"}}
}
+-- stone platement?
+
+vzxv.add_pummel_recipe{
+ node = {item="vzxv:stoneplate",count=1,consume=true},
+ side = {1,2,3,4,5,6},
+ tool = {{item="group1:pick"}},
+ outputs = {{item="vzxv:stonespadehead",count=1}}
+}
+
+vzxv.add_pummel_recipe{
+ node = {item="vzxv:stonespadehead",count=1,consume=true},
+ side = {1,2,3,4,5,6},
+ tool = {{item="group1:pick"}},
+ outputs = {{item="vzxv:stoneaxehead",count=1}}
+}
+
+vzxv.add_pummel_recipe{
+ node = {item="vzxv:stoneaxehead",count=1,consume=true},
+ side = {1,2,3,4,5,6},
+ tool = {{item="group1:pick"}},
+ outputs = {{item="vzxv:stonepickhead",count=1}}
+}
+
+vzxv.add_pummel_recipe{
+ node = {item="vzxv:stonepickhead",count=1,consume=true},
+ side = {1,2,3,4,5,6},
+ tool = {{item="group1:pick"}},
+ outputs = {}
+}
+
+-- stone tools
+
+vzxv.add_pummel_recipe{
+ node = {item="vzxv:stonespadehead",consume=true},
+ side = 1,
+ othernodes = {{node="vzxv:stick",y=-1,consume=true}},
+ outputs = {{item="vzxv:stonespade",y=-1}}
+}
+
+vzxv.add_pummel_recipe{
+ node = {item="vzxv:stoneaxehead",count=1,consume=true},
+ side = 1,
+ othernodes = {{node="vzxv:stick",y=-1,consume=true}},
+ outputs = {{item="vzxv:stoneaxe",y=-1}}
+}
+
+vzxv.add_pummel_recipe{
+ node = {item="vzxv:stonepickhead",consume=true},
+ side = 1,
+ othernodes = {{node="vzxv:stick",y=-1,consume=true}},
+ outputs = {{item="vzxv:stonepick",y=-1}}
+}