techage_modpack/signs_bot/bot_flap.lua

77 lines
1.7 KiB
Lua
Raw Permalink Normal View History

2020-05-31 23:31:18 +03:00
--[[
Signs Bot
=========
2021-05-14 19:50:16 +03:00
Copyright (C) 2019-2021 Joachim Stolberg
2020-05-31 23:31:18 +03:00
GPLv3
See LICENSE.txt for more information
2022-09-24 12:01:30 +03:00
2020-05-31 23:31:18 +03:00
Signs Bot: Bot Flap
]]--
2021-05-14 19:50:16 +03:00
-- Load support for I18n.
local S = signs_bot.S
2020-05-31 23:31:18 +03:00
local function formspec(cmnd)
cmnd = minetest.formspec_escape(cmnd)
return "size[6,5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"label[0.3,0.3;"..cmnd.."]"..
2021-05-14 19:50:16 +03:00
"button_exit[2.5,5.5;2,1;exit;"..S("Exit").."]"
2020-05-31 23:31:18 +03:00
end
local commands = [[dig_sign 6
move 2
place_sign_behind 6
]]
minetest.register_node("signs_bot:bot_flap", {
2021-05-14 19:50:16 +03:00
description = S("Bot Flap"),
2020-05-31 23:31:18 +03:00
paramtype2 = "facedir",
tiles = {
"signs_bot_bot_flap_top.png",
"signs_bot_bot_flap_top.png",
"signs_bot_bot_flap_top.png",
"signs_bot_bot_flap_top.png",
"signs_bot_bot_flap.png",
"signs_bot_bot_flap.png",
},
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("signs_bot_cmnd", commands)
meta:set_string("formspec", formspec(commands))
end,
on_rotate = screwdriver.disallow,
is_ground_content = false,
groups = {choppy = 2, oddly_breakable_by_hand = 2, wood = 1, sign_bot_sign = 1},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_craft({
output = "signs_bot:bot_flap",
recipe = {
{"signs_bot:sign_cmnd", "group:wood", "default:steel_ingot"},
{"", "", ""},
{"", "", ""}
}
})
if minetest.get_modpath("doc") then
doc.add_entry("signs_bot", "bot_flap", {
2021-05-14 19:50:16 +03:00
name = S("Bot Flap"),
2020-05-31 23:31:18 +03:00
data = {
item = "signs_bot:bot_flap",
text = table.concat({
2021-05-14 19:50:16 +03:00
S("The flap is a simple block used as door for the bot."),
S("Place the flap in any wall, and the bot will automatically open"),
S("and close the flap as it passes through it."),
2022-09-24 12:01:30 +03:00
}, "\n")
2020-05-31 23:31:18 +03:00
},
})
end