Compare commits
10 Commits
ad502c257c
...
142509130f
Author | SHA1 | Date | |
---|---|---|---|
142509130f | |||
1133093a79 | |||
e97181b7e4 | |||
fc249d46d5 | |||
e665536427 | |||
315c592d79 | |||
20952b751a | |||
5d08a76ff0 | |||
1a4e500d9d | |||
97247bdac1 |
@ -1,6 +1,5 @@
|
|||||||
# List of textures that still have to be done
|
# List of textures that still have to be done
|
||||||
- refined iron ingot for MCL
|
- refined iron ingot for MCL
|
||||||
- treetap
|
|
||||||
- sticky resin
|
- sticky resin
|
||||||
- rubber wood (top|side)
|
- rubber wood (top|side)
|
||||||
- rubber wood with rubber (side)
|
- rubber wood with rubber (side)
|
||||||
|
12
api.lua
@ -17,6 +17,7 @@
|
|||||||
local S=minetest.get_translator("industrialtest")
|
local S=minetest.get_translator("industrialtest")
|
||||||
|
|
||||||
industrialtest.api={}
|
industrialtest.api={}
|
||||||
|
industrialtest.api.maceratorRecipes={}
|
||||||
|
|
||||||
-- \brief Adds power storage to metadata
|
-- \brief Adds power storage to metadata
|
||||||
-- \param capacity How much EU item/node can store
|
-- \param capacity How much EU item/node can store
|
||||||
@ -241,3 +242,14 @@ industrialtest.api.isPowerOutput=function(meta,side)
|
|||||||
local mode=string.sub(ioConfig,side,side)
|
local mode=string.sub(ioConfig,side,side)
|
||||||
return (mode=="o" or mode=="a")
|
return (mode=="o" or mode=="a")
|
||||||
end
|
end
|
||||||
|
industrialtest.api.registerMaceratorRecipe=function(config)
|
||||||
|
local definition={
|
||||||
|
output=config.output or "",
|
||||||
|
recipe=config.recipe or "",
|
||||||
|
time=config.time or 2
|
||||||
|
}
|
||||||
|
industrialtest.api.maceratorRecipes[definition.recipe]=definition
|
||||||
|
end
|
||||||
|
industrialtest.api.getMaceratorRecipeResult=function(recipe)
|
||||||
|
return industrialtest.api.maceratorRecipes[recipe]
|
||||||
|
end
|
||||||
|
49
cables.lua
@ -94,18 +94,39 @@ local function registerCable(name,displayName,material,size,flow)
|
|||||||
end,
|
end,
|
||||||
on_timer=function(pos)
|
on_timer=function(pos)
|
||||||
local meta=minetest.get_meta(pos)
|
local meta=minetest.get_meta(pos)
|
||||||
local afterFlow,_=industrialtest.api.powerFlow(pos)
|
local afterFlow,transferred=industrialtest.api.powerFlow(pos)
|
||||||
meta:set_string("industrialtest.ioConfig","aaaaaa")
|
meta:set_string("industrialtest.ioConfig","aaaaaa")
|
||||||
if not industrialtest.api.isFullyCharged(meta) then
|
if not industrialtest.api.isFullyCharged(meta) then
|
||||||
industrialtest.api.triggerNeighbours(pos)
|
industrialtest.api.triggerNeighbours(pos)
|
||||||
end
|
end
|
||||||
|
if transferred then
|
||||||
|
local node=minetest.get_node(pos)
|
||||||
|
local def=minetest.registered_nodes[node.name]
|
||||||
|
if def._industrialtest_electrocution then
|
||||||
|
local players=minetest.get_connected_players()
|
||||||
|
for _,value in ipairs(players) do
|
||||||
|
-- Note: don't use vector.distance here because we don't need actual distance between two
|
||||||
|
-- vectors to determine if player is within range if we use squared range
|
||||||
|
local playerPos=value:get_pos()
|
||||||
|
local dx=pos.x-playerPos.x
|
||||||
|
local dy=pos.y-playerPos.y
|
||||||
|
local dz=pos.z-playerPos.z
|
||||||
|
local dist=math.pow(dx,2)+math.pow(dy,2)+math.pow(dz,2)
|
||||||
|
if dist<=0.60 then
|
||||||
|
local hp=value:get_hp()
|
||||||
|
value:set_hp(hp-0.5,"Electrocution")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
return (afterFlow and meta:get_int("industrialtest.powerAmount")>0)
|
return (afterFlow and meta:get_int("industrialtest.powerAmount")>0)
|
||||||
end,
|
end,
|
||||||
|
_industrialtest_electrocution=true,
|
||||||
_industrialtest_onPowerFlow=function(pos,side)
|
_industrialtest_onPowerFlow=function(pos,side)
|
||||||
local meta=minetest.get_meta(pos)
|
local meta=minetest.get_meta(pos)
|
||||||
industrialtest.api.changeIoConfig(meta,side,"i")
|
industrialtest.api.changeIoConfig(meta,side,"i")
|
||||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||||
end
|
end,
|
||||||
}
|
}
|
||||||
if industrialtest.mtgAvailable then
|
if industrialtest.mtgAvailable then
|
||||||
definition.groups={
|
definition.groups={
|
||||||
@ -149,6 +170,30 @@ local function registerCable(name,displayName,material,size,flow)
|
|||||||
{material,material,material}
|
{material,material,material}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
definition=table.copy(definition)
|
||||||
|
definition.description=S("Insulated "..displayName.." Cable")
|
||||||
|
definition.inventory_image="industrialtest_insulated_"..name.."_cable_inv.png"
|
||||||
|
definition.tiles={"industrialtest_insulated_copper_cable.png"}
|
||||||
|
definition.wield_image="industrialtest_insulated_"..name.."_cable_inv.png"
|
||||||
|
definition._industrialtest_electrocution=nil
|
||||||
|
minetest.register_node("industrialtest:insulated_"..name.."_cable",definition)
|
||||||
|
minetest.register_craft({
|
||||||
|
type="shapeless",
|
||||||
|
output="industrialtest:insulated_"..name.."_cable",
|
||||||
|
recipe={
|
||||||
|
"industrialtest:"..name.."_cable",
|
||||||
|
"industrialtest:rubber"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
type="shaped",
|
||||||
|
output="industrialtest:insulated_"..name.."_cable 6",
|
||||||
|
recipe={
|
||||||
|
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"},
|
||||||
|
{"industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot"},
|
||||||
|
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"}
|
||||||
|
}
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
registerCable("copper","Copper",industrialtest.elementKeys.copperIngot,0.15,216)
|
registerCable("copper","Copper",industrialtest.elementKeys.copperIngot,0.15,216)
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
local S=minetest.get_translator("industrialtest")
|
local S=minetest.get_translator("industrialtest")
|
||||||
|
|
||||||
industrialtest.mtgAvailable=minetest.get_modpath("default")
|
industrialtest.mtgAvailable=minetest.get_modpath("default")
|
||||||
local requiredMclModules={"mcl_core","mcl_copper","mcl_armor"}
|
local requiredMclModules={"mcl_core","mcl_copper","mcl_armor","mcl_deepslate"}
|
||||||
industrialtest.mclAvailable=true
|
industrialtest.mclAvailable=true
|
||||||
for _,mod in ipairs(requiredMclModules) do
|
for _,mod in ipairs(requiredMclModules) do
|
||||||
if not minetest.get_modpath(mod) then
|
if not minetest.get_modpath(mod) then
|
||||||
@ -479,11 +479,21 @@ if industrialtest.mclAvailable then
|
|||||||
industrialtest.gameTexturePrefix="mcl"
|
industrialtest.gameTexturePrefix="mcl"
|
||||||
-- assign element keys for elements that are required later
|
-- assign element keys for elements that are required later
|
||||||
industrialtest.elementKeys.stick="mcl_core:stick"
|
industrialtest.elementKeys.stick="mcl_core:stick"
|
||||||
|
industrialtest.elementKeys.flint="mcl_core:flint"
|
||||||
|
industrialtest.elementKeys.snowball="mcl_throwing:snowball"
|
||||||
|
industrialtest.elementKeys.string="mcl_mobitems:string"
|
||||||
industrialtest.elementKeys.junglePlanks="mcl_core:junglewood"
|
industrialtest.elementKeys.junglePlanks="mcl_core:junglewood"
|
||||||
industrialtest.elementKeys.ironIngot="mcl_core:iron_ingot"
|
industrialtest.elementKeys.ironIngot="mcl_core:iron_ingot"
|
||||||
industrialtest.elementKeys.copperIngot="mcl_copper:copper_ingot"
|
industrialtest.elementKeys.copperIngot="mcl_copper:copper_ingot"
|
||||||
industrialtest.elementKeys.powerCarrier="mesecons:mesecon"
|
industrialtest.elementKeys.powerCarrier="mesecons:mesecon"
|
||||||
industrialtest.elementKeys.furnace="mcl_furnaces:furnace"
|
industrialtest.elementKeys.furnace="mcl_furnaces:furnace"
|
||||||
|
industrialtest.elementKeys.stone="mcl_core:stone"
|
||||||
|
industrialtest.elementKeys.cobble="mcl_core:cobble"
|
||||||
|
industrialtest.elementKeys.sand="mcl_core:sand"
|
||||||
|
industrialtest.elementKeys.gravel="mcl_core:gravel"
|
||||||
|
industrialtest.elementKeys.ice="mcl_core:ice"
|
||||||
|
industrialtest.elementKeys.sandstone="mcl_core:sandstone"
|
||||||
|
industrialtest.elementKeys.whiteWool="mcl_wool:white"
|
||||||
|
|
||||||
-- register required minerals that are not available in MCL
|
-- register required minerals that are not available in MCL
|
||||||
industrialtest.registerMetal("tin","Tin",3,3)
|
industrialtest.registerMetal("tin","Tin",3,3)
|
||||||
@ -646,9 +656,19 @@ elseif industrialtest.mtgAvailable then
|
|||||||
industrialtest.elementKeys.ironIngot="default:steel_ingot"
|
industrialtest.elementKeys.ironIngot="default:steel_ingot"
|
||||||
industrialtest.elementKeys.copperIngot="default:copper_ingot"
|
industrialtest.elementKeys.copperIngot="default:copper_ingot"
|
||||||
industrialtest.elementKeys.stick="default:stick"
|
industrialtest.elementKeys.stick="default:stick"
|
||||||
|
industrialtest.elementKeys.flint="default:flint"
|
||||||
|
industrialtest.elementKeys.snowball="default:snow"
|
||||||
|
industrialtest.elementKeys.string="farming:string"
|
||||||
industrialtest.elementKeys.junglePlanks="default:junglewood"
|
industrialtest.elementKeys.junglePlanks="default:junglewood"
|
||||||
industrialtest.elementKeys.powerCarrier="default:mese_crystal_fragment"
|
industrialtest.elementKeys.powerCarrier="default:mese_crystal_fragment"
|
||||||
industrialtest.elementKeys.furnace="default:furnace"
|
industrialtest.elementKeys.furnace="default:furnace"
|
||||||
|
industrialtest.elementKeys.stone="default:stone"
|
||||||
|
industrialtest.elementKeys.cobble="default:cobble"
|
||||||
|
industrialtest.elementKeys.sand="default:sand"
|
||||||
|
industrialtest.elementKeys.gravel="default:gravel"
|
||||||
|
industrialtest.elementKeys.ice="default:ice"
|
||||||
|
industrialtest.elementKeys.sandstone="default:sandstone"
|
||||||
|
industrialtest.elementKeys.whiteWool="wool:white"
|
||||||
else
|
else
|
||||||
error("No compatible games found!")
|
error("No compatible games found!")
|
||||||
end
|
end
|
||||||
|
@ -28,7 +28,7 @@ minetest.register_craft({
|
|||||||
type="shaped",
|
type="shaped",
|
||||||
output="industrialtest:re_battery",
|
output="industrialtest:re_battery",
|
||||||
recipe={
|
recipe={
|
||||||
{"","industrialtest:copper_cable",""},
|
{"","industrialtest:insulated_copper_cable",""},
|
||||||
{industrialtest.elementKeys.tinIngot,industrialtest.elementKeys.powerCarrier,industrialtest.elementKeys.tinIngot},
|
{industrialtest.elementKeys.tinIngot,industrialtest.elementKeys.powerCarrier,industrialtest.elementKeys.tinIngot},
|
||||||
{industrialtest.elementKeys.tinIngot,industrialtest.elementKeys.powerCarrier,industrialtest.elementKeys.tinIngot}
|
{industrialtest.elementKeys.tinIngot,industrialtest.elementKeys.powerCarrier,industrialtest.elementKeys.tinIngot}
|
||||||
}
|
}
|
||||||
@ -73,6 +73,15 @@ minetest.register_craftitem("industrialtest:electronic_circuit",{
|
|||||||
description=S("Electronic Circuit"),
|
description=S("Electronic Circuit"),
|
||||||
inventory_image="industrialtest_electronic_circuit.png"
|
inventory_image="industrialtest_electronic_circuit.png"
|
||||||
})
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
type="shaped",
|
||||||
|
output="industrialtest:electronic_circuit",
|
||||||
|
recipe={
|
||||||
|
{"industrialtest:insulated_copper_cable","industrialtest:insulated_copper_cable","industrialtest:insulated_copper_cable"},
|
||||||
|
{industrialtest.elementKeys.powerCarrier,"industrialtest:refined_iron_ingot",industrialtest.elementKeys.powerCarrier},
|
||||||
|
{"industrialtest:insulated_copper_cable","industrialtest:insulated_copper_cable","industrialtest:insulated_copper_cable"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
-- Item callbacks
|
-- Item callbacks
|
||||||
minetest.register_on_player_inventory_action(function(player,action,inventory,info)
|
minetest.register_on_player_inventory_action(function(player,action,inventory,info)
|
||||||
@ -86,5 +95,5 @@ minetest.register_on_craft(function(itemstack)
|
|||||||
if industrialtest.api.preparePowerStorageItem(itemstack) then
|
if industrialtest.api.preparePowerStorageItem(itemstack) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
industrialtest.api.prepareItemTool(itemstack)
|
industrialtest.api.prepareToolItem(itemstack)
|
||||||
end)
|
end)
|
||||||
|
59
crafts.lua
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
-- IndustrialTest
|
||||||
|
-- Copyright (C) 2023 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/>.
|
||||||
|
|
||||||
|
-- Macerator crafts
|
||||||
|
industrialtest.api.registerMaceratorRecipe({
|
||||||
|
output=industrialtest.elementKeys.cobble,
|
||||||
|
recipe=industrialtest.elementKeys.stone
|
||||||
|
})
|
||||||
|
industrialtest.api.registerMaceratorRecipe({
|
||||||
|
output=industrialtest.elementKeys.sand,
|
||||||
|
recipe=industrialtest.elementKeys.cobble
|
||||||
|
})
|
||||||
|
industrialtest.api.registerMaceratorRecipe({
|
||||||
|
output=industrialtest.elementKeys.flint,
|
||||||
|
recipe=industrialtest.elementKeys.gravel
|
||||||
|
})
|
||||||
|
industrialtest.api.registerMaceratorRecipe({
|
||||||
|
output=industrialtest.elementKeys.snowball,
|
||||||
|
recipe=industrialtest.elementKeys.ice
|
||||||
|
})
|
||||||
|
industrialtest.api.registerMaceratorRecipe({
|
||||||
|
output=industrialtest.elementKeys.sand,
|
||||||
|
recipe=industrialtest.elementKeys.sandstone
|
||||||
|
})
|
||||||
|
industrialtest.api.registerMaceratorRecipe({
|
||||||
|
output=industrialtest.elementKeys.string.." 2",
|
||||||
|
recipe=industrialtest.elementKeys.whiteWool
|
||||||
|
})
|
||||||
|
if industrialtest.mclAvailable then
|
||||||
|
industrialtest.api.registerMaceratorRecipe({
|
||||||
|
output="mcl_mobitems:blaze_powder 5",
|
||||||
|
recipe="mcl_mobitems:blaze_rod"
|
||||||
|
})
|
||||||
|
industrialtest.api.registerMaceratorRecipe({
|
||||||
|
output="mesecons:mesecon 9",
|
||||||
|
recipe="mesecons_torch:redstoneblock"
|
||||||
|
})
|
||||||
|
industrialtest.api.registerMaceratorRecipe({
|
||||||
|
output="mcl_nether:quartz 4",
|
||||||
|
recipe="mcl_nether:quartz_block"
|
||||||
|
})
|
||||||
|
industrialtest.api.registerMaceratorRecipe({
|
||||||
|
output="mcl_bone_meal:bone_meal 4",
|
||||||
|
recipe="mcl_mobitems:bone"
|
||||||
|
})
|
||||||
|
end
|
1
init.lua
@ -40,3 +40,4 @@ end
|
|||||||
dofile(modpath.."/cables.lua")
|
dofile(modpath.."/cables.lua")
|
||||||
dofile(modpath.."/mapgen.lua")
|
dofile(modpath.."/mapgen.lua")
|
||||||
dofile(modpath.."/tools.lua")
|
dofile(modpath.."/tools.lua")
|
||||||
|
dofile(modpath.."/crafts.lua")
|
||||||
|
506
machines.lua
@ -79,7 +79,7 @@ local definition={
|
|||||||
"industrialtest_machine_block.png",
|
"industrialtest_machine_block.png",
|
||||||
"industrialtest_machine_block.png",
|
"industrialtest_machine_block.png",
|
||||||
"industrialtest_machine_block.png",
|
"industrialtest_machine_block.png",
|
||||||
"industrialtest_iron_furnace_front.png",
|
"industrialtest_machine_block.png^industrialtest_iron_furnace_front.png",
|
||||||
"industrialtest_machine_block.png"
|
"industrialtest_machine_block.png"
|
||||||
},
|
},
|
||||||
paramtype2="facedir",
|
paramtype2="facedir",
|
||||||
@ -218,6 +218,256 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- Item processing machines
|
-- Item processing machines
|
||||||
|
local function registerSimpleElectricItemProcessor(config)
|
||||||
|
local function getFormspec(powerPercent,srcPercent)
|
||||||
|
local formspec
|
||||||
|
if industrialtest.mtgAvailable then
|
||||||
|
formspec={
|
||||||
|
"formspec_version[4]",
|
||||||
|
"size[10.8,12]",
|
||||||
|
"label[0.5,0.5;"..S(config.displayName).."]",
|
||||||
|
"list[context;src;3.4,1.8;1,1]",
|
||||||
|
"listring[context;src]",
|
||||||
|
(powerPercent>0 and "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
|
||||||
|
or "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
|
||||||
|
"list[context;powerStorage;3.4,3.9;1,1]",
|
||||||
|
"listring[context;powerStorage]",
|
||||||
|
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
|
||||||
|
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
|
||||||
|
"list[context;dst;6.4,2.8;1,1]",
|
||||||
|
"listring[context;dst]",
|
||||||
|
"list[context;upgrades;9,0.9;1,4]",
|
||||||
|
"listring[context;upgrades]",
|
||||||
|
"list[current_player;main;0.5,6.25;8,1]",
|
||||||
|
"list[current_player;main;0.5,7.5;8,3;8]"
|
||||||
|
}
|
||||||
|
elseif industrialtest.mclAvailable then
|
||||||
|
formspec={
|
||||||
|
"size[10.04,12]",
|
||||||
|
"label[0.25,0.25;"..S(config.displayName).."]",
|
||||||
|
"list[context;src;3.4,1.8;1,1]",
|
||||||
|
mcl_formspec.get_itemslot_bg(3.4,1.8,1,1),
|
||||||
|
"listring[context;src]",
|
||||||
|
(powerPercent>0 and "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
|
||||||
|
or "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
|
||||||
|
"list[context;powerStorage;3.4,3.9;1,1]",
|
||||||
|
mcl_formspec.get_itemslot_bg(3.4,3.9,1,1),
|
||||||
|
"listring[context;powerStorage]",
|
||||||
|
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
|
||||||
|
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
|
||||||
|
"list[context;dst;6.4,2.8;1,1]",
|
||||||
|
mcl_formspec.get_itemslot_bg(6.4,2.8,1,1),
|
||||||
|
"listring[context;dst]",
|
||||||
|
"list[context;upgrades;9,0.9;1,4]",
|
||||||
|
mcl_formspec.get_itemslot_bg(9,0.9,1,4),
|
||||||
|
"listring[context;upgrades]",
|
||||||
|
"list[current_player;main;0.5,7;9,3;9]",
|
||||||
|
mcl_formspec.get_itemslot_bg(0.5,7,9,3),
|
||||||
|
"list[current_player;main;0.5,10.24;9,1]",
|
||||||
|
mcl_formspec.get_itemslot_bg(0.5,10.24,9,1)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
return table.concat(formspec,"")
|
||||||
|
end
|
||||||
|
local function craftResultProxy(method,item)
|
||||||
|
if method=="cooking" then
|
||||||
|
local output,after=minetest.get_craft_result({
|
||||||
|
method=method,
|
||||||
|
width=1,
|
||||||
|
items={item}
|
||||||
|
})
|
||||||
|
return {
|
||||||
|
item=output.item,
|
||||||
|
time=output.time,
|
||||||
|
src=after.items[1]
|
||||||
|
}
|
||||||
|
elseif method=="industrialtest.macerating" then
|
||||||
|
local output=industrialtest.api.getMaceratorRecipeResult(item:get_name())
|
||||||
|
if not output then
|
||||||
|
return {
|
||||||
|
item=ItemStack(),
|
||||||
|
time=0,
|
||||||
|
src=item
|
||||||
|
}
|
||||||
|
end
|
||||||
|
local srcAfter=ItemStack(item:get_name())
|
||||||
|
srcAfter:set_count(item:get_count()-1)
|
||||||
|
return {
|
||||||
|
item=ItemStack(output.output),
|
||||||
|
time=output.time,
|
||||||
|
src=srcAfter
|
||||||
|
}
|
||||||
|
end
|
||||||
|
error("Unknown craft method passed to craftResultProxy")
|
||||||
|
end
|
||||||
|
definition={
|
||||||
|
description=S(config.displayName),
|
||||||
|
tiles={
|
||||||
|
"industrialtest_machine_block.png",
|
||||||
|
"industrialtest_machine_block.png",
|
||||||
|
"industrialtest_machine_block.png",
|
||||||
|
"industrialtest_machine_block.png",
|
||||||
|
"industrialtest_machine_block.png",
|
||||||
|
"industrialtest_machine_block.png^industrialtest_"..config.name.."_front.png",
|
||||||
|
"industrialtest_machine_block.png"
|
||||||
|
},
|
||||||
|
paramtype2="facedir",
|
||||||
|
legacy_facedir_simple=true,
|
||||||
|
on_construct=function(pos)
|
||||||
|
local meta=minetest.get_meta(pos)
|
||||||
|
local inv=meta:get_inventory()
|
||||||
|
inv:set_size("src",1)
|
||||||
|
inv:set_size("dst",1)
|
||||||
|
inv:set_size("powerStorage",1)
|
||||||
|
inv:set_size("upgrades",4)
|
||||||
|
meta:set_string("formspec",getFormspec(0,0))
|
||||||
|
meta:set_float("srcTime",-1)
|
||||||
|
meta:set_float("maxSrcTime",0)
|
||||||
|
industrialtest.api.addPowerStorage(meta,config.capacity,config.flow,"iiiiii")
|
||||||
|
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||||
|
end,
|
||||||
|
on_timer=function(pos,elapsed)
|
||||||
|
local meta=minetest.get_meta(pos)
|
||||||
|
local inv=meta:get_inventory()
|
||||||
|
local srcSlot=inv:get_stack("src",1)
|
||||||
|
local powerStorageSlot=inv:get_stack("powerStorage",1)
|
||||||
|
local shouldUpdateFormspec=false
|
||||||
|
local shouldRerunTimer=false
|
||||||
|
local requiredPower=elapsed*config.opPower
|
||||||
|
|
||||||
|
if powerStorageSlot:get_count()>0 then
|
||||||
|
local stackMeta=powerStorageSlot:get_meta()
|
||||||
|
if industrialtest.api.transferPower(stackMeta,meta,stackMeta:get_int("industrialtest.powerFlow"))>0 then
|
||||||
|
shouldUpdateFormspec=true
|
||||||
|
shouldRerunTimer=true
|
||||||
|
industrialtest.api.updateItemPowerText(powerStorageSlot)
|
||||||
|
inv:set_stack("powerStorage",1,powerStorageSlot)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if srcSlot:get_count()>0 and meta:get_float("maxSrcTime")<=0 and meta:get_int("industrialtest.powerAmount")>=requiredPower then
|
||||||
|
local output=craftResultProxy(config.method,srcSlot)
|
||||||
|
if output.time>0 and inv:room_for_item("dst",output.item) then
|
||||||
|
meta:set_float("srcTime",0)
|
||||||
|
meta:set_float("maxSrcTime",output.time*config.efficiency)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if meta:get_float("maxSrcTime")>0 then
|
||||||
|
if meta:get_int("industrialtest.powerAmount")>=requiredPower then
|
||||||
|
meta:set_int("industrialtest.powerAmount",meta:get_int("industrialtest.powerAmount")-requiredPower)
|
||||||
|
meta:set_float("srcTime",meta:get_float("srcTime")+elapsed)
|
||||||
|
shouldRerunTimer=true
|
||||||
|
end
|
||||||
|
shouldUpdateFormspec=true
|
||||||
|
end
|
||||||
|
if meta:get_float("srcTime")>=meta:get_float("maxSrcTime") then
|
||||||
|
local output=craftResultProxy(config.method,srcSlot)
|
||||||
|
if output.item:get_count()>0 then
|
||||||
|
inv:set_stack("src",1,output.src)
|
||||||
|
inv:add_item("dst",output.item)
|
||||||
|
meta:set_float("srcTime",-1)
|
||||||
|
meta:set_float("maxSrcTime",0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not industrialtest.api.isFullyCharged(meta) then
|
||||||
|
industrialtest.api.triggerNeighbours(pos)
|
||||||
|
end
|
||||||
|
|
||||||
|
if shouldUpdateFormspec then
|
||||||
|
meta:set_string("formspec",getFormspec(meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")*100,meta:get_float("srcTime")/meta:get_float("maxSrcTime")*100))
|
||||||
|
end
|
||||||
|
|
||||||
|
return shouldRerunTimer
|
||||||
|
end,
|
||||||
|
allow_metadata_inventory_move=function(pos,fromList,fromIndex,toList,count)
|
||||||
|
if toList=="dst" then
|
||||||
|
return 0
|
||||||
|
elseif toList=="powerStorage" then
|
||||||
|
local meta=minetest.get_meta(pos)
|
||||||
|
local inv=meta:get_inventory()
|
||||||
|
local stack=inv:get_stack(fromList,fromIndex)
|
||||||
|
return (industrialtest.api.hasPowerStorage(stack:get_meta()) and count or 0)
|
||||||
|
elseif toList=="upgrades" then
|
||||||
|
-- TODO: Add support for upgrades when they will be added
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
return count
|
||||||
|
end,
|
||||||
|
allow_metadata_inventory_put=function(pos,listname,index,stack)
|
||||||
|
if listname=="dst" then
|
||||||
|
return 0
|
||||||
|
elseif listname=="src" then
|
||||||
|
local meta=minetest.get_meta(pos)
|
||||||
|
local inv=meta:get_inventory()
|
||||||
|
local srcSlot=inv:get_stack("src",1)
|
||||||
|
if srcSlot:get_name()~=stack:get_name() then
|
||||||
|
meta:set_float("srcTime",-1)
|
||||||
|
meta:set_float("maxSrcTime",0)
|
||||||
|
end
|
||||||
|
elseif listname=="powerStorage" then
|
||||||
|
return (industrialtest.api.hasPowerStorage(stack:get_meta()) and stack:get_count() or 0)
|
||||||
|
elseif listname=="upgrades" then
|
||||||
|
--TODO: See allow_metadata_inventory_move
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
return stack:get_count()
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_move=function(pos,fromList,fromIndex,toList,toIndex,count)
|
||||||
|
local meta=minetest.get_meta(pos)
|
||||||
|
local inv=meta:get_inventory()
|
||||||
|
local srcSlot=inv:get_stack("src",1)
|
||||||
|
if fromList=="src" and count==srcSlot:get_count() then
|
||||||
|
meta:set_float("srcTime",-1)
|
||||||
|
meta:set_float("maxSrcTime",0)
|
||||||
|
if meta:get_int("industrialtest.powerAmount")>0 then
|
||||||
|
meta:set_string("formspec",getFormspec(meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")*100,meta:get_float("srcTime")/meta:get_float("maxSrcTime")*100))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_put=function(pos,listname)
|
||||||
|
if listname=="src" or listname=="powerStorage" then
|
||||||
|
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_take=function(pos,listname,index,stack)
|
||||||
|
local meta=minetest.get_meta(pos)
|
||||||
|
local inv=meta:get_inventory()
|
||||||
|
local srcSlot=inv:get_stack("src",1)
|
||||||
|
if listname=="src" and stack:get_count()==srcSlot:get_count() then
|
||||||
|
meta:set_float("srcTime",-1)
|
||||||
|
meta:set_float("maxSrcTime",0)
|
||||||
|
if meta:get_int("industrialtest.powerAmount")>0 then
|
||||||
|
meta:set_string("formspec",getFormspec(meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")*100,meta:get_float("srcTime")/meta:get_float("maxSrcTime")*100))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
_industrialtest_updateFormspec=function(meta)
|
||||||
|
meta:set_string("formspec",getFormspec(meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")*100,meta:get_float("srcTime")/meta:get_float("maxSrcTime")*100))
|
||||||
|
end
|
||||||
|
}
|
||||||
|
if industrialtest.mtgAvailable then
|
||||||
|
definition.groups={
|
||||||
|
cracky=1,
|
||||||
|
level=2
|
||||||
|
}
|
||||||
|
definition.sounds=default.node_sound_metal_defaults()
|
||||||
|
definition.can_dig=function(pos)
|
||||||
|
local meta=minetest.get_meta(pos)
|
||||||
|
local inv=meta:get_inventory()
|
||||||
|
return not (inv:get_list("src")[1]:get_count()>0 or inv:get_list("powerStorage")[1]:get_count()>0 or inv:get_list("dst")[1]:get_count()>0)
|
||||||
|
end
|
||||||
|
elseif industrialtest.mclAvailable then
|
||||||
|
definition.after_dig_node=function(pos,oldnode,oldmeta)
|
||||||
|
mclAfterDigNode(pos,oldmeta,{"src","powerStorage","dst","upgrades"})
|
||||||
|
end
|
||||||
|
definition.groups={pickaxey=1}
|
||||||
|
definition.sounds=mcl_sounds.node_sound_metal_defaults()
|
||||||
|
definition._mcl_blast_resistance=3
|
||||||
|
definition._mcl_hardness=3.5
|
||||||
|
end
|
||||||
|
definition.groups._industrialtest_hasPowerInput=1
|
||||||
|
minetest.register_node("industrialtest:"..config.name,definition)
|
||||||
|
end
|
||||||
|
|
||||||
local function ironFurnaceFormspec(fuelPercent,srcPercent)
|
local function ironFurnaceFormspec(fuelPercent,srcPercent)
|
||||||
local formspec
|
local formspec
|
||||||
if industrialtest.mtgAvailable then
|
if industrialtest.mtgAvailable then
|
||||||
@ -271,7 +521,7 @@ definition={
|
|||||||
"industrialtest_machine_block.png",
|
"industrialtest_machine_block.png",
|
||||||
"industrialtest_machine_block.png",
|
"industrialtest_machine_block.png",
|
||||||
"industrialtest_machine_block.png",
|
"industrialtest_machine_block.png",
|
||||||
"industrialtest_iron_furnace_front.png",
|
"industrialtest_machine_block.png^industrialtest_iron_furnace_front.png",
|
||||||
"industrialtest_machine_block.png"
|
"industrialtest_machine_block.png"
|
||||||
},
|
},
|
||||||
paramtype2="facedir",
|
paramtype2="facedir",
|
||||||
@ -448,230 +698,15 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
local function electricFurnaceFormspec(powerPercent,srcPercent)
|
registerSimpleElectricItemProcessor({
|
||||||
local formspec
|
name="electric_furnace",
|
||||||
if industrialtest.mtgAvailable then
|
displayName="Electric Furnace",
|
||||||
formspec={
|
capacity=416,
|
||||||
"formspec_version[4]",
|
flow=390,
|
||||||
"size[10.8,12]",
|
opPower=60,
|
||||||
"label[0.5,0.5;"..S("Electric Furnace").."]",
|
method="cooking",
|
||||||
"list[context;src;3.4,1.8;1,1]",
|
efficiency=0.5
|
||||||
"listring[context;src]",
|
})
|
||||||
(powerPercent>0 and "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
|
|
||||||
or "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
|
|
||||||
"list[context;powerStorage;3.4,3.9;1,1]",
|
|
||||||
"listring[context;powerStorage]",
|
|
||||||
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
|
|
||||||
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
|
|
||||||
"list[context;dst;6.4,2.8;1,1]",
|
|
||||||
"listring[context;dst]",
|
|
||||||
"list[context;upgrades;9,0.9;1,4]",
|
|
||||||
"listring[context;upgrades]",
|
|
||||||
"list[current_player;main;0.5,6.25;8,1]",
|
|
||||||
"list[current_player;main;0.5,7.5;8,3;8]"
|
|
||||||
}
|
|
||||||
elseif industrialtest.mclAvailable then
|
|
||||||
formspec={
|
|
||||||
"size[10.04,12]",
|
|
||||||
"label[0.25,0.25;"..S("Electric Furnace").."]",
|
|
||||||
"list[context;src;3.4,1.8;1,1]",
|
|
||||||
mcl_formspec.get_itemslot_bg(3.4,1.8,1,1),
|
|
||||||
"listring[context;src]",
|
|
||||||
(powerPercent>0 and "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
|
|
||||||
or "image[3.4,2.8;1,1;industrialtest_gui_electricity_bg.png]"),
|
|
||||||
"list[context;powerStorage;3.4,3.9;1,1]",
|
|
||||||
mcl_formspec.get_itemslot_bg(3.4,3.9,1,1),
|
|
||||||
"listring[context;powerStorage]",
|
|
||||||
(srcPercent>0 and "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[lowpart:"..srcPercent..":gui_furnace_arrow_fg.png^[transformR270]"
|
|
||||||
or "image[4.9,2.8;1,1;gui_furnace_arrow_bg.png^[transformR270]"),
|
|
||||||
"list[context;dst;6.4,2.8;1,1]",
|
|
||||||
mcl_formspec.get_itemslot_bg(6.4,2.8,1,1),
|
|
||||||
"listring[context;dst]",
|
|
||||||
"list[context;upgrades;9,0.9;1,4]",
|
|
||||||
mcl_formspec.get_itemslot_bg(9,0.9,1,4),
|
|
||||||
"listring[context;upgrades]",
|
|
||||||
"list[current_player;main;0.5,7;9,3;9]",
|
|
||||||
mcl_formspec.get_itemslot_bg(0.5,7,9,3),
|
|
||||||
"list[current_player;main;0.5,10.24;9,1]",
|
|
||||||
mcl_formspec.get_itemslot_bg(0.5,10.24,9,1)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
return table.concat(formspec,"")
|
|
||||||
end
|
|
||||||
definition={
|
|
||||||
description=S("Electric Furnace"),
|
|
||||||
tiles={
|
|
||||||
"industrialtest_machine_block.png",
|
|
||||||
"industrialtest_machine_block.png",
|
|
||||||
"industrialtest_machine_block.png",
|
|
||||||
"industrialtest_machine_block.png",
|
|
||||||
"industrialtest_machine_block.png",
|
|
||||||
"industrialtest_electric_furnace_front.png",
|
|
||||||
"industrialtest_machine_block.png"
|
|
||||||
},
|
|
||||||
paramtype2="facedir",
|
|
||||||
legacy_facedir_simple=true,
|
|
||||||
on_construct=function(pos)
|
|
||||||
local meta=minetest.get_meta(pos)
|
|
||||||
local inv=meta:get_inventory()
|
|
||||||
inv:set_size("src",1)
|
|
||||||
inv:set_size("dst",1)
|
|
||||||
inv:set_size("powerStorage",1)
|
|
||||||
inv:set_size("upgrades",4)
|
|
||||||
meta:set_string("formspec",electricFurnaceFormspec(0,0))
|
|
||||||
meta:set_float("srcTime",-1)
|
|
||||||
meta:set_float("maxSrcTime",0)
|
|
||||||
industrialtest.api.addPowerStorage(meta,416,390,"iiiiii")
|
|
||||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
|
||||||
end,
|
|
||||||
on_timer=function(pos,elapsed)
|
|
||||||
local meta=minetest.get_meta(pos)
|
|
||||||
local inv=meta:get_inventory()
|
|
||||||
local srcSlot=inv:get_stack("src",1)
|
|
||||||
local powerStorageSlot=inv:get_stack("powerStorage",1)
|
|
||||||
local shouldUpdateFormspec=false
|
|
||||||
local shouldRerunTimer=false
|
|
||||||
local requiredPower=elapsed*60
|
|
||||||
|
|
||||||
if powerStorageSlot:get_count()>0 then
|
|
||||||
local stackMeta=powerStorageSlot:get_meta()
|
|
||||||
if industrialtest.api.transferPower(stackMeta,meta,stackMeta:get_int("industrialtest.powerFlow"))>0 then
|
|
||||||
shouldUpdateFormspec=true
|
|
||||||
shouldRerunTimer=true
|
|
||||||
industrialtest.api.updateItemPowerText(powerStorageSlot)
|
|
||||||
inv:set_stack("powerStorage",1,powerStorageSlot)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if srcSlot:get_count()>0 and meta:get_float("maxSrcTime")<=0 and meta:get_int("industrialtest.powerAmount")>=requiredPower then
|
|
||||||
local output,after=minetest.get_craft_result({
|
|
||||||
method="cooking",
|
|
||||||
width=1,
|
|
||||||
items={srcSlot}
|
|
||||||
})
|
|
||||||
if output.time>0 and inv:room_for_item("dst",output.item) then
|
|
||||||
meta:set_float("srcTime",0)
|
|
||||||
meta:set_float("maxSrcTime",output.time*0.5)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if meta:get_float("maxSrcTime")>0 then
|
|
||||||
if meta:get_int("industrialtest.powerAmount")>=requiredPower then
|
|
||||||
meta:set_int("industrialtest.powerAmount",meta:get_int("industrialtest.powerAmount")-requiredPower)
|
|
||||||
meta:set_float("srcTime",meta:get_float("srcTime")+elapsed)
|
|
||||||
shouldRerunTimer=true
|
|
||||||
end
|
|
||||||
shouldUpdateFormspec=true
|
|
||||||
end
|
|
||||||
if meta:get_float("srcTime")>=meta:get_float("maxSrcTime") then
|
|
||||||
local output,after=minetest.get_craft_result({
|
|
||||||
method="cooking",
|
|
||||||
width=1,
|
|
||||||
items={srcSlot}
|
|
||||||
})
|
|
||||||
if output.item:get_count()>0 then
|
|
||||||
inv:set_stack("src",1,after.items[1])
|
|
||||||
inv:add_item("dst",output.item)
|
|
||||||
meta:set_float("srcTime",-1)
|
|
||||||
meta:set_float("maxSrcTime",0)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if not industrialtest.api.isFullyCharged(meta) then
|
|
||||||
industrialtest.api.triggerNeighbours(pos)
|
|
||||||
end
|
|
||||||
|
|
||||||
if shouldUpdateFormspec then
|
|
||||||
meta:set_string("formspec",electricFurnaceFormspec(meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")*100,meta:get_float("srcTime")/meta:get_float("maxSrcTime")*100))
|
|
||||||
end
|
|
||||||
|
|
||||||
return shouldRerunTimer
|
|
||||||
end,
|
|
||||||
allow_metadata_inventory_move=function(pos,fromList,fromIndex,toList,count)
|
|
||||||
if toList=="dst" then
|
|
||||||
return 0
|
|
||||||
elseif toList=="powerStorage" then
|
|
||||||
local meta=minetest.get_meta(pos)
|
|
||||||
local inv=meta:get_inventory()
|
|
||||||
local stack=inv:get_stack(fromList,fromIndex)
|
|
||||||
return (industrialtest.api.hasPowerStorage(stack:get_meta()) and count or 0)
|
|
||||||
elseif toList=="upgrades" then
|
|
||||||
-- TODO: Add support for upgrades when they will be added
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
return count
|
|
||||||
end,
|
|
||||||
allow_metadata_inventory_put=function(pos,listname,index,stack)
|
|
||||||
if listname=="dst" then
|
|
||||||
return 0
|
|
||||||
elseif listname=="src" then
|
|
||||||
local meta=minetest.get_meta(pos)
|
|
||||||
local inv=meta:get_inventory()
|
|
||||||
local srcSlot=inv:get_stack("src",1)
|
|
||||||
if srcSlot:get_name()~=stack:get_name() then
|
|
||||||
meta:set_float("srcTime",-1)
|
|
||||||
meta:set_float("maxSrcTime",0)
|
|
||||||
end
|
|
||||||
elseif listname=="powerStorage" then
|
|
||||||
return (industrialtest.api.hasPowerStorage(stack:get_meta()) and stack:get_count() or 0)
|
|
||||||
elseif listname=="upgrades" then
|
|
||||||
--TODO: See allow_metadata_inventory_move
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
return stack:get_count()
|
|
||||||
end,
|
|
||||||
on_metadata_inventory_move=function(pos,fromList,fromIndex,toList,toIndex,count)
|
|
||||||
local meta=minetest.get_meta(pos)
|
|
||||||
local inv=meta:get_inventory()
|
|
||||||
local srcSlot=inv:get_stack("src",1)
|
|
||||||
if fromList=="src" and count==srcSlot:get_count() then
|
|
||||||
meta:set_float("srcTime",-1)
|
|
||||||
meta:set_float("maxSrcTime",0)
|
|
||||||
if meta:get_int("industrialtest.powerAmount")>0 then
|
|
||||||
meta:set_string("formspec",electricFurnaceFormspec(meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")*100,meta:get_float("srcTime")/meta:get_float("maxSrcTime")*100))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
on_metadata_inventory_put=function(pos,listname)
|
|
||||||
if listname=="src" or listname=="powerStorage" then
|
|
||||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
on_metadata_inventory_take=function(pos,listname,index,stack)
|
|
||||||
local meta=minetest.get_meta(pos)
|
|
||||||
local inv=meta:get_inventory()
|
|
||||||
local srcSlot=inv:get_stack("src",1)
|
|
||||||
if listname=="src" and stack:get_count()==srcSlot:get_count() then
|
|
||||||
meta:set_float("srcTime",-1)
|
|
||||||
meta:set_float("maxSrcTime",0)
|
|
||||||
if meta:get_int("industrialtest.powerAmount")>0 then
|
|
||||||
meta:set_string("formspec",electricFurnaceFormspec(meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")*100,meta:get_float("srcTime")/meta:get_float("maxSrcTime")*100))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
_industrialtest_updateFormspec=function(meta)
|
|
||||||
meta:set_string("formspec",electricFurnaceFormspec(meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")*100,meta:get_float("srcTime")/meta:get_float("maxSrcTime")*100))
|
|
||||||
end
|
|
||||||
}
|
|
||||||
if industrialtest.mtgAvailable then
|
|
||||||
definition.groups={
|
|
||||||
cracky=1,
|
|
||||||
level=2
|
|
||||||
}
|
|
||||||
definition.sounds=default.node_sound_metal_defaults()
|
|
||||||
definition.can_dig=function(pos)
|
|
||||||
local meta=minetest.get_meta(pos)
|
|
||||||
local inv=meta:get_inventory()
|
|
||||||
return not (inv:get_list("src")[1]:get_count()>0 or inv:get_list("powerStorage")[1]:get_count()>0 or inv:get_list("dst")[1]:get_count()>0)
|
|
||||||
end
|
|
||||||
elseif industrialtest.mclAvailable then
|
|
||||||
definition.after_dig_node=function(pos,oldnode,oldmeta)
|
|
||||||
mclAfterDigNode(pos,oldmeta,{"src","powerStorage","dst","upgrades"})
|
|
||||||
end
|
|
||||||
definition.groups={pickaxey=1}
|
|
||||||
definition.sounds=mcl_sounds.node_sound_metal_defaults()
|
|
||||||
definition._mcl_blast_resistance=3
|
|
||||||
definition._mcl_hardness=3.5
|
|
||||||
end
|
|
||||||
definition.groups._industrialtest_hasPowerInput=1
|
|
||||||
minetest.register_node("industrialtest:electric_furnace",definition)
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type="shaped",
|
type="shaped",
|
||||||
output="industrialtest:electric_furnace",
|
output="industrialtest:electric_furnace",
|
||||||
@ -690,3 +725,22 @@ minetest.register_craft({
|
|||||||
{industrialtest.elementKeys.powerCarrier,"industrialtest:iron_furnace",industrialtest.elementKeys.powerCarrier}
|
{industrialtest.elementKeys.powerCarrier,"industrialtest:iron_furnace",industrialtest.elementKeys.powerCarrier}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
registerSimpleElectricItemProcessor({
|
||||||
|
name="macerator",
|
||||||
|
displayName="Macerator",
|
||||||
|
capacity=1200,
|
||||||
|
flow=600,
|
||||||
|
opPower=100,
|
||||||
|
method="industrialtest.macerating",
|
||||||
|
efficiency=1
|
||||||
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
type="shaped",
|
||||||
|
output="industrialtest:macerator",
|
||||||
|
recipe={
|
||||||
|
{industrialtest.elementKeys.flint,industrialtest.elementKeys.flint,industrialtest.elementKeys.flint},
|
||||||
|
{industrialtest.elementKeys.cobble,"industrialtest:machine_block",industrialtest.elementKeys.cobble},
|
||||||
|
{"","industrialtest:electronic_circuit",""}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
2
mod.conf
@ -1,5 +1,5 @@
|
|||||||
name=industrialtest
|
name=industrialtest
|
||||||
description=Adds various machinery
|
description=Adds various machinery
|
||||||
optional_depends=default,3d_armor,mcl_core,mcl_copper,mcl_armor
|
optional_depends=default,3d_armor,mcl_core,mcl_copper,mcl_armor,mcl_deepslate
|
||||||
author=IndustrialTest Team
|
author=IndustrialTest Team
|
||||||
title=IndustrialTest
|
title=IndustrialTest
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 5.2 KiB |
BIN
textures/industrialtest_insulated_copper_cable.png
Normal file
After Width: | Height: | Size: 763 B |
BIN
textures/industrialtest_insulated_copper_cable_inv.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 1003 B After Width: | Height: | Size: 5.2 KiB |
BIN
textures/industrialtest_macerator_front.png
Normal file
After Width: | Height: | Size: 680 B |
BIN
textures/industrialtest_sticky_resin.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
textures/industrialtest_treetap.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
@ -18,7 +18,7 @@ local S=minetest.get_translator("industrialtest")
|
|||||||
|
|
||||||
local definition={
|
local definition={
|
||||||
description=S("Treetap"),
|
description=S("Treetap"),
|
||||||
inventory_image="industrialtest_tree_tap.png",
|
inventory_image="industrialtest_treetap.png",
|
||||||
tool_capabilities={
|
tool_capabilities={
|
||||||
full_punch_interval=1,
|
full_punch_interval=1,
|
||||||
uses=50
|
uses=50
|
||||||
|