mirror of
https://github.com/sirrobzeroone/elepower.git
synced 2024-12-02 19:43:43 +01:00
Grindstone now needs a hand crank to operate
This commit is contained in:
parent
2eb0062491
commit
0ec289fdc5
@ -327,6 +327,15 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "elepower_machines:crank",
|
||||
recipe = {
|
||||
{"group:stick", "group:stick", "group:stick"},
|
||||
{"", "", "group:stick"},
|
||||
{"", "", "group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
-- Machine block
|
||||
minetest.register_craft({
|
||||
output = "elepower_machines:machine_block",
|
||||
|
@ -107,7 +107,7 @@ local function grindstone_timer(pos, elapsed)
|
||||
meta:set_string("formspec", get_formspec(percentile))
|
||||
meta:set_int("src_time", time)
|
||||
meta:set_int("src_time_max", target_time)
|
||||
meta:set_string("infotext", "Grindstone: ".. percentile .. "%\nPunch me to progress!")
|
||||
meta:set_string("infotext", "Grindstone: ".. percentile .. "%")
|
||||
|
||||
return refresh
|
||||
end
|
||||
@ -115,7 +115,7 @@ end
|
||||
ele.register_base_device("elepower_machines:grindstone", {
|
||||
description = "Grindstone\nA medieval pulverizer",
|
||||
tiles = {
|
||||
"elepower_cfalloy_top.png", "elepower_cfalloy_bottom.png", "elepower_grinder_side.png",
|
||||
"elepower_grinder_top.png", "elepower_cfalloy_bottom.png", "elepower_grinder_side.png",
|
||||
"elepower_grinder_side.png", "elepower_grinder_side.png", "elepower_grinder_side.png"
|
||||
},
|
||||
on_construct = function (pos)
|
||||
@ -140,16 +140,43 @@ ele.register_base_device("elepower_machines:grindstone", {
|
||||
tubedevice = 1,
|
||||
cracky = 2,
|
||||
},
|
||||
on_punch = function (pos, node, puncher, pointed_thing)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local stime = meta:get_int("src_time")
|
||||
local sttm = meta:get_int("src_time_max")
|
||||
})
|
||||
|
||||
minetest.register_node("elepower_machines:crank", {
|
||||
description = "Hand Crank",
|
||||
groups = {choppy = 1, oddly_breakable_by_hand = 1},
|
||||
tiles = {"default_wood.png"},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.3750, -0.1250, -0.03125, 0.03125, -0.06250, 0.03125},
|
||||
{-0.03125, -0.5000, -0.03125, 0.03125, -0.1250, 0.03125}
|
||||
}
|
||||
},
|
||||
on_rightclick = function (pos, node, clicker, itemstack, pointed_thing)
|
||||
local gpos = vector.add(pos, {x = 0, y = -1, z = 0})
|
||||
local gnode = minetest.get_node_or_nil(gpos)
|
||||
|
||||
if not gnode or gnode.name ~= "elepower_machines:grindstone" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local gmeta = minetest.get_meta(gpos)
|
||||
|
||||
-- Advance grindstone
|
||||
local stime = gmeta:get_int("src_time")
|
||||
local sttm = gmeta:get_int("src_time_max")
|
||||
|
||||
if sttm > 0 then
|
||||
meta:set_int("src_time", stime + 5)
|
||||
minetest.get_node_timer(pos):start(0.2)
|
||||
gmeta:set_int("src_time", stime + 5)
|
||||
|
||||
local t = minetest.get_node_timer(gpos)
|
||||
if not t:is_started() then
|
||||
t:start(0.2)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.node_punch(pos, node, puncher, pointed_thing)
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
BIN
elepower_machines/textures/elepower_grinder_top.png
Normal file
BIN
elepower_machines/textures/elepower_grinder_top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Loading…
Reference in New Issue
Block a user