boiler bug fixes,

power distribution improved,
power line nodes for Minecart protection added
This commit is contained in:
Joachim Stolberg 2019-07-07 22:05:37 +02:00
parent a9eb4640a0
commit ca413a4976
6 changed files with 22 additions and 7 deletions

View File

@ -11,7 +11,7 @@ Textures: CC BY-SA 3.0
### Dependencies ### Dependencies
Required: default, tubelib2, basic_materials, bucket, stairs Required: default, tubelib2, basic_materials, bucket, stairs
Optional: unified_inventory, wielded_light Optional: unified_inventory, wielded_light, minecart
Highly recommended: signs_bot, minecart Highly recommended: signs_bot, minecart
### History ### History

View File

@ -233,6 +233,7 @@ minetest.register_node("techage:coalboiler_top", {
on_timer = node_timer, on_timer = node_timer,
allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_take = allow_metadata_inventory_take, allow_metadata_inventory_take = allow_metadata_inventory_take,
allow_metadata_inventory_move = function(pos) return 0 end,
on_receive_fields = on_receive_fields, on_receive_fields = on_receive_fields,
on_rightclick = on_rightclick, on_rightclick = on_rightclick,

View File

@ -1,4 +1,4 @@
name = techage name = techage
depends = default,tubelib2,basic_materials,bucket,stairs depends = default,tubelib2,basic_materials,bucket,stairs
optional_depends = unified_inventory,wielded_light optional_depends = unified_inventory,wielded_light,minecart
description = Techage, go through 4 tech ages in search of wealth and power! description = Techage, go through 4 tech ages in search of wealth and power!

View File

@ -315,13 +315,17 @@ end
function techage.power.provide_power(pos, provide) function techage.power.provide_power(pos, provide)
local mem = tubelib2.get_mem(pos) local mem = tubelib2.get_mem(pos)
if mem.is_master then if mem.is_master then
accounting(mem) --nothing todo
trigger_lamps(pos, mem)
elseif mem.master_pos then elseif mem.master_pos then
mem = tubelib2.get_mem(mem.master_pos) mem = tubelib2.get_mem(mem.master_pos)
else else
return 0 return 0
end end
if (mem.next_cycle or 0) < minetest.get_us_time() then
accounting(mem)
trigger_lamps(pos, mem)
mem.next_cycle = minetest.get_us_time() + 2000000 -- 2s
end
-- for next cycle -- for next cycle
mem.available1 = (mem.available1 or 0) + provide mem.available1 = (mem.available1 or 0) + provide
-- current cycle -- current cycle

View File

@ -209,8 +209,17 @@ minetest.register_craft({
minetest.register_craft({ minetest.register_craft({
output = "techage:power_pole", output = "techage:power_pole",
recipe = { recipe = {
{"default:stick", "techage:power_line", "default:stick"}, {"default:stick", "techage:power_lineS", "default:stick"},
{"techage:power_line", "default:copper_ingot", "techage:power_line"}, {"techage:power_lineS", "default:copper_ingot", "techage:power_lineS"},
{"default:stick", "techage:power_line", "default:stick"}, {"default:stick", "techage:power_lineS", "default:stick"},
}, },
}) })
if minetest.global_exists("minecart") and minecart.register_protected_node then
minecart.register_protected_node("techage:power_line")
minecart.register_protected_node("techage:power_lineS")
minecart.register_protected_node("techage:power_lineA")
minecart.register_protected_node("techage:power_pole")
minecart.register_protected_node("default:fence_wood")
end

View File

@ -241,6 +241,7 @@ minetest.register_node("techage:boiler2", {
on_timer = node_timer, on_timer = node_timer,
allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_take = allow_metadata_inventory_take, allow_metadata_inventory_take = allow_metadata_inventory_take,
allow_metadata_inventory_move = function(pos) return 0 end,
on_receive_fields = on_receive_fields, on_receive_fields = on_receive_fields,
on_rightclick = on_rightclick, on_rightclick = on_rightclick,