summaryrefslogtreecommitdiff
path: root/wrench
diff options
context:
space:
mode:
Diffstat (limited to 'wrench')
-rw-r--r--wrench/depends.txt6
-rw-r--r--wrench/init.lua162
-rw-r--r--wrench/locale/de.txt7
-rw-r--r--wrench/locale/es.txt5
-rw-r--r--wrench/locale/template.txt5
-rw-r--r--wrench/locale/tr.txt5
-rw-r--r--wrench/support.lua73
-rw-r--r--wrench/technic.lua343
-rw-r--r--wrench/textures/technic_wrench.pngbin249 -> 0 bytes
9 files changed, 0 insertions, 606 deletions
diff --git a/wrench/depends.txt b/wrench/depends.txt
deleted file mode 100644
index a681af3..0000000
--- a/wrench/depends.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-default
-technic?
-technic_chests?
-technic_worldgen?
-intllib?
-
diff --git a/wrench/init.lua b/wrench/init.lua
deleted file mode 100644
index f99fd14..0000000
--- a/wrench/init.lua
+++ /dev/null
@@ -1,162 +0,0 @@
---[[
-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.
-Because it enables arbitrary nesting of chests, and so allows the player
-to carry an unlimited amount of material at once, this wrench is not
-available to survival-mode players.
---]]
-
-local LATEST_SERIALIZATION_VERSION = 1
-
-wrench = {}
-
-local modpath = minetest.get_modpath(minetest.get_current_modname())
-dofile(modpath.."/support.lua")
-dofile(modpath.."/technic.lua")
-
--- Boilerplate to support localized strings if intllib mod is installed.
-local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
-
-local function get_meta_type(name, metaname)
- local def = wrench.registered_nodes[name]
- if not def or not def.metas or not def.metas[metaname] then
- return nil
- end
- return def.metas[metaname]
-end
-
-local function get_pickup_name(name)
- return "wrench:picked_up_"..(name:gsub(":", "_"))
-end
-
-local function restore(pos, placer, itemstack)
- local name = itemstack:get_name()
- local node = minetest.get_node(pos)
- local meta = minetest.get_meta(pos)
- local inv = meta:get_inventory()
- local data = itemstack:get_meta():get_string("data")
- data = (data ~= "" and data) or itemstack:get_metadata()
- data = minetest.deserialize(data)
- minetest.set_node(pos, {name = data.name, param2 = node.param2})
- for name, value in pairs(data.metas) do
- local meta_type = get_meta_type(data.name, name)
- if meta_type == wrench.META_TYPE_INT then
- meta:set_int(name, value)
- elseif meta_type == wrench.META_TYPE_FLOAT then
- meta:set_float(name, value)
- elseif meta_type == wrench.META_TYPE_STRING then
- meta:set_string(name, value)
- end
- end
- local lists = data.lists
- for listname, list in pairs(lists) do
- inv:set_list(listname, list)
- end
- itemstack:take_item()
- return itemstack
-end
-
-for name, info in pairs(wrench.registered_nodes) do
- local olddef = minetest.registered_nodes[name]
- if olddef then
- local newdef = {}
- for key, value in pairs(olddef) do
- newdef[key] = value
- end
- newdef.stack_max = 1
- newdef.description = S("%s with items"):format(newdef.description)
- newdef.groups = {}
- newdef.groups.not_in_creative_inventory = 1
- newdef.on_construct = nil
- newdef.on_destruct = nil
- newdef.after_place_node = restore
- minetest.register_node(":"..get_pickup_name(name), newdef)
- end
-end
-
-minetest.register_tool("wrench:wrench", {
- description = S("Wrench"),
- inventory_image = "technic_wrench.png",
- tool_capabilities = {
- full_punch_interval = 0.9,
- max_drop_level = 0,
- groupcaps = {
- crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
- snappy = {times={[3]=0.40}, uses=0, maxlevel=1},
- oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=1.40},
- uses=0, maxlevel=3}
- },
- damage_groups = {fleshy=1},
- },
- on_place = function(itemstack, placer, pointed_thing)
- local pos = pointed_thing.under
- if not placer or not pos then
- return
- end
- local player_name = placer:get_player_name()
- if minetest.is_protected(pos, player_name) then
- minetest.record_protection_violation(pos, player_name)
- return
- end
- local name = minetest.get_node(pos).name
- local def = wrench.registered_nodes[name]
- if not def then
- return
- end
-
- local stack = ItemStack(get_pickup_name(name))
- local player_inv = placer:get_inventory()
- if not player_inv:room_for_item("main", stack) then
- return
- end
- local meta = minetest.get_meta(pos)
- if def.owned then
- local owner = meta:get_string("owner")
- if owner and owner ~= player_name then
- minetest.log("action", player_name..
- " tried to pick up an owned node belonging to "..
- owner.." at "..
- minetest.pos_to_string(pos))
- return
- end
- end
-
- local metadata = {}
- metadata.name = name
- metadata.version = LATEST_SERIALIZATION_VERSION
-
- local inv = meta:get_inventory()
- local lists = {}
- for _, listname in pairs(def.lists or {}) do
- local list = inv:get_list(listname)
- for i, stack in pairs(list) do
- list[i] = stack:to_string()
- end
- lists[listname] = list
- end
- metadata.lists = lists
-
- local item_meta = stack:get_meta()
- metadata.metas = {}
- for name, meta_type in pairs(def.metas or {}) do
- if meta_type == wrench.META_TYPE_INT then
- metadata.metas[name] = meta:get_int(name)
- elseif meta_type == wrench.META_TYPE_FLOAT then
- metadata.metas[name] = meta:get_float(name)
- elseif meta_type == wrench.META_TYPE_STRING then
- metadata.metas[name] = meta:get_string(name)
- end
- end
-
- item_meta:set_string("data", minetest.serialize(metadata))
- minetest.remove_node(pos)
- itemstack:add_wear(65535 / 20)
- player_inv:add_item("main", stack)
- return itemstack
- end,
-})
diff --git a/wrench/locale/de.txt b/wrench/locale/de.txt
deleted file mode 100644
index b285cd3..0000000
--- a/wrench/locale/de.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# German Translation for technic_wrench
-# Deutsche Übersetzung von technic_wrench
-# by Xanthin
-
-Wrench = Schraubenschluessel
-%s with items = %s mit Gegenstaenden
-
diff --git a/wrench/locale/es.txt b/wrench/locale/es.txt
deleted file mode 100644
index 1d79a96..0000000
--- a/wrench/locale/es.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-# technic_wrench traducido por Carlos Barraza
-
-Wrench = Llave Inglesa
-%s with items = %s con elementos
-
diff --git a/wrench/locale/template.txt b/wrench/locale/template.txt
deleted file mode 100644
index eff2da2..0000000
--- a/wrench/locale/template.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-# technic_wrench translation template
-
-Wrench =
-%s with items =
-
diff --git a/wrench/locale/tr.txt b/wrench/locale/tr.txt
deleted file mode 100644
index 2050bce..0000000
--- a/wrench/locale/tr.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-# Turkish translation by mahmutelmas06
-# mahmutelmas06@hotmail.com
-
-Wrench = İngiliz anahtarı
-%s with items = Araçlarla birlikte %s
diff --git a/wrench/support.lua b/wrench/support.lua
deleted file mode 100644
index 1d21811..0000000
--- a/wrench/support.lua
+++ /dev/null
@@ -1,73 +0,0 @@
---[[
-supported_nodes
-This table stores all nodes that are compatible with the wrench mod.
-Syntax:
- [<node name>] = {
- lists = {"<inventory list name>"},
- metas = {["<meta name>"] = STRING,
- ["<meta name>"] = INT,
- ["<meta name>"] = FLOAT},
- owned = true,
- store_meta_always = true,
- }
- owned - 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)
---]]
-
-wrench.META_TYPE_INT = 0
-wrench.META_TYPE_FLOAT = 1
-wrench.META_TYPE_STRING = 2
-
-local INT, STRING, FLOAT =
- wrench.META_TYPE_INT,
- wrench.META_TYPE_STRING,
- wrench.META_TYPE_FLOAT
-
-wrench.registered_nodes = {
- ["default:chest"] = {
- lists = {"main"},
- },
- ["default:chest_locked"] = {
- lists = {"main"},
- metas = {owner = STRING,
- infotext = STRING},
- owned = true,
- },
- ["default:furnace"] = {
- lists = {"fuel", "src", "dst"},
- metas = {infotext = STRING,
- fuel_totaltime = FLOAT,
- fuel_time = FLOAT,
- src_totaltime = FLOAT,
- src_time = FLOAT},
- },
- ["default:furnace_active"] = {
- lists = {"fuel", "src", "dst"},
- metas = {infotext = STRING,
- fuel_totaltime = FLOAT,
- fuel_time = FLOAT,
- src_totaltime = FLOAT,
- src_time = FLOAT},
- store_meta_always = true,
- },
- ["default:sign_wall"] = {
- metas = {infotext = STRING,
- text = STRING},
- },
-}
-
-function wrench:original_name(name)
- for key, value in pairs(self.registered_nodes) do
- if name == value.name then
- return key
- end
- end
-end
-
-function wrench:register_node(name, def)
- if minetest.registered_nodes[name] then
- self.registered_nodes[name] = def
- end
-end
-
diff --git a/wrench/technic.lua b/wrench/technic.lua
deleted file mode 100644
index c404180..0000000
--- a/wrench/technic.lua
+++ /dev/null
@@ -1,343 +0,0 @@
-
-local INT, STRING, FLOAT =
- wrench.META_TYPE_INT,
- wrench.META_TYPE_STRING,
- wrench.META_TYPE_FLOAT
-
-wrench:register_node("technic:iron_chest", {
- lists = {"main"},
-})
-wrench:register_node("technic:iron_locked_chest", {
- lists = {"main"},
- metas = {infotext = STRING,
- owner = STRING},
- owned = true,
-})
-wrench:register_node("technic:copper_chest", {
- lists = {"main"},
-})
-wrench:register_node("technic:copper_locked_chest", {
- lists = {"main"},
- metas = {infotext = STRING,
- owner = STRING},
- owned = true,
-})
-wrench:register_node("technic:silver_chest", {
- lists = {"main"},
- metas = {infotext = STRING,
- formspec = STRING},
-})
-wrench:register_node("technic:silver_locked_chest", {
- lists = {"main"},
- metas = {infotext = STRING,
- owner = STRING,
- formspec = STRING},
- owned = true,
-})
-wrench:register_node("technic:gold_chest", {
- lists = {"main"},
- metas = {infotext = STRING,
- formspec = STRING},
-})
-wrench:register_node("technic:gold_locked_chest", {
- lists = {"main"},
- metas = {infotext = STRING,
- owner = STRING,
- formspec = STRING},
- owned = true,
-})
-wrench:register_node("technic:mithril_chest", {
- lists = {"main"},
- metas = {infotext = STRING,
- formspec = STRING},
-})
-wrench:register_node("technic:mithril_locked_chest", {
- lists = {"main"},
- metas = {infotext = STRING,
- owner = STRING,
- formspec = STRING},
- owned = true,
-})
-wrench:register_node("technic:lv_electric_furnace", {
- lists = {"src", "dst"},
- metas = {infotext = STRING,
- formspec = STRING,
- LV_EU_demand = INT,
- LV_EU_input = INT,
- src_time = INT},
-})
-wrench:register_node("technic:lv_electric_furnace_active", {
- lists = {"src", "dst"},
- metas = {infotext = STRING,
- formspec = STRING,
- LV_EU_demand = INT,
- LV_EU_input = INT,
- src_time = INT},
-})
-wrench:register_node("technic:mv_electric_furnace", {
- lists = {"src", "dst", "upgrade1", "upgrade2"},
- metas = {infotext = STRING,
- formspec = STRING,
- MV_EU_demand = INT,
- MV_EU_input = INT,
- tube_time = INT,
- src_time = INT},
-})
-wrench:register_node("technic:mv_electric_furnace_active", {
- lists = {"src", "dst", "upgrade1", "upgrade2"},
- metas = {infotext = STRING,
- formspec = STRING,
- MV_EU_demand = INT,
- MV_EU_input = INT,
- tube_time = INT,
- src_time = INT},
-})
-wrench:register_node("technic:coal_alloy_furnace", {
- lists = {"fuel", "src", "dst"},
- metas = {infotext = STRING,
- fuel_totaltime = FLOAT,
- fuel_time = FLOAT,
- src_totaltime = FLOAT,
- src_time = FLOAT},
-})
-wrench:register_node("technic:coal_alloy_furnace_active", {
- lists = {"fuel", "src", "dst"},
- metas = {infotext = STRING,
- fuel_totaltime = FLOAT,
- fuel_time = FLOAT,
- src_totaltime = FLOAT,
- src_time = FLOAT},
-})
-wrench:register_node("technic:alloy_furnace", {
- lists = {"src", "dst"},
- metas = {infotext = STRING,
- formspec = STRING,
- LV_EU_demand = INT,
- LV_EU_input = INT,
- tube_time = INT,
- src_time = INT},
-})
-wrench:register_node("technic:alloy_furnace_active", {
- lists = {"src", "dst"},
- metas = {infotext = STRING,
- formspec = STRING,
- LV_EU_demand = INT,
- LV_EU_input = INT,
- tube_time = INT,
- src_time = INT},
-})
-wrench:register_node("technic:mv_alloy_furnace", {
- lists = {"src", "dst", "upgrade1", "upgrade2"},
- metas = {infotext = STRING,
- formspec = STRING,
- MV_EU_demand = INT,
- MV_EU_input = INT,
- tube_time = INT,
- src_time = INT},
-})
-wrench:register_node("technic:mv_alloy_furnace_active", {
- lists = {"src", "dst", "upgrade1", "upgrade2"},
- metas = {infotext = STRING,
- formspec = STRING,
- MV_EU_demand = INT,
- MV_EU_input = INT,
- tube_time = INT,
- src_time = INT},
-})
-wrench:register_node("technic:tool_workshop", {
- lists = {"src", "upgrade1", "upgrade2"},
- metas = {infotext = STRING,
- formspec = STRING,
- MV_EU_demand = INT,
- MV_EU_input = INT,
- tube_time = INT},
-})
-wrench:register_node("technic:grinder", {
- lists = {"src", "dst"},
- metas = {infotext = STRING,
- formspec = STRING,
- LV_EU_demand = INT,
- LV_EU_input = INT,
- src_time = INT},
-})
-wrench:register_node("technic:grinder_active", {
- lists = {"src", "dst"},
- metas = {infotext = STRING,
- formspec = STRING,
- LV_EU_demand = INT,
- LV_EU_input = INT,
- src_time = INT},
-})
-wrench:register_node("technic:mv_grinder", {
- lists = {"src", "dst", "upgrade1", "upgrade2"},
- metas = {infotext = STRING,
- formspec = STRING,
- MV_EU_demand = INT,
- MV_EU_input = INT,
- tube_time = INT,
- src_time = INT},
-})
-wrench:register_node("technic:mv_grinder_active", {
- lists = {"src", "dst", "upgrade1", "upgrade2"},
- metas = {infotext = STRING,
- formspec = STRING,
- MV_EU_demand = INT,
- MV_EU_input = INT,
- tube_time = INT,
- src_time = INT},
-})
-wrench:register_node("technic:extractor", {
- lists = {"src", "dst"},
- metas = {infotext = STRING,
- formspec = STRING,
- LV_EU_demand = INT,
- LV_EU_input = INT,
- src_time = INT},
-})
-wrench:register_node("technic:extractor_active", {
- lists = {"src", "dst"},
- metas = {infotext = STRING,
- formspec = STRING,
- LV_EU_demand = INT,
- LV_EU_input = INT,
- src_time = INT},
-})
-wrench:register_node("technic:mv_extractor", {
- lists = {"src", "dst", "upgrade1", "upgrade2"},
- metas = {infotext = STRING,
- formspec = STRING,
- MV_EU_demand = INT,
- MV_EU_input = INT,
- tube_time = INT,
- src_time = INT},
-})
-wrench:register_node("technic:mv_extractor_active", {
- lists = {"src", "dst", "upgrade1", "upgrade2"},
- metas = {infotext = STRING,
- formspec = STRING,
- MV_EU_demand = INT,
- MV_EU_input = INT,
- tube_time = INT,
- src_time = INT},
-})
-wrench:register_node("technic:compressor", {
- lists = {"src", "dst"},
- metas = {infotext = STRING,
- formspec = STRING,
- LV_EU_demand = INT,
- LV_EU_input = INT,
- src_time = INT},
-})
-wrench:register_node("technic:compressor_active", {
- lists = {"src", "dst"},
- metas = {infotext = STRING,
- formspec = STRING,
- LV_EU_demand = INT,
- LV_EU_input = INT,
- src_time = INT},
-})
-wrench:register_node("technic:mv_compressor", {
- lists = {"src", "dst", "upgrade1", "upgrade2"},
- metas = {infotext = STRING,
- formspec = STRING,
- MV_EU_demand = INT,
- MV_EU_input = INT,
- tube_time = INT,
- src_time = INT},
-})
-wrench:register_node("technic:mv_compressor_active", {
- lists = {"src", "dst", "upgrade1", "upgrade2"},
- metas = {infotext = STRING,
- formspec = STRING,
- MV_EU_demand = INT,
- MV_EU_input = INT,
- tube_time = INT,
- src_time = INT},
-})
-wrench:register_node("technic:cnc", {
- lists = {"src", "dst"},
- metas = {infotext = STRING,
- formspec = STRING,
- LV_EU_demand = INT,
- LV_EU_input = INT,
- src_time = INT,
- cnc_product = STRING},
-})
-wrench:register_node("technic:cnc_active", {
- lists = {"src", "dst"},
- metas = {infotext = STRING,
- formspec = STRING,
- LV_EU_demand = INT,
- LV_EU_input = INT,
- src_time = INT,
- cnc_product = STRING},
-})
-wrench:register_node("technic:mv_centrifuge", {
- lists = {"src", "dst", "upgrade1", "upgrade2"},
- metas = {infotext = STRING,
- formspec = STRING,
- MV_EU_demand = INT,
- MV_EU_input = INT,
- tube_time = INT,
- src_time = INT},
-})
-wrench:register_node("technic:mv_centrifuge_active", {
- lists = {"src", "dst", "upgrade1", "upgrade2"},
- metas = {infotext = STRING,
- formspec = STRING,
- MV_EU_demand = INT,
- MV_EU_input = INT,
- tube_time = INT,
- src_time = INT},
-})
-
-
-local chest_mark_colors = {
- '_black',
- '_blue',
- '_brown',
- '_cyan',
- '_dark_green',
- '_dark_grey',
- '_green',
- '_grey',
- '_magenta',
- '_orange',
- '_pink',
- '_red',
- '_violet',
- '_white',
- '_yellow',
- '',
-}
-
-for i = 1, 15 do
- wrench:register_node("technic:gold_chest"..chest_mark_colors[i], {
- lists = {"main"},
- metas = {infotext = STRING,formspec = STRING},
- })
- wrench:register_node("technic:gold_locked_chest"..chest_mark_colors[i], {
- lists = {"main"},
- metas = {infotext = STRING,owner = STRING,formspec = STRING},
- owned = true,
- })
-end
-
-if minetest.get_modpath("technic") then
- for tier, _ in pairs(technic.machines) do
- local ltier = tier:lower()
- for i = 0, 8 do
- wrench:register_node("technic:"..ltier.."_battery_box"..i, {
- lists = {"src", "dst"},
- metas = {infotext = STRING,
- formspec = STRING,
- [tier.."_EU_demand"] = INT,
- [tier.."_EU_supply"] = INT,
- [tier.."_EU_input"] = INT,
- internal_EU_charge = INT,
- last_side_shown = INT},
- })
- end
- end
-end
-
diff --git a/wrench/textures/technic_wrench.png b/wrench/textures/technic_wrench.png
deleted file mode 100644
index 471b47e..0000000
--- a/wrench/textures/technic_wrench.png
+++ /dev/null
Binary files differ