forked from mrkubax10/industrialtest
Compare commits
15 Commits
7391ad34f3
...
17a9cab691
Author | SHA1 | Date | |
---|---|---|---|
17a9cab691 | |||
322655f483 | |||
2dae1d931d | |||
ce0a5ad2e6 | |||
c8e506be53 | |||
5161f70232 | |||
969744f242 | |||
c58aeb308b | |||
16c8bed915 | |||
a6cb0d4ed1 | |||
50565ca604 | |||
ea422c5999 | |||
65e0304c9e | |||
93d6cdbb89 | |||
03ff0ac8ce |
@ -16,19 +16,13 @@
|
||||
|
||||
local S=minetest.get_translator("industrialtest")
|
||||
|
||||
-- \brief Prepares itemstack containing fluid storage
|
||||
-- \param itemstack ItemStack
|
||||
-- \returns bool
|
||||
function industrialtest.api.prepareFluidStorageItem(itemstack)
|
||||
local function createItemFluidStorageText(itemstack)
|
||||
local meta=itemstack:get_meta()
|
||||
local def=itemstack:get_definition()
|
||||
if industrialtest.api.itemHasFluidStorage(itemstack) or not def.groups or not def.groups._industrialtest_fluidStorage or not def._industrialtest_fluidCapacity then
|
||||
return false
|
||||
end
|
||||
meta:set_int("industrialtest.fluidAmount",0)
|
||||
meta:set_int("industrialtest.fluidCapacity",def._industrialtest_fluidCapacity)
|
||||
industrialtest.api.updateItemFluidText(itemstack)
|
||||
return true
|
||||
local fluidCapacity=meta:get_int("industrialtest.fluidCapacity")
|
||||
local fluidAmount=meta:get_int("industrialtest.fluidAmount")
|
||||
local lowerLimit=math.floor(fluidCapacity*0.25)
|
||||
local color=(fluidAmount>lowerLimit and "#0000FF" or "#FF0000")
|
||||
return minetest.colorize(color,S("@1 / @2 mB",fluidAmount,fluidCapacity))
|
||||
end
|
||||
|
||||
-- \brief Check if itemstack contains fluid storage
|
||||
@ -80,8 +74,13 @@ end
|
||||
-- \returns nil
|
||||
function industrialtest.api.updateItemFluidText(itemstack)
|
||||
local meta=itemstack:get_meta()
|
||||
local def=itemstack:get_definition()
|
||||
meta:set_string("description",S("@1\n@2 / @3 mB",def.description,meta:get_int("industrialtest.fluidAmount"),meta:get_int("industrialtest.fluidCapacity")))
|
||||
if industrialtest.mtgAvailable then
|
||||
local def=itemstack:get_definition()
|
||||
local fluidStorageText=createItemFluidStorageText(itemstack)
|
||||
meta:set_string("description",string.format("%s\n%s",def.description,fluidStorageText))
|
||||
elseif industrialtest.mclAvailable then
|
||||
tt.reload_itemstack_description(itemstack)
|
||||
end
|
||||
itemstack:set_wear(65535-meta:get_int("industrialtest.fluidAmount")/meta:get_int("industrialtest.fluidCapacity")*65534)
|
||||
end
|
||||
|
||||
@ -119,3 +118,15 @@ function industrialtest.api.transferFluidToItem(srcItemstack,itemstack,amount)
|
||||
industrialtest.api.updateItemFluidText(srcItemstack)
|
||||
return actualFlow
|
||||
end
|
||||
|
||||
if industrialtest.mclAvailable then
|
||||
tt.register_snippet(function(itemstring,toolCapabilities,itemstack)
|
||||
if not itemstack then
|
||||
return nil
|
||||
end
|
||||
if not industrialtest.api.itemHasFluidStorage(itemstack) then
|
||||
return nil
|
||||
end
|
||||
return createItemFluidStorageText(itemstack),false
|
||||
end)
|
||||
end
|
||||
|
157
api/network.lua
157
api/network.lua
@ -41,6 +41,102 @@ local function clampFlow(pos,flow)
|
||||
return math.min(flow,newFlow)
|
||||
end
|
||||
|
||||
-- \brief Finds path from pos to dest in network. Function finished if either dest is found or every node was visited
|
||||
-- \param pos Vector
|
||||
-- \param dest Vector
|
||||
-- \returns table or nil
|
||||
function industrialtest.api.findPathInNetwork(pos,dest)
|
||||
local connections=industrialtest.api.getConnections(pos,"i")
|
||||
if #connections==0 then
|
||||
return nil
|
||||
end
|
||||
|
||||
local workers={}
|
||||
local serializedSourcePos=pos.x..","..pos.y..","..pos.z
|
||||
local visitedNodes={[serializedSourcePos]=true}
|
||||
for _,conn in ipairs(connections) do
|
||||
local sideVector=vector.subtract(conn,pos)
|
||||
table.insert(workers,{
|
||||
position=conn,
|
||||
direction=sideVector,
|
||||
path={[1]=conn}
|
||||
})
|
||||
end
|
||||
|
||||
while #workers>0 do
|
||||
for i=1,#workers do
|
||||
local worker=workers[i]
|
||||
local serializedPos=worker.position.x..","..worker.position.y..","..worker.position.z
|
||||
if visitedNodes[serializedPos] then
|
||||
table.remove(workers,i)
|
||||
break
|
||||
end
|
||||
visitedNodes[serializedPos]=true
|
||||
|
||||
if worker.position.x==dest.x and worker.position.y==dest.y and worker.position.z==dest.z then
|
||||
return worker.path
|
||||
end
|
||||
|
||||
local def=minetest.registered_nodes[minetest.get_node(worker.position).name]
|
||||
if def and def.groups and def.groups._industrialtest_cable then
|
||||
connections=industrialtest.api.getConnections(worker.position,"i")
|
||||
for j=1,#connections do
|
||||
local direction=vector.subtract(connections[j],worker.position)
|
||||
local oppositeDirection=vector.multiply(worker.direction,vector.new(-1,-1,-1))
|
||||
if direction.x~=oppositeDirection.x or direction.y~=oppositeDirection.y or direction.z~=oppositeDirection.z then
|
||||
if worker.direction.x~=direction.x or worker.direction.y~=direction.y or worker.direction.z~=direction.z then
|
||||
table.insert(worker.path,worker.position)
|
||||
end
|
||||
for c=1,#connections do
|
||||
local nextDirection=vector.subtract(connections[c],worker.position)
|
||||
if c~=j and (nextDirection.x~=oppositeDirection.x or nextDirection.y~=oppositeDirection.y or nextDirection.z~=oppositeDirection.z) then
|
||||
local newWorker={
|
||||
position=connections[c],
|
||||
direction=nextDirection,
|
||||
path=table.copy(worker.path)
|
||||
}
|
||||
table.insert(newWorker.path,worker.position)
|
||||
table.insert(workers,newWorker)
|
||||
end
|
||||
end
|
||||
worker.direction=direction
|
||||
worker.position=connections[j]
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if #connections>2 then
|
||||
break
|
||||
end
|
||||
else
|
||||
table.remove(workers,i)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
-- \brief Goes through path vertices specified by path running callback on each node.
|
||||
-- Function finishes if either callback returns false or entire path is went over.
|
||||
-- \param path table
|
||||
-- \param callback function
|
||||
-- \returns nil
|
||||
function industrialtest.api.walkPath(path,callback)
|
||||
local pos=path[1]
|
||||
for i=2,#path do
|
||||
local pathNode=path[i]
|
||||
local direction=vector.normalize(vector.subtract(pathNode,pos))
|
||||
while pos.x~=pathNode.x or pos.y~=pathNode.y or pos.z~=pathNode.z do
|
||||
if not callback(pos) then
|
||||
return
|
||||
end
|
||||
pos=vector.add(pos,direction)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- \brief Transfers power from source node to it's network, if sides is set then power will be only transfered to network connected to that sides
|
||||
-- \param pos Vector with position of source node
|
||||
-- \param (optional) sides table with Vectors
|
||||
@ -100,8 +196,36 @@ function industrialtest.api.powerFlow(pos,sides,flowOverride)
|
||||
roomAvailable=true
|
||||
end
|
||||
else
|
||||
minetest.remove_node(endpoint.position)
|
||||
industrialtest.internal.explode(endpoint.position,2)
|
||||
local path=industrialtest.api.findPathInNetwork(pos,endpoint.position)
|
||||
if path and #path>0 then
|
||||
table.insert(path,endpoint.position)
|
||||
local removed=false
|
||||
industrialtest.api.walkPath(path,function(pathPos)
|
||||
local def=minetest.registered_nodes[minetest.get_node(pathPos).name]
|
||||
if not def or not def.groups or not def.groups._industrialtest_cable then
|
||||
return false
|
||||
end
|
||||
if powerDistribution>def._industrialtest_cableFlow then
|
||||
removed=true
|
||||
minetest.swap_node(pathPos,{
|
||||
name="air"
|
||||
})
|
||||
minetest.remove_node(pathPos)
|
||||
minetest.check_for_falling(pathPos)
|
||||
minetest.sound_play("default_cool_lava",{
|
||||
pos=pathPos,
|
||||
max_hear_distance=5,
|
||||
gain=0.7
|
||||
})
|
||||
end
|
||||
return true
|
||||
end)
|
||||
if not removed and powerDistribution>endpoint.originalFlow then
|
||||
minetest.remove_node(endpoint.position)
|
||||
industrialtest.internal.explode(endpoint.position,2)
|
||||
end
|
||||
industrialtest.api.createNetworkMapForNode(pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -199,6 +323,7 @@ function industrialtest.api.createNetworkMap(pos,addCables,omit)
|
||||
position=worker.position,
|
||||
distance=worker.distance,
|
||||
flow=math.min(worker.flow,flow),
|
||||
originalFlow=flow,
|
||||
side=connectionSide,
|
||||
sourceSide=worker.sourceSide
|
||||
})
|
||||
@ -271,6 +396,34 @@ function industrialtest.api.getNetwork(meta)
|
||||
return minetest.deserialize(meta:get_string("industrialtest.network"))
|
||||
end
|
||||
|
||||
-- \brief Returns amount of power that will flow from specified network master
|
||||
-- \param pos Vector
|
||||
-- \returns number
|
||||
function industrialtest.api.getFlowingCurrent(pos)
|
||||
local meta=minetest.get_meta(pos)
|
||||
if not industrialtest.api.hasPowerStorage(meta) or meta:get_int("industrialtest.powerAmount")==0 then
|
||||
return 0
|
||||
end
|
||||
local network=industrialtest.api.getNetwork(meta)
|
||||
if not network then
|
||||
return 0
|
||||
end
|
||||
|
||||
local amount=meta:get_int("industrialtest.powerAmount")
|
||||
if amount==0 then
|
||||
return 0
|
||||
end
|
||||
local demand=0
|
||||
for _,endpoint in ipairs(network) do
|
||||
local endpointMeta=minetest.get_meta(endpoint.position)
|
||||
if industrialtest.api.hasPowerStorage(endpointMeta) then
|
||||
demand=demand+math.min(endpointMeta:get_int("industrialtest.powerCapacity")-endpointMeta:get_int("industrialtest.powerAmount"),endpoint.flow)
|
||||
end
|
||||
end
|
||||
|
||||
return math.min(amount,demand)
|
||||
end
|
||||
|
||||
-- \brief Returns connections of node with power storage. If direction is "i" only input connections will be returned, if direction is "o" only output connections
|
||||
-- will be returned, if it's not provided all connections will be returned.
|
||||
-- \param pos Vector
|
||||
|
@ -16,6 +16,15 @@
|
||||
|
||||
local S=minetest.get_translator("industrialtest")
|
||||
|
||||
local function createItemPowerText(itemstack)
|
||||
local meta=itemstack:get_meta()
|
||||
local powerCapacity=meta:get_int("industrialtest.powerCapacity")
|
||||
local powerAmount=meta:get_int("industrialtest.powerAmount")
|
||||
local lowerLimit=math.floor(powerCapacity*0.25)
|
||||
local color=(powerAmount>lowerLimit and "#00FFFF" or "#FF0000")
|
||||
return minetest.colorize(color,S("@1 / @2 EU",powerAmount,powerCapacity))
|
||||
end
|
||||
|
||||
-- \brief Adds power storage to metadata
|
||||
-- \param capacity How much EU item/node can store
|
||||
-- \param flow How much EU can flow in or out item/node per industrialtest.updateDelay
|
||||
@ -158,9 +167,14 @@ end
|
||||
-- \returns nil
|
||||
function industrialtest.api.updateItemPowerText(itemstack)
|
||||
local meta=itemstack:get_meta()
|
||||
local def=minetest.registered_tools[itemstack:get_name()]
|
||||
local desc=meta:contains("industrialtest.descriptionOverride") and meta:get_string("industrialtest.descriptionOverride") or def.description
|
||||
meta:set_string("description",S("@1\n@2 / @3 EU",desc,meta:get_int("industrialtest.powerAmount"),meta:get_int("industrialtest.powerCapacity")))
|
||||
if industrialtest.mtgAvailable then
|
||||
local def=minetest.registered_tools[itemstack:get_name()]
|
||||
local desc=meta:contains("industrialtest.descriptionOverride") and meta:get_string("industrialtest.descriptionOverride") or def.description
|
||||
local powerText=createItemPowerText(itemstack)
|
||||
meta:set_string("description",string.format("%s\n%s",desc,powerText))
|
||||
elseif industrialtest.mclAvailable then
|
||||
tt.reload_itemstack_description(itemstack)
|
||||
end
|
||||
itemstack:set_wear(65535-meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")*65534)
|
||||
end
|
||||
|
||||
@ -209,3 +223,15 @@ function industrialtest.api.transferPowerFromItem(srcItemstack,meta,amount)
|
||||
return actualFlow
|
||||
end
|
||||
|
||||
if industrialtest.mclAvailable then
|
||||
tt.register_snippet(function(itemstring,toolCapabilities,itemstack)
|
||||
if not itemstack then
|
||||
return nil
|
||||
end
|
||||
local meta=itemstack:get_meta()
|
||||
if not industrialtest.api.hasPowerStorage(meta) then
|
||||
return nil
|
||||
end
|
||||
return createItemPowerText(itemstack),false
|
||||
end)
|
||||
end
|
||||
|
55
cables.lua
55
cables.lua
@ -162,12 +162,15 @@ function industrialtest.Cable.createDefinitionTable(self,description,inventoryIm
|
||||
def.sound=mcl_sounds.node_sound_metal_defaults()
|
||||
end
|
||||
def.groups._industrialtest_cable=1
|
||||
if insulated then
|
||||
def.groups._industrialtest_insulatedCable=1
|
||||
end
|
||||
|
||||
return def
|
||||
end
|
||||
|
||||
function industrialtest.Cable.register(self)
|
||||
local def=self:createDefinitionTable(self.description,self.inventoryImage,self.tile,false)
|
||||
local def=self:createDefinitionTable(self.description,self.inventoryImage,self.tile,self.safe)
|
||||
minetest.register_node(self.name,def)
|
||||
|
||||
if self.insulated then
|
||||
@ -385,6 +388,7 @@ industrialtest.internal.unpackTableInto(industrialtest.GlassFibreCable,{
|
||||
inventoryImage="industrialtest_glass_fibre_cable_inv.png",
|
||||
transparent=true,
|
||||
tile="industrialtest_glass_fibre_cable.png",
|
||||
safe=true,
|
||||
size=0.12,
|
||||
flow=industrialtest.api.ivPowerFlow
|
||||
})
|
||||
@ -401,3 +405,52 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
-- TODO: Add glass fibre cable craft with silver ingot
|
||||
|
||||
if industrialtest.config.electrocution then
|
||||
local electrocutionDelta=0
|
||||
minetest.register_globalstep(function(dtime)
|
||||
electrocutionDelta=electrocutionDelta+dtime
|
||||
if electrocutionDelta<industrialtest.config.updateDelay then
|
||||
return
|
||||
end
|
||||
electrocutionDelta=0
|
||||
|
||||
local offsets={
|
||||
vector.new(0,0,0),
|
||||
vector.new(-0.7,0,0),
|
||||
vector.new(-0.7,1,0),
|
||||
vector.new(0,1,0),
|
||||
vector.new(0.7,0,0),
|
||||
vector.new(0.7,1,0),
|
||||
vector.new(0,0,-0.7),
|
||||
vector.new(0,1,-0.7),
|
||||
vector.new(0,0,0.7),
|
||||
vector.new(0,1,0.7)
|
||||
}
|
||||
|
||||
local players=minetest.get_connected_players()
|
||||
for _,player in ipairs(players) do
|
||||
local pos=player:get_pos()
|
||||
for _,offset in ipairs(offsets) do
|
||||
local nodePos=vector.add(pos,offset)
|
||||
local node=minetest.get_node(nodePos)
|
||||
local def=minetest.registered_nodes[node.name]
|
||||
if def and def.groups and def.groups._industrialtest_cable and not def.groups._industrialtest_insulatedCable then
|
||||
local meta=minetest.get_meta(pos)
|
||||
local networks=industrialtest.api.isAttachedToNetwork(meta)
|
||||
if networks then
|
||||
local current=0
|
||||
for _,network in ipairs(networks) do
|
||||
current=current+industrialtest.api.getFlowingCurrent(network)
|
||||
end
|
||||
if current>0 then
|
||||
local removed=math.ceil(current/500)
|
||||
player:set_hp(player:get_hp()-removed,"electrocution")
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
@ -506,6 +506,7 @@ if industrialtest.mclAvailable then
|
||||
industrialtest.elementKeys.dryShrub="mcl_core:deadbush"
|
||||
industrialtest.elementKeys.cactus="mcl_core:cactus"
|
||||
industrialtest.elementKeys.gunpowder="mcl_mobitems:gunpowder"
|
||||
industrialtest.elementKeys.chest="mcl_chests:chest_small"
|
||||
industrialtest.elementKeys.groupSapling="group:sapling"
|
||||
industrialtest.elementKeys.groupLeaves="group:leaves"
|
||||
industrialtest.elementKeys.stickyResin=(industrialtest.mods.mclRubber and "mcl_rubber:rubber_raw" or "industrialtest:sticky_resin")
|
||||
@ -740,6 +741,7 @@ elseif industrialtest.mtgAvailable then
|
||||
industrialtest.elementKeys.dryShrub="default:dry_shrub"
|
||||
industrialtest.elementKeys.cactus="default:cactus"
|
||||
industrialtest.elementKeys.gunpowder="tnt:gunpowder"
|
||||
industrialtest.elementKeys.chest="default:chest"
|
||||
industrialtest.elementKeys.groupSapling="group:sapling"
|
||||
industrialtest.elementKeys.groupLeaves="group:leaves"
|
||||
industrialtest.elementKeys.stickyResin="industrialtest:sticky_resin"
|
||||
|
5
init.lua
5
init.lua
@ -21,7 +21,8 @@ industrialtest={}
|
||||
|
||||
-- Settings
|
||||
industrialtest.config={
|
||||
updateDelay=minetest.settings:get("industrialtest.updateDelay") or 1,
|
||||
updateDelay=tonumber(minetest.settings:get("industrialtest.updateDelay") or "1"),
|
||||
electrocution=minetest.settings:get_bool("industrialtest.electrocution",true),
|
||||
developerMode=minetest.settings:get_bool("industrialtest.developerMode",false)
|
||||
}
|
||||
|
||||
@ -56,6 +57,7 @@ dofile(modpath.."/machines/induction_furnace.lua")
|
||||
dofile(modpath.."/machines/iron_furnace.lua")
|
||||
dofile(modpath.."/machines/macerator.lua")
|
||||
dofile(modpath.."/machines/mass_fabricator.lua")
|
||||
dofile(modpath.."/machines/miner.lua")
|
||||
dofile(modpath.."/machines/nuclear_reactor.lua")
|
||||
dofile(modpath.."/machines/power_storage.lua")
|
||||
dofile(modpath.."/machines/recycler.lua")
|
||||
@ -85,6 +87,7 @@ dofile(modpath.."/tools/jetpack.lua")
|
||||
dofile(modpath.."/tools/mining_laser.lua")
|
||||
dofile(modpath.."/tools/nano_suit.lua")
|
||||
dofile(modpath.."/tools/power_storage.lua")
|
||||
dofile(modpath.."/tools/scanner.lua")
|
||||
dofile(modpath.."/tools/solar_helmet.lua")
|
||||
dofile(modpath.."/tools/static_boots.lua")
|
||||
dofile(modpath.."/tools/treetap.lua")
|
||||
|
@ -32,6 +32,15 @@ function industrialtest.Machine.afterPlaceNode(self,pos,placer,itemstack,pointed
|
||||
-- dummy function
|
||||
end
|
||||
|
||||
function industrialtest.Machine.afterDigNode(self,pos,oldnode,oldmetadata,digger)
|
||||
-- dummy function
|
||||
end
|
||||
|
||||
function industrialtest.Machine.onDig(self,pos,node,digger)
|
||||
-- dummy function
|
||||
return minetest.node_dig(pos,node,digger)
|
||||
end
|
||||
|
||||
function industrialtest.Machine.getFormspec(self,pos)
|
||||
local formspec
|
||||
if industrialtest.mtgAvailable then
|
||||
@ -195,6 +204,12 @@ function industrialtest.Machine.createDefinitionTable(self)
|
||||
after_place_node=function(pos,placer,itemstack,pointed)
|
||||
self:afterPlaceNode(pos,placer,itemstack,pointed)
|
||||
end,
|
||||
after_dig_node=function(pos,oldnode,oldmetadata,digger)
|
||||
self:afterDigNode(pos,oldnode,oldmetadata,digger)
|
||||
end,
|
||||
on_dig=function(pos,node,digger)
|
||||
return self:onDig(pos,node,digger)
|
||||
end,
|
||||
on_timer=function(pos,elapsed)
|
||||
return self:onTimer(pos,elapsed)
|
||||
end,
|
||||
|
388
machines/miner.lua
Normal file
388
machines/miner.lua
Normal file
@ -0,0 +1,388 @@
|
||||
-- IndustrialTest
|
||||
-- Copyright (C) 2025 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/>.
|
||||
|
||||
local S=minetest.get_translator("industrialtest")
|
||||
|
||||
local function destructMiningPipe(pos,player)
|
||||
local count=0
|
||||
local originalPos=table.copy(pos)
|
||||
local node=minetest.get_node(pos)
|
||||
while node.name=="industrialtest:mining_pipe" do
|
||||
count=count+1
|
||||
pos.y=pos.y-1
|
||||
node=minetest.get_node(pos)
|
||||
if node.name=="ignore" then
|
||||
minetest.load_area(pos)
|
||||
node=minetest.get_node(pos)
|
||||
end
|
||||
end
|
||||
local endPos=table.copy(pos)
|
||||
|
||||
local manip=minetest.get_voxel_manip()
|
||||
local minp,maxp=manip:read_from_map(pos,originalPos)
|
||||
local data=manip:get_data()
|
||||
local area=VoxelArea(minp,maxp)
|
||||
pos=table.copy(originalPos)
|
||||
while pos.y>endPos.y do
|
||||
data[area:index(pos.x,pos.y,pos.z)]=minetest.CONTENT_AIR
|
||||
pos.y=pos.y-1
|
||||
end
|
||||
manip:set_data(data)
|
||||
manip:write_to_map()
|
||||
|
||||
if player then
|
||||
local itemstack=ItemStack("industrialtest:mining_pipe "..tostring(count))
|
||||
if industrialtest.mtgAvailable then
|
||||
local inv=player:get_inventory()
|
||||
local leftover=inv:add_item("main",itemstack)
|
||||
if not leftover:is_empty() then
|
||||
minetest.add_item(player:get_pos(),leftover)
|
||||
end
|
||||
elseif industrialtest.mclAvailable then
|
||||
minetest.add_item(originalPos,itemstack)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function miningPipeUpdateMiner(pos)
|
||||
local meta=minetest.get_meta(pos)
|
||||
if meta:contains("miner") then
|
||||
local minerPos=minetest.deserialize(meta:get_string("miner"))
|
||||
local minerMeta=minetest.get_meta(minerPos)
|
||||
minerMeta:set_int("level",pos.y)
|
||||
end
|
||||
end
|
||||
|
||||
local definition={
|
||||
description=S("Mining Pipe"),
|
||||
tiles={"industrialtest_mining_pipe.png"},
|
||||
paramtype="light",
|
||||
sunlight_propagates=true,
|
||||
drawtype="nodebox",
|
||||
node_box={
|
||||
type="fixed",
|
||||
fixed={
|
||||
-0.25,
|
||||
-0.5,
|
||||
-0.25,
|
||||
0.25,
|
||||
0.5,
|
||||
0.25
|
||||
}
|
||||
},
|
||||
on_destruct=function(pos)
|
||||
miningPipeUpdateMiner(pos)
|
||||
destructMiningPipe(pos,nil)
|
||||
end,
|
||||
on_dig=function(pos,node,digger)
|
||||
miningPipeUpdateMiner(pos)
|
||||
destructMiningPipe(pos,digger)
|
||||
end
|
||||
}
|
||||
if industrialtest.mtgAvailable then
|
||||
definition.groups={
|
||||
cracky=3,
|
||||
oddly_breakable_by_hand=1
|
||||
}
|
||||
definition.sounds=default.node_sound_metal_defaults()
|
||||
elseif industrialtest.mclAvailable then
|
||||
definition.groups={
|
||||
pickaxey=1,
|
||||
handy=1
|
||||
}
|
||||
definition.sounds=mcl_sounds.node_sound_metal_defaults()
|
||||
definition._mcl_blast_resistance=1
|
||||
definition._mcl_hardness=1
|
||||
end
|
||||
minetest.register_node("industrialtest:mining_pipe",definition)
|
||||
|
||||
minetest.register_craft({
|
||||
type="shaped",
|
||||
output="industrialtest:mining_pipe 8",
|
||||
recipe={
|
||||
{"industrialtest:refined_iron_ingot","","industrialtest:refined_iron_ingot"},
|
||||
{"industrialtest:refined_iron_ingot","","industrialtest:refined_iron_ingot"},
|
||||
{"industrialtest:refined_iron_ingot",industrialtest.elementKeys.treetap,"industrialtest:refined_iron_ingot"}
|
||||
}
|
||||
})
|
||||
|
||||
industrialtest.Miner=table.copy(industrialtest.ElectricMachine)
|
||||
industrialtest.internal.unpackTableInto(industrialtest.Miner,{
|
||||
name="industrialtest:miner",
|
||||
description=S("Miner"),
|
||||
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_miner_front.png"
|
||||
},
|
||||
sounds="metal",
|
||||
storageLists={
|
||||
"drill",
|
||||
"src",
|
||||
"scanner",
|
||||
"dst",
|
||||
"powerStorage",
|
||||
"upgrades"
|
||||
},
|
||||
powerLists={
|
||||
{
|
||||
list="powerStorage",
|
||||
direction="i"
|
||||
}
|
||||
},
|
||||
requiresWrench=true,
|
||||
facedir=true,
|
||||
flow=industrialtest.api.lvPowerFlow,
|
||||
capacity=5000,
|
||||
ioConfig="iiiiii",
|
||||
hasPowerInput=true,
|
||||
_opPower=1000,
|
||||
_scannerOpPower=10
|
||||
})
|
||||
|
||||
function industrialtest.Miner.onConstruct(self,pos)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
inv:set_size("drill",1)
|
||||
inv:set_size("src",1)
|
||||
inv:set_size("scanner",1)
|
||||
inv:set_size("dst",15)
|
||||
inv:set_size("powerStorage",1)
|
||||
inv:set_size("upgrades",1)
|
||||
meta:set_int("level",pos.y-1)
|
||||
industrialtest.ElectricMachine.onConstruct(self,pos)
|
||||
end
|
||||
|
||||
function industrialtest.Miner.onDestruct(self,pos)
|
||||
destructMiningPipe(vector.new(pos.x,pos.y-1,pos.z),nil)
|
||||
industrialtest.ElectricMachine.onDestruct(self,pos)
|
||||
end
|
||||
|
||||
function industrialtest.Miner.onDig(self,pos,node,digger)
|
||||
destructMiningPipe(vector.new(pos.x,pos.y-1,pos.z),digger)
|
||||
return industrialtest.ElectricMachine.onDig(self,pos,node,digger)
|
||||
end
|
||||
|
||||
function industrialtest.Miner.getFormspec(self,pos)
|
||||
local parentFormspec=industrialtest.ElectricMachine.getFormspec(self,pos)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local powerPercent=meta:get_int("industrialtest.powerAmount")/meta:get_int("industrialtest.powerCapacity")*100
|
||||
local formspec={
|
||||
"label[0.7,1.2;"..S("Drill").."]",
|
||||
"list[context;drill;0.7,1.5;1,1]",
|
||||
industrialtest.internal.getItemSlotBg(0.7,1.5,1,1),
|
||||
"label[0.7,2.8;"..S("Pipe").."]",
|
||||
"list[context;src;0.7,3.1;1,1]",
|
||||
industrialtest.internal.getItemSlotBg(0.7,3.1,1,1),
|
||||
"label[0.7,4.4;"..S("Scanner").."]",
|
||||
"list[context;scanner;0.7,4.7;1,1]",
|
||||
industrialtest.internal.getItemSlotBg(0.7,4.7,1,1),
|
||||
"list[context;dst;2.28,1.9;5,3]",
|
||||
industrialtest.internal.getItemSlotBg(2.28,1.9,5,3),
|
||||
"list[context;upgrades;9.1,1.2;1,1]",
|
||||
industrialtest.internal.getItemSlotBg(9.1,1.2,1,1),
|
||||
(powerPercent>0 and "image[9.1,2.29;1,1;industrialtest_gui_electricity_bg.png^[lowpart:"..powerPercent..":industrialtest_gui_electricity_fg.png]"
|
||||
or "image[9.1,2.29;1,1;industrialtest_gui_electricity_bg.png]"),
|
||||
"list[context;powerStorage;9.1,3.5;1,1]",
|
||||
industrialtest.internal.getItemSlotBg(9.1,3.5,1,1),
|
||||
"listring[context;src]",
|
||||
"listring[context;dst]"
|
||||
}
|
||||
return parentFormspec..table.concat(formspec,"")
|
||||
end
|
||||
|
||||
function industrialtest.Miner.canUpdate(self,pos)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
local drillSlot=inv:get_stack("drill",1)
|
||||
local srcSlot=inv:get_stack("src",1)
|
||||
local level=meta:get_int("level")
|
||||
local requiredPower=self:getRequiredPower(pos)
|
||||
return meta:get_int("industrialtest.powerAmount")>=requiredPower and not drillSlot:is_empty() and not srcSlot:is_empty() and
|
||||
self:canContinue(pos,level)
|
||||
end
|
||||
|
||||
function industrialtest.Miner.allowMetadataInventoryMove(self,pos,fromList,fromIndex,toList,toIndex,count)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
local itemstack=inv:get_stack(fromList,fromIndex)
|
||||
if toList=="drill" then
|
||||
return self.allowDrillPut(itemstack) and count or 0
|
||||
end
|
||||
if toList=="src" then
|
||||
return itemstack:get_name()=="industrialtest:mining_pipe" and count or 0
|
||||
end
|
||||
if toList=="scanner" then
|
||||
return self.allowScannerPut(itemstack) and 1 or 0
|
||||
end
|
||||
if toList=="dst" then
|
||||
return 0
|
||||
end
|
||||
return industrialtest.ElectricMachine.allowMetadataInventoryMove(self,pos,fromList,fromIndex,toList,toIndex,count)
|
||||
end
|
||||
|
||||
function industrialtest.Miner.allowMetadataInventoryPut(self,pos,listname,index,itemstack,player)
|
||||
if listname=="drill" then
|
||||
return self.allowDrillPut(itemstack) and itemstack:get_count() or 0
|
||||
end
|
||||
if listname=="src" then
|
||||
return itemstack:get_name()=="industrialtest:mining_pipe" and itemstack:get_count() or 0
|
||||
end
|
||||
if listname=="scanner" then
|
||||
return self.allowScannerPut(itemstack) and 1 or 0
|
||||
end
|
||||
if listname=="dst" then
|
||||
return 0
|
||||
end
|
||||
return industrialtest.ElectricMachine.allowMetadataInventoryPut(self,pos,listname,index,itemstack,player)
|
||||
end
|
||||
|
||||
function industrialtest.Miner.onMetadataInventoryMove(self,pos,fromList,fromIndex,toList,toIndex,count)
|
||||
self:onInventoryPut(pos,toList)
|
||||
industrialtest.ElectricMachine.onMetadataInventoryMove(self,pos,fromList,fromIndex,toList,toIndex,count)
|
||||
end
|
||||
|
||||
function industrialtest.Miner.onMetadataInventoryPut(self,pos,listname,index,stack)
|
||||
self:onInventoryPut(pos,listname)
|
||||
industrialtest.ElectricMachine.onMetadataInventoryPut(self,pos,listname,index,stack)
|
||||
end
|
||||
|
||||
function industrialtest.Miner.onMetadataInventoryTake(self,pos,listname,index,stack)
|
||||
if listname=="dst" then
|
||||
self:triggerIfNeeded(pos)
|
||||
end
|
||||
end
|
||||
|
||||
function industrialtest.Miner.update(self,pos,elapsed,meta,inv)
|
||||
if not self:canUpdate(pos) then
|
||||
return false,false
|
||||
end
|
||||
|
||||
local level=meta:get_int("level")
|
||||
if not self:canContinue(pos,level) then
|
||||
return false,false
|
||||
end
|
||||
|
||||
local srcSlot=inv:get_stack("src",1)
|
||||
srcSlot:take_item(1)
|
||||
inv:set_stack("src",1,srcSlot)
|
||||
local targetPos=vector.new(pos.x,level,pos.z)
|
||||
local drop=self.getNodeDrop(targetPos)
|
||||
self.placeMiningPipe(pos,targetPos)
|
||||
inv:add_item("dst",drop)
|
||||
|
||||
local scannerSlot=inv:get_stack("scanner",1)
|
||||
if not scannerSlot:is_empty() then
|
||||
local def=scannerSlot:get_definition()
|
||||
if def and def._industrialtest_self then
|
||||
local filtered=def._industrialtest_self:filter(targetPos)
|
||||
for _,filteredPos in ipairs(filtered) do
|
||||
drop=self.getNodeDrop(filteredPos)
|
||||
if inv:room_for_item("dst",drop) then
|
||||
minetest.remove_node(filteredPos)
|
||||
inv:add_item("dst",drop)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local requiredPower=self:getRequiredPower(pos)
|
||||
meta:set_int("level",level-1)
|
||||
industrialtest.api.addPower(meta,-requiredPower)
|
||||
|
||||
return true,true
|
||||
end
|
||||
|
||||
function industrialtest.Miner.onInventoryPut(self,pos,listname)
|
||||
if listname=="drill" or listname=="src" then
|
||||
self:triggerIfNeeded(pos)
|
||||
end
|
||||
end
|
||||
|
||||
function industrialtest.Miner.allowDrillPut(itemstack)
|
||||
local def=itemstack:get_definition()
|
||||
return def and def.groups and def.groups._industrialtest_miningDrill
|
||||
end
|
||||
|
||||
function industrialtest.Miner.allowScannerPut(itemstack)
|
||||
local def=itemstack:get_definition()
|
||||
return def and def.groups and def.groups._industrialtest_scanner
|
||||
end
|
||||
|
||||
function industrialtest.Miner.canContinue(self,pos,level)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
local targetPos=vector.new(pos.x,level,pos.z)
|
||||
local targetNode=minetest.get_node(targetPos)
|
||||
if targetNode.name=="ignore" then
|
||||
minetest.load_area(targetPos)
|
||||
targetNode=minetest.get_node(targetPos)
|
||||
if targetNode.name=="ignore" then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
local def=minetest.registered_nodes[targetNode.name]
|
||||
local drop=self.getNodeDrop(vector.new(pos.x,level,pos.z))
|
||||
return not (def and def.groups and def.groups.unbreakable) and inv:room_for_item("dst",drop)
|
||||
end
|
||||
|
||||
function industrialtest.Miner.getRequiredPower(self,pos)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
local scannerSlot=inv:get_stack("scanner",1)
|
||||
local result=self._opPower
|
||||
if not scannerSlot:is_empty() then
|
||||
local def=scannerSlot:get_definition()
|
||||
if def and def._industrialtest_self then
|
||||
local distance=def._industrialtest_self.minerDistance or 0
|
||||
result=result+(distance*distance-1)*self._scannerOpPower
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
function industrialtest.Miner.getNodeDrop(pos)
|
||||
local node=minetest.get_node(pos)
|
||||
local def=minetest.registered_nodes[node.name]
|
||||
if not def.pointable then
|
||||
return ItemStack()
|
||||
end
|
||||
return ItemStack((def and def.drop and def.drop~="") and def.drop or node.name)
|
||||
end
|
||||
|
||||
function industrialtest.Miner.placeMiningPipe(minerPos,pos)
|
||||
minetest.add_node(pos,{
|
||||
name="industrialtest:mining_pipe"
|
||||
})
|
||||
local meta=minetest.get_meta(pos)
|
||||
meta:set_string("miner",minetest.serialize(minerPos))
|
||||
end
|
||||
|
||||
industrialtest.Miner:register()
|
||||
|
||||
minetest.register_craft({
|
||||
type="shaped",
|
||||
output="industrialtest:miner",
|
||||
recipe={
|
||||
{"",industrialtest.elementKeys.chest,""},
|
||||
{"industrialtest:electronic_circuit","industrialtest:machine_block","industrialtest:electronic_circuit"},
|
||||
{"","industrialtest:mining_pipe",""}
|
||||
}
|
||||
})
|
@ -29,7 +29,8 @@ industrialtest.internal.unpackTableInto(industrialtest.SolarPanelBase,{
|
||||
}
|
||||
},
|
||||
hasPowerOutput=true,
|
||||
ioConfig="oooooo"
|
||||
ioConfig="oooooo",
|
||||
multiplier=1
|
||||
})
|
||||
|
||||
local solarPanels={}
|
||||
@ -66,7 +67,7 @@ function industrialtest.SolarPanelBase.action(self,pos)
|
||||
local amount=minetest.get_natural_light(vector.offset(pos,0,1,0))/15.0
|
||||
local charging=amount>0.5
|
||||
if charging then
|
||||
if industrialtest.api.addPower(meta,math.ceil(amount*self.flow))>0 then
|
||||
if industrialtest.api.addPower(meta,math.ceil(amount*self.flow*self.multiplier))>0 then
|
||||
self:updateFormspec(pos)
|
||||
end
|
||||
self:trigger(pos)
|
||||
@ -118,7 +119,8 @@ industrialtest.internal.unpackTableInto(industrialtest.LVSolarArray,{
|
||||
"industrialtest_machine_block.png"
|
||||
},
|
||||
capacity=industrialtest.api.lvPowerFlow*4,
|
||||
flow=industrialtest.api.lvPowerFlow*2
|
||||
flow=industrialtest.api.lvPowerFlow,
|
||||
multiplier=1.5
|
||||
})
|
||||
|
||||
industrialtest.LVSolarArray:register()
|
||||
|
@ -1,5 +1,8 @@
|
||||
# This determines value how frequently machines update
|
||||
industrialtest.updateDelay (Update delay) float 1.0
|
||||
|
||||
# Whether electrocution by uninsulated cables is used
|
||||
industrialtest.electrocution (Electrocution) bool true
|
||||
|
||||
# Enables additional utils useful when developing mod
|
||||
industrialtest.developerMode (Developer mode) bool false
|
||||
|
@ -3,4 +3,4 @@
|
||||
- `industrialtest_gui_water.png` was taken from Minetest Game (by Cisoun licensed with CC BY-SA 3.0)
|
||||
- `industrialtest_gui_river_water.png` was taken from Minetest Game (by paramat licensed with CC BY-SA 3.0)
|
||||
|
||||
... rest was made either by LuanHawk, mrkubax10 or Migdyn and is licensed with CC BY 4.0 International
|
||||
... rest was made either by LuanHawk, mrkubax10, HandfulOfFrogs or Migdyn and is licensed with CC BY 4.0 International
|
||||
|
BIN
textures/industrialtest_miner_front.png
Normal file
BIN
textures/industrialtest_miner_front.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 663 B |
BIN
textures/industrialtest_mining_pipe.png
Normal file
BIN
textures/industrialtest_mining_pipe.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 686 B |
BIN
textures/industrialtest_od_scanner.png
Normal file
BIN
textures/industrialtest_od_scanner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 692 B |
BIN
textures/industrialtest_ov_scanner.png
Normal file
BIN
textures/industrialtest_ov_scanner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 704 B |
@ -23,6 +23,12 @@ industrialtest.internal.unpackTableInto(industrialtest.ElectricDrillBase,{
|
||||
}
|
||||
})
|
||||
|
||||
function industrialtest.ElectricDrillBase.createDefinitionTable(self)
|
||||
local def=industrialtest.ActivatedElectricTool.createDefinitionTable(self)
|
||||
def.groups._industrialtest_miningDrill=1
|
||||
return def
|
||||
end
|
||||
|
||||
function industrialtest.ElectricDrillBase.getOpPower(self,itemstack)
|
||||
return 50
|
||||
end
|
||||
|
152
tools/scanner.lua
Normal file
152
tools/scanner.lua
Normal file
@ -0,0 +1,152 @@
|
||||
-- IndustrialTest
|
||||
-- Copyright (C) 2025 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/>.
|
||||
|
||||
local S=minetest.get_translator("industrialtest")
|
||||
|
||||
industrialtest.Scanner=table.copy(industrialtest.ElectricTool)
|
||||
industrialtest.internal.unpackTableInto(industrialtest.Scanner,{
|
||||
define={onUse=true}
|
||||
})
|
||||
|
||||
function industrialtest.Scanner.createDefinitionTable(self)
|
||||
local def=industrialtest.ElectricTool.createDefinitionTable(self)
|
||||
def.groups._industrialtest_scanner=1
|
||||
return def
|
||||
end
|
||||
|
||||
-- Used by Miner to provide Scanner functionality there
|
||||
function industrialtest.Scanner.filter(self,pos)
|
||||
-- dummy function
|
||||
return {}
|
||||
end
|
||||
|
||||
industrialtest.OreScanner=table.copy(industrialtest.Scanner)
|
||||
|
||||
function industrialtest.OreScanner.hitUse(self,itemstack,user,pointed)
|
||||
if not user:is_player() then
|
||||
return false
|
||||
end
|
||||
|
||||
local positions=""
|
||||
local pos=user:get_pos()
|
||||
for x=pos.x-self.distance,pos.x+self.distance do
|
||||
for y=pos.y-self.distance,pos.y+self.distance do
|
||||
for z=pos.z-self.distance,pos.z+self.distance do
|
||||
local targetPos=vector.new(x,y,z)
|
||||
local node=minetest.get_node(targetPos)
|
||||
if self.isOre(node) then
|
||||
positions=positions..string.format("%d %d %d",x,y,z)
|
||||
positions=positions..","
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local formspec={
|
||||
"formspec_version[4]",
|
||||
"size[10.5,11]",
|
||||
"label[0.5,0.5;"..self.description.."]",
|
||||
"label[0.5,1.7;"..S("Found ores").."]",
|
||||
"textlist[0.5,1.9;9.5,8.6;pos;"..positions.."]"
|
||||
}
|
||||
local content=table.concat(formspec,"")
|
||||
minetest.show_formspec(user:get_player_name(),"industrialtest:scanner",content)
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function industrialtest.OreScanner.filter(self,pos)
|
||||
local result={}
|
||||
for x=pos.x-self.minerDistance,pos.x+self.minerDistance do
|
||||
for z=pos.z-self.minerDistance,pos.z+self.minerDistance do
|
||||
local nodePos=vector.new(x,pos.y,z)
|
||||
local node=minetest.get_node(nodePos)
|
||||
-- This is very hacky, but currently there is no other way of determining if node is ore
|
||||
if (x~=pos.x or z~=pos.z) and self.isOre(node) then
|
||||
table.insert(result,nodePos)
|
||||
end
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
function industrialtest.OreScanner.isOre(node)
|
||||
return string.find(node.name,":stone_with_")
|
||||
end
|
||||
|
||||
industrialtest.ODScanner=table.copy(industrialtest.OreScanner)
|
||||
industrialtest.internal.unpackTableInto(industrialtest.ODScanner,{
|
||||
name="industrialtest:od_scanner",
|
||||
description=S("OD Scanner"),
|
||||
inventoryImage="industrialtest_od_scanner.png",
|
||||
capacity=100000,
|
||||
flow=industrialtest.api.lvPowerFlow,
|
||||
distance=7,
|
||||
minerDistance=3
|
||||
})
|
||||
|
||||
function industrialtest.ODScanner.getOpPower(self,itemstack)
|
||||
return 700
|
||||
end
|
||||
|
||||
industrialtest.ODScanner:register()
|
||||
|
||||
minetest.register_craft({
|
||||
type="shaped",
|
||||
output="industrialtest:od_scanner",
|
||||
recipe={
|
||||
{"",industrialtest.elementKeys.yellowDust,""},
|
||||
{"industrialtest:electronic_circuit","industrialtest:re_battery","industrialtest:electronic_circuit"},
|
||||
{"industrialtest:insulated_copper_cable","industrialtest:insulated_copper_cable","industrialtest:insulated_copper_cable"}
|
||||
}
|
||||
})
|
||||
|
||||
industrialtest.OVScanner=table.copy(industrialtest.OreScanner)
|
||||
industrialtest.internal.unpackTableInto(industrialtest.OVScanner,{
|
||||
name="industrialtest:ov_scanner",
|
||||
description=S("OV Scanner"),
|
||||
inventoryImage="industrialtest_ov_scanner.png",
|
||||
capacity=1000000,
|
||||
flow=industrialtest.api.mvPowerFlow,
|
||||
distance=11,
|
||||
minerDistance=5
|
||||
})
|
||||
|
||||
function industrialtest.OVScanner.getOpPower(self,itemstack)
|
||||
return 7000
|
||||
end
|
||||
|
||||
industrialtest.OVScanner:register()
|
||||
|
||||
minetest.register_craft({
|
||||
type="shaped",
|
||||
output="industrialtest:ov_scanner",
|
||||
recipe={
|
||||
{"",industrialtest.elementKeys.yellowDust,""},
|
||||
{industrialtest.elementKeys.yellowDust,"industrialtest:electronic_circuit",industrialtest.elementKeys.yellowDust},
|
||||
{"industrialtest:insulated_gold_cable","industrialtest:od_scanner","industrialtest:insulated_gold_cable"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type="shaped",
|
||||
output="industrialtest:ov_scanner",
|
||||
recipe={
|
||||
{"",industrialtest.elementKeys.yellowDust,""},
|
||||
{industrialtest.elementKeys.yellowDust,"industrialtest:electronic_circuit",industrialtest.elementKeys.yellowDust},
|
||||
{"industrialtest:insulated_gold_cable","industrialtest:re_battery","industrialtest:insulated_gold_cable"}
|
||||
}
|
||||
})
|
@ -124,7 +124,7 @@ minetest.register_craft({
|
||||
if industrialtest.mclAvailable then
|
||||
minetest.register_craft({
|
||||
type="shaped",
|
||||
output="mcl_core:vine 24"
|
||||
output="mcl_core:vine 24",
|
||||
recipe={
|
||||
{"industrialtest:uu_matter","",""},
|
||||
{"industrialtest:uu_matter","",""},
|
||||
|
Loading…
x
Reference in New Issue
Block a user