From d800a22fe0be048d07d048021e0d1da24c4c16fb Mon Sep 17 00:00:00 2001 From: mrkubax10 Date: Tue, 27 Feb 2024 21:02:12 +0100 Subject: [PATCH] Begin implementing compatibility with Pipeworks mod --- README.md | 3 +++ compat/pipeworks.lua | 52 ++++++++++++++++++++++++++++++++++++++++++++ compatibility.lua | 3 ++- init.lua | 5 +++++ mod.conf | 2 +- 5 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 compat/pipeworks.lua diff --git a/README.md b/README.md index 7c03cc9..b828ae4 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,9 @@ Currently IndustrialTest supports following games: - MineClone2 - none +## Optional dependencies +- [Pipeworks](https://content.minetest.net/packages/VanessaE/pipeworks) + ## Contributors - mrkubax10 [programming, some graphics] - LuanHawk [lead graphics] diff --git a/compat/pipeworks.lua b/compat/pipeworks.lua new file mode 100644 index 0000000..ff0d0b3 --- /dev/null +++ b/compat/pipeworks.lua @@ -0,0 +1,52 @@ +-- IndustrialTest +-- Copyright (C) 2024 mrkubax10 + +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. + +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. + +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . + +-- Iron Furnace +local def=table.copy(minetest.registered_nodes["industrialtest:iron_furnace"]) + +def.groups.tubedevice=1 +def.groups.tubedevice_receiver=1 + +local override={ + groups=def.groups, + tube={ + insert_object=function(pos,node,stack,direction) + local meta=minetest.get_meta(pos) + local inv=meta:get_inventory() + local result=inv:add_item(direction.y==1 and "fuel" or "src",stack) + minetest.get_node_timer(pos):start(industrialtest.updateDelay) + return result + end, + can_insert=function(pos,node,stack,direction) + local meta=minetest.get_meta(pos) + local inv=meta:get_inventory() + return inv:room_for_item(direction.y==1 and "fuel" or "src",stack) + end, + input_inventory="dst", + connect_sides={ + left=1, + right=1, + back=1, + bottom=1, + top=1 + } + }, + after_place_node=pipeworks.after_place, + after_dig_node=pipeworks.after_dig, + on_rotate=pipeworks.on_rotate +} +minetest.override_item("industrialtest:iron_furnace",override) +minetest.override_item("industrialtest:iron_furnace_active",override) diff --git a/compatibility.lua b/compatibility.lua index c93c026..0fb629d 100644 --- a/compatibility.lua +++ b/compatibility.lua @@ -39,8 +39,9 @@ if industrialtest.mtgAvailable then elseif industrialtest.mclAvailable then industrialtest.mods.mclRubber=minetest.get_modpath("mcl_rubber") end +industrialtest.mods.pipeworks=minetest.get_modpath("pipeworks") -if industrialtest.mtgAvailable and not industrialtest then +if industrialtest.mtgAvailable and not industrialtest.mods._3dArmor then error("IndustrialTest requires 3D Armor when used with Minetest Game") end diff --git a/init.lua b/init.lua index 7983fda..1f20582 100644 --- a/init.lua +++ b/init.lua @@ -74,3 +74,8 @@ dofile(modpath.."/cables.lua") dofile(modpath.."/mapgen.lua") dofile(modpath.."/uu_matter_crafts.lua") dofile(modpath.."/crafts.lua") + +-- compatibility with other mods +if industrialtest.mods.pipeworks then + dofile(modpath.."/compat/pipeworks.lua") +end diff --git a/mod.conf b/mod.conf index 52477e1..543305a 100644 --- a/mod.conf +++ b/mod.conf @@ -1,5 +1,5 @@ name=industrialtest description=Adds various machinery -optional_depends=default,bucket,3d_armor,mcl_core,mcl_copper,mcl_armor,mcl_deepslate,mcl_nether,mcl_buckets +optional_depends=default,bucket,3d_armor,mcl_core,mcl_copper,mcl_armor,mcl_deepslate,mcl_nether,mcl_buckets,pipeworks author=IndustrialTest Team title=IndustrialTest \ No newline at end of file