2022-10-20 01:55:07 +03:00
|
|
|
---
|
|
|
|
--- Generated by EmmyLua(https://github.com/EmmyLua)
|
|
|
|
--- Created by Michieal (FaerRaven).
|
|
|
|
--- DateTime: 10/14/22 4:05 PM
|
|
|
|
---
|
|
|
|
|
2021-05-29 17:12:33 +03:00
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
local modpath = minetest.get_modpath(modname)
|
2019-03-08 01:22:28 +02:00
|
|
|
|
2022-10-20 01:55:07 +03:00
|
|
|
-- Signs API
|
|
|
|
dofile(modpath .. "/signs_api.lua")
|
2017-01-24 03:31:49 +02:00
|
|
|
|
2022-10-20 01:55:07 +03:00
|
|
|
-- LOCALIZATION
|
|
|
|
local S = minetest.get_translator(modname)
|
2015-06-29 20:55:56 +03:00
|
|
|
|
2022-10-20 01:55:07 +03:00
|
|
|
-- HANDLE THE FORMSPEC CALLBACK
|
2017-07-25 02:56:04 +03:00
|
|
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
2022-10-20 01:55:07 +03:00
|
|
|
if formname:find("mcl_signs:set_text_") == 1 then
|
|
|
|
local x, y, z = formname:match("mcl_signs:set_text_(.-)_(.-)_(.*)")
|
|
|
|
local pos = { x = tonumber(x), y = tonumber(y), z = tonumber(z) }
|
|
|
|
if not pos or not pos.x or not pos.y or not pos.z then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
mcl_signs:update_sign(pos, fields, player)
|
|
|
|
end
|
2017-07-25 02:56:04 +03:00
|
|
|
end)
|
|
|
|
|
2019-02-18 22:29:11 +02:00
|
|
|
-- FIXME: Prevent entity destruction by /clearobjects
|
2017-07-25 03:20:37 +03:00
|
|
|
minetest.register_entity("mcl_signs:text", {
|
2022-10-20 01:55:07 +03:00
|
|
|
pointable = false,
|
|
|
|
visual = "upright_sprite",
|
|
|
|
textures = {},
|
|
|
|
physical = false,
|
|
|
|
collide_with_objects = false,
|
|
|
|
|
|
|
|
_signnodename = nil, -- node name of sign node to which the text belongs
|
|
|
|
|
|
|
|
on_activate = function(self, staticdata)
|
2022-10-22 05:50:39 +03:00
|
|
|
|
|
|
|
local meta = minetest.get_meta(self.object:get_pos())
|
|
|
|
local text = meta:get_string("text")
|
|
|
|
local text_color = meta:get_string("mcl_signs:text_color")
|
|
|
|
local glowing_sign = meta:get_string("mcl_signs:glowing_sign")
|
2022-10-20 01:55:07 +03:00
|
|
|
if staticdata and staticdata ~= "" then
|
|
|
|
local des = minetest.deserialize(staticdata)
|
|
|
|
if des then
|
|
|
|
self._signnodename = des._signnodename
|
2022-10-22 05:50:39 +03:00
|
|
|
if des._text_color ~= nil and des._text_color ~= "" then
|
|
|
|
self.text_color = des._text_color
|
|
|
|
end
|
|
|
|
if des._glowing_sign ~= nil and des._glowing_sign ~= "" then
|
|
|
|
self.glowing_sign = des._glowing_sign
|
|
|
|
end
|
2022-10-20 01:55:07 +03:00
|
|
|
end
|
|
|
|
end
|
2022-10-22 05:50:39 +03:00
|
|
|
|
|
|
|
if text_color == "" or text_color == nil then
|
|
|
|
text_color = "#000000" -- default to black text.
|
|
|
|
meta:set_string("mcl_signs:text_color", text_color)
|
|
|
|
end
|
|
|
|
|
|
|
|
if glowing_sign == "" or glowing_sign == nil then
|
|
|
|
glowing_sign = "false" -- default to not glowing.
|
|
|
|
meta:set_string("mcl_signs:glowing_sign", glowing_sign)
|
|
|
|
end
|
|
|
|
|
2022-10-20 01:55:07 +03:00
|
|
|
self.object:set_properties({
|
2022-10-22 05:50:39 +03:00
|
|
|
textures = { mcl_signs:create_lettering(text, self._signnodename, text_color) },
|
2022-10-20 01:55:07 +03:00
|
|
|
})
|
2022-10-22 05:50:39 +03:00
|
|
|
if glowing_sign == "true" then
|
|
|
|
self.object:set_properties({
|
|
|
|
glow = 6, --sign_glow,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2022-10-20 01:55:07 +03:00
|
|
|
self.object:set_armor_groups({ immortal = 1 })
|
2022-10-22 05:50:39 +03:00
|
|
|
|
2022-10-20 01:55:07 +03:00
|
|
|
end,
|
|
|
|
get_staticdata = function(self)
|
2022-10-22 05:50:39 +03:00
|
|
|
local out = {
|
|
|
|
_signnodename = self._signnodename,
|
|
|
|
}
|
2022-10-20 01:55:07 +03:00
|
|
|
return minetest.serialize(out)
|
|
|
|
end,
|
|
|
|
})
|
2017-07-26 16:11:52 +03:00
|
|
|
|
2022-10-22 05:50:39 +03:00
|
|
|
-- Build the signs x,y,z & rotations so that they work. (IE, do not remove!)
|
|
|
|
mcl_signs.build_signs_info()
|
2015-06-29 20:55:56 +03:00
|
|
|
|
2022-10-22 05:50:39 +03:00
|
|
|
-- ---------------------------- --
|
|
|
|
-- Register Signs for use. --
|
|
|
|
-- ---------------------------- --
|
|
|
|
local mcl_colors_official = mcl_colors
|
2017-02-16 22:47:47 +02:00
|
|
|
|
2022-10-22 05:50:39 +03:00
|
|
|
-- Standard (original) Sign
|
|
|
|
mcl_signs.register_sign("mcl_core", "#ffffff", "", "Sign")
|
|
|
|
mcl_signs.register_sign_craft("mcl_core", "mcl_core:wood", "")
|
2022-10-20 01:55:07 +03:00
|
|
|
|
2022-10-22 05:50:39 +03:00
|
|
|
-- birchwood Sign
|
|
|
|
--mcl_signs.register_sign("mcl_core", "#d5cb8d", "_birchwood", "Birch Sign")
|
|
|
|
mcl_signs.register_sign_custom("mcl_core", "_birchwood",
|
|
|
|
"mcl_signs_sign_greyscale.png",mcl_colors_official.YELLOW, "default_sign_greyscale.png",
|
|
|
|
"default_sign_greyscale.png", "Birch Sign"
|
|
|
|
)
|
2022-10-20 01:55:07 +03:00
|
|
|
|
2022-10-22 05:50:39 +03:00
|
|
|
mcl_signs.register_sign_craft("mcl_core", "mcl_core:birchwood", "_birchwood")
|
2022-10-20 01:55:07 +03:00
|
|
|
|
2022-10-22 05:50:39 +03:00
|
|
|
-- sprucewood Sign
|
|
|
|
mcl_signs.register_sign_custom("mcl_core", "_sprucewood",
|
|
|
|
"mcl_signs_sign_dark.png","#ffffff", "default_sign_dark.png",
|
|
|
|
"default_sign_dark.png", "Spruce Sign"
|
|
|
|
)
|
|
|
|
mcl_signs.register_sign_craft("mcl_core", "mcl_core:sprucewood", "_sprucewood")
|
2022-10-20 01:55:07 +03:00
|
|
|
|
2022-10-22 05:50:39 +03:00
|
|
|
-- darkwood Sign
|
|
|
|
--mcl_signs.register_sign("mcl_core","#291f1a", "_darkwood", "Dark Oak Sign")
|
|
|
|
mcl_signs.register_sign_custom("mcl_core", "_darkwood",
|
|
|
|
"mcl_signs_sign_greyscale.png","#856443", "default_sign_greyscale.png",
|
|
|
|
"default_sign_greyscale.png", "Dark Oak Sign"
|
|
|
|
)
|
2022-10-20 01:55:07 +03:00
|
|
|
|
2022-10-22 05:50:39 +03:00
|
|
|
mcl_signs.register_sign_craft("mcl_core", "mcl_core:darkwood", "_darkwood")
|
|
|
|
|
|
|
|
-- junglewood Sign
|
|
|
|
mcl_signs.register_sign("mcl_core", "#866249", "_junglewood", "Jungle Sign")
|
|
|
|
mcl_signs.register_sign_craft("mcl_core", "mcl_core:junglewood", "_junglewood")
|
|
|
|
|
|
|
|
-- acaciawood Sign "b8693d"
|
|
|
|
mcl_signs.register_sign("mcl_core", "#ea7479", "_acaciawood", "Acacia Sign")
|
|
|
|
mcl_signs.register_sign_craft("mcl_core", "mcl_core:acaciawood", "_acaciawood")
|
2017-07-25 03:20:37 +03:00
|
|
|
|
2022-10-22 05:50:39 +03:00
|
|
|
-- mangrove_wood Sign "#c7545c"
|
|
|
|
mcl_signs.register_sign("mcl_core", "#b8693d", "_mangrove_wood", "Mangrove Sign")
|
|
|
|
mcl_signs.register_sign_craft("mcl_core", "mcl_core:mangrove_wood", "_mangrove_wood")
|
|
|
|
|
|
|
|
-- Register the LBMs for the created signs.
|
|
|
|
mcl_signs.make_lbm()
|
|
|
|
|
|
|
|
-- really ancient compatibility.
|
2017-07-25 03:20:37 +03:00
|
|
|
minetest.register_alias("signs:sign_wall", "mcl_signs:wall_sign")
|
|
|
|
minetest.register_alias("signs:sign_yard", "mcl_signs:standing_sign")
|
2022-10-22 05:50:39 +03:00
|
|
|
minetest.register_alias("mcl_signs:wall_sign_dark", "mcl_signs:wall_sign_sprucewood")
|
|
|
|
minetest.register_alias("mcl_signs:standing_sign_dark", "mcl_signs:standing_sign_sprucewood")
|