Compare commits
10 Commits
12f69f9ad4
...
96c73e14d9
Author | SHA1 | Date | |
---|---|---|---|
|
96c73e14d9 | ||
|
53f062ab72 | ||
|
3c4141bbc4 | ||
|
2e8dd2d254 | ||
|
09af19981c | ||
|
957deff24c | ||
|
9319797805 | ||
|
b9a4f8b525 | ||
|
901e37a503 | ||
|
33af1b0c80 |
@ -6,4 +6,6 @@ It was made by Thomas-S.
|
|||||||
For license see LICENSE file.
|
For license see LICENSE file.
|
||||||
|
|
||||||
Special thanks to Wuzzy2, who helped to improve this mod by suggesting many good ideas.
|
Special thanks to Wuzzy2, who helped to improve this mod by suggesting many good ideas.
|
||||||
Special thanks to webdesigner97 and cheapie, who contributed some code for the door workshop.
|
Special thanks to webdesigner97 and cheapie, who contributed some code for the door workshop.
|
||||||
|
|
||||||
|
**NOTE:** This mod depends on the [ts_workshop](https://github.com/minetest-mods/ts_workshop) mod.
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
default
|
default
|
||||||
|
ts_workshop
|
||||||
doors
|
doors
|
||||||
moretrees?
|
moretrees?
|
||||||
moreores?
|
moreores?
|
||||||
technic?
|
technic?
|
||||||
|
ethereal?
|
||||||
|
basic_materials?
|
||||||
|
@ -1 +1 @@
|
|||||||
This mod adds doors for all kinds of wood.
|
Adds doors for all kinds of wood.
|
||||||
|
412
init.lua
412
init.lua
@ -4,6 +4,33 @@ ts_doors.registered_doors = {}
|
|||||||
|
|
||||||
ts_doors.sounds = {}
|
ts_doors.sounds = {}
|
||||||
|
|
||||||
|
-- Used for localization
|
||||||
|
local S = minetest.get_translator("ts_doors")
|
||||||
|
|
||||||
|
-- Get texture by node name
|
||||||
|
local T = function (node_name)
|
||||||
|
local def = minetest.registered_nodes[node_name]
|
||||||
|
if not (def and def.tiles) then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
local tile = def.tiles[5] or def.tiles[4] or def.tiles[3] or def.tiles[2] or def.tiles[1]
|
||||||
|
if type(tile) == "string" then
|
||||||
|
return tile
|
||||||
|
elseif type(tile) == "table" and tile.name then
|
||||||
|
return tile.name
|
||||||
|
end
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Use this to generate the translation template file.
|
||||||
|
--[[
|
||||||
|
local oldS = S
|
||||||
|
local function S(x)
|
||||||
|
print(x .. "=")
|
||||||
|
return oldS(x)
|
||||||
|
end
|
||||||
|
]]
|
||||||
|
|
||||||
if default.node_sound_metal_defaults then
|
if default.node_sound_metal_defaults then
|
||||||
ts_doors.sounds.metal = {
|
ts_doors.sounds.metal = {
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_metal_defaults(),
|
||||||
@ -30,93 +57,66 @@ ts_doors.sounds.glass = {
|
|||||||
sound_close = "doors_glass_door_close",
|
sound_close = "doors_glass_door_close",
|
||||||
}
|
}
|
||||||
|
|
||||||
local function copytable(orig)
|
|
||||||
local orig_type = type(orig)
|
|
||||||
local copy
|
|
||||||
if orig_type == 'table' then
|
|
||||||
copy = {}
|
|
||||||
for orig_key, orig_value in next, orig, nil do
|
|
||||||
copy[copytable(orig_key)] = copytable(orig_value)
|
|
||||||
end
|
|
||||||
setmetatable(copy, copytable(getmetatable(orig)))
|
|
||||||
else
|
|
||||||
copy = orig
|
|
||||||
end
|
|
||||||
return copy
|
|
||||||
end
|
|
||||||
|
|
||||||
local function get_door_name(meta, item)
|
local function get_door_name(meta, item)
|
||||||
local door = ""
|
local door_type_string = meta:get_int("trapdoor") == 1 and "trapdoor_" or "door_"
|
||||||
local int_to_bool = {}
|
local locked_string = meta:get_int("locked") == 1 and "locked_" or ""
|
||||||
int_to_bool[0] = false
|
local solid_string = meta:get_int("solid") == 1 and "full_" or ""
|
||||||
int_to_bool[1] = true
|
return "ts_doors:" .. door_type_string .. solid_string .. locked_string .. item:gsub(":", "_")
|
||||||
local trapdoor = int_to_bool[meta:get_int("trapdoor")] or false
|
|
||||||
local locked = int_to_bool[meta:get_int("locked")] or false
|
|
||||||
local solid = int_to_bool[meta:get_int("solid")] or false
|
|
||||||
if trapdoor then
|
|
||||||
if locked then
|
|
||||||
if solid then
|
|
||||||
door = "ts_doors:trapdoor_full_locked_" .. item:gsub(":", "_")
|
|
||||||
else
|
|
||||||
door = "ts_doors:trapdoor_locked_" .. item:gsub(":", "_")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if solid then
|
|
||||||
door = "ts_doors:trapdoor_full_" .. item:gsub(":", "_")
|
|
||||||
else
|
|
||||||
door = "ts_doors:trapdoor_" .. item:gsub(":", "_")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if locked then
|
|
||||||
if solid then
|
|
||||||
door = "ts_doors:door_full_locked_" .. item:gsub(":", "_")
|
|
||||||
else
|
|
||||||
door = "ts_doors:door_locked_" .. item:gsub(":", "_")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if solid then
|
|
||||||
door = "ts_doors:door_full_" .. item:gsub(":", "_")
|
|
||||||
else
|
|
||||||
door = "ts_doors:door_" .. item:gsub(":", "_")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return door
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function register_alias(name, convert_to)
|
local function register_door_alias(name, convert_to)
|
||||||
minetest.register_alias(name, convert_to)
|
minetest.register_alias(name, convert_to)
|
||||||
minetest.register_alias(name .. "_a", convert_to .. "_a")
|
minetest.register_alias(name .. "_a", convert_to .. "_a")
|
||||||
minetest.register_alias(name .. "_b", convert_to .. "_b")
|
minetest.register_alias(name .. "_b", convert_to .. "_b")
|
||||||
|
minetest.register_alias(name .. "_c", convert_to .. "_c")
|
||||||
|
minetest.register_alias(name .. "_d", convert_to .. "_d")
|
||||||
|
end
|
||||||
|
local function register_trapdoor_alias(name, convert_to)
|
||||||
|
minetest.register_alias(name, convert_to)
|
||||||
|
minetest.register_alias(name .. "_open", convert_to .. "_open")
|
||||||
|
end
|
||||||
|
|
||||||
|
function ts_doors.register_alias(name, convert_to)
|
||||||
|
name = name:gsub(":", "_")
|
||||||
|
convert_to = convert_to:gsub(":", "_")
|
||||||
|
for _,style in pairs({"", "full_", "locked_", "full_locked_"}) do
|
||||||
|
register_door_alias("ts_doors:door_" .. style .. name, "ts_doors:door_" .. style .. convert_to)
|
||||||
|
register_trapdoor_alias("ts_doors:trapdoor_" .. style .. name, "ts_doors:trapdoor_" .. style .. convert_to)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ts_doors.register_door(item, description, texture, sounds, recipe)
|
function ts_doors.register_door(item, description, texture, sounds, recipe)
|
||||||
|
if not minetest.registered_nodes[item] then
|
||||||
|
minetest.log("error", "[ts_doors] Bug found: "..item.." is not a registered node. Can not create doors.")
|
||||||
|
return
|
||||||
|
end
|
||||||
if not sounds then
|
if not sounds then
|
||||||
sounds = {}
|
sounds = {}
|
||||||
end
|
end
|
||||||
|
if not texture then
|
||||||
|
texture = T(item)
|
||||||
|
end
|
||||||
recipe = recipe or item
|
recipe = recipe or item
|
||||||
ts_doors.registered_doors[item:gsub(":", "_")] = recipe
|
ts_doors.registered_doors[item:gsub(":", "_")] = recipe
|
||||||
register_alias("doors:ts_door_" .. item:gsub(":", "_"), "ts_doors:door_" .. item:gsub(":", "_"))
|
register_door_alias("doors:ts_door_" .. item:gsub(":", "_"), "ts_doors:door_" .. item:gsub(":", "_"))
|
||||||
register_alias("doors:ts_door_full_" .. item:gsub(":", "_"), "ts_doors:door_full_" .. item:gsub(":", "_"))
|
register_door_alias("doors:ts_door_full_" .. item:gsub(":", "_"), "ts_doors:door_full_" .. item:gsub(":", "_"))
|
||||||
register_alias("doors:ts_door_locked_" .. item:gsub(":", "_"), "ts_doors:door_locked_" .. item:gsub(":", "_"))
|
register_door_alias("doors:ts_door_locked_" .. item:gsub(":", "_"), "ts_doors:door_locked_" .. item:gsub(":", "_"))
|
||||||
register_alias("doors:ts_door_full_locked_" .. item:gsub(":", "_"), "ts_doors:door_full_locked_" .. item:gsub(":", "_"))
|
register_door_alias("doors:ts_door_full_locked_" .. item:gsub(":", "_"), "ts_doors:door_full_locked_" .. item:gsub(":", "_"))
|
||||||
|
|
||||||
|
|
||||||
local groups = minetest.registered_nodes[item].groups
|
local groups = minetest.registered_nodes[item].groups
|
||||||
local door_groups = {}
|
local door_groups = {door=1, not_in_creative_inventory=1}
|
||||||
for k, v in pairs(groups) do
|
for k, v in pairs(groups) do
|
||||||
if k ~= "wood" then
|
if k ~= "wood" then
|
||||||
door_groups[k] = v
|
door_groups[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local trapdoor_groups = copytable(door_groups)
|
|
||||||
|
|
||||||
doors.register("ts_doors:door_" .. item:gsub(":", "_"), {
|
doors.register("ts_doors:door_" .. item:gsub(":", "_"), {
|
||||||
tiles = { { name = "[combine:32x38:0,0=" .. texture .. ":0,16=" .. texture .. ":0,32=" .. texture .. ":16,0=" .. texture .. ":16,16=" .. texture .. ":16,32=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base.png^[noalpha^[makealpha:0,255,0", backface_culling = true } },
|
tiles = { { name = "[combine:32x38:0,0=" .. texture .. ":0,16=" .. texture .. ":0,32=" .. texture .. ":16,0=" .. texture .. ":16,16=" .. texture .. ":16,32=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base.png^[noalpha^[makealpha:0,255,0", backface_culling = true } },
|
||||||
description = description .. " Windowed Door",
|
description = S(description .. " Windowed Door"),
|
||||||
inventory_image = "[combine:32x32:0,8=" .. texture .. ":16,8=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_inv.png^[noalpha^[makealpha:0,255,0",
|
inventory_image = "[combine:32x32:0,8=" .. texture .. ":16,8=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_inv.png^[noalpha^[makealpha:0,255,0",
|
||||||
groups = door_groups,
|
groups = table.copy(door_groups),
|
||||||
sounds = sounds.sounds or nil,
|
sounds = sounds.sounds or nil,
|
||||||
sound_open = sounds.sound_open or nil,
|
sound_open = sounds.sound_open or nil,
|
||||||
sound_close = sounds.sound_close or nil,
|
sound_close = sounds.sound_close or nil,
|
||||||
@ -124,47 +124,46 @@ function ts_doors.register_door(item, description, texture, sounds, recipe)
|
|||||||
|
|
||||||
doors.register("ts_doors:door_full_" .. item:gsub(":", "_"), {
|
doors.register("ts_doors:door_full_" .. item:gsub(":", "_"), {
|
||||||
tiles = { { name = "[combine:32x38:0,0=" .. texture .. ":0,16=" .. texture .. ":0,32=" .. texture .. ":16,0=" .. texture .. ":16,16=" .. texture .. ":16,32=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_full.png^[noalpha", backface_culling = true } },
|
tiles = { { name = "[combine:32x38:0,0=" .. texture .. ":0,16=" .. texture .. ":0,32=" .. texture .. ":16,0=" .. texture .. ":16,16=" .. texture .. ":16,32=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_full.png^[noalpha", backface_culling = true } },
|
||||||
description = "Solid " .. description .. " Door",
|
description = S("Solid " .. description .. " Door"),
|
||||||
inventory_image = "[combine:32x32:0,8=" .. texture .. ":16,8=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_full_inv.png^[noalpha^[makealpha:0,255,0",
|
inventory_image = "[combine:32x32:0,8=" .. texture .. ":16,8=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_full_inv.png^[noalpha^[makealpha:0,255,0",
|
||||||
groups = door_groups,
|
groups = table.copy(door_groups),
|
||||||
sounds = sounds.sounds or nil,
|
sounds = sounds.sounds or nil,
|
||||||
sound_open = sounds.sound_open or nil,
|
sound_open = sounds.sound_open or nil,
|
||||||
sound_close = sounds.sound_close or nil,
|
sound_close = sounds.sound_close or nil,
|
||||||
})
|
})
|
||||||
|
|
||||||
doors.register_trapdoor("ts_doors:trapdoor_" .. item:gsub(":", "_"), {
|
doors.register_trapdoor("ts_doors:trapdoor_" .. item:gsub(":", "_"), {
|
||||||
description = "Windowed " .. description .. " Trapdoor",
|
description = S("Windowed " .. description .. " Trapdoor"),
|
||||||
inventory_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor.png^[noalpha^[makealpha:0,255,0",
|
inventory_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor.png^[noalpha^[makealpha:0,255,0",
|
||||||
wield_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor.png^[noalpha^[makealpha:0,255,0",
|
wield_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor.png^[noalpha^[makealpha:0,255,0",
|
||||||
tile_front = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor.png^[noalpha^[makealpha:0,255,0",
|
tile_front = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor.png^[noalpha^[makealpha:0,255,0",
|
||||||
tile_side = texture .. "^[colorize:#fff:30",
|
tile_side = texture .. "^[colorize:#fff:30",
|
||||||
groups = trapdoor_groups,
|
groups = table.copy(door_groups),
|
||||||
sounds = sounds.sounds or nil,
|
sounds = sounds.sounds or nil,
|
||||||
sound_open = sounds.sound_open or nil,
|
sound_open = sounds.sound_open or nil,
|
||||||
sound_close = sounds.sound_close or nil,
|
sound_close = sounds.sound_close or nil,
|
||||||
})
|
})
|
||||||
|
|
||||||
doors.register_trapdoor("ts_doors:trapdoor_full_" .. item:gsub(":", "_"), {
|
doors.register_trapdoor("ts_doors:trapdoor_full_" .. item:gsub(":", "_"), {
|
||||||
description = "Solid " .. description .. " Trapdoor",
|
description = S("Solid " .. description .. " Trapdoor"),
|
||||||
inventory_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full.png^[noalpha",
|
inventory_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full.png^[noalpha",
|
||||||
wield_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full.png^[noalpha",
|
wield_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full.png^[noalpha",
|
||||||
tile_front = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full.png^[noalpha",
|
tile_front = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full.png^[noalpha",
|
||||||
tile_side = texture .. "^[colorize:#fff:30",
|
tile_side = texture .. "^[colorize:#fff:30",
|
||||||
groups = trapdoor_groups,
|
groups = table.copy(door_groups),
|
||||||
sounds = sounds.sounds or nil,
|
sounds = sounds.sounds or nil,
|
||||||
sound_open = sounds.sound_open or nil,
|
sound_open = sounds.sound_open or nil,
|
||||||
sound_close = sounds.sound_close or nil,
|
sound_close = sounds.sound_close or nil,
|
||||||
})
|
})
|
||||||
|
|
||||||
door_groups.level = 2
|
door_groups.level = 2
|
||||||
trapdoor_groups.level = 2
|
|
||||||
|
|
||||||
doors.register("ts_doors:door_locked_" .. item:gsub(":", "_"), {
|
doors.register("ts_doors:door_locked_" .. item:gsub(":", "_"), {
|
||||||
tiles = { { name = "[combine:32x38:0,0=" .. texture .. ":0,16=" .. texture .. ":0,32=" .. texture .. ":16,0=" .. texture .. ":16,16=" .. texture .. ":16,32=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_locked.png^[noalpha^[makealpha:0,255,0", backface_culling = true } },
|
tiles = { { name = "[combine:32x38:0,0=" .. texture .. ":0,16=" .. texture .. ":0,32=" .. texture .. ":16,0=" .. texture .. ":16,16=" .. texture .. ":16,32=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_locked.png^[noalpha^[makealpha:0,255,0", backface_culling = true } },
|
||||||
description = "Windowed Locked " .. description .. " Door",
|
description = S("Windowed Locked " .. description .. " Door"),
|
||||||
inventory_image = "[combine:32x32:0,8=" .. texture .. ":16,8=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_locked_inv.png^[noalpha^[makealpha:0,255,0",
|
inventory_image = "[combine:32x32:0,8=" .. texture .. ":16,8=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_locked_inv.png^[noalpha^[makealpha:0,255,0",
|
||||||
protected = true,
|
protected = true,
|
||||||
groups = door_groups,
|
groups = table.copy(door_groups),
|
||||||
sound_open = "doors_steel_door_open",
|
sound_open = "doors_steel_door_open",
|
||||||
sound_close = "doors_steel_door_close",
|
sound_close = "doors_steel_door_close",
|
||||||
sounds = sounds.sounds or nil,
|
sounds = sounds.sounds or nil,
|
||||||
@ -174,10 +173,10 @@ function ts_doors.register_door(item, description, texture, sounds, recipe)
|
|||||||
|
|
||||||
doors.register("ts_doors:door_full_locked_" .. item:gsub(":", "_"), {
|
doors.register("ts_doors:door_full_locked_" .. item:gsub(":", "_"), {
|
||||||
tiles = { { name = "[combine:32x38:0,0=" .. texture .. ":0,16=" .. texture .. ":0,32=" .. texture .. ":16,0=" .. texture .. ":16,16=" .. texture .. ":16,32=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_full_locked.png^[noalpha", backface_culling = true } },
|
tiles = { { name = "[combine:32x38:0,0=" .. texture .. ":0,16=" .. texture .. ":0,32=" .. texture .. ":16,0=" .. texture .. ":16,16=" .. texture .. ":16,32=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_full_locked.png^[noalpha", backface_culling = true } },
|
||||||
description = "Solid Locked " .. description .. " Door",
|
description = S("Solid Locked " .. description .. " Door"),
|
||||||
inventory_image = "[combine:32x32:0,8=" .. texture .. ":16,8=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_full_locked_inv.png^[noalpha^[makealpha:0,255,0",
|
inventory_image = "[combine:32x32:0,8=" .. texture .. ":16,8=" .. texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_full_locked_inv.png^[noalpha^[makealpha:0,255,0",
|
||||||
protected = true,
|
protected = true,
|
||||||
groups = door_groups,
|
groups = table.copy(door_groups),
|
||||||
sound_open = "doors_steel_door_open",
|
sound_open = "doors_steel_door_open",
|
||||||
sound_close = "doors_steel_door_close",
|
sound_close = "doors_steel_door_close",
|
||||||
sounds = sounds.sounds or nil,
|
sounds = sounds.sounds or nil,
|
||||||
@ -186,91 +185,109 @@ function ts_doors.register_door(item, description, texture, sounds, recipe)
|
|||||||
})
|
})
|
||||||
|
|
||||||
doors.register_trapdoor("ts_doors:trapdoor_locked_" .. item:gsub(":", "_"), {
|
doors.register_trapdoor("ts_doors:trapdoor_locked_" .. item:gsub(":", "_"), {
|
||||||
description = "Windowed Locked " .. description .. " Trapdoor",
|
description = S("Windowed Locked " .. description .. " Trapdoor"),
|
||||||
inventory_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_locked.png^[noalpha^[makealpha:0,255,0",
|
inventory_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_locked.png^[noalpha^[makealpha:0,255,0",
|
||||||
wield_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_locked.png^[noalpha^[makealpha:0,255,0",
|
wield_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_locked.png^[noalpha^[makealpha:0,255,0",
|
||||||
tile_front = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_locked.png^[noalpha^[makealpha:0,255,0",
|
tile_front = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_locked.png^[noalpha^[makealpha:0,255,0",
|
||||||
tile_side = texture .. "^[colorize:#fff:30",
|
tile_side = texture .. "^[colorize:#fff:30",
|
||||||
protected = true,
|
protected = true,
|
||||||
groups = trapdoor_groups,
|
groups = table.copy(door_groups),
|
||||||
sounds = sounds.sounds or nil,
|
sounds = sounds.sounds or nil,
|
||||||
sound_open = sounds.sound_open or nil,
|
sound_open = sounds.sound_open or nil,
|
||||||
sound_close = sounds.sound_close or nil,
|
sound_close = sounds.sound_close or nil,
|
||||||
})
|
})
|
||||||
|
|
||||||
doors.register_trapdoor("ts_doors:trapdoor_full_locked_" .. item:gsub(":", "_"), {
|
doors.register_trapdoor("ts_doors:trapdoor_full_locked_" .. item:gsub(":", "_"), {
|
||||||
description = "Solid Locked " .. description .. " Trapdoor",
|
description = S("Solid Locked " .. description .. " Trapdoor"),
|
||||||
inventory_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full_locked.png^[noalpha",
|
inventory_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full_locked.png^[noalpha",
|
||||||
wield_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full_locked.png^[noalpha",
|
wield_image = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full_locked.png^[noalpha",
|
||||||
tile_front = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full_locked.png^[noalpha",
|
tile_front = texture .. "^[transformR90^[colorize:#fff:30^ts_doors_base_trapdoor_full_locked.png^[noalpha",
|
||||||
tile_side = texture .. "^[colorize:#fff:30",
|
tile_side = texture .. "^[colorize:#fff:30",
|
||||||
protected = true,
|
protected = true,
|
||||||
groups = trapdoor_groups,
|
groups = table.copy(door_groups),
|
||||||
sounds = sounds.sounds or nil,
|
sounds = sounds.sounds or nil,
|
||||||
sound_open = sounds.sound_open or nil,
|
sound_open = sounds.sound_open or nil,
|
||||||
sound_close = sounds.sound_close or nil,
|
sound_close = sounds.sound_close or nil,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
ts_doors.register_door("default:aspen_wood", "Aspen", "default_aspen_wood.png", ts_doors.sounds.wood)
|
ts_doors.register_door("default:aspen_wood", "Aspen", nil, ts_doors.sounds.wood)
|
||||||
ts_doors.register_door("default:pine_wood", "Pine", "default_pine_wood.png", ts_doors.sounds.wood)
|
ts_doors.register_door("default:pine_wood", "Pine", nil, ts_doors.sounds.wood)
|
||||||
ts_doors.register_door("default:acacia_wood", "Acacia", "default_acacia_wood.png", ts_doors.sounds.wood)
|
ts_doors.register_door("default:acacia_wood", "Acacia", nil, ts_doors.sounds.wood)
|
||||||
ts_doors.register_door("default:wood", "Wooden", "default_wood.png", ts_doors.sounds.wood)
|
ts_doors.register_door("default:wood", "Wooden", nil, ts_doors.sounds.wood)
|
||||||
ts_doors.register_door("default:junglewood", "Jungle Wood", "default_junglewood.png", ts_doors.sounds.wood)
|
ts_doors.register_door("default:junglewood", "Jungle Wood", nil, ts_doors.sounds.wood)
|
||||||
|
|
||||||
if minetest.get_modpath("moretrees") then
|
if minetest.get_modpath("moretrees") then
|
||||||
ts_doors.register_door("moretrees:apple_tree_planks", "Apple Tree", "moretrees_apple_tree_wood.png", ts_doors.sounds.wood)
|
ts_doors.register_door("moretrees:apple_tree_planks", "Apple Tree", nil, ts_doors.sounds.wood)
|
||||||
ts_doors.register_door("moretrees:beech_planks", "Beech", "moretrees_beech_wood.png", ts_doors.sounds.wood)
|
ts_doors.register_door("moretrees:beech_planks", "Beech", nil, ts_doors.sounds.wood)
|
||||||
ts_doors.register_door("moretrees:birch_planks", "Birch", "moretrees_birch_wood.png", ts_doors.sounds.wood)
|
ts_doors.register_door("moretrees:birch_planks", "Birch", nil, ts_doors.sounds.wood)
|
||||||
ts_doors.register_door("moretrees:fir_planks", "Fir", "moretrees_fir_wood.png", ts_doors.sounds.wood)
|
ts_doors.register_door("moretrees:fir_planks", "Fir", nil, ts_doors.sounds.wood)
|
||||||
ts_doors.register_door("moretrees:oak_planks", "Oak", "moretrees_oak_wood.png", ts_doors.sounds.wood)
|
ts_doors.register_door("moretrees:oak_planks", "Oak", nil, ts_doors.sounds.wood)
|
||||||
ts_doors.register_door("moretrees:palm_planks", "Palm", "moretrees_palm_wood.png", ts_doors.sounds.wood)
|
ts_doors.register_door("moretrees:palm_planks", "Palm", nil, ts_doors.sounds.wood)
|
||||||
ts_doors.register_door("moretrees:rubber_tree_planks", "Rubber Tree", "moretrees_rubber_tree_wood.png", ts_doors.sounds.wood)
|
ts_doors.register_door("moretrees:rubber_tree_planks", "Rubber Tree", nil, ts_doors.sounds.wood)
|
||||||
ts_doors.register_door("moretrees:sequoia_planks", "Sequoia", "moretrees_sequoia_wood.png", ts_doors.sounds.wood)
|
ts_doors.register_door("moretrees:sequoia_planks", "Sequoia", nil, ts_doors.sounds.wood)
|
||||||
ts_doors.register_door("moretrees:spruce_planks", "Spruce", "moretrees_spruce_wood.png", ts_doors.sounds.wood)
|
ts_doors.register_door("moretrees:spruce_planks", "Spruce", nil, ts_doors.sounds.wood)
|
||||||
ts_doors.register_door("moretrees:willow_planks", "Willow", "moretrees_willow_wood.png", ts_doors.sounds.wood)
|
ts_doors.register_door("moretrees:willow_planks", "Willow", nil, ts_doors.sounds.wood)
|
||||||
|
end
|
||||||
|
|
||||||
|
if minetest.get_modpath("ethereal") then
|
||||||
|
ts_doors.register_door("ethereal:banana_wood", "Banana", nil, ts_doors.sounds.wood)
|
||||||
|
ts_doors.register_door("ethereal:birch_wood", "Birch", nil, ts_doors.sounds.wood)
|
||||||
|
ts_doors.register_door("ethereal:frost_wood", "Frost", nil, ts_doors.sounds.wood)
|
||||||
|
ts_doors.register_door("ethereal:mushroom_trunk", "Mushroom", nil, ts_doors.sounds.wood)
|
||||||
|
ts_doors.register_door("ethereal:palm_wood", "Palm", nil, ts_doors.sounds.wood)
|
||||||
|
ts_doors.register_door("ethereal:redwood_wood", "Redwood", nil, ts_doors.sounds.wood)
|
||||||
|
ts_doors.register_door("ethereal:sakura_wood", "Sakura", nil, ts_doors.sounds.wood)
|
||||||
|
ts_doors.register_door("ethereal:scorched_tree", "Scorched", nil, ts_doors.sounds.wood)
|
||||||
|
ts_doors.register_door("ethereal:willow_wood", "Willow", nil, ts_doors.sounds.wood)
|
||||||
|
ts_doors.register_door("ethereal:yellow_wood", "Healing Tree", nil, ts_doors.sounds.wood)
|
||||||
|
ts_doors.register_door("ethereal:crystal_block", "Crystal", nil, ts_doors.sounds.metal, "ethereal:crystal_ingot")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
ts_doors.register_door("default:bronzeblock", "Bronze", "default_bronze_block.png", ts_doors.sounds.metal, "default:bronze_ingot")
|
ts_doors.register_door("default:bronzeblock", "Bronze", nil, ts_doors.sounds.metal, "default:bronze_ingot")
|
||||||
ts_doors.register_door("default:copperblock", "Copper", "default_copper_block.png", ts_doors.sounds.metal, "default:copper_ingot")
|
ts_doors.register_door("default:copperblock", "Copper", nil, ts_doors.sounds.metal, "default:copper_ingot")
|
||||||
ts_doors.register_door("default:diamondblock", "Diamond", "default_diamond_block.png", ts_doors.sounds.metal, "default:diamond")
|
ts_doors.register_door("default:diamondblock", "Diamond", nil, ts_doors.sounds.metal, "default:diamond")
|
||||||
ts_doors.register_door("default:goldblock", "Gold", "default_gold_block.png", ts_doors.sounds.metal, "default:gold_ingot")
|
ts_doors.register_door("default:goldblock", "Gold", nil, ts_doors.sounds.metal, "default:gold_ingot")
|
||||||
ts_doors.register_door("default:steelblock", "Steel", minetest.registered_nodes["default:steelblock"].tiles[1], ts_doors.sounds.metal, "default:steel_ingot")
|
ts_doors.register_door("default:steelblock", "Steel", nil, ts_doors.sounds.metal, "default:steel_ingot")
|
||||||
|
|
||||||
if minetest.get_modpath("moreores") then
|
if minetest.get_modpath("moreores") then
|
||||||
ts_doors.register_door("moreores:mithril_block", "Mithril", "moreores_mithril_block.png", ts_doors.sounds.metal, "moreores:mithril_ingot")
|
ts_doors.register_door("moreores:mithril_block", "Mithril", nil, ts_doors.sounds.metal, "moreores:mithril_ingot")
|
||||||
ts_doors.register_door("moreores:silver_block", "Silver", "moreores_silver_block.png", ts_doors.sounds.metal, "moreores:silver_ingot")
|
ts_doors.register_door("moreores:silver_block", "Silver", nil, ts_doors.sounds.metal, "moreores:silver_ingot")
|
||||||
ts_doors.register_door("moreores:tin_block", "Tin", "moreores_tin_block.png", ts_doors.sounds.metal, "moreores:tin_ingot")
|
ts_doors.register_door("moreores:tin_block", "Tin", nil, ts_doors.sounds.metal, "moreores:tin_ingot")
|
||||||
end
|
end
|
||||||
|
|
||||||
if minetest.get_modpath("technic") then
|
if minetest.get_modpath("technic") then
|
||||||
ts_doors.register_door("technic:brass_block", "Brass", "technic_brass_block.png", ts_doors.sounds.metal, "technic:brass_ingot")
|
ts_doors.register_door("technic:carbon_steel_block", "Carbon Steel", nil, ts_doors.sounds.metal, "technic:carbon_steel_ingot")
|
||||||
ts_doors.register_door("technic:carbon_steel_block", "Carbon Steel", "technic_carbon_steel_block.png", ts_doors.sounds.metal, "technic:carbon_steel_ingot")
|
ts_doors.register_door("technic:cast_iron_block", "Cast Iron", nil, ts_doors.sounds.metal, "technic:cast_iron_ingot")
|
||||||
ts_doors.register_door("technic:cast_iron_block", "Cast Iron", "technic_cast_iron_block.png", ts_doors.sounds.metal, "technic:cast_iron_ingot")
|
ts_doors.register_door("technic:chromium_block", "Chromium", nil, ts_doors.sounds.metal, "technic:chromium_ingot")
|
||||||
ts_doors.register_door("technic:chromium_block", "Chromium", "technic_chromium_block.png", ts_doors.sounds.metal, "technic:chromium_ingot")
|
ts_doors.register_door("technic:lead_block", "Lead", nil, ts_doors.sounds.metal, "technic:lead_ingot")
|
||||||
ts_doors.register_door("technic:lead_block", "Lead", "technic_lead_block.png", ts_doors.sounds.metal, "technic:lead_ingot")
|
ts_doors.register_door("technic:stainless_steel_block", "Stainless Steel", nil, ts_doors.sounds.metal, "technic:stainless_steel_ingot")
|
||||||
ts_doors.register_door("technic:stainless_steel_block", "Stainless Steel", "technic_stainless_steel_block.png", ts_doors.sounds.metal, "technic:stainless_steel_ingot")
|
ts_doors.register_door("technic:zinc_block", "Zinc", nil, ts_doors.sounds.metal, "technic:zinc_ingot")
|
||||||
ts_doors.register_door("technic:zinc_block", "Zinc", "technic_zinc_block.png", ts_doors.sounds.metal, "technic:zinc_ingot")
|
ts_doors.register_door("technic:blast_resistant_concrete", "Blast Resistant Concrete", nil, ts_doors.sounds.metal)
|
||||||
|
end
|
||||||
|
|
||||||
ts_doors.register_door("technic:concrete", "Concrete", "technic_concrete_block.png", ts_doors.sounds.metal)
|
if minetest.get_modpath("basic_materials") then
|
||||||
ts_doors.register_door("technic:blast_resistant_concrete", "Blast Resistant Concrete", "technic_blast_resistant_concrete_block.png", ts_doors.sounds.metal)
|
ts_doors.register_door("basic_materials:brass_block", "Brass", nil, ts_doors.sounds.metal, "basic_materials:brass_ingot")
|
||||||
|
ts_doors.register_door("basic_materials:concrete_block", "Concrete", nil, ts_doors.sounds.metal)
|
||||||
|
ts_doors.register_alias("technic:brass_block", "basic_materials:brass_block")
|
||||||
|
ts_doors.register_alias("technic:concrete", "basic_materials:concrete_block")
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.override_item("doors:door_steel", {
|
minetest.override_item("doors:door_steel", {
|
||||||
description = "Windowed Locked Plain Steel Door",
|
description = S("Windowed Locked Plain Steel Door"),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.override_item("doors:door_wood", {
|
minetest.override_item("doors:door_wood", {
|
||||||
description = "Windowed Mixed Wood Door",
|
description = S("Windowed Mixed Wood Door"),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.override_item("doors:trapdoor", {
|
minetest.override_item("doors:trapdoor", {
|
||||||
description = "Windowed Mixed Wood Trapdoor",
|
description = S("Windowed Mixed Wood Trapdoor"),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.override_item("doors:trapdoor_steel", {
|
minetest.override_item("doors:trapdoor_steel", {
|
||||||
description = "Windowed Locked Plain Steel Trapdoor",
|
description = S("Windowed Locked Plain Steel Trapdoor"),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -278,83 +295,15 @@ minetest.override_item("doors:trapdoor_steel", {
|
|||||||
|
|
||||||
ts_doors.workshop = {}
|
ts_doors.workshop = {}
|
||||||
|
|
||||||
function ts_doors.workshop.start(pos)
|
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
if node.name ~= "ts_doors:workshop" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
local selection = meta:get_string("selection")
|
|
||||||
local material = inv:get_stack("material", 1):get_name()
|
|
||||||
local material_needed_name = inv:get_stack("material_needed", 1):get_name()
|
|
||||||
local material_needed = inv:get_stack("material_needed", 1):get_count()
|
|
||||||
local material_ok = inv:get_stack("material", 1):get_count() >= material_needed
|
|
||||||
local steel = inv:get_stack("steel", 1):get_name()
|
|
||||||
local steel_needed = inv:get_stack("steel_needed", 1):get_count()
|
|
||||||
local steel_ok = inv:get_stack("steel", 1):get_count() >= steel_needed
|
|
||||||
|
|
||||||
if not (material_ok and steel_ok
|
|
||||||
and (steel and steel == "default:steel_ingot" or steel_needed == 0)
|
|
||||||
and selection and selection ~= ""
|
|
||||||
and material == material_needed_name)
|
|
||||||
then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if not inv:room_for_item("output", { name = selection, count = 1 }) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
meta:set_string("working_on", selection)
|
|
||||||
meta:set_int("progress", 0)
|
|
||||||
inv:remove_item("material", { name = material, count = material_needed })
|
|
||||||
inv:remove_item("steel", { name = "default:steel_ingot", count = steel_needed })
|
|
||||||
ts_doors.workshop.step(pos)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ts_doors.workshop.step(pos)
|
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
if node.name ~= "ts_doors:workshop" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
if meta:get_string("working_on") == "" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
local progress = meta:get_int("progress")
|
|
||||||
progress = progress + 1
|
|
||||||
if progress < 10 then
|
|
||||||
minetest.after(0.2, ts_doors.workshop.step, pos)
|
|
||||||
else
|
|
||||||
meta:set_int("progress", 0)
|
|
||||||
progress = 0
|
|
||||||
inv:add_item("output", meta:get_string("working_on"))
|
|
||||||
meta:set_string("working_on", "")
|
|
||||||
ts_doors.workshop.start(pos)
|
|
||||||
end
|
|
||||||
meta:set_int("progress", progress)
|
|
||||||
ts_doors.workshop.update_formspec(pos)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ts_doors.workshop.update_formspec(pos)
|
function ts_doors.workshop.update_formspec(pos)
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
if node.name ~= "ts_doors:workshop" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local page = meta:get_int("page")
|
local page = meta:get_int("page")
|
||||||
local maxpage = meta:get_int("maxpage")
|
local maxpage = meta:get_int("maxpage")
|
||||||
local selection = meta:get_string("selection")
|
local selection = meta:get_string("selection")
|
||||||
|
|
||||||
local int_to_bool = {}
|
local trapdoor = meta:get_int("trapdoor") == 1
|
||||||
int_to_bool[0] = false
|
local locked = meta:get_int("locked") == 1
|
||||||
int_to_bool[1] = true
|
local solid = meta:get_int("solid") == 1
|
||||||
local trapdoor = int_to_bool[meta:get_int("trapdoor")] or false
|
|
||||||
local locked = int_to_bool[meta:get_int("locked")] or false
|
|
||||||
local solid = int_to_bool[meta:get_int("solid")] or false
|
|
||||||
|
|
||||||
if page < 1 then
|
if page < 1 then
|
||||||
page = maxpage
|
page = maxpage
|
||||||
@ -446,10 +395,6 @@ function ts_doors.workshop.update_formspec(pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function update_inventory(pos)
|
local function update_inventory(pos)
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
if node.name ~= "ts_doors:workshop" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
local itemcount = 0
|
local itemcount = 0
|
||||||
@ -467,45 +412,10 @@ local function update_inventory(pos)
|
|||||||
inv:set_size("steel", 1)
|
inv:set_size("steel", 1)
|
||||||
inv:set_size("output", 1)
|
inv:set_size("output", 1)
|
||||||
|
|
||||||
local int_to_bool = {}
|
local trapdoor = meta:get_int("trapdoor") == 1
|
||||||
int_to_bool[0] = false
|
local locked = meta:get_int("locked") == 1
|
||||||
int_to_bool[1] = true
|
local solid = meta:get_int("solid") == 1
|
||||||
|
|
||||||
local trapdoor = int_to_bool[meta:get_int("trapdoor")] or false
|
|
||||||
local locked = int_to_bool[meta:get_int("locked")] or false
|
|
||||||
local solid = int_to_bool[meta:get_int("solid")] or false
|
|
||||||
|
|
||||||
for item, recipe in pairs(ts_doors.registered_doors) do
|
|
||||||
if trapdoor then
|
|
||||||
if locked then
|
|
||||||
if solid then
|
|
||||||
inv:add_item("list", "ts_doors:trapdoor_full_locked_" .. item:gsub(":", "_"))
|
|
||||||
else
|
|
||||||
inv:add_item("list", "ts_doors:trapdoor_locked_" .. item:gsub(":", "_"))
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if solid then
|
|
||||||
inv:add_item("list", "ts_doors:trapdoor_full_" .. item:gsub(":", "_"))
|
|
||||||
else
|
|
||||||
inv:add_item("list", "ts_doors:trapdoor_" .. item:gsub(":", "_"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if locked then
|
|
||||||
if solid then
|
|
||||||
inv:add_item("list", "ts_doors:door_full_locked_" .. item:gsub(":", "_"))
|
|
||||||
else
|
|
||||||
inv:add_item("list", "ts_doors:door_locked_" .. item:gsub(":", "_"))
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if solid then
|
|
||||||
inv:add_item("list", "ts_doors:door_full_" .. item:gsub(":", "_"))
|
|
||||||
else
|
|
||||||
inv:add_item("list", "ts_doors:door_" .. item:gsub(":", "_"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local selection = meta:get_string("selection")
|
local selection = meta:get_string("selection")
|
||||||
if selection and selection ~= "" then
|
if selection and selection ~= "" then
|
||||||
local door = selection:sub(10)
|
local door = selection:sub(10)
|
||||||
@ -544,8 +454,6 @@ local function update_inventory(pos)
|
|||||||
inv:add_item("material_needed", { name = ts_doors.registered_doors[door], count = material_needed })
|
inv:add_item("material_needed", { name = ts_doors.registered_doors[door], count = material_needed })
|
||||||
inv:add_item("steel_needed", { name = "default:steel_ingot", count = steel_needed })
|
inv:add_item("steel_needed", { name = "default:steel_ingot", count = steel_needed })
|
||||||
end
|
end
|
||||||
ts_doors.workshop.update_formspec(pos)
|
|
||||||
ts_doors.workshop.start(pos)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_receive_fields(pos, formname, fields, sender)
|
local function on_receive_fields(pos, formname, fields, sender)
|
||||||
@ -575,7 +483,6 @@ local function on_receive_fields(pos, formname, fields, sender)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
update_inventory(pos)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_construct(pos)
|
local function on_construct(pos)
|
||||||
@ -588,7 +495,6 @@ local function on_construct(pos)
|
|||||||
meta:set_int("page", 1)
|
meta:set_int("page", 1)
|
||||||
meta:set_int("maxpage", 1)
|
meta:set_int("maxpage", 1)
|
||||||
meta:set_string("selection", "")
|
meta:set_string("selection", "")
|
||||||
update_inventory(pos)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
|
local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
@ -636,15 +542,12 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function on_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
|
local function on_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
update_inventory(pos)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_metadata_inventory_put(pos, listname, index, stack, player)
|
local function on_metadata_inventory_put(pos, listname, index, stack, player)
|
||||||
update_inventory(pos)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_metadata_inventory_take(pos, listname, index, stack, player)
|
local function on_metadata_inventory_take(pos, listname, index, stack, player)
|
||||||
update_inventory(pos)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function can_dig(pos, player)
|
local function can_dig(pos, player)
|
||||||
@ -656,8 +559,8 @@ local function can_dig(pos, player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("ts_doors:workshop", {
|
ts_workshop.register_workshop("ts_doors", "workshop", {
|
||||||
description = "Door Workshop",
|
description = S("Door Workshop"),
|
||||||
tiles = {
|
tiles = {
|
||||||
"default_wood.png",
|
"default_wood.png",
|
||||||
"default_wood.png",
|
"default_wood.png",
|
||||||
@ -693,6 +596,43 @@ minetest.register_node("ts_doors:workshop", {
|
|||||||
on_metadata_inventory_take = on_metadata_inventory_take,
|
on_metadata_inventory_take = on_metadata_inventory_take,
|
||||||
can_dig = can_dig,
|
can_dig = can_dig,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
enough_supply = function(pos, selection)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
if meta:get_string("working_on") ~= "" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
local selection = meta:get_string("selection")
|
||||||
|
local material = inv:get_stack("material", 1):get_name()
|
||||||
|
local material_needed_name = inv:get_stack("material_needed", 1):get_name()
|
||||||
|
local material_needed = inv:get_stack("material_needed", 1):get_count()
|
||||||
|
local material_ok = inv:get_stack("material", 1):get_count() >= material_needed
|
||||||
|
local steel = inv:get_stack("steel", 1):get_name()
|
||||||
|
local steel_needed = inv:get_stack("steel_needed", 1):get_count()
|
||||||
|
local steel_ok = inv:get_stack("steel", 1):get_count() >= steel_needed
|
||||||
|
|
||||||
|
if not (material_ok and steel_ok
|
||||||
|
and (steel and steel == "default:steel_ingot" or steel_needed == 0)
|
||||||
|
and selection and selection ~= ""
|
||||||
|
and material == material_needed_name)
|
||||||
|
then
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
remove_supply = function(pos, selection)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
local material = inv:get_stack("material", 1):get_name()
|
||||||
|
local material_needed = inv:get_stack("material_needed", 1):get_count()
|
||||||
|
local steel_needed = inv:get_stack("steel_needed", 1):get_count()
|
||||||
|
|
||||||
|
inv:remove_item("material", { name = material, count = material_needed })
|
||||||
|
inv:remove_item("steel", { name = "default:steel_ingot", count = steel_needed })
|
||||||
|
end,
|
||||||
|
update_inventory = update_inventory,
|
||||||
|
update_formspec = ts_doors.workshop.update_formspec,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_lbm({
|
minetest.register_lbm({
|
||||||
@ -716,4 +656,4 @@ minetest.register_craft({
|
|||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "ts_doors:workshop",
|
recipe = "ts_doors:workshop",
|
||||||
burntime = 30,
|
burntime = 30,
|
||||||
})
|
})
|
||||||
|
349
locale/template.txt
Normal file
349
locale/template.txt
Normal file
@ -0,0 +1,349 @@
|
|||||||
|
Aspen Windowed Door=
|
||||||
|
Solid Aspen Door=
|
||||||
|
Windowed Aspen Trapdoor=
|
||||||
|
Solid Aspen Trapdoor=
|
||||||
|
Windowed Locked Aspen Door=
|
||||||
|
Solid Locked Aspen Door=
|
||||||
|
Windowed Locked Aspen Trapdoor=
|
||||||
|
Solid Locked Aspen Trapdoor=
|
||||||
|
Pine Windowed Door=
|
||||||
|
Solid Pine Door=
|
||||||
|
Windowed Pine Trapdoor=
|
||||||
|
Solid Pine Trapdoor=
|
||||||
|
Windowed Locked Pine Door=
|
||||||
|
Solid Locked Pine Door=
|
||||||
|
Windowed Locked Pine Trapdoor=
|
||||||
|
Solid Locked Pine Trapdoor=
|
||||||
|
Acacia Windowed Door=
|
||||||
|
Solid Acacia Door=
|
||||||
|
Windowed Acacia Trapdoor=
|
||||||
|
Solid Acacia Trapdoor=
|
||||||
|
Windowed Locked Acacia Door=
|
||||||
|
Solid Locked Acacia Door=
|
||||||
|
Windowed Locked Acacia Trapdoor=
|
||||||
|
Solid Locked Acacia Trapdoor=
|
||||||
|
Wooden Windowed Door=
|
||||||
|
Solid Wooden Door=
|
||||||
|
Windowed Wooden Trapdoor=
|
||||||
|
Solid Wooden Trapdoor=
|
||||||
|
Windowed Locked Wooden Door=
|
||||||
|
Solid Locked Wooden Door=
|
||||||
|
Windowed Locked Wooden Trapdoor=
|
||||||
|
Solid Locked Wooden Trapdoor=
|
||||||
|
Jungle Wood Windowed Door=
|
||||||
|
Solid Jungle Wood Door=
|
||||||
|
Windowed Jungle Wood Trapdoor=
|
||||||
|
Solid Jungle Wood Trapdoor=
|
||||||
|
Windowed Locked Jungle Wood Door=
|
||||||
|
Solid Locked Jungle Wood Door=
|
||||||
|
Windowed Locked Jungle Wood Trapdoor=
|
||||||
|
Solid Locked Jungle Wood Trapdoor=
|
||||||
|
Apple Tree Windowed Door=
|
||||||
|
Solid Apple Tree Door=
|
||||||
|
Windowed Apple Tree Trapdoor=
|
||||||
|
Solid Apple Tree Trapdoor=
|
||||||
|
Windowed Locked Apple Tree Door=
|
||||||
|
Solid Locked Apple Tree Door=
|
||||||
|
Windowed Locked Apple Tree Trapdoor=
|
||||||
|
Solid Locked Apple Tree Trapdoor=
|
||||||
|
Beech Windowed Door=
|
||||||
|
Solid Beech Door=
|
||||||
|
Windowed Beech Trapdoor=
|
||||||
|
Solid Beech Trapdoor=
|
||||||
|
Windowed Locked Beech Door=
|
||||||
|
Solid Locked Beech Door=
|
||||||
|
Windowed Locked Beech Trapdoor=
|
||||||
|
Solid Locked Beech Trapdoor=
|
||||||
|
Birch Windowed Door=
|
||||||
|
Solid Birch Door=
|
||||||
|
Windowed Birch Trapdoor=
|
||||||
|
Solid Birch Trapdoor=
|
||||||
|
Windowed Locked Birch Door=
|
||||||
|
Solid Locked Birch Door=
|
||||||
|
Windowed Locked Birch Trapdoor=
|
||||||
|
Solid Locked Birch Trapdoor=
|
||||||
|
Fir Windowed Door=
|
||||||
|
Solid Fir Door=
|
||||||
|
Windowed Fir Trapdoor=
|
||||||
|
Solid Fir Trapdoor=
|
||||||
|
Windowed Locked Fir Door=
|
||||||
|
Solid Locked Fir Door=
|
||||||
|
Windowed Locked Fir Trapdoor=
|
||||||
|
Solid Locked Fir Trapdoor=
|
||||||
|
Oak Windowed Door=
|
||||||
|
Solid Oak Door=
|
||||||
|
Windowed Oak Trapdoor=
|
||||||
|
Solid Oak Trapdoor=
|
||||||
|
Windowed Locked Oak Door=
|
||||||
|
Solid Locked Oak Door=
|
||||||
|
Windowed Locked Oak Trapdoor=
|
||||||
|
Solid Locked Oak Trapdoor=
|
||||||
|
Palm Windowed Door=
|
||||||
|
Solid Palm Door=
|
||||||
|
Windowed Palm Trapdoor=
|
||||||
|
Solid Palm Trapdoor=
|
||||||
|
Windowed Locked Palm Door=
|
||||||
|
Solid Locked Palm Door=
|
||||||
|
Windowed Locked Palm Trapdoor=
|
||||||
|
Solid Locked Palm Trapdoor=
|
||||||
|
Rubber Tree Windowed Door=
|
||||||
|
Solid Rubber Tree Door=
|
||||||
|
Windowed Rubber Tree Trapdoor=
|
||||||
|
Solid Rubber Tree Trapdoor=
|
||||||
|
Windowed Locked Rubber Tree Door=
|
||||||
|
Solid Locked Rubber Tree Door=
|
||||||
|
Windowed Locked Rubber Tree Trapdoor=
|
||||||
|
Solid Locked Rubber Tree Trapdoor=
|
||||||
|
Sequoia Windowed Door=
|
||||||
|
Solid Sequoia Door=
|
||||||
|
Windowed Sequoia Trapdoor=
|
||||||
|
Solid Sequoia Trapdoor=
|
||||||
|
Windowed Locked Sequoia Door=
|
||||||
|
Solid Locked Sequoia Door=
|
||||||
|
Windowed Locked Sequoia Trapdoor=
|
||||||
|
Solid Locked Sequoia Trapdoor=
|
||||||
|
Spruce Windowed Door=
|
||||||
|
Solid Spruce Door=
|
||||||
|
Windowed Spruce Trapdoor=
|
||||||
|
Solid Spruce Trapdoor=
|
||||||
|
Windowed Locked Spruce Door=
|
||||||
|
Solid Locked Spruce Door=
|
||||||
|
Windowed Locked Spruce Trapdoor=
|
||||||
|
Solid Locked Spruce Trapdoor=
|
||||||
|
Willow Windowed Door=
|
||||||
|
Solid Willow Door=
|
||||||
|
Windowed Willow Trapdoor=
|
||||||
|
Solid Willow Trapdoor=
|
||||||
|
Windowed Locked Willow Door=
|
||||||
|
Solid Locked Willow Door=
|
||||||
|
Windowed Locked Willow Trapdoor=
|
||||||
|
Solid Locked Willow Trapdoor=
|
||||||
|
Banana Windowed Door=
|
||||||
|
Solid Banana Door=
|
||||||
|
Windowed Banana Trapdoor=
|
||||||
|
Solid Banana Trapdoor=
|
||||||
|
Windowed Locked Banana Door=
|
||||||
|
Solid Locked Banana Door=
|
||||||
|
Windowed Locked Banana Trapdoor=
|
||||||
|
Solid Locked Banana Trapdoor=
|
||||||
|
Birch Windowed Door=
|
||||||
|
Solid Birch Door=
|
||||||
|
Windowed Birch Trapdoor=
|
||||||
|
Solid Birch Trapdoor=
|
||||||
|
Windowed Locked Birch Door=
|
||||||
|
Solid Locked Birch Door=
|
||||||
|
Windowed Locked Birch Trapdoor=
|
||||||
|
Solid Locked Birch Trapdoor=
|
||||||
|
Frost Windowed Door=
|
||||||
|
Solid Frost Door=
|
||||||
|
Windowed Frost Trapdoor=
|
||||||
|
Solid Frost Trapdoor=
|
||||||
|
Windowed Locked Frost Door=
|
||||||
|
Solid Locked Frost Door=
|
||||||
|
Windowed Locked Frost Trapdoor=
|
||||||
|
Solid Locked Frost Trapdoor=
|
||||||
|
Mushroom Windowed Door=
|
||||||
|
Solid Mushroom Door=
|
||||||
|
Windowed Mushroom Trapdoor=
|
||||||
|
Solid Mushroom Trapdoor=
|
||||||
|
Windowed Locked Mushroom Door=
|
||||||
|
Solid Locked Mushroom Door=
|
||||||
|
Windowed Locked Mushroom Trapdoor=
|
||||||
|
Solid Locked Mushroom Trapdoor=
|
||||||
|
Palm Windowed Door=
|
||||||
|
Solid Palm Door=
|
||||||
|
Windowed Palm Trapdoor=
|
||||||
|
Solid Palm Trapdoor=
|
||||||
|
Windowed Locked Palm Door=
|
||||||
|
Solid Locked Palm Door=
|
||||||
|
Windowed Locked Palm Trapdoor=
|
||||||
|
Solid Locked Palm Trapdoor=
|
||||||
|
Redwood Windowed Door=
|
||||||
|
Solid Redwood Door=
|
||||||
|
Windowed Redwood Trapdoor=
|
||||||
|
Solid Redwood Trapdoor=
|
||||||
|
Windowed Locked Redwood Door=
|
||||||
|
Solid Locked Redwood Door=
|
||||||
|
Windowed Locked Redwood Trapdoor=
|
||||||
|
Solid Locked Redwood Trapdoor=
|
||||||
|
Sakura Windowed Door=
|
||||||
|
Solid Sakura Door=
|
||||||
|
Windowed Sakura Trapdoor=
|
||||||
|
Solid Sakura Trapdoor=
|
||||||
|
Windowed Locked Sakura Door=
|
||||||
|
Solid Locked Sakura Door=
|
||||||
|
Windowed Locked Sakura Trapdoor=
|
||||||
|
Solid Locked Sakura Trapdoor=
|
||||||
|
Scorched Windowed Door=
|
||||||
|
Solid Scorched Door=
|
||||||
|
Windowed Scorched Trapdoor=
|
||||||
|
Solid Scorched Trapdoor=
|
||||||
|
Windowed Locked Scorched Door=
|
||||||
|
Solid Locked Scorched Door=
|
||||||
|
Windowed Locked Scorched Trapdoor=
|
||||||
|
Solid Locked Scorched Trapdoor=
|
||||||
|
Willow Windowed Door=
|
||||||
|
Solid Willow Door=
|
||||||
|
Windowed Willow Trapdoor=
|
||||||
|
Solid Willow Trapdoor=
|
||||||
|
Windowed Locked Willow Door=
|
||||||
|
Solid Locked Willow Door=
|
||||||
|
Windowed Locked Willow Trapdoor=
|
||||||
|
Solid Locked Willow Trapdoor=
|
||||||
|
Healing Tree Windowed Door=
|
||||||
|
Solid Healing Tree Door=
|
||||||
|
Windowed Healing Tree Trapdoor=
|
||||||
|
Solid Healing Tree Trapdoor=
|
||||||
|
Windowed Locked Healing Tree Door=
|
||||||
|
Solid Locked Healing Tree Door=
|
||||||
|
Windowed Locked Healing Tree Trapdoor=
|
||||||
|
Solid Locked Healing Tree Trapdoor=
|
||||||
|
Crystal Windowed Door=
|
||||||
|
Solid Crystal Door=
|
||||||
|
Windowed Crystal Trapdoor=
|
||||||
|
Solid Crystal Trapdoor=
|
||||||
|
Windowed Locked Crystal Door=
|
||||||
|
Solid Locked Crystal Door=
|
||||||
|
Windowed Locked Crystal Trapdoor=
|
||||||
|
Solid Locked Crystal Trapdoor=
|
||||||
|
Bronze Windowed Door=
|
||||||
|
Solid Bronze Door=
|
||||||
|
Windowed Bronze Trapdoor=
|
||||||
|
Solid Bronze Trapdoor=
|
||||||
|
Windowed Locked Bronze Door=
|
||||||
|
Solid Locked Bronze Door=
|
||||||
|
Windowed Locked Bronze Trapdoor=
|
||||||
|
Solid Locked Bronze Trapdoor=
|
||||||
|
Copper Windowed Door=
|
||||||
|
Solid Copper Door=
|
||||||
|
Windowed Copper Trapdoor=
|
||||||
|
Solid Copper Trapdoor=
|
||||||
|
Windowed Locked Copper Door=
|
||||||
|
Solid Locked Copper Door=
|
||||||
|
Windowed Locked Copper Trapdoor=
|
||||||
|
Solid Locked Copper Trapdoor=
|
||||||
|
Diamond Windowed Door=
|
||||||
|
Solid Diamond Door=
|
||||||
|
Windowed Diamond Trapdoor=
|
||||||
|
Solid Diamond Trapdoor=
|
||||||
|
Windowed Locked Diamond Door=
|
||||||
|
Solid Locked Diamond Door=
|
||||||
|
Windowed Locked Diamond Trapdoor=
|
||||||
|
Solid Locked Diamond Trapdoor=
|
||||||
|
Gold Windowed Door=
|
||||||
|
Solid Gold Door=
|
||||||
|
Windowed Gold Trapdoor=
|
||||||
|
Solid Gold Trapdoor=
|
||||||
|
Windowed Locked Gold Door=
|
||||||
|
Solid Locked Gold Door=
|
||||||
|
Windowed Locked Gold Trapdoor=
|
||||||
|
Solid Locked Gold Trapdoor=
|
||||||
|
Steel Windowed Door=
|
||||||
|
Solid Steel Door=
|
||||||
|
Windowed Steel Trapdoor=
|
||||||
|
Solid Steel Trapdoor=
|
||||||
|
Windowed Locked Steel Door=
|
||||||
|
Solid Locked Steel Door=
|
||||||
|
Windowed Locked Steel Trapdoor=
|
||||||
|
Solid Locked Steel Trapdoor=
|
||||||
|
Mithril Windowed Door=
|
||||||
|
Solid Mithril Door=
|
||||||
|
Windowed Mithril Trapdoor=
|
||||||
|
Solid Mithril Trapdoor=
|
||||||
|
Windowed Locked Mithril Door=
|
||||||
|
Solid Locked Mithril Door=
|
||||||
|
Windowed Locked Mithril Trapdoor=
|
||||||
|
Solid Locked Mithril Trapdoor=
|
||||||
|
Silver Windowed Door=
|
||||||
|
Solid Silver Door=
|
||||||
|
Windowed Silver Trapdoor=
|
||||||
|
Solid Silver Trapdoor=
|
||||||
|
Windowed Locked Silver Door=
|
||||||
|
Solid Locked Silver Door=
|
||||||
|
Windowed Locked Silver Trapdoor=
|
||||||
|
Solid Locked Silver Trapdoor=
|
||||||
|
Tin Windowed Door=
|
||||||
|
Solid Tin Door=
|
||||||
|
Windowed Tin Trapdoor=
|
||||||
|
Solid Tin Trapdoor=
|
||||||
|
Windowed Locked Tin Door=
|
||||||
|
Solid Locked Tin Door=
|
||||||
|
Windowed Locked Tin Trapdoor=
|
||||||
|
Solid Locked Tin Trapdoor=
|
||||||
|
Carbon Steel Windowed Door=
|
||||||
|
Solid Carbon Steel Door=
|
||||||
|
Windowed Carbon Steel Trapdoor=
|
||||||
|
Solid Carbon Steel Trapdoor=
|
||||||
|
Windowed Locked Carbon Steel Door=
|
||||||
|
Solid Locked Carbon Steel Door=
|
||||||
|
Windowed Locked Carbon Steel Trapdoor=
|
||||||
|
Solid Locked Carbon Steel Trapdoor=
|
||||||
|
Cast Iron Windowed Door=
|
||||||
|
Solid Cast Iron Door=
|
||||||
|
Windowed Cast Iron Trapdoor=
|
||||||
|
Solid Cast Iron Trapdoor=
|
||||||
|
Windowed Locked Cast Iron Door=
|
||||||
|
Solid Locked Cast Iron Door=
|
||||||
|
Windowed Locked Cast Iron Trapdoor=
|
||||||
|
Solid Locked Cast Iron Trapdoor=
|
||||||
|
Chromium Windowed Door=
|
||||||
|
Solid Chromium Door=
|
||||||
|
Windowed Chromium Trapdoor=
|
||||||
|
Solid Chromium Trapdoor=
|
||||||
|
Windowed Locked Chromium Door=
|
||||||
|
Solid Locked Chromium Door=
|
||||||
|
Windowed Locked Chromium Trapdoor=
|
||||||
|
Solid Locked Chromium Trapdoor=
|
||||||
|
Lead Windowed Door=
|
||||||
|
Solid Lead Door=
|
||||||
|
Windowed Lead Trapdoor=
|
||||||
|
Solid Lead Trapdoor=
|
||||||
|
Windowed Locked Lead Door=
|
||||||
|
Solid Locked Lead Door=
|
||||||
|
Windowed Locked Lead Trapdoor=
|
||||||
|
Solid Locked Lead Trapdoor=
|
||||||
|
Stainless Steel Windowed Door=
|
||||||
|
Solid Stainless Steel Door=
|
||||||
|
Windowed Stainless Steel Trapdoor=
|
||||||
|
Solid Stainless Steel Trapdoor=
|
||||||
|
Windowed Locked Stainless Steel Door=
|
||||||
|
Solid Locked Stainless Steel Door=
|
||||||
|
Windowed Locked Stainless Steel Trapdoor=
|
||||||
|
Solid Locked Stainless Steel Trapdoor=
|
||||||
|
Zinc Windowed Door=
|
||||||
|
Solid Zinc Door=
|
||||||
|
Windowed Zinc Trapdoor=
|
||||||
|
Solid Zinc Trapdoor=
|
||||||
|
Windowed Locked Zinc Door=
|
||||||
|
Solid Locked Zinc Door=
|
||||||
|
Windowed Locked Zinc Trapdoor=
|
||||||
|
Solid Locked Zinc Trapdoor=
|
||||||
|
Blast Resistant Concrete Windowed Door=
|
||||||
|
Solid Blast Resistant Concrete Door=
|
||||||
|
Windowed Blast Resistant Concrete Trapdoor=
|
||||||
|
Solid Blast Resistant Concrete Trapdoor=
|
||||||
|
Windowed Locked Blast Resistant Concrete Door=
|
||||||
|
Solid Locked Blast Resistant Concrete Door=
|
||||||
|
Windowed Locked Blast Resistant Concrete Trapdoor=
|
||||||
|
Solid Locked Blast Resistant Concrete Trapdoor=
|
||||||
|
Brass Windowed Door=
|
||||||
|
Solid Brass Door=
|
||||||
|
Windowed Brass Trapdoor=
|
||||||
|
Solid Brass Trapdoor=
|
||||||
|
Windowed Locked Brass Door=
|
||||||
|
Solid Locked Brass Door=
|
||||||
|
Windowed Locked Brass Trapdoor=
|
||||||
|
Solid Locked Brass Trapdoor=
|
||||||
|
Concrete Windowed Door=
|
||||||
|
Solid Concrete Door=
|
||||||
|
Windowed Concrete Trapdoor=
|
||||||
|
Solid Concrete Trapdoor=
|
||||||
|
Windowed Locked Concrete Door=
|
||||||
|
Solid Locked Concrete Door=
|
||||||
|
Windowed Locked Concrete Trapdoor=
|
||||||
|
Solid Locked Concrete Trapdoor=
|
||||||
|
Windowed Locked Plain Steel Door=
|
||||||
|
Windowed Mixed Wood Door=
|
||||||
|
Windowed Mixed Wood Trapdoor=
|
||||||
|
Windowed Locked Plain Steel Trapdoor=
|
||||||
|
Door Workshop=
|
Loading…
x
Reference in New Issue
Block a user