From e2277e45af62f9f7a152a1281d5c5a292c9ed4e6 Mon Sep 17 00:00:00 2001 From: unknown <24964441+wsor4035@users.noreply.github.com> Date: Sat, 4 Dec 2021 22:45:04 -0500 Subject: [PATCH 1/7] add conveyors, start of tech --- mods/fl_builtin/builtin_item.lua | 61 ++++++++++++++- mods/fl_industrial/README | 4 + mods/fl_industrial/conveyors.lua | 72 ++++++++++++++++++ mods/fl_industrial/init.lua | 2 + .../textures/farlands_conveyor_base.png | Bin 0 -> 644 bytes .../textures/farlands_conveyor_top.png | Bin 0 -> 2173 bytes .../textures/farlands_conveyor_top_two.png | Bin 0 -> 2870 bytes 7 files changed, 135 insertions(+), 4 deletions(-) create mode 100644 mods/fl_industrial/README create mode 100644 mods/fl_industrial/conveyors.lua create mode 100644 mods/fl_industrial/init.lua create mode 100644 mods/fl_industrial/textures/farlands_conveyor_base.png create mode 100644 mods/fl_industrial/textures/farlands_conveyor_top.png create mode 100644 mods/fl_industrial/textures/farlands_conveyor_top_two.png diff --git a/mods/fl_builtin/builtin_item.lua b/mods/fl_builtin/builtin_item.lua index bb55cec..852c96a 100644 --- a/mods/fl_builtin/builtin_item.lua +++ b/mods/fl_builtin/builtin_item.lua @@ -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,30 @@ end minetest.registered_entities["__builtin:item"].on_step = function(self, dtime, moveresult) self._dtime = min(dtime,0.2) + self.age = self.age + dtime 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 + + --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,6 +63,11 @@ 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)) --[[ @@ -66,6 +82,43 @@ 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} + 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 + 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 \ No newline at end of file diff --git a/mods/fl_industrial/README b/mods/fl_industrial/README new file mode 100644 index 0000000..b8e102d --- /dev/null +++ b/mods/fl_industrial/README @@ -0,0 +1,4 @@ +Aurailus MIT: +farlands_conveyor_base.png +farlands_conveyor_top.png +farlands_conveyor_top_two.png \ No newline at end of file diff --git a/mods/fl_industrial/conveyors.lua b/mods/fl_industrial/conveyors.lua new file mode 100644 index 0000000..e8c84a5 --- /dev/null +++ b/mods/fl_industrial/conveyors.lua @@ -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 \ No newline at end of file diff --git a/mods/fl_industrial/init.lua b/mods/fl_industrial/init.lua new file mode 100644 index 0000000..aa35168 --- /dev/null +++ b/mods/fl_industrial/init.lua @@ -0,0 +1,2 @@ +local modpath = minetest.get_modpath("fl_industrial") +dofile(modpath .. "/conveyors.lua") \ No newline at end of file diff --git a/mods/fl_industrial/textures/farlands_conveyor_base.png b/mods/fl_industrial/textures/farlands_conveyor_base.png new file mode 100644 index 0000000000000000000000000000000000000000..94b9549527bde4999e733f8486ee5803e66bd623 GIT binary patch literal 644 zcmV-~0( zK~y-)J(J5)#UKzw4=@n&u&$OH{Sp8FkFLf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~}hhK**=+IJt*ojnI(BbV-+LnYecC(hoYweX6o^7c*xzC)lxbgnO1Abr? zQo!4w_k%ODQ)wZi*v^$#uPt~{H;Tu6+6e=e*_w4|ZVAx%vL4y{1gvPENn@jsCvt`^c}_^jDU z^H#wIaBJMZ_n`WR9d{bn)aY1{~*VT^Nr?L+wtoxN7&_n49V!O)BTdbIL zQXJEM{m|M0s4!u0f&cU=e6%$N6BbwWzlGIfMA1s3%Mh739ypZeyKEAZxz$)ev#r4fO#b>2V2ViA=J;|B4nO&;EGrb5X#Z=-%Mnia* ztAEdL(2*nRHToWoFy0*I#HqDS@FlOVQ(I|WfAy*7cyyqIpJ>ry5^c?j#=`Q`lYitO zXl%HNo5`e_(F4Z#lqYR8pUoIoRKD0pi5d^^tlE?BTR(ie$f?aEnY#kyUD>ShTthVAQp=O&yrRz!^4X8G|d+b3OL1*dO@A1>w#(+LWF4 GOZY##>6yL& literal 0 HcmV?d00001 From 547541e2f315e708ffeec7f357ae458fa9b11e20 Mon Sep 17 00:00:00 2001 From: unknown <24964441+wsor4035@users.noreply.github.com> Date: Sun, 5 Dec 2021 15:12:27 -0500 Subject: [PATCH 2/7] small fix --- mods/fl_builtin/builtin_item.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mods/fl_builtin/builtin_item.lua b/mods/fl_builtin/builtin_item.lua index 852c96a..71da2e7 100644 --- a/mods/fl_builtin/builtin_item.lua +++ b/mods/fl_builtin/builtin_item.lua @@ -32,6 +32,7 @@ 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} @@ -70,6 +71,7 @@ minetest.registered_entities["__builtin:item"].on_step = function(self, dtime, m 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() @@ -95,6 +97,7 @@ minetest.registered_entities["__builtin:item"].on_step = function(self, dtime, m 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 @@ -104,6 +107,14 @@ minetest.registered_entities["__builtin:item"].on_step = function(self, dtime, m self.conveyor = nil else self.conveyor[2] = self.conveyor[2] - 1 + self.freeze = false + end + end + + --collision stop + if self.freeze and not vector.equals(vector.new(0,0,0), self.object:get_velocity()) then + if moveresult.collides then + self.object:set_velocity(vector.new(0,0,0)) end end From b1ba5d7899afeac2401ce4a79ca0e6e013b0523c Mon Sep 17 00:00:00 2001 From: unknown <24964441+wsor4035@users.noreply.github.com> Date: Sat, 18 Dec 2021 23:03:02 -0500 Subject: [PATCH 3/7] add injectors --- mods/fl_builtin/builtin_item.lua | 31 +++++++++++++--- mods/fl_industrial/init.lua | 3 +- mods/fl_industrial/injector.lua | 35 ++++++++++++++++++ .../{ => conveyor}/farlands_conveyor_base.png | Bin .../{ => conveyor}/farlands_conveyor_top.png | Bin .../farlands_conveyor_top_two.png | Bin .../injector/farlands_injector_arrow.png | Bin 0 -> 509 bytes 7 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 mods/fl_industrial/injector.lua rename mods/fl_industrial/textures/{ => conveyor}/farlands_conveyor_base.png (100%) rename mods/fl_industrial/textures/{ => conveyor}/farlands_conveyor_top.png (100%) rename mods/fl_industrial/textures/{ => conveyor}/farlands_conveyor_top_two.png (100%) create mode 100644 mods/fl_industrial/textures/injector/farlands_injector_arrow.png diff --git a/mods/fl_builtin/builtin_item.lua b/mods/fl_builtin/builtin_item.lua index 71da2e7..ef2fcc0 100644 --- a/mods/fl_builtin/builtin_item.lua +++ b/mods/fl_builtin/builtin_item.lua @@ -32,7 +32,7 @@ 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 + self._freeze = true local pos = self.object:get_pos() local node = minetest.get_node_or_nil(pos) or {name = "*", param2 = 0} @@ -42,6 +42,25 @@ minetest.registered_entities["__builtin:item"].on_step = function(self, dtime, m 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 @@ -71,7 +90,7 @@ minetest.registered_entities["__builtin:item"].on_step = function(self, dtime, m local oldv = self.object:get_velocity() self.object:add_velocity(vector.new(-oldv.x,1,-oldv.z)) - self.freeze = false + self._freeze = false --[[ elseif self.isinflowingliquid then local oldv = self.object:get_velocity() @@ -97,7 +116,7 @@ minetest.registered_entities["__builtin:item"].on_step = function(self, dtime, m self.object:set_velocity(dir) self.conveyor = {true, 10, dir} - self.freeze = false + 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 @@ -107,13 +126,13 @@ minetest.registered_entities["__builtin:item"].on_step = function(self, dtime, m self.conveyor = nil else self.conveyor[2] = self.conveyor[2] - 1 - self.freeze = false + self._freeze = false end end --collision stop - if self.freeze and not vector.equals(vector.new(0,0,0), self.object:get_velocity()) then - if moveresult.collides then + 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 diff --git a/mods/fl_industrial/init.lua b/mods/fl_industrial/init.lua index aa35168..9006940 100644 --- a/mods/fl_industrial/init.lua +++ b/mods/fl_industrial/init.lua @@ -1,2 +1,3 @@ local modpath = minetest.get_modpath("fl_industrial") -dofile(modpath .. "/conveyors.lua") \ No newline at end of file +dofile(modpath .. "/conveyors.lua") +dofile(modpath .. "/injector.lua") \ No newline at end of file diff --git a/mods/fl_industrial/injector.lua b/mods/fl_industrial/injector.lua new file mode 100644 index 0000000..dcc70e3 --- /dev/null +++ b/mods/fl_industrial/injector.lua @@ -0,0 +1,35 @@ +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", + _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.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} +}) \ No newline at end of file diff --git a/mods/fl_industrial/textures/farlands_conveyor_base.png b/mods/fl_industrial/textures/conveyor/farlands_conveyor_base.png similarity index 100% rename from mods/fl_industrial/textures/farlands_conveyor_base.png rename to mods/fl_industrial/textures/conveyor/farlands_conveyor_base.png diff --git a/mods/fl_industrial/textures/farlands_conveyor_top.png b/mods/fl_industrial/textures/conveyor/farlands_conveyor_top.png similarity index 100% rename from mods/fl_industrial/textures/farlands_conveyor_top.png rename to mods/fl_industrial/textures/conveyor/farlands_conveyor_top.png diff --git a/mods/fl_industrial/textures/farlands_conveyor_top_two.png b/mods/fl_industrial/textures/conveyor/farlands_conveyor_top_two.png similarity index 100% rename from mods/fl_industrial/textures/farlands_conveyor_top_two.png rename to mods/fl_industrial/textures/conveyor/farlands_conveyor_top_two.png diff --git a/mods/fl_industrial/textures/injector/farlands_injector_arrow.png b/mods/fl_industrial/textures/injector/farlands_injector_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..c4882a12f1257e882690cc87aa1daa21e688ee2b GIT binary patch literal 509 zcmV?Gn7;8#7hOdT6_Y-XLj@PKe{K36h-&!cV)CgP-;OkYwR2P@y)U-9#j4{WgKy2$ci^AYDv0UQq!Va^5rP2 z-2dk3rbmXW-9s^Ge)7DxJ_znWW!v+C8x0u(YI?_?*T+M;Ow%d z8M|=437rqN?&v>KlT3d)4X>vVPD1+)v@TV%`d#Pb9un*FMAxvl5B;(~viuFT(P!u} zhJGCY000SaNLh0L04^f{04^f|c%?sf0000qNkl7&Ktj*(d+Q=biqK>>zAn zcpW@y2xjmQ6DCYFO9sT)j??mysF`LlL5#rwlE#K9rcc5=00000NkvXXu0mjf7;D{S literal 0 HcmV?d00001 From bc5edf8b5d6959056133022972d1eaa256a29fc1 Mon Sep 17 00:00:00 2001 From: unknown <24964441+wsor4035@users.noreply.github.com> Date: Sun, 26 Dec 2021 22:03:16 -0500 Subject: [PATCH 4/7] add extraction for injector --- mods/fl_industrial/injector.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/mods/fl_industrial/injector.lua b/mods/fl_industrial/injector.lua index dcc70e3..af183b9 100644 --- a/mods/fl_industrial/injector.lua +++ b/mods/fl_industrial/injector.lua @@ -11,6 +11,30 @@ minetest.register_node("fl_industrial:injector", { "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)) + + 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 + minetest.add_item(vector.add(pos, dir), list[i]) + 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) From 2e716cb4845ca9ae77ac6bad4e183b0734dec5d2 Mon Sep 17 00:00:00 2001 From: unknown <24964441+wsor4035@users.noreply.github.com> Date: Fri, 31 Dec 2021 23:13:35 -0500 Subject: [PATCH 5/7] make furnaces work --- mods/fl_ores/init.lua | 11 ++ mods/fl_wildlife/crafts.lua | 2 +- mods/fl_workshop/furnace.lua | 241 ++++++++++++++++++----------------- mods/fl_workshop/init.lua | 2 +- 4 files changed, 136 insertions(+), 120 deletions(-) diff --git a/mods/fl_ores/init.lua b/mods/fl_ores/init.lua index 51fe8f3..086e8e6 100644 --- a/mods/fl_ores/init.lua +++ b/mods/fl_ores/init.lua @@ -82,6 +82,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", diff --git a/mods/fl_wildlife/crafts.lua b/mods/fl_wildlife/crafts.lua index 1771528..e42bb70 100644 --- a/mods/fl_wildlife/crafts.lua +++ b/mods/fl_wildlife/crafts.lua @@ -2,5 +2,5 @@ minetest.register_craft({ type = "cooking", output = "fl_wildlife:cooked_riverfish", recipe = "fl_wildlife:raw_riverfish", - cooktime = 1, + cooktime = 5, }) \ No newline at end of file diff --git a/mods/fl_workshop/furnace.lua b/mods/fl_workshop/furnace.lua index ce189e4..bb183e8 100644 --- a/mods/fl_workshop/furnace.lua +++ b/mods/fl_workshop/furnace.lua @@ -1,9 +1,11 @@ -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 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 +34,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 +73,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 +162,39 @@ 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, }) 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 +212,33 @@ 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, }) -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 +254,5 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) viewing_furnace[player:get_player_name()] = nil return end -end) \ No newline at end of file + --]] +--end) \ No newline at end of file diff --git a/mods/fl_workshop/init.lua b/mods/fl_workshop/init.lua index 14d2d88..c743215 100644 --- a/mods/fl_workshop/init.lua +++ b/mods/fl_workshop/init.lua @@ -11,7 +11,7 @@ fl_workshop.details = { local tool_nodes = { "saw", - --"furnace", + "furnace", "anvil", } From 47f8b44a85f93509156d4bd0da2d4542f646eb41 Mon Sep 17 00:00:00 2001 From: unknown <24964441+wsor4035@users.noreply.github.com> Date: Sat, 1 Jan 2022 21:38:13 -0500 Subject: [PATCH 6/7] add furnace injector support --- mods/fl_industrial/injector.lua | 11 +++++++++-- mods/fl_workshop/furnace.lua | 13 +++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/mods/fl_industrial/injector.lua b/mods/fl_industrial/injector.lua index af183b9..28ddc8e 100644 --- a/mods/fl_industrial/injector.lua +++ b/mods/fl_industrial/injector.lua @@ -18,6 +18,7 @@ minetest.register_node("fl_industrial:injector", { 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") @@ -27,7 +28,11 @@ minetest.register_node("fl_industrial:injector", { inv_node.allow_metadata_inventory_take(vector.subtract(pos, dir), "main", i, list[i], nil) ~= 0 then return end - minetest.add_item(vector.add(pos, dir), list[i]) + 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 @@ -43,7 +48,9 @@ minetest.register_node("fl_industrial:injector", { local def = minetest.registered_nodes[inv_node.name] local dump - if def.allow_metadata_inventory_put + 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 diff --git a/mods/fl_workshop/furnace.lua b/mods/fl_workshop/furnace.lua index bb183e8..f1eb86b 100644 --- a/mods/fl_workshop/furnace.lua +++ b/mods/fl_workshop/furnace.lua @@ -3,6 +3,17 @@ --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 @@ -184,6 +195,7 @@ minetest.register_node("fl_workshop:furnace", { return count end, on_timer = on_timer, + _machine_input = _machine_input, }) minetest.register_node("fl_workshop:furnace_active", { @@ -235,6 +247,7 @@ minetest.register_node("fl_workshop:furnace_active", { return count end, on_timer = on_timer, + _machine_input = _machine_input, }) --minetest.register_on_player_receive_fields(function(player, formname, fields) From f14fc58b503dae282e6f15ba2fc3c9e108ed39a5 Mon Sep 17 00:00:00 2001 From: unknown <24964441+wsor4035@users.noreply.github.com> Date: Sat, 1 Jan 2022 22:53:37 -0500 Subject: [PATCH 7/7] fix up some crafts --- mods/fl_ores/init.lua | 7 +++++++ mods/fl_workshop/furnace.lua | 17 +++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/mods/fl_ores/init.lua b/mods/fl_ores/init.lua index 086e8e6..e5d11ef 100644 --- a/mods/fl_ores/init.lua +++ b/mods/fl_ores/init.lua @@ -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", diff --git a/mods/fl_workshop/furnace.lua b/mods/fl_workshop/furnace.lua index f1eb86b..cf202d6 100644 --- a/mods/fl_workshop/furnace.lua +++ b/mods/fl_workshop/furnace.lua @@ -124,7 +124,7 @@ local function on_timer(pos, elapsed) meta:set_float("burn_time", burn_time) ifuel[1]:take_item() inv:set_list("fuel", ifuel) - minetest.chat_send_all("fuel") + --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}) @@ -135,7 +135,7 @@ local function on_timer(pos, elapsed) 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") + --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) @@ -150,7 +150,7 @@ local function on_timer(pos, elapsed) 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") + --minetest.chat_send_all("trigger2") return swap_node(pos, {name = "fl_workshop:furnace_active", param2 = minetest.get_node(pos).param2}) end end @@ -268,4 +268,13 @@ minetest.register_node("fl_workshop:furnace_active", { return end --]] ---end) \ No newline at end of file +--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"}, + }, +}) \ No newline at end of file