Merge pull request #79 from metalstache/master
Fix recipe and battery box compatibility
This commit is contained in:
commit
e08ee75990
316
wrench/init.lua
316
wrench/init.lua
@ -1,44 +1,221 @@
|
|||||||
--[""] = {name="", lists={}, metas={}},
|
--[[
|
||||||
|
Wrench mod
|
||||||
|
Adds a wrench that allows the player to pickup nodes that contain an inventory with items or metadata that needs perserving.
|
||||||
|
The wrench has the same tool capability as the normal hand.
|
||||||
|
To pickup a node simply right click on it. If the node contains a formspec, you will need to shift+right click instead.
|
||||||
|
supported_nodes
|
||||||
|
This table stores all nodes that are compatible with the wrench mod.
|
||||||
|
Syntax:
|
||||||
|
[<node name>] = {
|
||||||
|
name = "wrench:<temporary node name>",
|
||||||
|
lists = {"<inventory list name>"},
|
||||||
|
metas = {{string="<meta name>"},{int="<meta name>"},{float="<meta name>"}},
|
||||||
|
owner_protection[optional] = 1,
|
||||||
|
store_meta_always[optional] = 1,
|
||||||
|
}
|
||||||
|
<temporary node name> - can be anything as long as it is unique
|
||||||
|
[optional] - parameters do not have to be included
|
||||||
|
owner_protection - nodes that are protected by owner requirements (Ex. locked chests)
|
||||||
|
store_meta_always - when nodes are broken this ensures metadata and inventory is always stored (Ex. active state for machines)
|
||||||
|
--]]
|
||||||
local supported_nodes = {
|
local supported_nodes = {
|
||||||
["default:chest"] = {name="wrench:default_chest", lists={"main"}, metas={}},
|
["default:chest"] = {
|
||||||
["default:chest_locked"] = {name="wrench:default_chest_locked", lists={"main"}, metas={{string="owner"},{string="infotext"}}},
|
name="wrench:default_chest",
|
||||||
["default:furnace"] = {name="wrench:default_furnace", lists={"fuel", "src", "dst"}, metas={{string="infotext"},{float="fuel_totaltime"},{float="fuel_time"},{float="src_totaltime"},{float="src_time"}}},
|
lists={"main"},
|
||||||
["default:furnace_active"] = {name="wrench:default_furnace", lists={"fuel", "src", "dst"}, metas={{string="infotext"},{float="fuel_totaltime"},{float="fuel_time"},{float="src_totaltime"},{float="src_time"}}},
|
metas={},
|
||||||
["default:sign_wall"] = {name="wrench:default_sing_wall", lists={}, metas={{string="infotext"},{string="text"}}},
|
},
|
||||||
["technic:iron_chest"] = {name="wrench:technic_iron_chest", lists={"main"}, metas={}},
|
["default:chest_locked"] = {
|
||||||
["technic:iron_locked_chest"] = {name="wrench:technic_iron_locked_chest", lists={"main"}, metas={{string="infotext"},{string="owner"}}},
|
name="wrench:default_chest_locked",
|
||||||
["technic:copper_chest"] = {name="wrench:technic_copper_chest", lists={"main"}, metas={}},
|
lists={"main"},
|
||||||
["technic:copper_locked_chest"] = {name="wrench:technic_copper_locked_chest", lists={"main"}, metas={{string="infotext"},{string="owner"}}},
|
metas={{string="owner"},{string="infotext"}},
|
||||||
["technic:silver_chest"] = {name="wrench:technic_silver_chest", lists={"main"}, metas={{string="infotext"},{string="formspec"}}},
|
owner_protection=1,
|
||||||
["technic:silver_locked_chest"] = {name="wrench:technic_silver_locked_chest", lists={"main"}, metas={{string="infotext"},{string="owner"},{string="formspec"}}},
|
},
|
||||||
["technic:gold_chest"] = {name="wrench:technic_gold_chest", lists={"main"}, metas={{string="infotext"},{string="formspec"}}},
|
["default:furnace"] = {
|
||||||
["technic:gold_locked_chest"] = {name="wrench:technic_gold_locked_chest", lists={"main"}, metas={{string="infotext"},{string="owner"},{string="formspec"}}},
|
name="wrench:default_furnace",
|
||||||
["technic:mithril_chest"] = {name="wrench:technic_mithril_chest", lists={"main"}, metas={{string="infotext"},{string="formspec"}}},
|
lists={"fuel", "src", "dst"},
|
||||||
["technic:mithril_locked_chest"] = {name="wrench:technic_mithril_locked_chest", lists={"main"}, metas={{string="infotext"},{string="owner"},{string="formspec"}}},
|
metas={{string="infotext"},{float="fuel_totaltime"},{float="fuel_time"},{float="src_totaltime"},{float="src_time"}},
|
||||||
["technic:battery_box"] = {name="wrench:technic_battery_box", lists={"src", "dst"}, metas={{string="infotext"},{string="formspec"},{int="LV_EU_demand"},{int="LV_EU_supply"},{int="LV_EU_input"},{int="internal_EU_charge"},{float="last_side_shown"}}},
|
},
|
||||||
["technic:mv_battery_box"] = {name="wrench:technic_mv_battery_box", lists={"src", "dst"}, metas={{string="infotext"},{string="formspec"},{int="MV_EU_demand"},{int="MV_EU_supply"},{int="MV_EU_input"},{int="internal_EU_charge"},{float="last_side_shown"}}},
|
["default:furnace_active"] = {
|
||||||
["technic:hv_battery_box"] = {name="wrench:technic_hv_battery_box", lists={"src", "dst"}, metas={{string="infotext"},{string="formspec"},{int="HV_EU_demand"},{int="HV_EU_supply"},{int="HV_EU_input"},{int="internal_EU_charge"},{float="last_side_shown"}}},
|
name="wrench:default_furnace",
|
||||||
["technic:electric_furnace"] = {name="wrench:technic_electric_furnace", lists={"src", "dst"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"}}},
|
lists={"fuel", "src", "dst"},
|
||||||
["technic:electric_furnace_active"] = {name="wrench:technic_electric_furnace_active", lists={"src", "dst"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"}}},
|
metas={{string="infotext"},{float="fuel_totaltime"},{float="fuel_time"},{float="src_totaltime"},{float="src_time"}},
|
||||||
["technic:mv_electric_furnace"] = {name="wrench:technic_mv_electric_furnace", lists={"src", "dst", "upgrade1", "upgrade2"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="MV_EU_demand"},{int="MV_EU_input"},{int="tube_time"},{int="src_time"}}},
|
store_meta_always=1,
|
||||||
["technic:mv_electric_furnace_active"] = {name="wrench:technic_mv_electric_furnace_active", lists={"src", "dst", "upgrade1", "upgrade2"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="MV_EU_demand"},{int="MV_EU_input"},{int="tube_time"},{int="src_time"}}},
|
},
|
||||||
["technic:coal_alloy_furnace"] = {name="wrench:technic_coal_alloy_furnace", lists={"fuel", "src", "src2", "dst"}, metas={{string="infotext"},{float="fuel_totaltime"},{float="fuel_time"},{float="src_totaltime"},{float="src_time"}}},
|
["default:sign_wall"] = {
|
||||||
["technic:coal_alloy_furnace_active"] = {name="wrench:technic_coal_alloy_furnace_active", lists={"fuel", "src", "src2", "dst"}, metas={{string="infotext"},{float="fuel_totaltime"},{float="fuel_time"},{float="src_totaltime"},{float="src_time"}}},
|
name="wrench:default_sing_wall",
|
||||||
["technic:alloy_furnace"] = {name="wrench:technic_alloy_furnace", lists={"src", "src2", "dst"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="tube_time"},{int="src_time"}}},
|
lists={},
|
||||||
["technic:alloy_furnace_active"] = {name="wrench:technic_alloy_furnace_active", lists={"src", "src2", "dst"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="tube_time"},{int="src_time"}}},
|
metas={{string="infotext"},{string="text"}},
|
||||||
["technic:mv_alloy_furnace"] = {name="wrench:technic_mv_alloy_furnace", lists={"src", "src2", "dst", "upgrade1", "upgrade2"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="MV_EU_demand"},{int="MV_EU_input"},{int="tube_time"},{int="src_time"}}},
|
},
|
||||||
["technic:mv_alloy_furnace_active"] = {name="wrench:technic_mv_alloy_furnace_active", lists={"src", "src2", "dst", "upgrade1", "upgrade2"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="MV_EU_demand"},{int="MV_EU_input"},{int="tube_time"},{int="src_time"}}},
|
["technic:iron_chest"] = {
|
||||||
["technic:tool_workshop"] = {name="wrench:technic_tool_workshop", lists={"src"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"}}},
|
name="wrench:technic_iron_chest",
|
||||||
["technic:grinder"] = {name="wrench:technic_grinder", lists={"src", "dst"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"}}},
|
lists={"main"},
|
||||||
["technic:grinder_active"] = {name="wrench:technic_grinder_active", lists={"src", "dst"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"}}},
|
metas={},
|
||||||
["technic:mv_grinder"] = {name="wrench:technic_mv_grinder", lists={"src", "dst", "upgrade1", "upgrade2"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="MV_EU_demand"},{int="MV_EU_input"},{int="tube_time"},{int="src_time"}}},
|
},
|
||||||
["technic:mv_grinder_active"] = {name="wrench:technic_mv_grinder_active", lists={"src", "dst", "upgrade1", "upgrade2"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="MV_EU_demand"},{int="MV_EU_input"},{int="tube_time"},{int="src_time"}}},
|
["technic:iron_locked_chest"] = {
|
||||||
["technic:extractor"] = {name="wrench:technic_extractor", lists={"src", "dst"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"}}},
|
name="wrench:technic_iron_locked_chest",
|
||||||
["technic:extractor_active"] = {name="wrench:technic_extractor_active", lists={"src", "dst"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"}}},
|
lists={"main"},
|
||||||
["technic:compressor"] = {name="wrench:technic_compressor", lists={"src", "dst"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"}}},
|
metas={{string="infotext"},{string="owner"}},
|
||||||
["technic:compressor_active"] = {name="wrench:technic_compressor_active", lists={"src", "dst"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"}}},
|
owner_protection=1,
|
||||||
["technic:cnc"] = {name="wrench:technic_cnc", lists={"src", "dst"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"},{string="cnc_product"}}},
|
},
|
||||||
["technic:cnc_active"] = {name="wrench:technic_cnc_active", lists={"src", "dst"}, metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"},{string="cnc_product"}}},
|
["technic:copper_chest"] = {
|
||||||
|
name="wrench:technic_copper_chest",
|
||||||
|
lists={"main"},
|
||||||
|
metas={},
|
||||||
|
},
|
||||||
|
["technic:copper_locked_chest"] = {
|
||||||
|
name="wrench:technic_copper_locked_chest",
|
||||||
|
lists={"main"},
|
||||||
|
metas={{string="infotext"},{string="owner"}},
|
||||||
|
owner_protection=1,
|
||||||
|
},
|
||||||
|
["technic:silver_chest"] = {
|
||||||
|
name="wrench:technic_silver_chest",
|
||||||
|
lists={"main"},
|
||||||
|
metas={{string="infotext"},{string="formspec"}},
|
||||||
|
},
|
||||||
|
["technic:silver_locked_chest"] = {
|
||||||
|
name="wrench:technic_silver_locked_chest",
|
||||||
|
lists={"main"},
|
||||||
|
metas={{string="infotext"},{string="owner"},{string="formspec"}},
|
||||||
|
owner_protection=1,
|
||||||
|
},
|
||||||
|
["technic:gold_chest"] = {
|
||||||
|
name="wrench:technic_gold_chest",
|
||||||
|
lists={"main"},
|
||||||
|
metas={{string="infotext"},{string="formspec"}},
|
||||||
|
},
|
||||||
|
["technic:gold_locked_chest"] = {
|
||||||
|
name="wrench:technic_gold_locked_chest",
|
||||||
|
lists={"main"},
|
||||||
|
metas={{string="infotext"},{string="owner"},{string="formspec"}},
|
||||||
|
owner_protection=1,
|
||||||
|
},
|
||||||
|
["technic:mithril_chest"] = {
|
||||||
|
name="wrench:technic_mithril_chest",
|
||||||
|
lists={"main"},
|
||||||
|
metas={{string="infotext"},{string="formspec"}},
|
||||||
|
},
|
||||||
|
["technic:mithril_locked_chest"] = {
|
||||||
|
name="wrench:technic_mithril_locked_chest",
|
||||||
|
lists={"main"},
|
||||||
|
metas={{string="infotext"},{string="owner"},{string="formspec"}},
|
||||||
|
owner_protection=1,
|
||||||
|
},
|
||||||
|
["technic:electric_furnace"] = {
|
||||||
|
name="wrench:technic_electric_furnace",
|
||||||
|
lists={"src", "dst"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"}},
|
||||||
|
},
|
||||||
|
["technic:electric_furnace_active"] = {
|
||||||
|
name="wrench:technic_electric_furnace_active",
|
||||||
|
lists={"src", "dst"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"}},
|
||||||
|
store_meta_always=1,
|
||||||
|
},
|
||||||
|
["technic:mv_electric_furnace"] = {
|
||||||
|
name="wrench:technic_mv_electric_furnace",
|
||||||
|
lists={"src", "dst", "upgrade1", "upgrade2"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="MV_EU_demand"},{int="MV_EU_input"},{int="tube_time"},{int="src_time"}},
|
||||||
|
},
|
||||||
|
["technic:mv_electric_furnace_active"] = {
|
||||||
|
name="wrench:technic_mv_electric_furnace_active",
|
||||||
|
lists={"src", "dst", "upgrade1", "upgrade2"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="MV_EU_demand"},{int="MV_EU_input"},{int="tube_time"},{int="src_time"}},
|
||||||
|
store_meta_always=1,
|
||||||
|
},
|
||||||
|
["technic:coal_alloy_furnace"] = {
|
||||||
|
name="wrench:technic_coal_alloy_furnace",
|
||||||
|
lists={"fuel", "src", "src2", "dst"},
|
||||||
|
metas={{string="infotext"},{float="fuel_totaltime"},{float="fuel_time"},{float="src_totaltime"},{float="src_time"}},
|
||||||
|
},
|
||||||
|
["technic:coal_alloy_furnace_active"] = {
|
||||||
|
name="wrench:technic_coal_alloy_furnace_active",
|
||||||
|
lists={"fuel", "src", "src2", "dst"},
|
||||||
|
metas={{string="infotext"},{float="fuel_totaltime"},{float="fuel_time"},{float="src_totaltime"},{float="src_time"}},
|
||||||
|
store_meta_always=1,
|
||||||
|
},
|
||||||
|
["technic:alloy_furnace"] = {
|
||||||
|
name="wrench:technic_alloy_furnace",
|
||||||
|
lists={"src", "src2", "dst"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="tube_time"},{int="src_time"}},
|
||||||
|
},
|
||||||
|
["technic:alloy_furnace_active"] = {
|
||||||
|
name="wrench:technic_alloy_furnace_active",
|
||||||
|
lists={"src", "src2", "dst"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="tube_time"},{int="src_time"}},
|
||||||
|
store_meta_always=1,
|
||||||
|
},
|
||||||
|
["technic:mv_alloy_furnace"] = {
|
||||||
|
name="wrench:technic_mv_alloy_furnace",
|
||||||
|
lists={"src", "src2", "dst", "upgrade1", "upgrade2"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="MV_EU_demand"},{int="MV_EU_input"},{int="tube_time"},{int="src_time"}},
|
||||||
|
},
|
||||||
|
["technic:mv_alloy_furnace_active"] = {
|
||||||
|
name="wrench:technic_mv_alloy_furnace_active",
|
||||||
|
lists={"src", "src2", "dst", "upgrade1", "upgrade2"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="MV_EU_demand"},{int="MV_EU_input"},{int="tube_time"},{int="src_time"}},
|
||||||
|
store_meta_always=1,
|
||||||
|
},
|
||||||
|
["technic:tool_workshop"] = {
|
||||||
|
name="wrench:technic_tool_workshop",
|
||||||
|
lists={"src"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"}},
|
||||||
|
},
|
||||||
|
["technic:grinder"] = {
|
||||||
|
name="wrench:technic_grinder",
|
||||||
|
lists={"src", "dst"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"}},
|
||||||
|
},
|
||||||
|
["technic:grinder_active"] = {
|
||||||
|
name="wrench:technic_grinder_active",
|
||||||
|
lists={"src", "dst"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"}},
|
||||||
|
store_meta_always=1,
|
||||||
|
},
|
||||||
|
["technic:mv_grinder"] = {
|
||||||
|
name="wrench:technic_mv_grinder",
|
||||||
|
lists={"src", "dst", "upgrade1", "upgrade2"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="MV_EU_demand"},{int="MV_EU_input"},{int="tube_time"},{int="src_time"}},
|
||||||
|
},
|
||||||
|
["technic:mv_grinder_active"] = {
|
||||||
|
name="wrench:technic_mv_grinder_active",
|
||||||
|
lists={"src", "dst", "upgrade1", "upgrade2"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="MV_EU_demand"},{int="MV_EU_input"},{int="tube_time"},{int="src_time"}},
|
||||||
|
store_meta_always=1,
|
||||||
|
},
|
||||||
|
["technic:extractor"] = {
|
||||||
|
name="wrench:technic_extractor",
|
||||||
|
lists={"src", "dst"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"}},
|
||||||
|
},
|
||||||
|
["technic:extractor_active"] = {
|
||||||
|
name="wrench:technic_extractor_active",
|
||||||
|
lists={"src", "dst"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"}},
|
||||||
|
store_meta_always=1,
|
||||||
|
},
|
||||||
|
["technic:compressor"] = {
|
||||||
|
name="wrench:technic_compressor",
|
||||||
|
lists={"src", "dst"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"}},
|
||||||
|
},
|
||||||
|
["technic:compressor_active"] = {
|
||||||
|
name="wrench:technic_compressor_active",
|
||||||
|
lists={"src", "dst"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"}},
|
||||||
|
store_meta_always=1,
|
||||||
|
},
|
||||||
|
["technic:cnc"] = {
|
||||||
|
name="wrench:technic_cnc",
|
||||||
|
lists={"src", "dst"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"},{string="cnc_product"}},
|
||||||
|
},
|
||||||
|
["technic:cnc_active"] = {
|
||||||
|
name="wrench:technic_cnc_active",
|
||||||
|
lists={"src", "dst"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="state"},{int="LV_EU_demand"},{int="LV_EU_input"},{int="src_time"},{string="cnc_product"}},
|
||||||
|
store_meta_always=1,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
local chest_mark_colors = {
|
local chest_mark_colors = {
|
||||||
{'_black','Black'},
|
{'_black','Black'},
|
||||||
@ -59,8 +236,38 @@ local chest_mark_colors = {
|
|||||||
{'','None'}
|
{'','None'}
|
||||||
}
|
}
|
||||||
for i=1,15,1 do
|
for i=1,15,1 do
|
||||||
supported_nodes["technic:gold_chest"..chest_mark_colors[i][1]] = {name="wrench:technic_gold_chest"..chest_mark_colors[i][1], lists={"main"}, metas={{string="infotext"},{string="formspec"}}}
|
supported_nodes["technic:gold_chest"..chest_mark_colors[i][1]] = {
|
||||||
supported_nodes["technic:gold_locked_chest"..chest_mark_colors[i][1]] = {name="wrench:technic_gold_locked_chest"..chest_mark_colors[i][1], lists={"main"}, metas={{string="infotext"},{string="owner"},{string="formspec"}}}
|
name="wrench:technic_gold_chest"..chest_mark_colors[i][1],
|
||||||
|
lists={"main"},
|
||||||
|
metas={{string="infotext"},{string="formspec"}},
|
||||||
|
}
|
||||||
|
supported_nodes["technic:gold_locked_chest"..chest_mark_colors[i][1]] = {
|
||||||
|
name="wrench:technic_gold_locked_chest"..chest_mark_colors[i][1],
|
||||||
|
lists={"main"},
|
||||||
|
metas={{string="infotext"},{string="owner"},{string="formspec"}},
|
||||||
|
owner_protection=1,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
for i=0,8,1 do
|
||||||
|
if i==0 then i="" end
|
||||||
|
supported_nodes["technic:battery_box"..i] = {
|
||||||
|
name="wrench:technic_battery_box"..i,
|
||||||
|
lists={"src", "dst"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="LV_EU_demand"},{int="LV_EU_supply"},{int="LV_EU_input"},{int="internal_EU_charge"},{float="last_side_shown"}},
|
||||||
|
store_meta_always=1,
|
||||||
|
}
|
||||||
|
supported_nodes["technic:mv_battery_box"..i] = {
|
||||||
|
name="wrench:technic_mv_battery_box"..i,
|
||||||
|
lists={"src", "dst"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="MV_EU_demand"},{int="MV_EU_supply"},{int="MV_EU_input"},{int="internal_EU_charge"},{float="last_side_shown"}},
|
||||||
|
store_meta_always=1,
|
||||||
|
}
|
||||||
|
supported_nodes["technic:hv_battery_box"..i] = {
|
||||||
|
name="wrench:technic_hv_battery_box"..i,
|
||||||
|
lists={"src", "dst"},
|
||||||
|
metas={{string="infotext"},{string="formspec"},{int="HV_EU_demand"},{int="HV_EU_supply"},{int="HV_EU_input"},{int="internal_EU_charge"},{float="last_side_shown"}},
|
||||||
|
store_meta_always=1,
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local function convert_to_original_name(name)
|
local function convert_to_original_name(name)
|
||||||
@ -83,9 +290,8 @@ for name,info in pairs(supported_nodes) do
|
|||||||
newdef.on_construct = nil
|
newdef.on_construct = nil
|
||||||
newdef.on_destruct = nil
|
newdef.on_destruct = nil
|
||||||
newdef.after_place_node = function(pos, placer, itemstack)
|
newdef.after_place_node = function(pos, placer, itemstack)
|
||||||
local node = minetest.get_node(pos)
|
minetest.set_node(pos, {name = convert_to_original_name(itemstack:get_name()),
|
||||||
local item = convert_to_original_name(itemstack:get_name())
|
param2 = minetest.get_node(pos).param2})
|
||||||
minetest.set_node(pos, {name = item, param2 = node.param2})
|
|
||||||
minetest.after(0.5, function(pos, placer, itemstack)
|
minetest.after(0.5, function(pos, placer, itemstack)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -95,8 +301,9 @@ for name,info in pairs(supported_nodes) do
|
|||||||
inv:set_list(listname, list)
|
inv:set_list(listname, list)
|
||||||
end
|
end
|
||||||
local metas = data.metas
|
local metas = data.metas
|
||||||
|
local temp = nil
|
||||||
for i=1,#metas,1 do
|
for i=1,#metas,1 do
|
||||||
local temp = metas[i]
|
temp = metas[i]
|
||||||
if temp.string ~= nil then
|
if temp.string ~= nil then
|
||||||
meta:set_string(temp.string, temp.value)
|
meta:set_string(temp.string, temp.value)
|
||||||
end
|
end
|
||||||
@ -134,12 +341,13 @@ minetest.register_tool("wrench:wrench", {
|
|||||||
local support = supported_nodes[name]
|
local support = supported_nodes[name]
|
||||||
if support == nil then return end
|
if support == nil then return end
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
if name:find("_locked") ~= nil then
|
if support.owner_protection ~= nil then
|
||||||
if meta:get_string("owner") ~= nil then
|
local owner = meta:get_string("owner")
|
||||||
if meta:get_string("owner") ~= placer:get_player_name() then
|
if owner ~= nil then
|
||||||
|
if owner ~= placer:get_player_name() then
|
||||||
minetest.log("action", placer:get_player_name()..
|
minetest.log("action", placer:get_player_name()..
|
||||||
" tried to destroy a locked chest belonging to "..
|
" tried to destroy a locked chest belonging to "..
|
||||||
meta:get_string("owner").." at "..
|
owner.." at "..
|
||||||
minetest.pos_to_string(pos))
|
minetest.pos_to_string(pos))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -182,7 +390,7 @@ minetest.register_tool("wrench:wrench", {
|
|||||||
if inv:room_for_item("main", stack) then
|
if inv:room_for_item("main", stack) then
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
itemstack:add_wear(65535/20)
|
itemstack:add_wear(65535/20)
|
||||||
if empty and #lists > 0 then
|
if empty and #lists > 0 and support.store_meta_always == nil then
|
||||||
inv:add_item("main", stack)
|
inv:add_item("main", stack)
|
||||||
else
|
else
|
||||||
stack.name = supported_nodes[name].name
|
stack.name = supported_nodes[name].name
|
||||||
@ -197,8 +405,8 @@ minetest.register_tool("wrench:wrench", {
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "wrench:wrench",
|
output = "wrench:wrench",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"default:iron_lump","","default:iron_lump"},
|
{"default:steel_ingot","","default:steel_ingot"},
|
||||||
{"","default:iron_lump",""},
|
{"","default:steel_ingot",""},
|
||||||
{"","default:iron_lump",""},
|
{"","default:steel_ingot",""},
|
||||||
},
|
},
|
||||||
})
|
})
|
Loading…
Reference in New Issue
Block a user