summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--concrete/init.lua239
-rw-r--r--concrete/textures/technic_blast_resistant_concrete_block.pngbin0 -> 311 bytes
-rw-r--r--item_drop/item_entity.lua2
-rw-r--r--stargate/gate_defs.lua14
-rw-r--r--stargate/stargate_gui.lua2
-rw-r--r--technic/init.lua2
-rw-r--r--technic/items.lua60
-rw-r--r--technic/machines/battery_boxes_commons.lua80
-rw-r--r--technic/machines/hv/battery_box.lua308
-rw-r--r--technic/machines/hv/nuclear_reactor.lua416
-rw-r--r--technic/machines/hv/wires.lua2
-rw-r--r--technic/machines/init.lua1
-rw-r--r--technic/machines/lv/battery_box.lua103
-rw-r--r--technic/machines/lv/compressor.lua207
-rw-r--r--technic/machines/lv/init.lua2
-rw-r--r--technic/machines/mv/alloy_furnace.lua9
-rw-r--r--technic/machines/mv/battery_box.lua109
-rw-r--r--technic/machines/mv/electric_furnace.lua13
-rw-r--r--technic/machines/mv/grinder.lua293
-rw-r--r--technic/machines/mv/init.lua1
-rw-r--r--technic/machines/other/deployer.lua113
-rw-r--r--technic/machines/other/init.lua2
-rw-r--r--technic/machines/other/node_breaker.lua89
-rw-r--r--technic/register_machine_and_tool.lua21
-rw-r--r--technic/textures/technic_carbon_cloth.pngbin0 -> 169 bytes
-rw-r--r--technic/textures/technic_carbon_plate.pngbin0 -> 162 bytes
-rw-r--r--technic/textures/technic_composite_plate.pngbin0 -> 165 bytes
-rw-r--r--technic/textures/technic_compressor_back.pngbin0 -> 2893 bytes
-rw-r--r--technic/textures/technic_compressor_bottom.pngbin0 -> 2865 bytes
-rw-r--r--technic/textures/technic_compressor_front.pngbin0 -> 2714 bytes
-rw-r--r--technic/textures/technic_compressor_front_active.pngbin0 -> 2743 bytes
-rw-r--r--technic/textures/technic_compressor_side.pngbin0 -> 2893 bytes
-rw-r--r--technic/textures/technic_compressor_top.pngbin0 -> 2940 bytes
-rw-r--r--technic/textures/technic_copper_plate.pngbin0 -> 174 bytes
-rw-r--r--technic/textures/technic_graphite.pngbin0 -> 140 bytes
-rw-r--r--technic/textures/technic_mixed_metal_ingot.pngbin0 -> 407 bytes
-rw-r--r--technic/tools/chainsaw.lua2
-rw-r--r--technic/tools/flashlight.lua2
-rw-r--r--technic/tools/mining_drill.lua10
-rw-r--r--technic/tools/mining_laser_mk1.lua2
-rw-r--r--technic/tools/sonic_screwdriver.lua2
-rw-r--r--technic_chests/chest_commons.lua11
-rw-r--r--unified_inventory/api.lua14
-rw-r--r--unified_inventory/depends.txt1
-rw-r--r--unified_inventory/textures/ui_hv_battery_box.pngbin0 -> 15941 bytes
-rw-r--r--unified_inventory/textures/ui_mv_battery_box.pngbin0 -> 15941 bytes
46 files changed, 1191 insertions, 941 deletions
diff --git a/concrete/init.lua b/concrete/init.lua
index 12deb74..bf25c32 100644
--- a/concrete/init.lua
+++ b/concrete/init.lua
@@ -1,8 +1,8 @@
---Minetest 0.4.6 mod: concrete
+--Minetest 0.4.7 mod: concrete
--(c) 2013 by RealBadAngel <mk@realbadangel.pl>
minetest.register_craft({
- output = ':technic:rebar 6',
+ output = 'technic:rebar 6',
recipe = {
{'','', 'default:steel_ingot'},
{'','default:steel_ingot',''},
@@ -11,7 +11,7 @@ minetest.register_craft({
})
minetest.register_craft({
- output = ':technic:concrete 5',
+ output = 'technic:concrete 5',
recipe = {
{'default:stone','technic:rebar','default:stone'},
{'technic:rebar','default:stone','technic:rebar'},
@@ -20,14 +20,14 @@ minetest.register_craft({
})
minetest.register_craft({
- output = ':technic:concrete_post_platform 6',
+ output = 'technic:concrete_post_platform 6',
recipe = {
{'technic:concrete','technic:concrete_post','technic:concrete'},
}
})
minetest.register_craft({
- output = ':technic:concrete_post 12',
+ output = 'technic:concrete_post 12',
recipe = {
{'default:stone','technic:rebar','default:stone'},
{'default:stone','technic:rebar','default:stone'},
@@ -35,6 +35,15 @@ minetest.register_craft({
}
})
+minetest.register_craft({
+ output = 'technic:blast_resistant_concrete 5',
+ recipe = {
+ {'technic:concrete','technic:composite_plate','technic:concrete'},
+ {'technic:composite_plate','technic:concrete','technic:composite_plate'},
+ {'technic:concrete','technic:composite_plate','technic:concrete'},
+ }
+})
+
platform_box = {-0.5 , 0.3 , -0.5 , 0.5 , 0.5 , 0.5 }
post_str_y={ -0.15 , -0.5 , -0.15 , 0.15 , 0.5 , 0.15 }
post_str_x1={ 0 , -0.3 , -0.1, 0.5 , 0.3 , 0.1 } -- x+
@@ -48,6 +57,12 @@ minetest.register_craftitem(":technic:rebar", {
stack_max = 99,
})
+minetest.register_craftitem(":technic:blast_resistant_concrete", {
+ description = "Blast-resistant Concrete Block",
+ inventory_image = "technic_blast_resistant_concrete_block.png",
+ stack_max = 99,
+})
+
minetest.register_craftitem(":technic:concrete", {
description = "Concrete Block",
inventory_image = "technic_concrete_block.png",
@@ -83,6 +98,25 @@ minetest.register_node(":technic:concrete", {
end,
})
+minetest.register_node(":technic:blast_resistant_concrete", {
+ description = "Blast-resistant Concrete Block",
+ tile_images = {"technic_blast_resistant_concrete_block.png",},
+ is_ground_content = true,
+ groups={cracky=1,level=3},
+ sounds = default.node_sound_stone_defaults(),
+ paramtype = "light",
+ light_source = 0,
+ sunlight_propagates = true,
+ on_construct = function(pos)
+ meta=minetest.env:get_meta(pos)
+ meta:set_float("postlike",1)
+ check_post_connections (pos,1)
+ end,
+ after_dig_node = function (pos, oldnode, oldmetadata, digger)
+ check_post_connections (pos,0)
+ end,
+})
+
minetest.register_node(":technic:concrete_post_platform", {
description = "Concrete Post Platform",
tile_images = {"technic_concrete_block.png",},
@@ -165,16 +199,16 @@ local x1,x2,y1,z1,z2
local count=0
for x1 = 0, 1, 1 do --x-
-for x2 = 0, 1, 1 do --x+
-for z1 = 0, 1, 1 do --z-
-for z2 = 0, 1, 1 do --z+
+ for x2 = 0, 1, 1 do --x+
+ for z1 = 0, 1, 1 do --z-
+ for z2 = 0, 1, 1 do --z+
-temp_x1={} temp_x2={} temp_z1={} temp_z2={}
+ temp_x1={} temp_x2={} temp_z1={} temp_z2={}
-if x1==1 then temp_x1=post_str_x1 end
-if x2==1 then temp_x2=post_str_x2 end
-if z1==1 then temp_z1=post_str_z1 end
-if z2==1 then temp_z2=post_str_z2 end
+ if x1==1 then temp_x1=post_str_x1 end
+ if x2==1 then temp_x2=post_str_x2 end
+ if z1==1 then temp_z1=post_str_z1 end
+ if z2==1 then temp_z2=post_str_z2 end
minetest.register_node(":technic:concrete_post"..count, {
@@ -280,7 +314,7 @@ minetest.register_node(":technic:concrete_post33", {
}},
after_dig_node = function (pos, oldnode, oldmetadata, digger)
- check_post_connections (pos,0)
+ check_post_connections (pos,0)
end,
})
@@ -344,7 +378,7 @@ dig_post_with_platform = function (pos,oldnode,oldmetadata)
print(dump(x1))
oldmetadata.fields["platform"]="0"
local rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,0)
- print(dump(rule))
+ --print(dump(rule))
oldnode.name="technic:concrete_post"..rule
minetest.env:set_node(pos,oldnode)
meta = minetest.env:get_meta(pos)
@@ -365,103 +399,104 @@ check_post_connections = function(pos,mode)
pos1.x=pos1.x+1
if minetest.env:get_meta(pos1):get_int("postlike")==1 then
- x2=mode
- x1=minetest.env:get_meta(pos1):get_int("x1")
- y1=minetest.env:get_meta(pos1):get_int("y1")
- y2=minetest.env:get_meta(pos1):get_int("y2")
- z1=minetest.env:get_meta(pos1):get_int("z1")
- z2=minetest.env:get_meta(pos1):get_int("z2")
- platform=minetest.env:get_meta(pos1):get_int("platform")
- rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
- hacky_swap_posts(pos1,"technic:concrete_post"..rule)
- meta=minetest.env:get_meta(pos1)
- meta:set_int("x2",x2)
- tempx1=mode
+ x2=mode
+ x1=minetest.env:get_meta(pos1):get_int("x1")
+ y1=minetest.env:get_meta(pos1):get_int("y1")
+ y2=minetest.env:get_meta(pos1):get_int("y2")
+ z1=minetest.env:get_meta(pos1):get_int("z1")
+ z2=minetest.env:get_meta(pos1):get_int("z2")
+ platform=minetest.env:get_meta(pos1):get_int("platform")
+ rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
+ hacky_swap_posts(pos1,"technic:concrete_post"..rule)
+ meta=minetest.env:get_meta(pos1)
+ meta:set_int("x2",x2)
+ tempx1=mode
end
pos1.x=pos1.x-2
if minetest.env:get_meta(pos1):get_int("postlike")==1 then
- x1=mode
- x2=minetest.env:get_meta(pos1):get_int("x2")
- y1=minetest.env:get_meta(pos1):get_int("y1")
- y2=minetest.env:get_meta(pos1):get_int("y2")
- z1=minetest.env:get_meta(pos1):get_int("z1")
- z2=minetest.env:get_meta(pos1):get_int("z2")
- platform=minetest.env:get_meta(pos1):get_int("platform")
- rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
- hacky_swap_posts(pos1,"technic:concrete_post"..rule)
- meta=minetest.env:get_meta(pos1)
- meta:set_int("x1",x1)
- tempx2=mode
+ x1=mode
+ x2=minetest.env:get_meta(pos1):get_int("x2")
+ y1=minetest.env:get_meta(pos1):get_int("y1")
+ y2=minetest.env:get_meta(pos1):get_int("y2")
+ z1=minetest.env:get_meta(pos1):get_int("z1")
+ z2=minetest.env:get_meta(pos1):get_int("z2")
+ platform=minetest.env:get_meta(pos1):get_int("platform")
+ rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
+ hacky_swap_posts(pos1,"technic:concrete_post"..rule)
+ meta=minetest.env:get_meta(pos1)
+ meta:set_int("x1",x1)
+ tempx2=mode
end
pos1.x=pos1.x+1
pos1.y=pos1.y+1
if minetest.env:get_meta(pos1):get_int("postlike")==1 then
- y2=mode
- x1=minetest.env:get_meta(pos1):get_int("x1")
- x2=minetest.env:get_meta(pos1):get_int("x2")
- y1=minetest.env:get_meta(pos1):get_int("y1")
- z1=minetest.env:get_meta(pos1):get_int("z1")
- z2=minetest.env:get_meta(pos1):get_int("z2")
- platform=minetest.env:get_meta(pos1):get_int("platform")
- rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
- hacky_swap_posts(pos1,"technic:concrete_post"..rule)
- meta=minetest.env:get_meta(pos1)
- meta:set_int("y2",y2)
- tempy1=mode
+ y2=mode
+ x1=minetest.env:get_meta(pos1):get_int("x1")
+ x2=minetest.env:get_meta(pos1):get_int("x2")
+ y1=minetest.env:get_meta(pos1):get_int("y1")
+ z1=minetest.env:get_meta(pos1):get_int("z1")
+ z2=minetest.env:get_meta(pos1):get_int("z2")
+ platform=minetest.env:get_meta(pos1):get_int("platform")
+ rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
+ hacky_swap_posts(pos1,"technic:concrete_post"..rule)
+ meta=minetest.env:get_meta(pos1)
+ meta:set_int("y2",y2)
+ tempy1=mode
end
pos1.y=pos1.y-2
if minetest.env:get_meta(pos1):get_int("postlike")==1 then
- y1=mode
- x1=minetest.env:get_meta(pos1):get_int("x1")
- x2=minetest.env:get_meta(pos1):get_int("x2")
- y2=minetest.env:get_meta(pos1):get_int("y2")
- z1=minetest.env:get_meta(pos1):get_int("z1")
- z2=minetest.env:get_meta(pos1):get_int("z2")
- platform=minetest.env:get_meta(pos1):get_int("platform")
- rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
- hacky_swap_posts(pos1,"technic:concrete_post"..rule)
- meta=minetest.env:get_meta(pos1)
- meta:set_int("y1",y1)
- tempy2=mode
+ y1=mode
+ x1=minetest.env:get_meta(pos1):get_int("x1")
+ x2=minetest.env:get_meta(pos1):get_int("x2")
+ y2=minetest.env:get_meta(pos1):get_int("y2")
+ z1=minetest.env:get_meta(pos1):get_int("z1")
+ z2=minetest.env:get_meta(pos1):get_int("z2")
+ platform=minetest.env:get_meta(pos1):get_int("platform")
+ rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
+ hacky_swap_posts(pos1,"technic:concrete_post"..rule)
+ meta=minetest.env:get_meta(pos1)
+ meta:set_int("y1",y1)
+ tempy2=mode
end
pos1.y=pos1.y+1
pos1.z=pos1.z+1
if minetest.env:get_meta(pos1):get_int("postlike")==1 then
- z2=mode
- x1=minetest.env:get_meta(pos1):get_int("x1")
- x2=minetest.env:get_meta(pos1):get_int("x2")
- y1=minetest.env:get_meta(pos1):get_int("y1")
- y2=minetest.env:get_meta(pos1):get_int("y2")
- z1=minetest.env:get_meta(pos1):get_int("z1")
- platform=minetest.env:get_meta(pos1):get_int("platform")
- rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
- hacky_swap_posts(pos1,"technic:concrete_post"..rule)
- meta=minetest.env:get_meta(pos1)
- meta:set_int("z2",z2)
- tempz1=mode
+ z2=mode
+ x1=minetest.env:get_meta(pos1):get_int("x1")
+ x2=minetest.env:get_meta(pos1):get_int("x2")
+ y1=minetest.env:get_meta(pos1):get_int("y1")
+ y2=minetest.env:get_meta(pos1):get_int("y2")
+ z1=minetest.env:get_meta(pos1):get_int("z1")
+ platform=minetest.env:get_meta(pos1):get_int("platform")
+ rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
+ hacky_swap_posts(pos1,"technic:concrete_post"..rule)
+ meta=minetest.env:get_meta(pos1)
+ meta:set_int("z2",z2)
+ tempz1=mode
end
pos1.z=pos1.z-2
if minetest.env:get_meta(pos1):get_int("postlike")==1 then
- z1=mode
- x1=minetest.env:get_meta(pos1):get_int("x1")
- x2=minetest.env:get_meta(pos1):get_int("x2")
- y1=minetest.env:get_meta(pos1):get_int("y1")
- y2=minetest.env:get_meta(pos1):get_int("y2")
- z2=minetest.env:get_meta(pos1):get_int("z2")
- platform=minetest.env:get_meta(pos1):get_int("platform")
- rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
- hacky_swap_posts(pos1,"technic:concrete_post"..rule)
- meta=minetest.env:get_meta(pos1)
- meta:set_int("z1",z1)
- tempz2=mode
+ z1=mode
+ x1=minetest.env:get_meta(pos1):get_int("x1")
+ x2=minetest.env:get_meta(pos1):get_int("x2")
+ y1=minetest.env:get_meta(pos1):get_int("y1")
+ y2=minetest.env:get_meta(pos1):get_int("y2")
+ z2=minetest.env:get_meta(pos1):get_int("z2")
+ platform=minetest.env:get_meta(pos1):get_int("platform")
+ rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
+ hacky_swap_posts(pos1,"technic:concrete_post"..rule)
+ meta=minetest.env:get_meta(pos1)
+ meta:set_int("z1",z1)
+ tempz2=mode
end
pos1.z=pos1.z+1
+
if mode==1 then
meta=minetest.env:get_meta(pos)
meta:set_int("x1",tempx1)
@@ -476,25 +511,25 @@ check_post_connections = function(pos,mode)
end
function make_post_rule_number (x1,x2,y1,y2,z1,z2,platform)
-local tempy=y1+y2
-local tempx=x1+x2
-local tempz=z1+z2
-if platform==0 then
- if tempy==0 and tempx==0 and tempz==0 then return 0 end
- if x1==1 and x2==1 and tempz==0 and tempy==0 then return 32 end
- if z1==1 and z2==1 and tempx==0 and tempy==0 then return 33 end
- return z2+z1*2+x2*4+x1*8
-else
- if tempy==0 and tempx==0 and tempz==0 then return 16 end
- if x1==1 and x2==1 and tempz==0 and tempy==0 then return 34 end
- if z1==1 and z2==1 and tempx==0 and tempy==0 then return 35 end
- return z2+z1*2+x2*4+x1*8+16
-end
+ local tempy=y1+y2
+ local tempx=x1+x2
+ local tempz=z1+z2
+ if platform==0 then
+ if tempy==0 and tempx==0 and tempz==0 then return 0 end
+ if x1==1 and x2==1 and tempz==0 and tempy==0 then return 32 end
+ if z1==1 and z2==1 and tempx==0 and tempy==0 then return 33 end
+ return z2+z1*2+x2*4+x1*8
+ else
+ if tempy==0 and tempx==0 and tempz==0 then return 16 end
+ if x1==1 and x2==1 and tempz==0 and tempy==0 then return 34 end
+ if z1==1 and z2==1 and tempx==0 and tempy==0 then return 35 end
+ return z2+z1*2+x2*4+x1*8+16
+ end
end
function hacky_swap_posts(pos,name)
local node = minetest.env:get_node(pos)
- if node.name == "technic:concrete" then
+ if node.name == "technic:concrete" or node.name == "technic:blast_resistant_concrete" then
return nil
end
local meta = minetest.env:get_meta(pos)
diff --git a/concrete/textures/technic_blast_resistant_concrete_block.png b/concrete/textures/technic_blast_resistant_concrete_block.png
new file mode 100644
index 0000000..b7d8588
--- /dev/null
+++ b/concrete/textures/technic_blast_resistant_concrete_block.png
Binary files differ
diff --git a/item_drop/item_entity.lua b/item_drop/item_entity.lua
index 5da8285..fb0527f 100644
--- a/item_drop/item_entity.lua
+++ b/item_drop/item_entity.lua
@@ -88,7 +88,7 @@ minetest.register_entity(":__builtin:item", {
end,
on_step = function(self, dtime)
- local time = minetest.setting_get("remove_items")
+ local time = tonumber(minetest.setting_get("remove_items"))
if not time then
time = 300
end
diff --git a/stargate/gate_defs.lua b/stargate/gate_defs.lua
index caca8ca..8c3fa91 100644
--- a/stargate/gate_defs.lua
+++ b/stargate/gate_defs.lua
@@ -500,16 +500,22 @@ minetest.register_abm({
end
if player_name~=owner and gate["type"]=="private" then return end
local dir1=gate["destination_dir"]
+ local dest_angle
if dir1 == 0 then
- pos1.z=pos1.z+2
+ pos1.z = pos1.z-2
+ dest_angle = 180
elseif dir1 == 1 then
- pos1.x=pos1.x+2
+ pos1.x = pos1.x-2
+ dest_angle = 90
elseif dir1 == 2 then
- pos1.z=pos1.z-2
+ pos1.z=pos1.z+2
+ dest_angle = 0
elseif dir1 == 3 then
- pos1.x=pos1.x-2
+ pos1.x = pos1.x+2
+ dest_angle = -90
end
object:moveto(pos1,false)
+ object:set_look_yaw(math.rad(dest_angle))
minetest.sound_play("enterEventHorizon", {pos = pos, gain = 1.0,loop = false, max_hear_distance = 72,})
end
end
diff --git a/stargate/stargate_gui.lua b/stargate/stargate_gui.lua
index 9046e53..f96d48a 100644
--- a/stargate/stargate_gui.lua
+++ b/stargate/stargate_gui.lua
@@ -181,7 +181,7 @@ stargate.get_formspec = function(player_name,page)
local temp_gate=stargate_network["players"][player_name]["temp_gate"]
local formspec = "size[14,10]"
--background
- formspec = formspec .."background[-0.19,-0.2,;14.38,10.55;ui_form_bg.png]"
+ formspec = formspec .."background[-0.19,-0.2;14.38,10.55;ui_form_bg.png]"
formspec = formspec.."label[0,0.0;Stargate DHD]"
formspec = formspec.."label[0,.5;Position: ("..temp_gate["pos"].x..","..temp_gate["pos"].y..","..temp_gate["pos"].z..")]"
formspec = formspec.."image_button[3.5,.6;.6,.6;toggle_icon.png;toggle_type;]"
diff --git a/technic/init.lua b/technic/init.lua
index 3068885..da67c07 100644
--- a/technic/init.lua
+++ b/technic/init.lua
@@ -1,4 +1,4 @@
--- Minetest 0.4.6 mod: technic
+-- Minetest 0.4.7 mod: technic
-- namespace: technic
-- (c) 2012-2013 by RealBadAngel <mk@realbadangel.pl>
diff --git a/technic/items.lua b/technic/items.lua
index 8d952c6..a05a6c6 100644
--- a/technic/items.lua
+++ b/technic/items.lua
@@ -55,6 +55,13 @@ minetest.register_craft({
})
minetest.register_craft({
+ output = 'pipeworks:mese_sand_tube_000000',
+ recipe = {
+ {'default:mese_crystal_fragment', 'pipeworks:sand_tube_000000', 'default:mese_crystal_fragment'},
+ }
+})
+
+minetest.register_craft({
output = 'pipeworks:teleport_tube_000000',
recipe = {
{'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'},
@@ -240,3 +247,56 @@ minetest.register_craft({
{'', 'default:copper_ingot', ''},
}
})
+
+minetest.register_craftitem("technic:mixed_metal_ingot", {
+ description = "Mixed Metal Ingot",
+ inventory_image = "technic_mixed_metal_ingot.png",
+ on_place_on_ground = minetest.craftitem_place_item,
+})
+
+minetest.register_craft({
+ output = 'technic:mixed_metal_ingot 2',
+ recipe = {
+ {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'},
+ {'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'},
+ {'moreores:tin_ingot', 'moreores:tin_ingot', 'moreores:tin_ingot'},
+ }
+})
+
+minetest.register_craftitem("technic:composite_plate", {
+ description = "Composite Plate",
+ inventory_image = "technic_composite_plate.png",
+ on_place_on_ground = minetest.craftitem_place_item,
+})
+
+minetest.register_craftitem("technic:copper_plate", {
+ description = "Copper Plate",
+ inventory_image = "technic_copper_plate.png",
+ on_place_on_ground = minetest.craftitem_place_item,
+})
+
+minetest.register_craftitem("technic:carbon_plate", {
+ description = "Carbon Plate",
+ inventory_image = "technic_carbon_plate.png",
+ on_place_on_ground = minetest.craftitem_place_item,
+})
+
+minetest.register_craftitem("technic:graphite", {
+ description = "Graphite",
+ inventory_image = "technic_graphite.png",
+ on_place_on_ground = minetest.craftitem_place_item,
+})
+
+minetest.register_craftitem("technic:carbon_cloth", {
+ description = "Carbon Cloth",
+ inventory_image = "technic_carbon_cloth.png",
+ on_place_on_ground = minetest.craftitem_place_item,
+})
+
+minetest.register_craft({
+ output = 'technic:carbon_cloth',
+ recipe = {
+ {'technic:graphite', 'technic:graphite', 'technic:graphite'}
+ }
+})
+
diff --git a/technic/machines/battery_boxes_commons.lua b/technic/machines/battery_boxes_commons.lua
new file mode 100644
index 0000000..441b39b
--- /dev/null
+++ b/technic/machines/battery_boxes_commons.lua
@@ -0,0 +1,80 @@
+charge_tools = function(meta, charge, step)
+ --charge registered power tools
+ local inv = meta:get_inventory()
+ if inv:is_empty("src")==false then
+ local srcstack = inv:get_stack("src", 1)
+ local src_item=srcstack:to_table()
+ local src_meta=get_item_meta(src_item["metadata"])
+
+ local toolname = src_item["name"]
+ if technic.power_tools[toolname] ~= nil then
+ -- Set meta data for the tool if it didn't do it itself :-(
+ src_meta=get_item_meta(src_item["metadata"])
+ if src_meta==nil then
+ src_meta={}
+ src_meta["technic_power_tool"]=true
+ src_meta["charge"]=0
+ else
+ if src_meta["technic_power_tool"]==nil then
+ src_meta["technic_power_tool"]=true
+ src_meta["charge"]=0
+ end
+ end
+ -- Do the charging
+ local item_max_charge = technic.power_tools[toolname]
+ local load = src_meta["charge"]
+ local load_step = step -- how much to charge per tick
+ if load<item_max_charge and charge>0 then
+ if charge-load_step<0 then load_step=charge end
+ if load+load_step>item_max_charge then load_step=item_max_charge-load end
+ load=load+load_step
+ charge=charge-load_step
+ technic.set_RE_wear(src_item,load,item_max_charge)
+ src_meta["charge"] = load
+ src_item["metadata"] = set_item_meta(src_meta)
+ inv:set_stack("src", 1, src_item)
+ end
+ end
+ end
+ return charge -- return the remaining charge in the battery
+end
+
+discharge_tools = function(meta, charge, max_charge, step)
+ -- discharging registered power tools
+ local inv = meta:get_inventory()
+ if inv:is_empty("dst") == false then
+ srcstack = inv:get_stack("dst", 1)
+ src_item=srcstack:to_table()
+ local src_meta=get_item_meta(src_item["metadata"])
+ local toolname = src_item["name"]
+ if technic.power_tools[toolname] ~= nil then
+ -- Set meta data for the tool if it didn't do it itself :-(
+ src_meta=get_item_meta(src_item["metadata"])
+ if src_meta==nil then
+ src_meta={}
+ src_meta["technic_power_tool"]=true
+ src_meta["charge"]=0
+ else
+ if src_meta["technic_power_tool"]==nil then
+ src_meta["technic_power_tool"]=true
+ src_meta["charge"]=0
+ end
+ end
+ -- Do the discharging
+ local item_max_charge = technic.power_tools[toolname]
+ local load = src_meta["charge"]
+ local load_step = step -- how much to discharge per tick
+ if load>0 and charge<max_charge then
+ if charge+load_step>max_charge then load_step=max_charge-charge end
+ if load-load_step<0 then load_step=load end
+ load=load-load_step
+ charge=charge+load_step
+ technic.set_RE_wear(src_item,load,item_max_charge)
+ src_meta["charge"]=load
+ src_item["metadata"]=set_item_meta(src_meta)
+ inv:set_stack("dst", 1, src_item)
+ end
+ end
+ end
+ return charge -- return the remaining charge in the battery
+end
diff --git a/technic/machines/hv/battery_box.lua b/technic/machines/hv/battery_box.lua
index 979dc13..34e41fc 100644
--- a/technic/machines/hv/battery_box.lua
+++ b/technic/machines/hv/battery_box.lua
@@ -1,192 +1,115 @@
+
+local max_charge = 1500000
+local max_charge_rate = 3000
+local max_discharge_rate = 5000
+
-- HV battery box
-minetest.register_craft(
- {output = 'technic:hv_battery_box 1',
- recipe = {
- {'technic:mv_battery_box', 'technic:mv_battery_box', 'technic:mv_battery_box'},
- {'technic:mv_battery_box', 'technic:hv_transformer', 'technic:mv_battery_box'},
- {'', 'technic:hv_cable', ''},
- }
- })
+minetest.register_craft({
+ output = 'technic:hv_battery_box 1',
+ recipe = {
+ {'technic:mv_battery_box', 'technic:mv_battery_box', 'technic:mv_battery_box'},
+ {'technic:mv_battery_box', 'technic:hv_transformer', 'technic:mv_battery_box'},
+ {'', 'technic:hv_cable', ''},
+ }
+})
local battery_box_formspec =
- "invsize[8,9;]"..
- "image[1,1;1,2;technic_power_meter_bg.png]"..
- "list[current_name;src;3,1;1,1;]"..
- "image[4,1;1,1;technic_battery_reload.png]"..
- "list[current_name;dst;5,1;1,1;]"..
- "label[0,0;HV Battery Box]"..
- "label[3,0;Charge]"..
- "label[5,0;Discharge]"..
- "label[1,3;Power level]"..
- "list[current_player;main;0,5;8,4;]"
-
-minetest.register_node(
- "technic:hv_battery_box", {
- description = "HV Battery Box",
- tiles = {"technic_hv_battery_box_top.png", "technic_hv_battery_box_bottom.png", "technic_hv_battery_box_side0.png",
- "technic_hv_battery_box_side0.png", "technic_hv_battery_box_side0.png", "technic_hv_battery_box_side0.png"},
- groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
- sounds = default.node_sound_wood_defaults(),
- drop="technic:hv_battery_box",
- on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ "invsize[8,9;]"..
+ "image[1,1;1,2;technic_power_meter_bg.png]"..
+ "list[current_name;src;3,1;1,1;]"..
+ "list[current_name;dst;5,1;1,1;]"..
+ "label[0,0;HV Battery Box]"..
+ "label[3,0;Charge]"..
+ "label[5,0;Discharge]"..
+ "label[1,3;Power level]"..
+ "list[current_player;main;0,5;8,4;]"..
+ "background[-0.19,-0.25;8.4,9.75;ui_form_bg.png]"..
+ "background[0,0;8,4;ui_hv_battery_box.png]"..
+ "background[0,5;8,4;ui_main_inventory.png]"
+
+minetest.register_node("technic:hv_battery_box", {
+ description = "HV Battery Box",
+ tiles = {"technic_hv_battery_box_top.png", "technic_hv_battery_box_bottom.png",
+ "technic_hv_battery_box_side0.png", "technic_hv_battery_box_side0.png",
+ "technic_hv_battery_box_side0.png", "technic_hv_battery_box_side0.png"},
+ groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2},
+ sounds = default.node_sound_wood_defaults(),
+ drop = "technic:hv_battery_box",
+ on_construct = function(pos)
+ local meta = minetest.env:get_meta(pos)
+ local inv = meta:get_inventory()
+ meta:set_string("infotext", "HV Battery Box")
+ meta:set_float("technic_hv_power_machine", 1)
+ meta:set_string("formspec", battery_box_formspec)
+ meta:set_int("HV_EU_demand", 0) -- How much this node can charge
+ meta:set_int("HV_EU_supply", 0) -- How much this node can discharge
+ meta:set_int("HV_EU_input", 0) -- How much power this machine is getting.
+ meta:set_float("internal_EU_charge", 0)
+ inv:set_size("src", 1)
+ inv:set_size("dst", 1)
+ end,
+ can_dig = function(pos,player)
+ local meta = minetest.env:get_meta(pos);
+ local inv = meta:get_inventory()
+ if not inv:is_empty("src") or not inv:is_empty("dst") then
+ minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
+ return false
+ else
+ return true
+ end
+ end,
+})
+
+for i = 1,8,1 do
+ minetest.register_node("technic:hv_battery_box"..i, {
+ description = "HV Battery Box",
+ tiles = {"technic_hv_battery_box_top.png", "technic_hv_battery_box_bottom.png",
+ "technic_hv_battery_box_side0.png^technic_power_meter"..i..".png",
+ "technic_hv_battery_box_side0.png^technic_power_meter"..i..".png",
+ "technic_hv_battery_box_side0.png^technic_power_meter"..i..".png",
+ "technic_hv_battery_box_side0.png^technic_power_meter"..i..".png"},
+ groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
+ sounds = default.node_sound_wood_defaults(),
+ paramtype="light",
+ light_source=9,
+ drop="technic:hv_battery_box",
+ can_dig = function(pos,player)
+ local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
- meta:set_string("infotext", "HV Battery Box")
- meta:set_float("technic_hv_power_machine", 1)
- meta:set_string("formspec", battery_box_formspec)
- meta:set_int("HV_EU_demand", 0) -- How much can this node charge
- meta:set_int("HV_EU_supply", 0) -- How much can this node discharge
- meta:set_int("HV_EU_input", 0) -- How much power is this machine getting.
- meta:set_float("internal_EU_charge", 0)
- inv:set_size("src", 1)
- inv:set_size("dst", 1)
- end,
- can_dig = function(pos,player)
- local meta = minetest.env:get_meta(pos);
- local inv = meta:get_inventory()
- if not inv:is_empty("src") or not inv:is_empty("dst") then
- minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
- return false
- else
- return true
- end
+ if not inv:is_empty("src") or not inv:is_empty("dst") then
+ minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
+ return false
+ else
+ return true
+ end
end,
- })
-
-for i=1,8,1 do
- minetest.register_node(
- "technic:hv_battery_box"..i,
- {description = "HV Battery Box",
- tiles = {"technic_hv_battery_box_top.png", "technic_hv_battery_box_bottom.png", "technic_hv_battery_box_side0.png^technic_power_meter"..i..".png",
- "technic_hv_battery_box_side0.png^technic_power_meter"..i..".png", "technic_hv_battery_box_side0.png^technic_power_meter"..i..".png", "technic_hv_battery_box_side0.png^technic_power_meter"..i..".png"},
- groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1},
- sounds = default.node_sound_wood_defaults(),
- paramtype="light",
- light_source=9,
- drop="technic:hv_battery_box",
- can_dig = function(pos,player)
- local meta = minetest.env:get_meta(pos);
- local inv = meta:get_inventory()
- if not inv:is_empty("src") or not inv:is_empty("dst") then
- minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
- return false
- else
- return true
- end
- end,
- })
+ })
end
-local power_tools = technic.HV_power_tools
-
-local charge_HV_tools = function(meta, charge)
- --charge registered power tools
- local inv = meta:get_inventory()
- if inv:is_empty("src")==false then
- local srcstack = inv:get_stack("src", 1)
- local src_item=srcstack:to_table()
- local src_meta=get_item_meta(src_item["metadata"])
-
- local toolname = src_item["name"]
- if power_tools[toolname] ~= nil then
- -- Set meta data for the tool if it didn't do it itself :-(
- src_meta=get_item_meta(src_item["metadata"])
- if src_meta==nil then
- src_meta={}
- src_meta["technic_hv_power_tool"]=true
- src_meta["charge"]=0
- else
- if src_meta["technic_hv_power_tool"]==nil then
- src_meta["technic_hv_power_tool"]=true
- src_meta["charge"]=0
- end
- end
- -- Do the charging
- local item_max_charge = power_tools[toolname]
- local load = src_meta["charge"]
- local load_step = 1000 -- how much to charge per tick
- if load<item_max_charge and charge>0 then
- if charge-load_step<0 then load_step=charge end
- if load+load_step>item_max_charge then load_step=item_max_charge-load end
- load=load+load_step
- charge=charge-load_step
- technic.set_RE_wear(src_item,load,item_max_charge)
- src_meta["charge"] = load
- src_item["metadata"] = set_item_meta(src_meta)
- inv:set_stack("src", 1, src_item)
- end
- end
- end
- return charge -- return the remaining charge in the battery
- end
-
-local discharge_HV_tools = function(meta, charge, max_charge)
- -- discharging registered power tools
- local inv = meta:get_inventory()
- if inv:is_empty("dst") == false then
- srcstack = inv:get_stack("dst", 1)
- src_item=srcstack:to_table()
- local src_meta=get_item_meta(src_item["metadata"])
- local toolname = src_item["name"]
- if power_tools[toolname] ~= nil then
- -- Set meta data for the tool if it didn't do it itself :-(
- src_meta=get_item_meta(src_item["metadata"])
- if src_meta==nil then
- src_meta={}
- src_meta["technic_hv_power_tool"]=true
- src_meta["charge"]=0
- else
- if src_meta["technic_hv_power_tool"]==nil then
- src_meta["technic_hv_power_tool"]=true
- src_meta["charge"]=0
- end
- end
- -- Do the discharging
- local item_max_charge = power_tools[toolname]
- local load = src_meta["charge"]
- local load_step = 4000 -- how much to discharge per tick
- if load>0 and charge<max_charge then
- if charge+load_step>max_charge then load_step=max_charge-charge end
- if load-load_step<0 then load_step=load end
- load=load-load_step
- charge=charge+load_step
- technic.set_RE_wear(src_item,load,item_max_charge)
- src_meta["charge"]=load
- src_item["metadata"]=set_item_meta(src_meta)
- inv:set_stack("dst", 1, src_item)
- end
- end
- end
- return charge -- return the remaining charge in the battery
- end
-
-minetest.register_abm(
- {nodenames = {"technic:hv_battery_box","technic:hv_battery_box1","technic:hv_battery_box2","technic:hv_battery_box3","technic:hv_battery_box4",
- "technic:hv_battery_box5","technic:hv_battery_box6","technic:hv_battery_box7","technic:hv_battery_box8"
- },
- interval = 1,
- chance = 1,
- action = function(pos, node, active_object_count, active_object_count_wider)
- local meta = minetest.env:get_meta(pos)
- local max_charge = 1500000 -- Set maximum charge for the device here
- local max_charge_rate = 3000 -- Set maximum rate of charging
- local max_discharge_rate = 5000 -- Set maximum rate of discharging (16000)
- local eu_input = meta:get_int("HV_EU_input")
- local current_charge = meta:get_int("internal_EU_charge") -- Battery charge right now
+minetest.register_abm({
+ nodenames = {"technic:hv_battery_box", "technic:hv_battery_box1", "technic:hv_battery_box2",
+ "technic:hv_battery_box3", "technic:hv_battery_box4", "technic:hv_battery_box5",
+ "technic:hv_battery_box6", "technic:hv_battery_box7", "technic:hv_battery_box8"},
+ interval = 1,
+ chance = 1,
+ action = function(pos, node, active_object_count, active_object_count_wider)
+ local meta = minetest.env:get_meta(pos)
+ local eu_input = meta:get_int("HV_EU_input")
+ local current_charge = meta:get_int("internal_EU_charge") -- Battery charge right now
-- Power off automatically if no longer connected to a switching station
technic.switching_station_timeout_count(pos, "HV")
-- Charge/discharge the battery with the input EUs
- if eu_input >=0 then
- current_charge = math.min(current_charge+eu_input, max_charge)
+ if eu_input >= 0 then
+ current_charge = math.min(current_charge + eu_input, max_charge)
else
- current_charge = math.max(current_charge+eu_input, 0)
+ current_charge = math.max(current_charge + eu_input, 0)
end
-- Charging/discharging tools here
- current_charge = charge_HV_tools(meta, current_charge)
- current_charge = discharge_HV_tools(meta, current_charge, max_charge)
+ current_charge = charge_tools(meta, current_charge, 16000)
+ current_charge = discharge_tools(meta, current_charge, max_charge, 16000)
-- Set a demand (we allow batteries to charge on less than the demand though)
meta:set_int("HV_EU_demand", math.min(max_charge_rate, max_charge-current_charge))
@@ -195,37 +118,40 @@ minetest.register_abm(
meta:set_int("HV_EU_supply", math.min(max_discharge_rate, current_charge))
meta:set_int("internal_EU_charge", current_charge)
- --dprint("BA: input:"..eu_input.." supply="..meta:get_int("HV_EU_supply").." demand="..meta:get_int("HV_EU_demand").." current:"..current_charge)
-- Select node textures
- local i=math.ceil((current_charge/max_charge)*8)
- if i > 8 then i = 8 end
- local j = meta:get_float("last_side_shown")
- if i~=j then
- if i>0 then hacky_swap_node(pos,"technic:hv_battery_box"..i)
- elseif i==0 then hacky_swap_node(pos,"technic:hv_battery_box") end
- meta:set_float("last_side_shown",i)
+ local charge_count = math.ceil((current_charge / max_charge) * 8)
+ if charge_count > 8 then
+ charge_count = 8
+ end
+ local last_count = meta:get_float("last_side_shown")
+ if charge_count ~= last_count then
+ if charge_count > 0 then
+ hacky_swap_node(pos,"technic:hv_battery_box"..charge_count)
+ else
+ hacky_swap_node(pos,"technic:hv_battery_box")
+ end
+ meta:set_float("last_side_shown", charge_count)
end
- local load = math.floor(current_charge/max_charge * 100)
+ local charge_percent = math.floor(current_charge / max_charge * 100)
meta:set_string("formspec",
- battery_box_formspec..
- "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:"..
- (load)..":technic_power_meter_fg.png]"
- )
+ battery_box_formspec..
+ "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:"
+ ..charge_percent..":technic_power_meter_fg.png]")
if eu_input == 0 then
- meta:set_string("infotext", "HV Battery box: "..current_charge.."/"..max_charge.." (idle)")
+ meta:set_string("infotext", "HV Battery box: "..current_charge.."/"..max_charge.." (idle)")
else
- meta:set_string("infotext", "HV Battery box: "..current_charge.."/"..max_charge)
+ meta:set_string("infotext", "HV Battery box: "..current_charge.."/"..max_charge)
end
- end
- })
+ end
+})
-- Register as a battery type
-- Battery type machines function as power reservoirs and can both receive and give back power
technic.register_HV_machine("technic:hv_battery_box","BA")
for i=1,8,1 do
- technic.register_HV_machine("technic:hv_battery_box"..i,"BA")
+ technic.register_HV_machine("technic:hv_battery_box"..i,"BA")
end
diff --git a/technic/machines/hv/nuclear_reactor.lua b/technic/machines/hv/nuclear_reactor.lua
index da5edf0..54defd6 100644
--- a/technic/machines/hv/nuclear_reactor.lua
+++ b/technic/machines/hv/nuclear_reactor.lua
@@ -5,239 +5,241 @@
--
-- The nuclear reactor core needs water and a protective shield to work.
-- This is checked now and then and if the machine is tampered with... BOOM!
+
local burn_ticks = 24*60 -- [minutes]. How many minutes does the power plant burn per serving?
local power_supply = 10000 -- [HV] EUs
-local fuel_type = "technic:enriched_uranium" -- This reactor burns this stuff
+local fuel_type = "technic:enriched_uranium" -- The reactor burns this stuff
+
-- FIXME: recipe must make more sense like a rod recepticle, steam chamber, HV generator?
-minetest.register_craft(
- {output = 'technic:hv_nuclear_reactor_core',
- recipe = {
- {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'},
- {'technic:stainless_steel_ingot', '', 'technic:stainless_steel_ingot'},
- {'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot'},
- }
- })
-
-minetest.register_craftitem(
- "technic:hv_nuclear_reactor_core",
- {description = "Uranium Rod Driven HV Reactor",
- stack_max = 1,
- })
+minetest.register_craft({
+ output = 'technic:hv_nuclear_reactor_core',
+ recipe = {
+ {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'},
+ {'technic:stainless_steel_ingot', '', 'technic:stainless_steel_ingot'},
+ {'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot'},
+ }
+})
+
+minetest.register_craftitem("technic:hv_nuclear_reactor_core",{
+ description = "Uranium Rod Driven HV Reactor",
+ stack_max = 1,
+})
local generator_formspec =
- "invsize[8,9;]"..
- -- "image[0,0;5,5;technic_generator_menu.png]"..
- "label[0,0;Nuclear Reactor Rod Compartment]"..
- "list[current_name;src;2,1;3,2;]"..
- "list[current_player;main;0,5;8,4;]"
+ "invsize[8,9;]"..
+ --"image[0,0;5,5;technic_generator_menu.png]"..
+ "label[0,0;Nuclear Reactor Rod Compartment]"..
+ "list[current_name;src;2,1;3,2;]"..
+ "list[current_player;main;0,5;8,4;]"
-- "Boxy sphere"
local nodebox = {
- { -0.353, -0.353, -0.353, 0.353, 0.353, 0.353 }, -- Box
- { -0.495, -0.064, -0.064, 0.495, 0.064, 0.064 }, -- Circle +-x
- { -0.483, -0.128, -0.128, 0.483, 0.128, 0.128 },
- { -0.462, -0.191, -0.191, 0.462, 0.191, 0.191 },
- { -0.433, -0.249, -0.249, 0.433, 0.249, 0.249 },
- { -0.397, -0.303, -0.303, 0.397, 0.303, 0.303 },
- { -0.305, -0.396, -0.305, 0.305, 0.396, 0.305 }, -- Circle +-y
- { -0.250, -0.432, -0.250, 0.250, 0.432, 0.250 },
- { -0.191, -0.461, -0.191, 0.191, 0.461, 0.191 },
- { -0.130, -0.482, -0.130, 0.130, 0.482, 0.130 },
- { -0.066, -0.495, -0.066, 0.066, 0.495, 0.066 },
- { -0.064, -0.064, -0.495, 0.064, 0.064, 0.495 }, -- Circle +-z
- { -0.128, -0.128, -0.483, 0.128, 0.128, 0.483 },
- { -0.191, -0.191, -0.462, 0.191, 0.191, 0.462 },
- { -0.249, -0.249, -0.433, 0.249, 0.249, 0.433 },
- { -0.303, -0.303, -0.397, 0.303, 0.303, 0.397 },
+ { -0.353, -0.353, -0.353, 0.353, 0.353, 0.353 }, -- Box
+ { -0.495, -0.064, -0.064, 0.495, 0.064, 0.064 }, -- Circle +-x
+ { -0.483, -0.128, -0.128, 0.483, 0.128, 0.128 },
+ { -0.462, -0.191, -0.191, 0.462, 0.191, 0.191 },
+ { -0.433, -0.249, -0.249, 0.433, 0.249, 0.249 },
+ { -0.397, -0.303, -0.303, 0.397, 0.303, 0.303 },
+ { -0.305, -0.396, -0.305, 0.305, 0.396, 0.305 }, -- Circle +-y
+ { -0.250, -0.432, -0.250, 0.250, 0.432, 0.250 },
+ { -0.191, -0.461, -0.191, 0.191, 0.461, 0.191 },
+ { -0.130, -0.482, -0.130, 0.130, 0.482, 0.130 },
+ { -0.066, -0.495, -0.066, 0.066, 0.495, 0.066 },
+ { -0.064, -0.064, -0.495, 0.064, 0.064, 0.495 }, -- Circle +-z
+ { -0.128, -0.128, -0.483, 0.128, 0.128, 0.483 },
+ { -0.191, -0.191, -0.462, 0.191, 0.191, 0.462 },
+ { -0.249, -0.249, -0.433, 0.249, 0.249, 0.433 },
+ { -0.303, -0.303, -0.397, 0.303, 0.303, 0.397 },
}
-minetest.register_node(
- "technic:hv_nuclear_reactor_core",
- {description = "Nuclear Reactor",
- tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
- "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
- "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"},
- -- paramtype2 = "facedir",
- groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
- legacy_facedir_simple = true,
- sounds = default.node_sound_wood_defaults(),
- drawtype="nodebox",
- paramtype = "light",
- node_box = {
- type = "fixed",
- fixed = nodebox
- },
- on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
- meta:set_string("infotext", "Nuclear Reactor Core")
- meta:set_float("technic_hv_power_machine", 1)
- meta:set_int("HV_EU_supply", 0)
- meta:set_int("HV_EU_from_fuel", 1) -- Signal to the switching station that this device burns some sort of fuel and needs special handling
- meta:set_int("burn_time", 0)
- meta:set_string("formspec", generator_formspec)
- local inv = meta:get_inventory()
- inv:set_size("src", 6)
- end,
- can_dig = function(pos,player)
- local meta = minetest.env:get_meta(pos);
- local inv = meta:get_inventory()
- if not inv:is_empty("src") then
- minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
- return false
- else
- return true
- end
- end,
- })
-
-minetest.register_node(
- "technic:hv_nuclear_reactor_core_active",
- {description = "Uranium Rod Driven HV Reactor",
- tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
- "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"},
- -- paramtype2 = "facedir",
- groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1},
- legacy_facedir_simple = true,
- sounds = default.node_sound_wood_defaults(),
- drop="technic:hv_nuclear_reactor_core",
- drawtype="nodebox",
- light_source = 15,
- paramtype = "light",
- node_box = {
- type = "fixed",
- fixed = nodebox
- },
- can_dig = function(pos,player)
- local meta = minetest.env:get_meta(pos);
- local inv = meta:get_inventory()
- if not inv:is_empty("src") then
- minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
- return false
- else
- return true
- end
- end,
- })
+minetest.register_node("technic:hv_nuclear_reactor_core", {
+ description = "Nuclear Reactor",
+ tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
+ "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
+ "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"},
+ groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2},
+ legacy_facedir_simple = true,
+ sounds = default.node_sound_wood_defaults(),
+ drawtype="nodebox",
+ paramtype = "light",
+ node_box = {
+ type = "fixed",
+ fixed = nodebox
+ },
+ on_construct = function(pos)
+ local meta = minetest.env:get_meta(pos)
+ meta:set_string("infotext", "Nuclear Reactor Core")
+ meta:set_float("technic_hv_power_machine", 1)
+ meta:set_int("HV_EU_supply", 0)
+ meta:set_int("HV_EU_from_fuel", 1) -- Signal to the switching station that this device burns some sort of fuel and needs special handling
+ meta:set_int("burn_time", 0)
+ meta:set_string("formspec", generator_formspec)
+ local inv = meta:get_inventory()
+ inv:set_size("src", 6)
+ end,
+ can_dig = function(pos,player)
+ local meta = minetest.env:get_meta(pos);
+ local inv = meta:get_inventory()
+ if not inv:is_empty("src") then
+ minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
+ return false
+ else
+ return true
+ end
+ end,
+})
+
+minetest.register_node("technic:hv_nuclear_reactor_core_active", {
+ description = "Uranium Rod Driven HV Reactor",
+ tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
+ "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
+ "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"},
+ groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
+ legacy_facedir_simple = true,
+ sounds = default.node_sound_wood_defaults(),
+ drop="technic:hv_nuclear_reactor_core",
+ drawtype="nodebox",
+ light_source = 15,
+ paramtype = "light",
+ node_box = {
+ type = "fixed",
+ fixed = nodebox
+ },
+ can_dig = function(pos,player)
+ local meta = minetest.env:get_meta(pos);
+ local inv = meta:get_inventory()
+ if not inv:is_empty("src") then
+ minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
+ return false
+ else
+ return true
+ end
+ end,
+})
local check_reactor_structure = function(pos)
- -- The reactor consists of an 11x11x11 cube structure
- -- A cross section through the middle:
- -- CCCCC CCCCC
- -- CCCCC CCCCC
- -- CCSSS SSSCC
- -- CCSCC CCSCC
- -- CCSCWWWCSCC
- -- CCSCW#WCSCC
- -- CCSCW|WCSCC
- -- CCSCC|CCSCC
- -- CCSSS|SSSCC
- -- CCCCC|CCCCC
- -- C = Concrete, S = Stainless Steel, W = water node (not floating), #=reactor core, |=HV cable
- -- The man-hole and the HV cable is only in the middle.
- local water_nodes = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1},
- {x=pos.x+1, y=pos.y+1, z=pos.z+1},
- "default:water_source")
- --print("Water ( 25):"..#water_nodes)
- if #water_nodes ~= 25 then
- --print("Water supply defect")
- return 0
- end
- local inner_shield_nodes = minetest.find_nodes_in_area({x=pos.x-2, y=pos.y-2, z=pos.z-2},
- {x=pos.x+2, y=pos.y+2, z=pos.z+2},
- "technic:concrete")
-
- --print("Concrete 1 ( 96):"..#inner_shield_nodes)
- if #inner_shield_nodes ~= 96 then
- --print("Inner shield defect")
- return 0
- end
- local steel_shield_nodes = minetest.find_nodes_in_area({x=pos.x-3, y=pos.y-3, z=pos.z-3},
- {x=pos.x+3, y=pos.y+3, z=pos.z+3},
- "default:steelblock")
-
- --print("Steel ( 216):"..#steel_shield_nodes)
- if #steel_shield_nodes ~= 216 then
- --print("Steel shield defect")
- return 0
- end
- local outer_shield_nodes = minetest.find_nodes_in_area({x=pos.x-5, y=pos.y-5, z=pos.z-5},
- {x=pos.x+5, y=pos.y+5, z=pos.z+5},
- "technic:concrete")
- --print("Concrete 2 (1080):"..#outer_shield_nodes)
- if #outer_shield_nodes ~= (984+#inner_shield_nodes) then
- --print("Outer shield defect")
- return 0
- end
- return 1
- end
+ -- The reactor consists of an 11x11x11 cube structure
+ -- A cross section through the middle:
+ -- CCCCC CCCCC
+ -- CCCCC CCCCC
+ -- CCSSS SSSCC
+ -- CCSCC CCSCC
+ -- CCSCWWWCSCC
+ -- CCSCW#WCSCC
+ -- CCSCW|WCSCC
+ -- CCSCC|CCSCC
+ -- CCSSS|SSSCC
+ -- CCCCC|CCCCC
+ -- C = Concrete, S = Stainless Steel, W = water node (not floating), #=reactor core, |=HV cable
+ -- The man-hole and the HV cable is only in the middle
+ -- The man-hole is optional
+
+ local source_water_nodes = minetest.find_nodes_in_area(
+ {x=pos.x-1, y=pos.y-1, z=pos.z-1},
+ {x=pos.x+1, y=pos.y+1, z=pos.z+1},
+ "default:water_source")
+ local flowing_water_nodes = minetest.find_nodes_in_area(
+ {x=pos.x-1, y=pos.y-1, z=pos.z-1},
+ {x=pos.x+1, y=pos.y+1, z=pos.z+1},
+ "default:water_flowing")
+ if not ((#source_water_nodes + #flowing_water_nodes) >= 25) then
+ return false
+ end
+
+ local inner_shield_nodes = minetest.find_nodes_in_area(
+ {x=pos.x-2, y=pos.y-2, z=pos.z-2},
+ {x=pos.x+2, y=pos.y+2, z=pos.z+2},
+ "technic:concrete")
+ if not (#inner_shield_nodes >= 96) then
+ return false
+ end
+
+ local steel_shield_nodes = minetest.find_nodes_in_area(
+ {x=pos.x-3, y=pos.y-3, z=pos.z-3},
+ {x=pos.x+3, y=pos.y+3, z=pos.z+3},
+ "default:steelblock")
+ if not (#steel_shield_nodes >= 216) then
+ return false
+ end
+
+ local outer_shield_nodes = minetest.find_nodes_in_area(
+ {x=pos.x-5, y=pos.y-5, z=pos.z-5},
+ {x=pos.x+5, y=pos.y+5, z=pos.z+5},
+ "technic:concrete")
+ if not (#outer_shield_nodes >= (984 + #inner_shield_nodes)) then
+ return false
+ end
+ return true
+end
local explode_reactor = function(pos)
- print("BOOM A reactor exploded!")
- end
+ print("BOOM A reactor exploded!")
+end
-minetest.register_abm(
- {nodenames = {"technic:hv_nuclear_reactor_core","technic:hv_nuclear_reactor_core_active"},
- interval = 1,
- chance = 1,
- action = function(pos, node, active_object_count, active_object_count_wider)
+minetest.register_abm({
+ nodenames = {"technic:hv_nuclear_reactor_core", "technic:hv_nuclear_reactor_core_active"},
+ interval = 1,
+ chance = 1,
+ action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.env:get_meta(pos)
- local burn_time= meta:get_int("burn_time")
+ local burn_time = meta:get_int("burn_time")
-- If more to burn and the energy produced was used: produce some more
- if burn_time>0 then
- if meta:get_int("HV_EU_supply") == 0 then
- -- We did not use the power
- meta:set_int("HV_EU_supply", power_sypply)
- else
- burn_time = burn_time - 1
- meta:set_int("burn_time",burn_time)
- meta:set_string("infotext", "Nuclear Reactor Core ("..math.floor(burn_time/(burn_ticks*60)*100).."%)")
- end
+ if burn_time > 0 then
+ if not check_reactor_structure(pos) then
+ explode_reactor(pos)
+ end
+ if meta:get_int("HV_EU_supply") == 0 then
+ -- We did not use the power
+ meta:set_int("HV_EU_supply", power_supply)
+ else
+ burn_time = burn_time - 1
+ meta:set_int("burn_time", burn_time)
+ local percent = math.floor(burn_time / (burn_ticks * 60) * 100)
+ meta:set_string("infotext", "Nuclear Reactor Core ("..percent.."%)")
+ end
end
-- Burn another piece of coal
- if burn_time==0 then
- local inv = meta:get_inventory()
- local correct_fuel_count = 0
- if inv:is_empty("src") == false then
- local srclist= inv:get_list("src")
- for _, srcstack in pairs(srclist) do
- if srcstack then
- local src_item=srcstack:to_table()
- if src_item and src_item["name"] == fuel_type then
- correct_fuel_count = correct_fuel_count + 1
- end
- end
- end
- -- Check that the reactor is complete as well as the correct number of correct fuel
- if correct_fuel_count == 6 then
- if check_reactor_structure(pos) == 1 then
- burn_time=burn_ticks*60
- meta:set_int("burn_time",burn_time)
- hacky_swap_node (pos,"technic:hv_nuclear_reactor_core_active")
- meta:set_int("HV_EU_supply", power_supply)
- for idx, srcstack in pairs(srclist) do
- srcstack:take_item()
- inv:set_stack("src", idx, srcstack)
- end
- else
- -- BOOM!!! (the reactor was compromised and it should explode after some time) TNT mod inspired??
- explode_reactor(pos)
- end
- else
- meta:set_int("HV_EU_supply", 0)
- end
- end
+ if burn_time <= 0 then
+ local inv = meta:get_inventory()
+ local correct_fuel_count = 0
+ if not inv:is_empty("src") then
+ local srclist = inv:get_list("src")
+ for _, srcstack in pairs(srclist) do
+ if srcstack then
+ local src_item=srcstack:to_table()
+ if src_item and src_item["name"] == fuel_type then
+ correct_fuel_count = correct_fuel_count + 1
+ end
+ end
+ end
+ -- Check that the reactor is complete as well as the correct number of correct fuel
+ if correct_fuel_count == 6 then
+ if not check_reactor_structure(pos) then
+ burn_time = burn_ticks * 60
+ meta:set_int("burn_time", burn_time)
+ hacky_swap_node (pos,"technic:hv_nuclear_reactor_core_active")
+ meta:set_int("HV_EU_supply", power_supply)
+ for idx, srcstack in pairs(srclist) do
+ srcstack:take_item()
+ inv:set_stack("src", idx, srcstack)
+ end
+ end
+ else
+ meta:set_int("HV_EU_supply", 0)
+ end
+ end
end
-- Nothing left to burn
- if burn_time==0 then
- meta:set_string("infotext", "Nuclear Reactor Core (idle)")
- hacky_swap_node (pos,"technic:hv_nuclear_reactor_core")
+ if burn_time == 0 then
+ meta:set_string("infotext", "Nuclear Reactor Core (idle)")
+ hacky_swap_node(pos,"technic:hv_nuclear_reactor_core")
end
- end
- })
+ end
+})
technic.register_HV_machine ("technic:hv_nuclear_reactor_core","PR")
technic.register_HV_machine ("technic:hv_nuclear_reactor_core_active","PR")
diff --git a/technic/machines/hv/wires.lua b/technic/machines/hv/wires.lua
index b2c9834..47f714d 100644
--- a/technic/machines/hv/wires.lua
+++ b/technic/machines/hv/wires.lua
@@ -92,7 +92,7 @@ if z2==1 then temp_z2=str_z2 end
minetest.register_node("technic:hv_cable"..count, {
- description = "Gigh Voltage Copper Cable",
+ description = "High Voltage Copper Cable",
tiles = {"technic_hv_cable.png"},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
diff --git a/technic/machines/init.lua b/technic/machines/init.lua
index 58b42f4..d798e9f 100644
--- a/technic/machines/init.lua
+++ b/technic/machines/init.lua
@@ -3,6 +3,7 @@ local path = technic.modpath.."/machines"
dofile(path.."/switching_station.lua")
dofile(path.."/supply_converter.lua")
dofile(path.."/alloy_furnaces_commons.lua")
+dofile(path.."/battery_boxes_commons.lua")
dofile(path.."/lv/init.lua")
dofile(path.."/mv/init.lua")
dofile(path.."/hv/init.lua")
diff --git a/technic/machines/lv/battery_box.lua b/technic/machines/lv/battery_box.lua
index 3a2272a..e27da51 100644
--- a/technic/machines/lv/battery_box.lua
+++ b/technic/machines/lv/battery_box.lua
@@ -1,8 +1,8 @@
-- LV Battery box and some other nodes...
-technic.register_LV_power_tool("technic:battery",10000)
-technic.register_MV_power_tool("technic:red_energy_crystal",100000)
-technic.register_HV_power_tool("technic:green_energy_crystal",250000)
-technic.register_HV_power_tool("technic:blue_energy_crystal",500000)
+technic.register_power_tool("technic:battery",10000)
+technic.register_power_tool("technic:red_energy_crystal",100000)
+technic.register_power_tool("technic:green_energy_crystal",250000)
+technic.register_power_tool("technic:blue_energy_crystal",500000)
minetest.register_craft({
output = 'technic:battery 1',
@@ -46,13 +46,15 @@ local battery_box_formspec =
"invsize[8,9;]"..
"image[1,1;1,2;technic_power_meter_bg.png]"..
"list[current_name;src;3,1;1,1;]"..
- "image[4,1;1,1;technic_battery_reload.png]"..
"list[current_name;dst;5,1;1,1;]"..
- "label[0,0;Battery box]"..
+ "label[0,0;LV Battery Box]"..
"label[3,0;Charge]"..
"label[5,0;Discharge]"..
"label[1,3;Power level]"..
- "list[current_player;main;0,5;8,4;]"
+ "list[current_player;main;0,5;8,4;]"..
+ "background[-0.19,-0.25;8.4,9.75;ui_form_bg.png]"..
+ "background[0,0;8,4;ui_lv_battery_box.png]"..
+ "background[0,5;8,4;ui_main_inventory.png]"
minetest.register_node("technic:battery_box", {
description = "LV Battery Box",
@@ -114,89 +116,6 @@ for i=1,8,1 do
})
end
-local power_tools = technic.LV_power_tools
-
-local charge_LV_tools = function(meta, charge)
- --charge registered power tools
- local inv = meta:get_inventory()
- if inv:is_empty("src")==false then
- local srcstack = inv:get_stack("src", 1)
- local src_item=srcstack:to_table()
- local src_meta=get_item_meta(src_item["metadata"])
-
- local toolname = src_item["name"]
- if power_tools[toolname] ~= nil then
- -- Set meta data for the tool if it didn't do it itself :-(
- src_meta=get_item_meta(src_item["metadata"])
- if src_meta==nil then
- src_meta={}
- src_meta["technic_power_tool"]=true
- src_meta["charge"]=0
- else
- if src_meta["technic_power_tool"]==nil then
- src_meta["technic_power_tool"]=true
- src_meta["charge"]=0
- end
- end
- -- Do the charging
- local item_max_charge = power_tools[toolname]
- local load = src_meta["charge"]
- local load_step = 1000 -- how much to charge per tick
- if load<item_max_charge and charge>0 then
- if charge-load_step<0 then load_step=charge end
- if load+load_step>item_max_charge then load_step=item_max_charge-load end
- load=load+load_step
- charge=charge-load_step
- technic.set_RE_wear(src_item,load,item_max_charge)
- src_meta["charge"] = load
- src_item["metadata"] = set_item_meta(src_meta)
- inv:set_stack("src", 1, src_item)
- end
- end
- end
- return charge -- return the remaining charge in the battery
- end
-
-local discharge_LV_tools = function(meta, charge, max_charge)
- -- discharging registered power tools
- local inv = meta:get_inventory()
- if inv:is_empty("dst") == false then
- srcstack = inv:get_stack("dst", 1)
- src_item=srcstack:to_table()
- local src_meta=get_item_meta(src_item["metadata"])
- local toolname = src_item["name"]
- if power_tools[toolname] ~= nil then
- -- Set meta data for the tool if it didn't do it itself :-(
- src_meta=get_item_meta(src_item["metadata"])
- if src_meta==nil then
- src_meta={}
- src_meta["technic_power_tool"]=true
- src_meta["charge"]=0
- else
- if src_meta["technic_power_tool"]==nil then
- src_meta["technic_power_tool"]=true
- src_meta["charge"]=0
- end
- end
- -- Do the discharging
- local item_max_charge = power_tools[toolname]
- local load = src_meta["charge"]
- local load_step = 4000 -- how much to discharge per tick
- if load>0 and charge<max_charge then
- if charge+load_step>max_charge then load_step=max_charge-charge end
- if load-load_step<0 then load_step=load end
- load=load-load_step
- charge=charge+load_step
- technic.set_RE_wear(src_item,load,item_max_charge)
- src_meta["charge"]=load
- src_item["metadata"]=set_item_meta(src_meta)
- inv:set_stack("dst", 1, src_item)
- end
- end
- end
- return charge -- return the remaining charge in the battery
- end
-
minetest.register_abm(
{nodenames = {"technic:battery_box","technic:battery_box1","technic:battery_box2","technic:battery_box3","technic:battery_box4",
"technic:battery_box5","technic:battery_box6","technic:battery_box7","technic:battery_box8"},
@@ -221,8 +140,8 @@ minetest.register_abm(
end
-- Charging/discharging tools here
- current_charge = charge_LV_tools(meta, current_charge)
- current_charge = discharge_LV_tools(meta, current_charge, max_charge)
+ current_charge = charge_tools(meta, current_charge, 1000)
+ current_charge = discharge_tools(meta, current_charge, max_charge, 1000)
-- Set a demand (we allow batteries to charge on less than the demand though)
meta:set_int("LV_EU_demand", math.min(max_charge_rate, max_charge-current_charge))
diff --git a/technic/machines/lv/compressor.lua b/technic/machines/lv/compressor.lua
new file mode 100644
index 0000000..41eb947
--- /dev/null
+++ b/technic/machines/lv/compressor.lua
@@ -0,0 +1,207 @@
+technic.compressor_recipes ={}
+
+technic.register_compressor_recipe = function(src, src_count, dst, dst_count)
+ technic.compressor_recipes[src] = {src_count = src_count, dst_name = dst, dst_count = dst_count}
+ if unified_inventory then
+ unified_inventory.register_craft(
+ {
+ type = "compressing",
+ output = dst.." "..dst_count,
+ items = {src.." "..src_count},
+ width = 0,
+ })
+ end
+end
+
+technic.get_compressor_recipe = function(item)
+ if technic.compressor_recipes[item.name] and
+ item.count >= technic.compressor_recipes[item.name].src_count then
+ return technic.compressor_recipes[item.name]
+ else
+ return nil
+ end
+end
+
+technic.register_compressor_recipe("default:snowblock", 1, "default:ice", 1)
+technic.register_compressor_recipe("default:sand", 1, "default:sandstone", 1)
+technic.register_compressor_recipe("default:desert_sand", 1, "default:desert_stone", 1)
+technic.register_compressor_recipe("technic:mixed_metal_ingot", 1, "technic:composite_plate", 1)
+technic.register_compressor_recipe("default:copper_ingot", 5, "technic:copper_plate", 1)
+technic.register_compressor_recipe("technic:coal_dust", 4, "technic:graphite", 1)
+technic.register_compressor_recipe("technic:carbon_cloth", 1, "technic:carbon_plate", 1)
+
+
+minetest.register_alias("compressor", "technic:compressor")
+minetest.register_craft({
+ output = 'technic:compressor',
+ recipe = {
+ {'default:stone', 'default:stone', 'default:stone'},
+ {'mesecons:piston', 'technic:motor', 'mesecons:piston'},
+ {'default:stone', 'technic:lv_cable', 'default:stone'},
+ }
+})
+
+minetest.register_craftitem("technic:compressor", {
+ description = "Compressor",
+ stack_max = 99,
+})
+
+local compressor_formspec =
+ "invsize[8,9;]"..
+ "label[0,0;Compressor]"..
+ "list[current_name;src;3,1;1,1;]"..
+ "list[current_name;dst;5,1;2,2;]"..
+ "list[current_player;main;0,5;8,4;]"
+
+minetest.register_node("technic:compressor", {
+ description = "Compressor",
+ tiles = {"technic_compressor_top.png", "technic_compressor_bottom.png", "technic_compressor_side.png",
+ "technic_compressor_side.png", "technic_compressor_back.png", "technic_compressor_front.png"},
+ paramtype2 = "facedir",
+ groups = {cracky=2},
+ legacy_facedir_simple = true,
+ sounds = default.node_sound_wood_defaults(),
+ on_construct = function(pos)
+ local meta = minetest.env:get_meta(pos)
+ meta:set_string("infotext", "Compressor")
+ meta:set_float("technic_power_machine", 1)
+ meta:set_string("formspec", compressor_formspec)
+ local inv = meta:get_inventory()
+ inv:set_size("src", 1)
+ inv:set_size("dst", 4)
+ end,
+ can_dig = function(pos,player)
+ local meta = minetest.env:get_meta(pos);
+ local inv = meta:get_inventory()
+ if not inv:is_empty("src") or not inv:is_empty("dst") then
+ minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
+ return false
+ else
+ return true
+ end
+ end,
+})
+
+minetest.register_node("technic:compressor_active", {
+ description = "Compressor",
+ tiles = {"technic_compressor_top.png", "technic_compressor_bottom.png", "technic_compressor_side.png",
+ "technic_compressor_side.png", "technic_compressor_back.png", "technic_compressor_front_active.png"},
+ paramtype2 = "facedir",
+ groups = {cracky=2,not_in_creative_inventory=1},
+ legacy_facedir_simple = true,
+ sounds = default.node_sound_wood_defaults(),
+ can_dig = function(pos,player)
+ local meta = minetest.env:get_meta(pos);
+ local inv = meta:get_inventory()
+ if not inv:is_empty("src") or not inv:is_empty("dst") then
+ minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
+ return false
+ else
+ return true
+ end
+ end,
+})
+
+minetest.register_abm({
+ nodenames = {"technic:compressor","technic:compressor_active"},
+ interval = 1,
+ chance = 1,
+ action = function(pos, node, active_object_count, active_object_count_wider)
+ -- Run a machine through its states. Takes the same arguments as the ABM action
+ -- and adds the machine's states and any extra data which is needed by the machine.
+ -- A machine is characterized by running through a set number of states (usually 2:
+ -- Idle and active) in some order. A state decides when to move to the next one
+ -- and the machine only changes state if it is powered correctly.
+ -- The machine will automatically shut down if disconnected from power in some fashion.
+ local meta = minetest.env:get_meta(pos)
+ local eu_input = meta:get_int("LV_EU_input")
+ local state = meta:get_int("state")
+ local next_state = state
+
+ -- Machine information
+ local machine_name = "Compressor"
+ local machine_node = "technic:compressor"
+ local machine_state_demand = { 50, 300 }
+
+ -- Setup meta data if it does not exist. state is used as an indicator of this
+ if state == 0 then
+ meta:set_int("state", 1)
+ meta:set_int("LV_EU_demand", machine_state_demand[1])
+ meta:set_int("LV_EU_input", 0)
+ return
+ end
+
+ -- Power off automatically if no longer connected to a switching station
+ technic.switching_station_timeout_count(pos, "LV")
+
+ -- State machine
+ if eu_input == 0 then
+ -- unpowered - go idle
+ hacky_swap_node(pos, machine_node)
+ meta:set_string("infotext", machine_name.." Unpowered")
+ next_state = 1
+ elseif eu_input == machine_state_demand[state] then
+ -- Powered - do the state specific actions
+
+ local inv = meta:get_inventory()
+ local empty = inv:is_empty("src")
+ local srcstack = inv:get_stack("src", 1)
+ local src_item = nil
+ local recipe = nil
+ local result = nil
+
+ if srcstack then
+ src_item = srcstack:to_table()
+ end
+ if src_item then
+ recipe = technic.get_compressor_recipe(src_item)
+ end
+ if recipe then
+ result = {name=recipe.dst_name, count=recipe.dst_count}
+ end
+
+ if state == 1 then
+ hacky_swap_node(pos, machine_node)
+ meta:set_string("infotext", machine_name.." Idle")
+
+ if not empty and result and inv:room_for_item("dst",result) then
+ meta:set_int("src_time", 0)
+ next_state = 2
+ end
+ elseif state == 2 then
+ hacky_swap_node(pos, machine_node.."_active")
+ meta:set_string("infotext", machine_name.." Active")
+
+ if empty then
+ next_state = 1
+ else
+ meta:set_int("src_time", meta:get_int("src_time") + 1)
+ if meta:get_int("src_time") == 4 then
+ -- 4 ticks per output
+ -- check if there's room for output in "dst" list
+
+ meta:set_int("src_time", 0)
+ if recipe and inv:room_for_item("dst",result) then
+ -- take stuff from "src" list
+ srcstack:take_item(recipe.src_count)
+ inv:set_stack("src", 1, srcstack)
+ -- Put result in "dst" list
+ inv:add_item("dst", result)
+ else
+ -- all full: go idle
+ next_state = 1
+ end
+ end
+ end
+ end
+ end
+ -- Change state?
+ if next_state ~= state then
+ meta:set_int("LV_EU_demand", machine_state_demand[next_state])
+ meta:set_int("state", next_state)
+ end
+ end
+})
+
+technic.register_LV_machine ("technic:compressor","RE")
+technic.register_LV_machine ("technic:compressor_active","RE")
diff --git a/technic/machines/lv/init.lua b/technic/machines/lv/init.lua
index a95f78e..a82c3ec 100644
--- a/technic/machines/lv/init.lua
+++ b/technic/machines/lv/init.lua
@@ -16,4 +16,4 @@ dofile(path.."/cnc.lua")
dofile(path.."/cnc_api.lua")
dofile(path.."/cnc_nodes.lua")
dofile(path.."/extractor.lua")
-
+dofile(path.."/compressor.lua")
diff --git a/technic/machines/mv/alloy_furnace.lua b/technic/machines/mv/alloy_furnace.lua
index cadcb67..e70df1c 100644
--- a/technic/machines/mv/alloy_furnace.lua
+++ b/technic/machines/mv/alloy_furnace.lua
@@ -36,6 +36,7 @@ minetest.register_node(
local inv=meta:get_inventory()
return inv:room_for_item("src",stack)
end,
+ connect_sides = {left=1, right=1, back=1, top=1, bottom=1},
},
legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(),
@@ -82,6 +83,7 @@ minetest.register_node(
local inv=meta:get_inventory()
return inv:room_for_item("src",stack)
end,
+ connect_sides = {left=1, right=1, back=1, top=1, bottom=1},
},
legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(),
@@ -258,10 +260,9 @@ minetest.register_abm(
end
meta:set_int("tube_time", tube_time)
- -- The machine shuts down if we have nothing to smelt and no tube is connected
- -- or if we have nothing to send with a tube connected.
- if (not output_tube_connected and inv:is_empty("src"))
- or ( output_tube_connected and inv:is_empty("dst")) then
+ -- The machine shuts down if we have nothing to smelt since we tube stuff
+ -- out while being idle.
+ if inv:is_empty("src") then
next_state = 1
end
----------------------
diff --git a/technic/machines/mv/battery_box.lua b/technic/machines/mv/battery_box.lua
index e1295ce..86a1d78 100644
--- a/technic/machines/mv/battery_box.lua
+++ b/technic/machines/mv/battery_box.lua
@@ -9,16 +9,18 @@ minetest.register_craft(
})
local battery_box_formspec =
- "invsize[8,9;]"..
- "image[1,1;1,2;technic_power_meter_bg.png]"..
- "list[current_name;src;3,1;1,1;]"..
- "image[4,1;1,1;technic_battery_reload.png]"..
- "list[current_name;dst;5,1;1,1;]"..
- "label[0,0;MV_Battery box]"..
- "label[3,0;Charge]"..
- "label[5,0;Discharge]"..
- "label[1,3;Power level]"..
- "list[current_player;main;0,5;8,4;]"
+ "invsize[8,9;]"..
+ "image[1,1;1,2;technic_power_meter_bg.png]"..
+ "list[current_name;src;3,1;1,1;]"..
+ "list[current_name;dst;5,1;1,1;]"..
+ "label[0,0;MV Battery Box]"..
+ "label[3,0;Charge]"..
+ "label[5,0;Discharge]"..
+ "label[1,3;Power level]"..
+ "list[current_player;main;0,5;8,4;]"..
+ "background[-0.19,-0.25;8.4,9.75;ui_form_bg.png]"..
+ "background[0,0;8,4;ui_mv_battery_box.png]"..
+ "background[0,5;8,4;ui_main_inventory.png]"
minetest.register_node(
"technic:mv_battery_box", {
@@ -78,89 +80,6 @@ for i=1,8,1 do
})
end
-local power_tools = technic.MV_power_tools
-
-local charge_MV_tools = function(meta, charge)
- --charge registered power tools
- local inv = meta:get_inventory()
- if inv:is_empty("src")==false then
- local srcstack = inv:get_stack("src", 1)
- local src_item=srcstack:to_table()
- local src_meta=get_item_meta(src_item["metadata"])
-
- local toolname = src_item["name"]
- if power_tools[toolname] ~= nil then
- -- Set meta data for the tool if it didn't do it itself :-(
- src_meta=get_item_meta(src_item["metadata"])
- if src_meta==nil then
- src_meta={}
- src_meta["technic_mv_power_tool"]=true
- src_meta["charge"]=0
- else
- if src_meta["technic_mv_power_tool"]==nil then
- src_meta["technic_mv_power_tool"]=true
- src_meta["charge"]=0
- end
- end
- -- Do the charging
- local item_max_charge = power_tools[toolname]
- local load = src_meta["charge"]
- local load_step = 1000 -- how much to charge per tick
- if load<item_max_charge and charge>0 then
- if charge-load_step<0 then load_step=charge end
- if load+load_step>item_max_charge then load_step=item_max_charge-load end
- load=load+load_step
- charge=charge-load_step
- technic.set_RE_wear(src_item,load,item_max_charge)
- src_meta["charge"] = load
- src_item["metadata"] = set_item_meta(src_meta)
- inv:set_stack("src", 1, src_item)
- end
- end
- end
- return charge -- return the remaining charge in the battery
- end
-
-local discharge_MV_tools = function(meta, charge, max_charge)
- -- discharging registered power tools
- local inv = meta:get_inventory()
- if inv:is_empty("dst") == false then
- srcstack = inv:get_stack("dst", 1)
- src_item=srcstack:to_table()
- local src_meta=get_item_meta(src_item["metadata"])
- local toolname = src_item["name"]
- if power_tools[toolname] ~= nil then
- -- Set meta data for the tool if it didn't do it itself :-(
- src_meta=get_item_meta(src_item["metadata"])
- if src_meta==nil then
- src_meta={}
- src_meta["technic_mv_power_tool"]=true
- src_meta["charge"]=0
- else
- if src_meta["technic_mv_power_tool"]==nil then
- src_meta["technic_mv_power_tool"]=true
- src_meta["charge"]=0
- end
- end
- -- Do the discharging
- local item_max_charge = power_tools[toolname]
- local load = src_meta["charge"]
- local load_step = 4000 -- how much to discharge per tick
- if load>0 and charge<max_charge then
- if charge+load_step>max_charge then load_step=max_charge-charge end
- if load-load_step<0 then load_step=load end
- load=load-load_step
- charge=charge+load_step
- technic.set_RE_wear(src_item,load,item_max_charge)
- src_meta["charge"]=load
- src_item["metadata"]=set_item_meta(src_meta)
- inv:set_stack("dst", 1, src_item)
- end
- end
- end
- return charge -- return the remaining charge in the battery
- end
-
minetest.register_abm(
{
nodenames = {"technic:mv_battery_box","technic:mv_battery_box1","technic:mv_battery_box2","technic:mv_battery_box3","technic:mv_battery_box4",
@@ -187,8 +106,8 @@ minetest.register_abm(
end
-- Charging/discharging tools here
- current_charge = charge_MV_tools(meta, current_charge)
- current_charge = discharge_MV_tools(meta, current_charge, max_charge)
+ current_charge = charge_tools(meta, current_charge, 4000)
+ current_charge = discharge_tools(meta, current_charge, max_charge, 4000)
-- Set a demand (we allow batteries to charge on less than the demand though)
meta:set_int("MV_EU_demand", math.min(max_charge_rate, max_charge-current_charge))
diff --git a/technic/machines/mv/electric_furnace.lua b/technic/machines/mv/electric_furnace.lua
index 7f205b5..a0eff21 100644
--- a/technic/machines/mv/electric_furnace.lua
+++ b/technic/machines/mv/electric_furnace.lua
@@ -41,6 +41,7 @@ minetest.register_node(
local inv=meta:get_inventory()
return inv:room_for_item("src",stack)
end,
+ connect_sides = {left=1, right=1, back=1, top=1, bottom=1},
},
legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(),
@@ -87,6 +88,7 @@ minetest.register_node(
local inv=meta:get_inventory()
return inv:room_for_item("src",stack)
end,
+ connect_sides = {left=1, right=1, back=1, top=1, bottom=1},
},
legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(),
@@ -257,12 +259,11 @@ minetest.register_abm(
end
end
meta:set_int("tube_time", tube_time)
-
- -- The machine shuts down if we have nothing to smelt and no tube is connected
- -- or if we have nothing to send with a tube connected.
- if (not output_tube_connected and inv:is_empty("src"))
- or ( output_tube_connected and inv:is_empty("dst")) then
- next_state = 1
+
+ -- The machine shuts down if we have nothing to smelt since we tube stuff
+ -- out while being idle.
+ if inv:is_empty("src") then
+ next_state = 1
end
----------------------
diff --git a/technic/machines/mv/grinder.lua b/technic/machines/mv/grinder.lua
new file mode 100644
index 0000000..84a885a
--- /dev/null
+++ b/technic/machines/mv/grinder.lua
@@ -0,0 +1,293 @@
+-- MV grinder
+
+minetest.register_craft({
+ output = 'technic:mv_grinder',
+ recipe = {
+ {'technic:stainless_steel_ingot', 'technic:grinder', 'technic:stainless_steel_ingot'},
+ {'pipeworks:tube_000000', 'technic:mv_transformer', 'pipeworks:tube_000000'},
+ {'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'},
+ }
+})
+minetest.register_craftitem("technic:mv_grinder", {
+ description = "MV Grinder",
+ stack_max = 99,
+})
+
+local mv_grinder_formspec =
+ "invsize[8,10;]"..
+ "list[current_name;src;3,1;1,1;]"..
+ "list[current_name;dst;5,1;2,2;]"..
+ "list[current_player;main;0,6;8,4;]"..
+ "label[0,0;MV Grinder]"..
+ "list[current_name;upgrade1;1,4;1,1;]"..
+ "list[current_name;upgrade2;2,4;1,1;]"..
+ "label[1,5;Upgrade Slots]"
+
+minetest.register_node(
+"technic:mv_grinder",
+{
+ description = "MV Grinder",
+ tiles = {"technic_mv_grinder_top.png", "technic_mv_grinder_bottom.png", "technic_mv_grinder_side.png",
+ "technic_mv_grinder_side.png", "technic_mv_grinder_side.png", "technic_mv_grinder_front.png"},
+ paramtype2 = "facedir",
+ groups = {cracky=2, tubedevice=1,tubedevice_receiver=1,},
+ tube={insert_object=function(pos,node,stack,direction)
+ local meta=minetest.env:get_meta(pos)
+ local inv=meta:get_inventory()
+ return inv:add_item("src",stack)
+ end,
+ can_insert=function(pos,node,stack,direction)
+ local meta=minetest.env:get_meta(pos)
+ local inv=meta:get_inventory()
+ return inv:room_for_item("src",stack)
+ end,
+ connect_sides = {left=1, right=1, back=1, top=1, bottom=1},
+ },
+ legacy_facedir_simple = true,
+ sounds = default.node_sound_wood_defaults(),
+ on_construct = function(pos)
+ local meta = minetest.env:get_meta(pos)
+ meta:set_string("infotext", "MV Grinder")
+ meta:set_float("technic_mv_power_machine", 1)
+ meta:set_int("tube_time", 0)
+ meta:set_string("formspec", mv_grinder_formspec)
+ local inv = meta:get_inventory()
+ inv:set_size("src", 1)
+ inv:set_size("dst", 4)
+ inv:set_size("upgrade1", 1)
+ inv:set_size("upgrade2", 1)
+ end,
+ can_dig = function(pos,player)
+ local meta = minetest.env:get_meta(pos);
+ local inv = meta:get_inventory()
+ if not inv:is_empty("src") or not inv:is_empty("dst") or not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
+ minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
+ return false
+ else
+ return true
+ end
+ end,
+})
+
+minetest.register_node(
+ "technic:mv_grinder_active",
+ {
+ description = "Grinder",
+ tiles = {"technic_mv_grinder_top.png", "technic_mv_grinder_bottom.png", "technic_mv_grinder_side.png",
+ "technic_mv_grinder_side.png", "technic_mv_grinder_side.png", "technic_mv_grinder_front_active.png"},
+ paramtype2 = "facedir",
+ groups = {cracky=2,tubedevice=1,tubedevice_receiver=1,not_in_creative_inventory=1},
+ tube={ insert_object=function(pos,node,stack,direction)
+ local meta=minetest.env:get_meta(pos)
+ local inv=meta:get_inventory()
+ return inv:add_item("src",stack)
+ end,
+ can_insert=function(pos,node,stack,direction)
+ local meta=minetest.env:get_meta(pos)
+ local inv=meta:get_inventory()
+ return inv:room_for_item("src",stack)
+ end,
+ connect_sides = {left=1, right=1, back=1, top=1, bottom=1},
+ },
+ legacy_facedir_simple = true,
+ sounds = default.node_sound_wood_defaults(),
+ can_dig = function(pos,player)
+ local meta = minetest.env:get_meta(pos);
+ local inv = meta:get_inventory()
+ if not inv:is_empty("src") or not inv:is_empty("dst") or not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
+ minetest.chat_send_player(player:get_player_name(), "Machine cannot be removed because it is not empty");
+ return false
+ else
+ return true
+ end
+ end,
+ -- These three makes sure upgrades are not moved in or out while the grinder is active.
+ allow_metadata_inventory_put = function(pos, listname, index, stack, player)
+ if listname == "src" or listname == "dst" then
+ return 99
+ else
+ return 0 -- Disallow the move
+ end
+ end,
+ allow_metadata_inventory_take = function(pos, listname, index, stack, player)
+ if listname == "src" or listname == "dst" then
+ return 99
+ else
+ return 0 -- Disallow the move
+ end
+ end,
+ allow_metadata_inventory_move = function(pos, from_list, to_list, to_list, to_index, count, player)
+ return 0
+ end,
+ })
+
+local send_grinded_items = function(pos,x_velocity,z_velocity)
+ -- Send items on their way in the pipe system.
+ local meta=minetest.env:get_meta(pos)
+ local inv = meta:get_inventory()
+ local i=0
+ for _,stack in ipairs(inv:get_list("dst")) do
+ i=i+1
+ if stack then
+ local item0=stack:to_table()
+ if item0 then
+ item0["count"]="1"
+ local item1=tube_item({x=pos.x,y=pos.y,z=pos.z},item0)
+ item1:get_luaentity().start_pos = {x=pos.x,y=pos.y,z=pos.z}
+ item1:setvelocity({x=x_velocity, y=0, z=z_velocity})
+ item1:setacceleration({x=0, y=0, z=0})
+ stack:take_item(1);
+ inv:set_stack("dst", i, stack)
+ return
+ end
+ end
+ end
+end
+
+minetest.register_abm(
+ { nodenames = {"technic:mv_grinder","technic:mv_grinder_active"},
+ interval = 1,
+ chance = 1,
+ action = function(pos, node, active_object_count, active_object_count_wider)
+ -- Run a machine through its states. Takes the same arguments as the ABM action
+ -- and adds the machine's states and any extra data which is needed by the machine.
+ -- A machine is characterized by running through a set number of states (usually 2:
+ -- Idle and active) in some order. A state decides when to move to the next one
+ -- and the machine only changes state if it is powered correctly.
+ -- The machine will automatically shut down if disconnected from power in some fashion.
+ local meta = minetest.env:get_meta(pos)
+ local eu_input = meta:get_int("MV_EU_input")
+ local state = meta:get_int("state")
+ local next_state = state
+
+ -- Machine information
+ local machine_name = "MV Grinder"
+ local machine_node = "technic:mv_grinder"
+ local machine_state_demand = { 50, 600, 450, 300 }
+
+ -- Setup meta data if it does not exist. state is used as an indicator of this
+ if state == 0 then
+ meta:set_int("state", 1)
+ meta:set_int("MV_EU_demand", machine_state_demand[1])
+ meta:set_int("MV_EU_input", 0)
+ return
+ end
+
+ -- Power off automatically if no longer connected to a switching station
+ technic.switching_station_timeout_count(pos, "MV")
+
+ -- State machine
+ if eu_input == 0 then
+ -- unpowered - go idle
+ hacky_swap_node(pos, machine_node)
+ meta:set_string("infotext", machine_name.." Unpowered")
+ next_state = 1
+ elseif eu_input == machine_state_demand[state] then
+ -- Powered - do the state specific actions
+
+ local inv = meta:get_inventory()
+ local empty = inv:is_empty("src")
+
+ -- get the names of the upgrades
+ local upg_item1
+ local upg_item1_name=""
+ local upg_item2
+ local upg_item2_name=""
+ local srcstack = inv:get_stack("upgrade1", 1)
+ if srcstack then upg_item1=srcstack:to_table() end
+ srcstack = inv:get_stack("upgrade2", 1)
+ if srcstack then upg_item2=srcstack:to_table() end
+ if upg_item1 then upg_item1_name=upg_item1.name end
+ if upg_item2 then upg_item2_name=upg_item2.name end
+
+ -- Save some power by installing battery upgrades. Fully upgraded makes this
+ -- furnace use the same amount of power as the LV version
+ local EU_saving_upgrade = 0
+ if upg_item1_name=="technic:battery" then EU_saving_upgrade = EU_saving_upgrade + 1 end
+ if upg_item2_name=="technic:battery" then EU_saving_upgrade = EU_saving_upgrade + 1 end
+
+ -- Tube loading speed can be upgraded using control logic units
+ local tube_speed_upgrade = 0
+ if upg_item1_name=="technic:control_logic_unit" then tube_speed_upgrade = tube_speed_upgrade + 1 end
+ if upg_item2_name=="technic:control_logic_unit" then tube_speed_upgrade = tube_speed_upgrade + 1 end
+
+ -- Handle pipeworks (consumes tube_speed_upgrade)
+ local pos1={x=pos.x, y=pos.y, z=pos.z}
+ local x_velocity=0
+ local z_velocity=0
+
+ -- Output is on the left side of the furnace
+ if node.param2==3 then pos1.z=pos1.z-1 z_velocity =-1 end
+ if node.param2==2 then pos1.x=pos1.x-1 x_velocity =-1 end
+ if node.param2==1 then pos1.z=pos1.z+1 z_velocity = 1 end
+ if node.param2==0 then pos1.x=pos1.x+1 x_velocity = 1 end
+
+ local output_tube_connected = false
+ local meta1 = minetest.env:get_meta(pos1)
+ if meta1:get_int("tubelike") == 1 then
+ output_tube_connected=true
+ end
+ tube_time = meta:get_int("tube_time")
+ tube_time = tube_time + tube_speed_upgrade
+ if tube_time > 3 then
+ tube_time = 0
+ if output_tube_connected then
+ send_grinded_items(pos,x_velocity,z_velocity)
+ end
+ end
+ meta:set_int("tube_time", tube_time)
+
+ -- The machine shuts down if we have nothing to smelt since we tube stuff
+ -- out while being idle.
+ if inv:is_empty("src") then
+ next_state = 1
+ end
+
+ if state == 1 then
+ hacky_swap_node(pos, machine_node)
+ meta:set_string("infotext", machine_name.." Idle")
+
+ local result = technic.get_grinder_recipe(inv:get_stack("src", 1))
+ if not empty and result and inv:room_for_item("dst",result) then
+ meta:set_int("src_time", 0)
+ next_state = 2+EU_saving_upgrade
+ end
+
+ elseif state == 2 or state == 3 or state == 4 then
+ hacky_swap_node(pos, machine_node.."_active")
+ meta:set_string("infotext", machine_name.." Active")
+
+ if empty then
+ next_state = 1
+ else
+ meta:set_int("src_time", meta:get_int("src_time") + 1)
+ if meta:get_int("src_time") == 4 then -- 4 ticks per output
+ -- check if there's room for output in "dst" list
+ local result = technic.get_grinder_recipe(inv:get_stack("src", 1))
+
+ meta:set_int("src_time", 0)
+ if inv:room_for_item("dst",result) then
+ -- take stuff from "src" list
+ srcstack = inv:get_stack("src", 1)
+ srcstack:take_item()
+ inv:set_stack("src", 1, srcstack)
+ -- Put result in "dst" list
+ inv:add_item("dst", result)
+ else
+ -- all full: go idle
+ next_state = 1
+ end
+ end
+ end
+ end
+ end
+ -- Change state?
+ if next_state ~= state then
+ meta:set_int("MV_EU_demand", machine_state_demand[next_state])
+ meta:set_int("state", next_state)
+ end
+ end
+})
+
+technic.register_MV_machine ("technic:mv_grinder","RE")
+technic.register_MV_machine ("technic:mv_grinder_active","RE") \ No newline at end of file
diff --git a/technic/machines/mv/init.lua b/technic/machines/mv/init.lua
index 1e1147c..d4328ce 100644
--- a/technic/machines/mv/init.lua
+++ b/technic/machines/mv/init.lua
@@ -5,6 +5,7 @@ dofile(path.."/battery_box.lua")
dofile(path.."/solar_array.lua")
dofile(path.."/electric_furnace.lua")
dofile(path.."/alloy_furnace.lua")
+dofile(path.."/grinder.lua")
-- The power radiator supplies appliances with inductive coupled power:
-- Lighting and associated textures is taken directly from VanessaE's homedecor and made electric.
diff --git a/technic/machines/other/deployer.lua b/technic/machines/other/deployer.lua
deleted file mode 100644
index c5dba2a..0000000
--- a/technic/machines/other/deployer.lua
+++ /dev/null
@@ -1,113 +0,0 @@
-minetest.register_craft({
- output = 'technic:deployer_off 1',
- recipe = {
- {'default:wood', 'default:chest','default:wood'},
- {'default:stone', 'mesecons:piston','default:stone'},
- {'default:stone', 'mesecons:mesecon','default:stone'},
-
- }
-})
-
-deployer_signal_on = function(pos, node)
- local pos1={}
- pos1.x=pos.x
- pos1.y=pos.y
- pos1.z=pos.z
- if node.param2==3 then pos1.x=pos1.x+1 end
- if node.param2==2 then pos1.z=pos1.z+1 end
- if node.param2==1 then pos1.x=pos1.x-1 end
- if node.param2==0 then pos1.z=pos1.z-1 end
-
- if node.name == "technic:deployer_off" then
- local node1=minetest.env:get_node(pos1)
- if node1.name == "air" then
- hacky_swap_node(pos,"technic:deployer_on")
- nodeupdate(pos)
- local meta = minetest.env:get_meta(pos);
- local inv = meta:get_inventory()
- local i=0
- for _,stack in ipairs(inv:get_list("main")) do
- i=i+1
- if stack:get_name() ~=nil and minetest.registered_nodes[stack:get_name()]~=nil then
- node1={name=stack:get_name(), param1=0, param2=node.param2}
- minetest.env:place_node(pos1,node1)
- stack:take_item(1);
- inv:set_stack("main", i, stack)
- return
- end
- end
- end
- end
-end
-
-deployer_signal_off = function(pos, node)
- if node.name == "technic:deployer_on" then
- hacky_swap_node(pos,"technic:deployer_off")
- nodeupdate(pos)
- end
-end
-
-minetest.register_node("technic:deployer_off", {
- description = "Deployer",
- tile_images = {"technic_deployer_top.png","technic_deployer_bottom.png","technic_deployer_side2.png","technic_deployer_side1.png",
- "technic_deployer_back.png","technic_deployer_front_off.png"},
- is_ground_content = true,
- paramtype2 = "facedir",
- groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2,tubedevice=1, tubedevice_receiver=1},
- mesecons = {effector={action_on=deployer_signal_on}},
- tube={insert_object=function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
- local inv=meta:get_inventory()
- return inv:add_item("main",stack)
- end,
- can_insert=function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
- local inv=meta:get_inventory()
- return inv:room_for_item("main",stack)
- end,
- input_inventory="main"},
- sounds = default.node_sound_stone_defaults(),
- on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
- meta:set_string("formspec",
- "invsize[8,9;]"..
- "label[0,0;Deployer]"..
- "list[current_name;main;4,1;3,3;]"..
- "list[current_player;main;0,5;8,4;]")
- meta:set_string("infotext", "Deployer")
- local inv = meta:get_inventory()
- inv:set_size("main", 3*3)
- end,
-
- can_dig = function(pos,player)
- local meta = minetest.env:get_meta(pos);
- local inv = meta:get_inventory()
- if not inv:is_empty("main") then
- return false
- end
- return true
- end,
-
-})
-
-minetest.register_node("technic:deployer_on", {
- description = "Deployer",
- tile_images = {"technic_deployer_top.png","technic_deployer_bottom.png","technic_deployer_side2.png","technic_deployer_side1.png",
- "technic_deployer_back.png","technic_deployer_front_on.png"},
- is_ground_content = true,
- paramtype2 = "facedir",
- groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2,tubedevice=1, tubedevice_receiver=1,not_in_creative_inventory=1},
- mesecons = {effector={action_off=deployer_signal_off}},
- tube={insert_object=function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
- local inv=meta:get_inventory()
- return inv:add_item("main",stack)
- end,
- can_insert=function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
- local inv=meta:get_inventory()
- return inv:room_for_item("main",stack)
- end,
- input_inventory="main"},
- sounds = default.node_sound_stone_defaults(),
-})
diff --git a/technic/machines/other/init.lua b/technic/machines/other/init.lua
index 766e0eb..e9d30a4 100644
--- a/technic/machines/other/init.lua
+++ b/technic/machines/other/init.lua
@@ -2,7 +2,5 @@ local path = technic.modpath.."/machines/other"
-- mesecons and tubes related
dofile(path.."/injector.lua")
-dofile(path.."/node_breaker.lua")
-dofile(path.."/deployer.lua")
dofile(path.."/constructor.lua")
dofile(path.."/frames.lua")
diff --git a/technic/machines/other/node_breaker.lua b/technic/machines/other/node_breaker.lua
deleted file mode 100644
index 06de700..0000000
--- a/technic/machines/other/node_breaker.lua
+++ /dev/null
@@ -1,89 +0,0 @@
-minetest.register_craft({
- output = 'technic:nodebreaker_off 1',
- recipe = {
- {'default:wood', 'default:pick_mese','default:wood'},
- {'default:stone', 'mesecons:piston','default:stone'},
- {'default:stone', 'mesecons:mesecon','default:stone'},
-
- }
-})
-
-node_breaker_on = function(pos, node)
- if node.name == "technic:nodebreaker_off" then
- hacky_swap_node(pos,"technic:nodebreaker_on")
- break_node (pos,node.param2)
- nodeupdate(pos)
- end
-end
-
-node_breaker_off = function(pos, node)
- if node.name == "technic:nodebreaker_on" then
- hacky_swap_node(pos,"technic:nodebreaker_off")
- nodeupdate(pos)
- end
-end
-
-minetest.register_node("technic:nodebreaker_off", {
- description = "Node Breaker",
- tile_images = {"technic_nodebreaker_top_off.png","technic_nodebreaker_bottom_off.png","technic_nodebreaker_side2_off.png","technic_nodebreaker_side1_off.png",
- "technic_nodebreaker_back.png","technic_nodebreaker_front_off.png"},
- is_ground_content = true,
- paramtype2 = "facedir",
- groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2,tubedevice=1},
- mesecons= {effector={action_on=node_breaker_on, action_off=node_breaker_off}},
- sounds = default.node_sound_stone_defaults(),
- on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
- end,
-
-})
-
-minetest.register_node("technic:nodebreaker_on", {
- description = "Node Breaker",
- tile_images = {"technic_nodebreaker_top_on.png","technic_nodebreaker_bottom_on.png","technic_nodebreaker_side2_on.png","technic_nodebreaker_side1_on.png",
- "technic_nodebreaker_back.png","technic_nodebreaker_front_on.png"},
- mesecons= {effector={action_on=node_breaker_on, action_off=node_breaker_off}},
- is_ground_content = true,
- paramtype2 = "facedir",
- groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2,tubedevice=1,not_in_creative_inventory=1},
- sounds = default.node_sound_stone_defaults(),
-})
-
-
-function break_node (pos,n_param)
- local pos1={}
- local pos2={}
- pos1.x=pos.x
- pos1.y=pos.y
- pos1.z=pos.z
- pos2.x=pos.x
- pos2.y=pos.y
- pos2.z=pos.z
-
- --param2 3=x+ 1=x- 2=z+ 0=z-
- local x_velocity=0
- local z_velocity=0
-
- if n_param==3 then pos2.x=pos2.x+1 pos1.x=pos1.x-1 x_velocity=-1 end
- if n_param==2 then pos2.z=pos2.z+1 pos1.z=pos1.z-1 z_velocity=-1 end
- if n_param==1 then pos2.x=pos2.x-1 pos1.x=pos1.x+1 x_velocity=1 end
- if n_param==0 then pos2.z=pos2.z-1 pos1.x=pos1.z+1 z_velocity=1 end
-
- local node=minetest.env:get_node(pos2)
- if node.name == "air" then return nil end
- if node.name == "default:lava_source" then return nil end
- if node.name == "default:lava_flowing" then return nil end
- if node.name == "default:water_source" then minetest.env:remove_node(pos2) return nil end
- if node.name == "default:water_flowing" then minetest.env:remove_node(pos2) return nil end
- if node.name == "ignore" then minetest.env:remove_node(pos2) return nil end
- local drops = minetest.get_node_drops(node.name, "default:pick_mese")
- local _, dropped_item
- for _, dropped_item in ipairs(drops) do
- local item1=tube_item({x=pos.x,y=pos.y,z=pos.z},dropped_item)
- item1:get_luaentity().start_pos = {x=pos.x,y=pos.y,z=pos.z}
- item1:setvelocity({x=x_velocity, y=0, z=z_velocity})
- item1:setacceleration({x=0, y=0, z=0})
- end
- minetest.env:remove_node(pos2)
-end
-
diff --git a/technic/register_machine_and_tool.lua b/technic/register_machine_and_tool.lua
index b7d039a..6ea361d 100644
--- a/technic/register_machine_and_tool.lua
+++ b/technic/register_machine_and_tool.lua
@@ -1,9 +1,15 @@
-- This file includes the functions and data structures for registering machines and tools for LV, MV, HV types.
-- We use the technic namespace for these functions and data to avoid eventual conflict.
+-- register power tools here
+technic.power_tools = {}
+technic.register_power_tool = function(craftitem,max_charge)
+ technic.power_tools[craftitem] = max_charge
+ end
+
-- register LV machines here
technic.LV_machines = {}
-technic.LV_power_tools = {}
+
technic.register_LV_machine = function(nodename,type)
technic.LV_machines[nodename] = type
end
@@ -12,10 +18,6 @@ technic.unregister_LV_machine = function(nodename,type)
technic.LV_machines[nodename] = nil
end
-technic.register_LV_power_tool = function(craftitem,max_charge)
- technic.LV_power_tools[craftitem] = max_charge
- end
-
-- register MV machines here
technic.MV_machines = {}
technic.MV_power_tools = {}
@@ -27,10 +29,6 @@ technic.unregister_MV_machine = function(nodename)
technic.MV_machines[nodename] = nil
end
-technic.register_MV_power_tool = function(craftitem,max_charge)
- technic.MV_power_tools[craftitem] = max_charge
- end
-
-- register HV machines here
technic.HV_machines = {}
technic.HV_power_tools = {}
@@ -42,11 +40,6 @@ technic.unregister_HV_machine = function(nodename)
technic.HV_machines[nodename] = nil
end
-technic.register_HV_power_tool = function(craftitem,max_charge)
- technic.HV_power_tools[craftitem] = max_charge
- end
-
-
-- Utility functions. Not sure exactly what they do.. water.lua uses the two first.
function technic.get_RE_item_load (load1,max_load)
if load1==0 then load1=65535 end
diff --git a/technic/textures/technic_carbon_cloth.png b/technic/textures/technic_carbon_cloth.png
new file mode 100644
index 0000000..65a6dab
--- /dev/null
+++ b/technic/textures/technic_carbon_cloth.png
Binary files differ
diff --git a/technic/textures/technic_carbon_plate.png b/technic/textures/technic_carbon_plate.png
new file mode 100644
index 0000000..5da83b8
--- /dev/null
+++ b/technic/textures/technic_carbon_plate.png
Binary files differ
diff --git a/technic/textures/technic_composite_plate.png b/technic/textures/technic_composite_plate.png
new file mode 100644
index 0000000..79b7b8d
--- /dev/null
+++ b/technic/textures/technic_composite_plate.png
Binary files differ
diff --git a/technic/textures/technic_compressor_back.png b/technic/textures/technic_compressor_back.png
new file mode 100644
index 0000000..11286e3
--- /dev/null
+++ b/technic/textures/technic_compressor_back.png
Binary files differ
diff --git a/technic/textures/technic_compressor_bottom.png b/technic/textures/technic_compressor_bottom.png
new file mode 100644
index 0000000..886f27e
--- /dev/null
+++ b/technic/textures/technic_compressor_bottom.png
Binary files differ
diff --git a/technic/textures/technic_compressor_front.png b/technic/textures/technic_compressor_front.png
new file mode 100644
index 0000000..007d6de
--- /dev/null
+++ b/technic/textures/technic_compressor_front.png
Binary files differ
diff --git a/technic/textures/technic_compressor_front_active.png b/technic/textures/technic_compressor_front_active.png
new file mode 100644
index 0000000..b3d27c0
--- /dev/null
+++ b/technic/textures/technic_compressor_front_active.png
Binary files differ
diff --git a/technic/textures/technic_compressor_side.png b/technic/textures/technic_compressor_side.png
new file mode 100644
index 0000000..87acda6
--- /dev/null
+++ b/technic/textures/technic_compressor_side.png
Binary files differ
diff --git a/technic/textures/technic_compressor_top.png b/technic/textures/technic_compressor_top.png
new file mode 100644
index 0000000..786b859
--- /dev/null
+++ b/technic/textures/technic_compressor_top.png
Binary files differ
diff --git a/technic/textures/technic_copper_plate.png b/technic/textures/technic_copper_plate.png
new file mode 100644
index 0000000..99a49c8
--- /dev/null
+++ b/technic/textures/technic_copper_plate.png
Binary files differ
diff --git a/technic/textures/technic_graphite.png b/technic/textures/technic_graphite.png
new file mode 100644
index 0000000..00cd0ee
--- /dev/null
+++ b/technic/textures/technic_graphite.png
Binary files differ
diff --git a/technic/textures/technic_mixed_metal_ingot.png b/technic/textures/technic_mixed_metal_ingot.png
new file mode 100644
index 0000000..80283c6
--- /dev/null
+++ b/technic/textures/technic_mixed_metal_ingot.png
Binary files differ
diff --git a/technic/tools/chainsaw.lua b/technic/tools/chainsaw.lua
index ae0c30c..891f4e4 100644
--- a/technic/tools/chainsaw.lua
+++ b/technic/tools/chainsaw.lua
@@ -3,7 +3,7 @@ local chainsaw_max_charge = 30000 -- 30000 - Maximum charge of the saw
local chainsaw_charge_per_node = 12 -- 12 - Gives 2500 nodes on a single charge (about 50 complete normal trees)
local chainsaw_leaves = true -- true - Cut down entire trees, leaves and all
-technic.register_LV_power_tool ("technic:chainsaw",chainsaw_max_charge)
+technic.register_power_tool ("technic:chainsaw",chainsaw_max_charge)
minetest.register_tool("technic:chainsaw", {
description = "Chainsaw",
diff --git a/technic/tools/flashlight.lua b/technic/tools/flashlight.lua
index 5f3ea96..f591894 100644
--- a/technic/tools/flashlight.lua
+++ b/technic/tools/flashlight.lua
@@ -1,7 +1,7 @@
-- original code comes from walkin_light mod by Echo http://minetest.net/forum/viewtopic.php?id=2621
local flashlight_max_charge=30000
-technic.register_LV_power_tool ("technic:flashlight",flashlight_max_charge)
+technic.register_power_tool ("technic:flashlight",flashlight_max_charge)
minetest.register_tool("technic:flashlight", {
description = "Flashlight",
diff --git a/technic/tools/mining_drill.lua b/technic/tools/mining_drill.lua
index 6df9e97..860127f 100644
--- a/technic/tools/mining_drill.lua
+++ b/technic/tools/mining_drill.lua
@@ -210,7 +210,7 @@ function drill_dig_it4 (pos,player)
drill_dig_it0 (pos,player)
end
-technic.register_MV_power_tool ("technic:mining_drill",mining_drill_max_charge)
+technic.register_power_tool ("technic:mining_drill",mining_drill_max_charge)
minetest.register_tool("technic:mining_drill", {
description = "Mining Drill Mk1",
inventory_image = "technic_mining_drill.png",
@@ -243,10 +243,10 @@ minetest.register_tool("technic:mining_drill_mk2", {
return itemstack
end,
})
-technic.register_HV_power_tool ("technic:mining_drill_mk2",mining_drill_mk2_max_charge)
+technic.register_power_tool ("technic:mining_drill_mk2",mining_drill_mk2_max_charge)
for i=1,4,1 do
-technic.register_HV_power_tool ("technic:mining_drill_mk2_"..i,mining_drill_mk2_max_charge)
+technic.register_power_tool ("technic:mining_drill_mk2_"..i,mining_drill_mk2_max_charge)
minetest.register_tool("technic:mining_drill_mk2_"..i, {
description = "Mining Drill Mk2 in Mode "..i,
inventory_image = "technic_mining_drill_mk2.png^technic_tool_mode"..i..".png",
@@ -267,10 +267,10 @@ minetest.register_tool("technic:mining_drill_mk3", {
return itemstack
end,
})
-technic.register_HV_power_tool ("technic:mining_drill_mk3",mining_drill_mk3_max_charge)
+technic.register_power_tool ("technic:mining_drill_mk3",mining_drill_mk3_max_charge)
for i=1,5,1 do
-technic.register_HV_power_tool ("technic:mining_drill_mk3_"..i,mining_drill_mk3_max_charge)
+technic.register_power_tool ("technic:mining_drill_mk3_"..i,mining_drill_mk3_max_charge)
minetest.register_tool("technic:mining_drill_mk3_"..i, {
description = "Mining Drill Mk3 in Mode "..i,
inventory_image = "technic_mining_drill_mk3.png^technic_tool_mode"..i..".png",
diff --git a/technic/tools/mining_laser_mk1.lua b/technic/tools/mining_laser_mk1.lua
index 8b89131..245725f 100644
--- a/technic/tools/mining_laser_mk1.lua
+++ b/technic/tools/mining_laser_mk1.lua
@@ -1,5 +1,5 @@
local laser_mk1_max_charge=40000
-technic.register_LV_power_tool ("technic:laser_mk1",laser_mk1_max_charge)
+technic.register_power_tool ("technic:laser_mk1",laser_mk1_max_charge)
local laser_shoot = function(itemstack, player, pointed_thing)
local laser_straight_mode=0
diff --git a/technic/tools/sonic_screwdriver.lua b/technic/tools/sonic_screwdriver.lua
index 00922f7..a290c94 100644
--- a/technic/tools/sonic_screwdriver.lua
+++ b/technic/tools/sonic_screwdriver.lua
@@ -1,5 +1,5 @@
local sonic_screwdriver_max_charge=15000
-technic.register_HV_power_tool ("technic:sonic_screwdriver",sonic_screwdriver_max_charge)
+technic.register_power_tool ("technic:sonic_screwdriver",sonic_screwdriver_max_charge)
minetest.register_tool("technic:sonic_screwdriver", {
description = "Sonic Screwdriver",
diff --git a/technic_chests/chest_commons.lua b/technic_chests/chest_commons.lua
index 7786496..92827ab 100644
--- a/technic_chests/chest_commons.lua
+++ b/technic_chests/chest_commons.lua
@@ -11,8 +11,10 @@ tubes_properties = {insert_object=function(pos,node,stack,direction)
local inv=meta:get_inventory()
return inv:room_for_item("main",stack)
end,
- input_inventory="main"}
-
+ input_inventory="main",
+ connect_sides = {left=1, right=1, front=1, back=1, top=1, bottom=1},
+}
+
chest_can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
@@ -71,8 +73,5 @@ def_on_metadata_inventory_take = function(pos, listname, index, stack, player)
end
function has_locked_chest_privilege(meta, player)
- if player:get_player_name() ~= meta:get_string("owner") then
- return false
- end
- return true
+ return player:get_player_name() == meta:get_string("owner")
end
diff --git a/unified_inventory/api.lua b/unified_inventory/api.lua
index e386a76..c059c87 100644
--- a/unified_inventory/api.lua
+++ b/unified_inventory/api.lua
@@ -22,7 +22,15 @@ local homepos = {}
unified_inventory.home_filename = minetest.get_worldpath()..'/unified_inventory_home'
-- Create detached creative inventory after loading all mods
+-- Also 2nd attempt to disable default creative mod
minetest.after(0.01, function()
+
+ if creative_inventory then
+ creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
+ return
+ end
+ end
+
unified_inventory.items_list = {}
for name,def in pairs(minetest.registered_items) do
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0)
@@ -233,6 +241,9 @@ unified_inventory.get_formspec = function(player,page)
end
if craft.type == "extracting" then
method="Extracting"
+ end
+ if craft.type == "compressing" then
+ method="Compressing"
end
formspec = formspec.."label[6,3;"..method.."]"
end
@@ -565,7 +576,8 @@ unified_inventory.update_recipe = function(player, stack_name, alternate)
if craft.type == "cooking" or
craft.type == "fuel" or
craft.type == "grinding" or
- craft.type == "extracting" then
+ craft.type == "extracting" or
+ craft.type == "compressing" then
def=unified_inventory.find_item_def(craft["items"][1])
if def then
inv:set_stack("build", 1, def)
diff --git a/unified_inventory/depends.txt b/unified_inventory/depends.txt
index 45b4a33..8b13789 100644
--- a/unified_inventory/depends.txt
+++ b/unified_inventory/depends.txt
@@ -1,2 +1 @@
-creative
diff --git a/unified_inventory/textures/ui_hv_battery_box.png b/unified_inventory/textures/ui_hv_battery_box.png
new file mode 100644
index 0000000..61c55de
--- /dev/null
+++ b/unified_inventory/textures/ui_hv_battery_box.png
Binary files differ
diff --git a/unified_inventory/textures/ui_mv_battery_box.png b/unified_inventory/textures/ui_mv_battery_box.png
new file mode 100644
index 0000000..61c55de
--- /dev/null
+++ b/unified_inventory/textures/ui_mv_battery_box.png
Binary files differ