Merge pull request #5 from TerraQuest-Studios/industrial

add basic tech
This commit is contained in:
wsor4035 2022-01-01 23:04:48 -05:00 committed by GitHub
commit 6aea0f9f24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 397 additions and 124 deletions

View File

@ -1,7 +1,8 @@
local floor = math.floor
local min = math.min
local item_health = 8
local on_step = minetest.registered_entities["__builtin:item"].on_step
local lifespan = tonumber(core.settings:get("item_entity_ttl")) or 900
--local on_step = minetest.registered_entities["__builtin:item"].on_step
local on_activate = minetest.registered_entities["__builtin:item"].on_activate
local get_staticdata = minetest.registered_entities["__builtin:item"].get_staticdata
@ -30,20 +31,50 @@ end
minetest.registered_entities["__builtin:item"].on_step = function(self, dtime, moveresult)
self._dtime = min(dtime,0.2)
self.age = self.age + dtime
self._freeze = true
local pos = self.object:get_pos()
local node = minetest.get_node_or_nil(pos) or {name = "*", param2 = 0}
--kill if to old
if lifespan > 0 and self.age > lifespan then
self.object:remove()
return
end
--item input injects (for machines, injectors)
if moveresult.collides and self.conveyor then
if moveresult.collisions[1] and moveresult.collisions[1].type == "node" then
local cpos = moveresult.collisions[1].node_pos
local cnode = minetest.get_node(cpos)
local cdef = minetest.registered_nodes[cnode.name]
if minetest.get_item_group(cnode.name, "item_input") >= 1
and cdef._allow_input(cnode.param2, node.param2) then
local istack = ItemStack(self.itemstring)
cdef._item_input(cpos, cnode, istack)
self.object:remove()
--return
--minetest.chat_send_all(cnode.name)
return
end
end
end
--burning code
if not self._memory.thing then self._memory.thing = 1 end
if timer(self, 1) and core.get_item_group(self.itemstring, "unburnable") == 0 then
local node = minetest.get_node_or_nil(pos) or {name = "*"}
--local node = minetest.get_node_or_nil(pos) or {name = "*"}
local def = minetest.registered_nodes[node.name] or {}
if def.damage_per_second then self._memory.health = self._memory.health - def.damage_per_second end
if self._memory.health <= 0 then self.object:remove() return end
end
--floating code
self.isinliquid = false
self.isinflowingliquid = false
local node = minetest.get_node_or_nil(pos) or {name = "*"}
--local node = minetest.get_node_or_nil(pos) or {name = "*"}
local def = minetest.registered_nodes[node.name] or {}
if def.drawtype == "liquid" then
self.isinliquid = true
@ -52,8 +83,14 @@ minetest.registered_entities["__builtin:item"].on_step = function(self, dtime, m
end
if self.isinliquid and self.object:get_velocity().y < 1 then
--snap to center
if pos.x ~= math.floor(pos.x+0.5) or pos.z ~= math.floor(pos.z+0.5) then
self.object:set_pos(vector.new(math.floor(pos.x+0.5), pos.y, math.floor(pos.z+0.5)))
end
local oldv = self.object:get_velocity()
self.object:add_velocity(vector.new(-oldv.x,1,-oldv.z))
self._freeze = false
--[[
elseif self.isinflowingliquid then
local oldv = self.object:get_velocity()
@ -66,6 +103,52 @@ minetest.registered_entities["__builtin:item"].on_step = function(self, dtime, m
--]]
end
--conveyor code
if string.find(node.name, "fl_industrial:conveyor") then
local dir = core.facedir_to_dir(node.param2)
--center on conveyor
if dir.x == 0 and pos.x ~= math.floor(pos.x+0.5) then
self.object:set_pos(vector.new(math.floor(pos.x+0.5), pos.y, pos.z))
elseif dir.z == 0 and pos.z ~= math.floor(pos.z+0.5) then
self.object:set_pos(vector.new(pos.x, pos.y, math.floor(pos.z+0.5)))
end
self.object:set_velocity(dir)
self.conveyor = {true, 10, dir}
self._freeze = false
elseif self.conveyor and self.conveyor[1] then
if self.conveyor[2] == 0 then
if self.conveyor[3].x == self.object:get_velocity().x
or self.conveyor[3].z == self.object:get_velocity().z then
self.object:set_velocity(vector.new(0,0,0))
end
self.conveyor = nil
else
self.conveyor[2] = self.conveyor[2] - 1
self._freeze = false
end
end
--collision stop
if self._freeze and moveresult.collides then
if not vector.equals(vector.new(0,0,0), self.object:get_velocity()) then
self.object:set_velocity(vector.new(0,0,0))
end
end
--merge items
local own_stack = ItemStack(self.itemstring)
if vector.equals(self.object:get_velocity(), vector.new(0,0,0)) and own_stack:get_free_space() ~= 0 then
local objs = core.get_objects_inside_radius(pos, 1.0)
for _, obj in pairs(objs) do
local ent = obj:get_luaentity()
if ent and ent.name == "__builtin:item" then
self:try_merge_with(own_stack, obj, ent)
end
end
end
self._time_total=self._time_total+self._dtime
on_step(self, dtime, moveresult)
--on_step(self, dtime, moveresult)
end

View File

@ -0,0 +1,4 @@
Aurailus MIT:
farlands_conveyor_base.png
farlands_conveyor_top.png
farlands_conveyor_top_two.png

View File

@ -0,0 +1,72 @@
--Aurailus, wsor, MIT
local nb_table = {
{
{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, -- NodeBox1
{-0.5, -0.4375, -0.5, -0.375, -0.3125, 0.5}, -- NodeBox2
{0.375, -0.4375, -0.5, 0.5, -0.3125, 0.5}, -- NodeBox3
},
{
{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, -- NodeBox1
{-0.5, -0.4375, -0.5, -0.375, -0.3125, 0.5}, -- NodeBox2
{0.375, -0.4375, -0.5, 0.5, -0.3125, -0.375}, -- NodeBox3
{0.375, -0.4375, 0.375, 0.5, -0.3125, 0.5}, -- NodeBox4}
},
{
{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, -- NodeBox1
{0.5, -0.4375, -0.5, 0.375, -0.3125, 0.5}, -- NodeBox2
{-0.375, -0.4375, -0.5, -0.5, -0.3125, -0.375}, -- NodeBox3
{-0.375, -0.4375, 0.375, -0.5, -0.3125, 0.5}, -- NodeBox4}
},
{
{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, -- NodeBox1
{0.375, -0.4375, -0.5, 0.5, -0.3125, -0.375}, -- NodeBox3
{0.375, -0.4375, 0.375, 0.5, -0.3125, 0.5}, -- NodeBox4}
{-0.375, -0.4375, -0.5, -0.5, -0.3125, -0.375}, -- NodeBox3
{-0.375, -0.4375, 0.375, -0.5, -0.3125, 0.5}, -- NodeBox4}
}
}
local names = {
{"", "farlands_conveyor_top.png"},
{"_left", "farlands_conveyor_top_two.png^[transformR180"},
{"_right", "farlands_conveyor_top_two.png"},
{"_funnel", "[combine:16x256:0,0=farlands_conveyor_top_two.png:14,0=farlands_conveyor_top_two.png"}
}
for i = 1, 4 do
minetest.register_node("fl_industrial:conveyor" .. names[i][1], {
description = "Conveyor Belt",
groups = {oddly_breakable_by_hand = 3, cracky = 3, choppy = 3, conveyor = 1},
tiles = {
{
name = names[i][2],
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
"farlands_conveyor_base.png",
"farlands_conveyor_base.png",
"farlands_conveyor_base.png",
"farlands_conveyor_base.png",
"farlands_conveyor_base.png",
},
drawtype = "nodebox",
paramtype = "light",
sunlight_propagates = true,
node_box = {
type = "fixed",
fixed = nb_table[i]
},
paramtype2 = "facedir",
collision_box = {
type = "fixed",
fixed = {{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}},
},
selection_box = {
type = "fixed",
fixed = {{-0.5, -0.5, -0.5, 0.5, -0.3125, 0.5}},
}
})
end

View File

@ -0,0 +1,3 @@
local modpath = minetest.get_modpath("fl_industrial")
dofile(modpath .. "/conveyors.lua")
dofile(modpath .. "/injector.lua")

View File

@ -0,0 +1,66 @@
minetest.register_node("fl_industrial:injector", {
description = "injector",
tiles = {
"farlands_conveyor_base.png",
"farlands_conveyor_base.png",
"farlands_conveyor_base.png^farlands_injector_arrow.png",
"farlands_conveyor_base.png^(farlands_injector_arrow.png^[transformR180)",
--"[combine:16x16",
--"[combine:16x16",
"farlands_conveyor_base.png",
"farlands_conveyor_base.png",
},
paramtype2 = "facedir",
on_punch = function(pos, node, puncher, pointed_thing)
--handle register_on_punchnode stuff
minetest.node_punch(pos, node, puncher, pointed_thing)
local dir = core.facedir_to_dir(node.param2)
local inv = minetest.get_inventory({type = "node", pos = vector.subtract(pos, dir)})
local inv_node = minetest.get_node(vector.subtract(pos, dir))
local drop_def = minetest.registered_items[minetest.get_node(vector.add(pos, dir)).name]
if inv and not inv:is_empty("main") then
local list = inv:get_list("main")
for i = inv:get_size("main"),1,-1 do
if not list[i]:is_empty() then
if inv_node.allow_metadata_inventory_take and
inv_node.allow_metadata_inventory_take(vector.subtract(pos, dir), "main", i, list[i], nil) ~= 0 then
return
end
if drop_def.drawtype == "airlike" and not drop_def._machine_input then
minetest.add_item(vector.add(pos, dir), list[i])
else
minetest.registered_items[node.name]._item_input(pos, node, list[i])
end
list[i]:clear()
inv:set_list("main", list)
return
end
end
end
end,
_item_input = function(pos, node, itemstack)
--minetest.chat_send_all(minetest.pos_to_string(pos, 2))
local dir = core.facedir_to_dir(node.param2)
local inv = minetest.get_inventory({type = "node", pos = vector.add(pos, dir)})
local inv_node = minetest.get_node(vector.add(pos, dir))
local def = minetest.registered_nodes[inv_node.name]
local dump
if def._machine_input then
dump = def._machine_input(vector.add(pos, dir), minetest.get_node(vector.add(pos, dir)), itemstack)
elseif def.allow_metadata_inventory_put
and def.allow_metadata_inventory_put(vector.add(pos, dir), "main", 1, itemstack, nil) == 0 or not inv then
dump = itemstack
else
dump = inv:add_item("main", itemstack)
end
if not dump:is_empty() then minetest.add_item(vector.new(pos.x, pos.y+1, pos.z), dump) end
end,
_allow_input = function(np2, op2)
if np2 == op2 then return true end
end,
groups = {oddly_breakable_by_hand = 3, item_input = 1}
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

View File

@ -10,6 +10,13 @@ local function register_ore(name, ingot_toggle, block_groups)
description = name .. " ingot",
inventory_image = "farlands_" .. name .. "_ingot.png",
})
minetest.register_craft({
type = "cooking",
output = "fl_ores:" .. name .. "_ingot",
recipe = "fl_ores:" .. name .. "_ore",
cooktime = 5,
})
end
minetest.register_node("fl_ores:" .. name .. "_block", {
description = name .. " block",
@ -82,6 +89,17 @@ minetest.register_craft({
}
})
local groups = table.copy(minetest.registered_items["fl_ores:coal_ore"].groups)
groups.fuel = 1
minetest.override_item("fl_ores:coal_ore",{
groups = groups
})
groups = table.copy(minetest.registered_items["fl_ores:coal_block"].groups)
groups.fuel = 1
minetest.override_item("fl_ores:coal_block",{
groups = groups
})
minetest.register_craft({
type = "fuel",
recipe = "fl_ores:coal_ore",

View File

@ -2,5 +2,5 @@ minetest.register_craft({
type = "cooking",
output = "fl_wildlife:cooked_riverfish",
recipe = "fl_wildlife:raw_riverfish",
cooktime = 1,
cooktime = 5,
})

View File

@ -1,9 +1,22 @@
viewing_furnace = {}
--this file is far, far from perfect but is a effort to get a working furnace out currently
--todo: show fire animation and progress in formspec
local function update_active(pos, pname, firep, arrowp)
--viewing_furnace = {}
local function _machine_input(pos, node, itemstack)
local inv = minetest.get_meta(pos):get_inventory()
if minetest.get_item_group(itemstack:get_name(), "fuel") >= 1 then
return inv:add_item("fuel", itemstack)
else
local output, _ = minetest.get_craft_result({method = "cooking", width = 1, items = {itemstack}})
if output.time == 0 or output.item:is_empty() then return itemstack end
return inv:add_item("input", itemstack)
end
end
local function on_rightclick(pos, node, clicker, itemstack, pointed_thing)
--vars for stuff
local clicker = minetest.get_player_by_name(pname)
local chName = "furnace"
local iPos = pos.x .. "," .. pos.y .. "," .. pos.z
local cInvSize = clicker:get_inventory():get_size("main")
@ -32,18 +45,15 @@ local function update_active(pos, pname, firep, arrowp)
"background9[0,0;" .. formSize .. ";i3_bg_full.png;false;10]",
}
local car = "(i3_arrow.png^[transformR90)"
local arrow_out = "(" .. car .. "^[lowpart:" .. arrowp .. ":(" .. car .. "^[brighten))^[transformR270"
--build chest inventory
local furnace_layout = {
"label[0.3,0.4;" .. chName .. "]",
"box[2.7,0.7;1,1;]",
"list[nodemeta:" .. iPos .. ";input;2.7,0.7;1,1;]",
"image[2.7,2.2;1,1;farlands_furnace_fire_bg.png^[lowpart:" .. firep ..":farlands_furnace_fire_fg.png]",
"image[2.7,2.2;1,1;farlands_furnace_fire_bg.png]",
"box[2.7,3.7;1,1;]",
"list[nodemeta:" .. iPos .. ";fuel;2.7,3.7;1,1;]",
"image[4.7,2.2;1,1;" .. arrow_out .. "]",
"image[4.7,2.2;1,1;i3_arrow.png]",
"box[6.7,2.2;1,1;]",
"list[nodemeta:" .. iPos .. ";output;6.7,2.2;1,1;]",
}
@ -74,39 +84,77 @@ local function update_active(pos, pname, firep, arrowp)
--show formspec
local chest_formspec = table.concat(formspec, "")
minetest.show_formspec(clicker:get_player_name(), "fl_workshop:furnace_active_formspec", chest_formspec)
--[[
if viewing_furnace[minetest.hash_node_position(pos)] then
local vft = viewing_furnace[minetest.hash_node_position(pos)]
table.insert(vft, clicker:get_player_name())
viewing_furnace[minetest.hash_node_position(pos)] = vft
else viewing_furnace[minetest.hash_node_position(pos)] = {clicker:get_player_name()} end
viewing_furnace[clicker:get_player_name()] = pos
--]]
minetest.show_formspec(clicker:get_player_name(), "fl_workshop:furnace_formspec", chest_formspec)
end
local function furnace_nt(pos, elapsed)
--minetest.chat_send_all(elapsed)
--return true
local function swap_node(pos, node)
if minetest.get_node(pos).name == node.name then return end
minetest.swap_node(pos, node)
end
if viewing_furnace[minetest.hash_node_position(pos)] then
for _, pname in pairs(viewing_furnace[minetest.hash_node_position(pos)]) do
update_active(pos, pname, 40, 70)
end
local function on_timer(pos, elapsed)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local ifuel, iinput, ioutput = inv:get_list("fuel"), inv:get_list("input"), inv:get_list("output")
local total_time = meta:get_float("total_time") or 0
total_time = total_time + elapsed
local burn_time = meta:get_float("burn_time") or 0
burn_time = burn_time - elapsed
local coutput, _ = minetest.get_craft_result({method = "cooking", width = 1, items = iinput})
if coutput.item:is_empty() or coutput.time == 0 then
return swap_node(pos, {name = "fl_workshop:furnace", param2 = minetest.get_node(pos).param2})
end
return false
if burn_time <= 0 and not ifuel[1]:is_empty() then
local foutput, _ = minetest.get_craft_result({method = "fuel", width = 1, items = ifuel})
if foutput.time == 0 then
meta:set_float("burn_time", 0)
return swap_node(pos, {name = "fl_workshop:furnace", param2 = minetest.get_node(pos).param2})
end
burn_time = foutput.time
meta:set_float("burn_time", burn_time)
ifuel[1]:take_item()
inv:set_list("fuel", ifuel)
--minetest.chat_send_all("fuel")
elseif burn_time <= 0 then
meta:set_float("burn_time", 0)
return swap_node(pos, {name = "fl_workshop:furnace", param2 = minetest.get_node(pos).param2})
else
meta:set_float("burn_time", burn_time)
end
if coutput.time > total_time then
minetest.get_node_timer(pos):start(1.0)
meta:set_float("total_time", total_time)
--minetest.chat_send_all("trigger1")
return swap_node(pos, {name = "fl_workshop:furnace_active", param2 = minetest.get_node(pos).param2})
else
meta:set_float("total_time", 0)
if iinput[1]:is_empty() then
return swap_node(pos, {name = "fl_workshop:furnace", param2 = minetest.get_node(pos).param2})
end
if not ioutput[1]:is_empty() and coutput.item:get_name() ~= ioutput[1]:get_name() then
return swap_node(pos, {name = "fl_workshop:furnace", param2 = minetest.get_node(pos).param2})
end
local remainder = inv:add_item("output", coutput.item)
if remainder:is_empty() then iinput[1]:take_item() end
inv:set_list("input", iinput)
if not iinput[1]:is_empty() then minetest.get_node_timer(pos):start(1.0) end
--minetest.chat_send_all("trigger2")
return swap_node(pos, {name = "fl_workshop:furnace_active", param2 = minetest.get_node(pos).param2})
end
end
--if either or empty, do nothing
--if inv:is_empty("input") or inv:is_empty("fuel") then return false end
--local Coutput, Creturn = minetest.get_craft_result({method = "cooking", width = 1, items = inv:get_list("input")})
--local Foutput, Freturn = minetest.get_craft_result({method = "fuel", width = 1, items = inv:get_list("fuel")})
--not valid fuel or cookable item, do nothing
--if Coutput.time == 0 or Foutput.time == 0 then return false end
--[[debug dumps
minetest.chat_send_all(dump(Coutput))
minetest.chat_send_all(dump(Creturn))
minetest.chat_send_all("break")
minetest.chat_send_all(dump(Foutput))
minetest.chat_send_all(dump(Freturn))
--]]
minetest.register_node("fl_workshop:furnace", {
description = "furnace",
paramtype2 = "facedir",
@ -125,95 +173,40 @@ minetest.register_node("fl_workshop:furnace", {
"farlands_furnace_front.png",
},
groups = {oddly_breakable_by_hand = 3},
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
--vars for stuff
local chName = "furnace"
local iPos = pos.x .. "," .. pos.y .. "," .. pos.z
local cInvSize = clicker:get_inventory():get_size("main")
local rLength = (cInvSize-9)/3
local slotSize
local formSize
if rLength == 12 then slotSize, formSize = 0.725, "10.4,9.475"
elseif rLength == 11 then slotSize, formSize = 0.8, "10.4,9.7"
elseif rLength == 10 then slotSize, formSize = 0.89, "10.4,9.97"
else slotSize, formSize = 1, "10.4,10.3" end
if minetest.get_meta(pos):get_string("description") ~= "" then
chName = minetest.get_meta(pos):get_string("description")
--minetest.get_meta(pos):set_string("infotext", minetest.get_meta(pos):get_string("description"))
end
--header of formspec
local formspec = {
"formspec_version[4]",
"size[" .. formSize .. "]",
"no_prepend[]",
"style_type[box;colors=#77777710,#77777710,#777,#777]",
"style_type[list;size=1;spacing=0.1]",
"listcolors[#0000;#ffffff20]",
"bgcolor[black;neither]",
"background9[0,0;" .. formSize .. ";i3_bg_full.png;false;10]",
}
--build chest inventory
local furnace_layout = {
"label[0.3,0.4;" .. chName .. "]",
"box[2.7,0.7;1,1;]",
"list[nodemeta:" .. iPos .. ";input;2.7,0.7;1,1;]",
"image[2.7,2.2;1,1;farlands_furnace_fire_bg.png]",
"box[2.7,3.7;1,1;]",
"list[nodemeta:" .. iPos .. ";fuel;2.7,3.7;1,1;]",
"image[4.7,2.2;1,1;i3_arrow.png]",
"box[6.7,2.2;1,1;]",
"list[nodemeta:" .. iPos .. ";output;6.7,2.2;1,1;]",
}
table.insert(formspec, table.concat(furnace_layout, ""))
--build inventory part of formspec
table.insert(formspec, "label[0.3,5.4;Inventory]")
table.insert(formspec, "style_type[box;colors=#77777710,#77777710,#777,#777]")
for i=0, 8 do
table.insert(formspec, "box[" .. 0.3+i+(i*0.1) ..",5.7;1,1;]")
end
table.insert(formspec, "list[current_player;main;0.3,5.7;9,1;]")
table.insert(formspec, "style_type[list;size=" .. slotSize .. ";spacing=0.1]")
table.insert(formspec, "style_type[box;colors=#666]") -- change bottom 3 rows color
for i=0, 2 do
for j=0, rLength-1 do
table.insert(formspec, "box[" .. 0.3+(j*0.1)+(j*slotSize) .."," .. 6.8+(i*0.1)+(i*slotSize) .. ";"
.. slotSize .. "," .. slotSize .. ";]")
end
table.insert(formspec, "list[current_player;main;0.3," .. 6.8+(i*0.1)+(i*slotSize) .. ";"
.. rLength .. ",1;" .. 9+(rLength*i) .. "]")
end
--enable shiftclicking?
table.insert(formspec, "listring[nodemeta:" .. iPos .. ";main]")
table.insert(formspec, "listring[current_player;main]")
--show formspec
local chest_formspec = table.concat(formspec, "")
if viewing_furnace[minetest.hash_node_position(pos)] then
local vft = viewing_furnace[minetest.hash_node_position(pos)]
table.insert(vft, clicker:get_player_name())
viewing_furnace[minetest.hash_node_position(pos)] = vft
else viewing_furnace[minetest.hash_node_position(pos)] = {clicker:get_player_name()} end
viewing_furnace[clicker:get_player_name()] = pos
minetest.show_formspec(clicker:get_player_name(), "fl_workshop:furnace_formspec", chest_formspec)
end,
on_rightclick = on_rightclick,
on_metadata_inventory_put = function(pos) minetest.get_node_timer(pos):start(1.0) end,
on_metadata_inventory_take = function(pos) minetest.get_node_timer(pos):start(1.0) end,
on_metadata_inventory_move = function(pos) minetest.get_node_timer(pos):start(1.0) end,
on_timer = furnace_nt,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if listname == "output" then
return 0
elseif listname == "fuel" and minetest.get_item_group(stack:get_name(), "fuel") <= 0 then
return 0
end
return stack:get_count()
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local stack = minetest.get_meta(pos):get_inventory():get_stack(from_list, from_index)
if to_list == "output" then
return 0
elseif to_list == "fuel" and minetest.get_item_group(stack:get_name(), "fuel") <= 0 then
return 0
end
return count
end,
on_timer = on_timer,
_machine_input = _machine_input,
})
minetest.register_node("fl_workshop:furnace_active", {
description = "furnace",
paramtype2 = "facedir",
--this will be used because furnace is swaped to furnace_active
on_timer = furnace_nt,
on_construct = function(pos)
local inv = minetest.get_meta(pos):get_inventory()
inv:set_size("input", 1)
inv:set_size("fuel", 1)
inv:set_size("output", 1)
end,
tiles = {
"farlands_stone_block.png",
"farlands_stone_block.png",
@ -231,10 +224,34 @@ minetest.register_node("fl_workshop:furnace_active", {
},
}
},
groups = {oddly_breakable_by_hand = 3},
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
on_rightclick = on_rightclick,
on_metadata_inventory_put = function(pos) minetest.get_node_timer(pos):start(1.0) end,
on_metadata_inventory_take = function(pos) minetest.get_node_timer(pos):start(1.0) end,
on_metadata_inventory_move = function(pos) minetest.get_node_timer(pos):start(1.0) end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if listname == "output" then
return 0
elseif listname == "fuel" and minetest.get_item_group(stack:get_name(), "fuel") <= 0 then
return 0
end
return stack:get_count()
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local stack = minetest.get_meta(pos):get_inventory():get_stack(from_list, from_index)
if to_list == "output" then
return 0
elseif to_list == "fuel" and minetest.get_item_group(stack:get_name(), "fuel") <= 0 then
return 0
end
return count
end,
on_timer = on_timer,
_machine_input = _machine_input,
})
minetest.register_on_player_receive_fields(function(player, formname, fields)
--minetest.register_on_player_receive_fields(function(player, formname, fields)
--[[
if formname ~= "fl_workshop:furnace_formspec" and formname ~= "fl_workshop:furnace_active_formspec" then return end
if fields.quit == "true" then
local ref = viewing_furnace[minetest.hash_node_position(viewing_furnace[player:get_player_name()])]
@ -250,4 +267,14 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
viewing_furnace[player:get_player_name()] = nil
return
end
end)
--]]
--end)
minetest.register_craft({
output = "fl_workshop:furnace",
recipe = {
{"group:stone", "group:stone", "group:stone"},
{"group:stone", "", "group:stone"},
{"group:stone", "group:stone", "group:stone"},
},
})

View File

@ -11,7 +11,7 @@ fl_workshop.details = {
local tool_nodes = {
"saw",
--"furnace",
"furnace",
"anvil",
}