forked from mtcontrib/arrow_signs
Separate API from registration files.
This commit is contained in:
parent
5f11ec9809
commit
ed25a62185
75
init.lua
75
init.lua
@ -141,15 +141,7 @@ arrow_signs.create_lines = function(text)
|
|||||||
return text, n+m
|
return text, n+m
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.override_item("default:sign_wall", {
|
arrow_signs.nodebox = {
|
||||||
groups = {choppy=2,dig_immediate=2,attached_node=1,sign=1},
|
|
||||||
})
|
|
||||||
|
|
||||||
--Sign arrow
|
|
||||||
minetest.register_node("arrow_signs:wall", {
|
|
||||||
description = "Arrow signs",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{ 0.25, -0.25, 0.5, -0.25, 0.5, 0.47},
|
{ 0.25, -0.25, 0.5, -0.25, 0.5, 0.47},
|
||||||
@ -157,70 +149,21 @@ minetest.register_node("arrow_signs:wall", {
|
|||||||
{ 0.125, -0.3125, 0.5, -0.125, -0.375, 0.47},
|
{ 0.125, -0.3125, 0.5, -0.125, -0.375, 0.47},
|
||||||
{ 0.0625, -0.375, 0.5, -0.0625, -0.437, 0.47}
|
{ 0.0625, -0.375, 0.5, -0.0625, -0.437, 0.47}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
selection_box = {
|
|
||||||
|
arrow_signs.selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{ 0.30, -0.5, 0.5, -0.30, 0.5, 0.47}
|
{ 0.30, -0.5, 0.5, -0.30, 0.5, 0.47}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
tiles = {"arrow_sign_border_left.png","arrow_sign_border_right.png","arrow_sign_border_up.png","arrow_sign_border_down.png","arrow_sign.png","arrow_sign.png"},
|
|
||||||
inventory_image = "arrow_sign.png",
|
|
||||||
wield_image = "arrow_sign.png",
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
walkable = false,
|
|
||||||
groups = {choppy=2,dig_immediate=2,sign=1},
|
|
||||||
sounds = default.node_sound_defaults(),
|
|
||||||
on_place = arrow_signs.on_place,
|
|
||||||
on_construct = function(pos)
|
|
||||||
--local n = minetest.get_node(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_string("formspec", arrow_signs.formspec)
|
|
||||||
meta:set_string("infotext", [[""]])
|
|
||||||
end,
|
|
||||||
on_receive_fields = arrow_signs.savetext,
|
|
||||||
})
|
|
||||||
|
|
||||||
--Recipes
|
|
||||||
minetest.register_craft({
|
|
||||||
type = 'shapeless',
|
|
||||||
output = 'arrow_signs:wall',
|
|
||||||
recipe = {'group:sign', 'default:stick'},
|
|
||||||
})
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'default:sign_wall',
|
|
||||||
recipe = {
|
|
||||||
{'group:sign'},
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
|
||||||
--Redefinition
|
local MODPATH = minetest.get_modpath("arrow_signs")
|
||||||
minetest.register_lbm({
|
|
||||||
name = "arrow_signs:replace_old",
|
|
||||||
nodenames = {"arrow_signs:wall_right", "arrow_signs:wall_left", "arrow_signs:wall_up", "arrow_signs:wall_down",
|
|
||||||
"more_signs:wall_right","more_signs:wall_left","more_signs:wall_up" ,"more_signs:wall_down"
|
|
||||||
},
|
|
||||||
action = function(pos, node)
|
|
||||||
local convert_facedir={
|
|
||||||
["arrow_signs:wall_right"] = {6,4,5,11,16,14},
|
|
||||||
["arrow_signs:wall_left"] = {8,10,9,7,12,18},
|
|
||||||
["arrow_signs:wall_up"] = {15,19,23,21,20,22},
|
|
||||||
["arrow_signs:wall_down"] = {17,13,1,3,0,2},
|
|
||||||
-- For old mod
|
|
||||||
["more_signs:wall_right"] = {6,4,5,11,16,14},
|
|
||||||
["more_signs:wall_left"] = {8,10,9,7,12,18},
|
|
||||||
["more_signs:wall_up"] = {15,19,23,21,20,22},
|
|
||||||
["more_signs:wall_down"] = {17,13,1,3,0,2},
|
|
||||||
}
|
|
||||||
minetest.swap_node(pos, {name="arrow_signs:wall",param2=convert_facedir[node.name][node.param2+1]})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
-- Wooden Sign
|
||||||
|
dofile(MODPATH.."/wood.lua")
|
||||||
|
|
||||||
--Locked sign
|
--Shared Locked sign
|
||||||
if locks then
|
if minetest.get_modpath("locks") then
|
||||||
local MODPATH = minetest.get_modpath("arrow_signs");
|
|
||||||
dofile(MODPATH.."/shared_locked.lua")
|
dofile(MODPATH.."/shared_locked.lua")
|
||||||
end
|
end
|
@ -1,22 +1,14 @@
|
|||||||
-- a sign
|
--[[
|
||||||
|
Shared Locked Arrow sign
|
||||||
|
|
||||||
|
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
|
||||||
|
To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
|
||||||
|
]]
|
||||||
minetest.register_node("arrow_signs:shared_locked", {
|
minetest.register_node("arrow_signs:shared_locked", {
|
||||||
description = "Shared locked sign",
|
description = "Shared locked sign",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = {
|
node_box = arrow_signs.nodebox,
|
||||||
type = "fixed",
|
selection_box = arrow_signs.selection_box,
|
||||||
fixed = {
|
|
||||||
{ 0.25, -0.25, 0.5, -0.25, 0.5, 0.47},
|
|
||||||
{ 0.1875, -0.3125, 0.5, -0.1875, -0.25, 0.47},
|
|
||||||
{ 0.125, -0.3125, 0.5, -0.125, -0.375, 0.47},
|
|
||||||
{ 0.0625, -0.375, 0.5, -0.0625, -0.437, 0.47}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{ 0.30, -0.5, 0.5, -0.30, 0.5, 0.47}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
tiles = {"arrow_sign_border_left.png","arrow_sign_border_right.png","arrow_sign_border_up.png","arrow_sign_border_down.png","arrow_sign.png","arrow_sign.png"},
|
tiles = {"arrow_sign_border_left.png","arrow_sign_border_right.png","arrow_sign_border_up.png","arrow_sign_border_down.png","arrow_sign.png","arrow_sign.png"},
|
||||||
inventory_image = "arrow_sign.png",
|
inventory_image = "arrow_sign.png",
|
||||||
wield_image = "arrow_sign.png",
|
wield_image = "arrow_sign.png",
|
||||||
|
66
wood.lua
Normal file
66
wood.lua
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
--[[
|
||||||
|
Wooden Arrow sign
|
||||||
|
|
||||||
|
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
|
||||||
|
To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
|
||||||
|
]]
|
||||||
|
|
||||||
|
minetest.register_node("arrow_signs:wall", {
|
||||||
|
description = "Arrow signs",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = arrow_signs.nodebox,
|
||||||
|
selection_box = arrow_signs.selection_box,
|
||||||
|
tiles = {"arrow_sign_border_left.png","arrow_sign_border_right.png","arrow_sign_border_up.png","arrow_sign_border_down.png","arrow_sign.png","arrow_sign.png"},
|
||||||
|
inventory_image = "arrow_sign.png",
|
||||||
|
wield_image = "arrow_sign.png",
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
walkable = false,
|
||||||
|
groups = {choppy=2,dig_immediate=2,sign=1},
|
||||||
|
sounds = default.node_sound_defaults(),
|
||||||
|
on_place = arrow_signs.on_place,
|
||||||
|
on_construct = function(pos)
|
||||||
|
--local n = minetest.get_node(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("formspec", arrow_signs.formspec)
|
||||||
|
meta:set_string("infotext", [[""]])
|
||||||
|
end,
|
||||||
|
on_receive_fields = arrow_signs.savetext,
|
||||||
|
})
|
||||||
|
|
||||||
|
--Recipes
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "arrow_signs:wall",
|
||||||
|
recipe = {"default:sign_wall_wood", "group:stick"},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "default:sign_wall",
|
||||||
|
recipe = {
|
||||||
|
{"arrow_signs:wall"},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
--Redefinition
|
||||||
|
minetest.register_lbm({
|
||||||
|
name = "arrow_signs:replace_old",
|
||||||
|
nodenames = {"arrow_signs:wall_right", "arrow_signs:wall_left", "arrow_signs:wall_up", "arrow_signs:wall_down",
|
||||||
|
"more_signs:wall_right","more_signs:wall_left","more_signs:wall_up" ,"more_signs:wall_down"
|
||||||
|
},
|
||||||
|
action = function(pos, node)
|
||||||
|
local convert_facedir={
|
||||||
|
["arrow_signs:wall_right"] = {6,4,5,11,16,14},
|
||||||
|
["arrow_signs:wall_left"] = {8,10,9,7,12,18},
|
||||||
|
["arrow_signs:wall_up"] = {15,19,23,21,20,22},
|
||||||
|
["arrow_signs:wall_down"] = {17,13,1,3,0,2},
|
||||||
|
-- For old mod
|
||||||
|
["more_signs:wall_right"] = {6,4,5,11,16,14},
|
||||||
|
["more_signs:wall_left"] = {8,10,9,7,12,18},
|
||||||
|
["more_signs:wall_up"] = {15,19,23,21,20,22},
|
||||||
|
["more_signs:wall_down"] = {17,13,1,3,0,2},
|
||||||
|
}
|
||||||
|
minetest.swap_node(pos, {name="arrow_signs:wall",param2=convert_facedir[node.name][node.param2+1]})
|
||||||
|
end,
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user