Begin implementing compatibility with Pipeworks mod

This commit is contained in:
mrkubax10 2024-02-27 21:02:12 +01:00
parent a5ef9eca00
commit d800a22fe0
5 changed files with 63 additions and 2 deletions

View File

@ -12,6 +12,9 @@ Currently IndustrialTest supports following games:
- MineClone2 - MineClone2
- none - none
## Optional dependencies
- [Pipeworks](https://content.minetest.net/packages/VanessaE/pipeworks)
## Contributors ## Contributors
- mrkubax10 <mrkubax10@onet.pl or mrkubax10 at irc.libera.chat> [programming, some graphics] - mrkubax10 <mrkubax10@onet.pl or mrkubax10 at irc.libera.chat> [programming, some graphics]
- LuanHawk <Discord: LuanHawk#8733> [lead graphics] - LuanHawk <Discord: LuanHawk#8733> [lead graphics]

52
compat/pipeworks.lua Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
-- 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)

View File

@ -39,8 +39,9 @@ if industrialtest.mtgAvailable then
elseif industrialtest.mclAvailable then elseif industrialtest.mclAvailable then
industrialtest.mods.mclRubber=minetest.get_modpath("mcl_rubber") industrialtest.mods.mclRubber=minetest.get_modpath("mcl_rubber")
end 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") error("IndustrialTest requires 3D Armor when used with Minetest Game")
end end

View File

@ -74,3 +74,8 @@ dofile(modpath.."/cables.lua")
dofile(modpath.."/mapgen.lua") dofile(modpath.."/mapgen.lua")
dofile(modpath.."/uu_matter_crafts.lua") dofile(modpath.."/uu_matter_crafts.lua")
dofile(modpath.."/crafts.lua") dofile(modpath.."/crafts.lua")
-- compatibility with other mods
if industrialtest.mods.pipeworks then
dofile(modpath.."/compat/pipeworks.lua")
end

View File

@ -1,5 +1,5 @@
name=industrialtest name=industrialtest
description=Adds various machinery 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 author=IndustrialTest Team
title=IndustrialTest title=IndustrialTest