Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
102a537ded | |||
c65a10ac27 | |||
e74f54c342 | |||
5e27234790 | |||
95d45d7e62 | |||
ed25a62185 | |||
5f11ec9809 | |||
9b5250c1eb | |||
53b67c16a7 | |||
1a63436b95 | |||
7a3a058675 | |||
4c80c97f8d |
1
depends.txt
Executable file → Normal file
@ -1,2 +1,3 @@
|
||||
default
|
||||
signs_lib?
|
||||
locks?
|
2
description.txt
Normal file
@ -0,0 +1,2 @@
|
||||
This mods adds arrowsigns into Minetest.
|
||||
Rotatable in all directions.
|
BIN
development/arrow_signs_steel.xcf
Normal file
BIN
development/arrow_signs_wood.xcf
Normal file
225
init.lua
Executable file → Normal file
@ -1,207 +1,150 @@
|
||||
--more_signs by addi
|
||||
--Code and Textures are under the CC by-sa 3.0 licence
|
||||
--see: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
--[[
|
||||
Arrow signs mod for Minetest.
|
||||
|
||||
This mods adds arrowsigns into Minetest. Rotatable in all directions.
|
||||
|
||||
Thanks to:
|
||||
Jat15 for the place and rotate system
|
||||
Hectic for the new Textures that fit into Minetest 0.4.14
|
||||
|
||||
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.
|
||||
]]
|
||||
|
||||
arrow_signs={}
|
||||
|
||||
arrow_signs.formspec = "field[text;Sign text:;${text}]";
|
||||
arrow_signs.formspec = "field[text;Sign text: (Hint: Use / or | to create a new line);${text}]";
|
||||
|
||||
arrow_signs_on_place = function(itemstack, placer, pointed_thing)
|
||||
arrow_signs.on_place = function(itemstack, placer, pointed_thing)
|
||||
|
||||
local posabove = pointed_thing.above
|
||||
local posunder = pointed_thing.under
|
||||
local vector = placer:get_look_dir()
|
||||
local place = true
|
||||
local param2 = 0
|
||||
|
||||
-- I wonder if there is a way to calculate the param2 instad of using so much if here.
|
||||
-- +Y
|
||||
if posabove.y>posunder.y then
|
||||
if(vector.z>0.5 and vector.z<=1) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 10})
|
||||
param2 = 10
|
||||
elseif (vector.x>0.5 and vector.x<=1) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 19})
|
||||
param2 = 19
|
||||
elseif(-0.5>vector.z and -1<=vector.z) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 4})
|
||||
param2 = 4
|
||||
elseif (-0.5>vector.x and -1<=vector.x) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 13})
|
||||
else
|
||||
place = false
|
||||
param2 = 13
|
||||
end
|
||||
-- -Y
|
||||
elseif posabove.y<posunder.y then
|
||||
if(vector.z>0.5 and vector.z<=1) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 8})
|
||||
param2 = 8
|
||||
elseif (vector.x>0.5 and vector.x<=1) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 17})
|
||||
param2 = 17
|
||||
elseif(-0.5>vector.z and -1<=vector.z) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 6})
|
||||
param2 = 6
|
||||
elseif (-0.5>vector.x and -1<=vector.x) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 15})
|
||||
else
|
||||
place = false
|
||||
param2 = 15
|
||||
end
|
||||
-- +Z
|
||||
elseif posabove.z>posunder.z then
|
||||
if(vector.y>0.75 and vector.y<=1) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 22})
|
||||
param2 = 22
|
||||
elseif (vector.y>=-1 and vector.y<-0.75) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 2})
|
||||
param2 = 2
|
||||
elseif (vector.x>=0 and vector.x<=1) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 18})
|
||||
param2 = 18
|
||||
elseif (vector.x<0 and vector.x>=-1) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 14})
|
||||
else
|
||||
place = false
|
||||
param2 = 14
|
||||
end
|
||||
-- -Z
|
||||
elseif posabove.z<posunder.z then
|
||||
if(vector.y>0.75 and vector.y<=1) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 20})
|
||||
param2 = 20
|
||||
elseif (vector.y>=-1 and vector.y<-0.75) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 0})
|
||||
param2 = 0
|
||||
elseif (vector.x>=0 and vector.x<=1) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 16})
|
||||
param2 = 16
|
||||
elseif (vector.x<0 and vector.x>=-1) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 12})
|
||||
else
|
||||
place = false
|
||||
param2 = 12
|
||||
end
|
||||
-- +X
|
||||
elseif posabove.x>posunder.x then
|
||||
if(vector.y>0.75 and vector.y<=1) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 21})
|
||||
param2 = 21
|
||||
elseif (vector.y>=-1 and vector.y<-0.75) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 3})
|
||||
param2 = 3
|
||||
elseif (vector.z>=0 and vector.z<=1) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 11})
|
||||
param2 = 11
|
||||
elseif (vector.z<0 and vector.z>=-1) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 7})
|
||||
else
|
||||
place = false
|
||||
param2 = 7
|
||||
end
|
||||
-- -X
|
||||
elseif posabove.x<posunder.x then
|
||||
if(vector.y>0.75 and vector.y<=1) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 23})
|
||||
param2 = 23
|
||||
elseif (vector.y>=-1 and vector.y<-0.75) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 1})
|
||||
param2 = 1
|
||||
elseif (vector.z>=0 and vector.z<=1) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 9})
|
||||
param2 = 9
|
||||
elseif (vector.z<0 and vector.z>=-1) then
|
||||
minetest.add_node(posabove,{name = itemstack:get_name(), param2 = 5})
|
||||
else
|
||||
place = false
|
||||
param2 = 5
|
||||
end
|
||||
else
|
||||
place = false
|
||||
end
|
||||
|
||||
if not(place) then
|
||||
minetest.rotate_node(itemstack, placer, pointed_thing)
|
||||
else
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
return minetest.item_place_node(itemstack, placer, pointed_thing, param2)
|
||||
end
|
||||
|
||||
function arrow_signs:savetext(pos, formname, fields, sender)
|
||||
|
||||
if not minetest.get_player_privs(sender:get_player_name())["interact"] then
|
||||
minetest.chat_send_player(sender:get_player_name(), "error: you don't have permission to edit the sign. you need the interact priv")
|
||||
return
|
||||
arrow_signs.savetext = function(pos, formname, fields, sender)
|
||||
if fields.text then
|
||||
local playername = sender:get_player_name() or ""
|
||||
if minetest.is_protected(pos, playername) then
|
||||
minetest.record_protection_violation(pos, playername)
|
||||
return
|
||||
end
|
||||
local meta = minetest.get_meta(pos)
|
||||
fields.text = fields.text or ""
|
||||
print((sender:get_player_name() or "").." wrote \""..fields.text..
|
||||
"\" to sign at "..minetest.pos_to_string(pos))
|
||||
minetest.log("action", string.format("%q wrote %q to sign at %s", playername, fields.text, minetest.pos_to_string(pos)));
|
||||
meta:set_string("text", fields.text)
|
||||
text = arrow_signs:create_lines(fields.text)
|
||||
local text, lines = arrow_signs.create_lines(fields.text)
|
||||
meta:set_string("infotext", '"'..text..'"')
|
||||
i=0
|
||||
for wort in text:gfind("\n") do
|
||||
i=i+1
|
||||
end
|
||||
if i > 4 then
|
||||
minetest.chat_send_player(sender:get_player_name(),"\tInformation: \nYou've written more than 5 lines. \n it may be that not all lines are displayed. \n Please remove the last entry")
|
||||
if lines >= 6 then
|
||||
minetest.chat_send_player(playername, "Information: \nYou've written "..lines.." lines. \nThe sign can only display 5 lines \nPlease remove the last entries")
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function arrow_signs:create_lines(text)
|
||||
text = text:gsub("/", "\"\n\"")
|
||||
text = text:gsub("|", "\"\n\"")
|
||||
return text
|
||||
end
|
||||
|
||||
minetest.override_item("default:sign_wall", {
|
||||
groups = {choppy=2,dig_immediate=2,attached_node=1,sign=1},
|
||||
})
|
||||
--this function creates the linebreaks
|
||||
arrow_signs.create_lines = function(text)
|
||||
local text, n = text:gsub("[ ]*(%|)[ ]*", '"\n"')--search for |
|
||||
local text, m = text:gsub("[ ]*(%/)[ ]*", '"\n"')--search for /
|
||||
return text, n+m+1
|
||||
end
|
||||
|
||||
--Sign arrow
|
||||
minetest.register_node("arrow_signs:wall", {
|
||||
description = "Arrow signs",
|
||||
drawtype = "mesh",
|
||||
mesh = "arrow_sign.obj",
|
||||
selection_box = {
|
||||
arrow_signs.nodebox = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ 0.25, -0.25, 0.4375, -0.25, 0.5, 0.5},
|
||||
{ 0.1875, -0.3125, 0.4375, -0.1875, -0.25, 0.5},
|
||||
{ 0.125, -0.3125, 0.4375, -0.125, -0.375, 0.5},
|
||||
{ 0.0625, -0.375, 0.4375, -0.0625, -0.437, 0.5}
|
||||
}
|
||||
}
|
||||
|
||||
arrow_signs.selection_box = {
|
||||
type = "fixed",
|
||||
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}
|
||||
{ 0.30, -0.5, 0.4375, -0.30, 0.5, 0.5}
|
||||
}
|
||||
},
|
||||
tiles = {"arrow_sign.png", "arrow_sign_border_down.png", "arrow_sign_border_left.png", "arrow_sign_border_right.png", "arrow_sign_border_up.png"},
|
||||
inventory_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 = function(pos, formname, fields, sender)
|
||||
arrow_signs:savetext(pos, formname, fields, sender)
|
||||
end,
|
||||
})
|
||||
|
||||
--Recipes
|
||||
minetest.register_craft({
|
||||
type = 'shapeless',
|
||||
output = 'arrow_signs:wall',
|
||||
recipe = {'default:sign_wall', 'default:stick'},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = 'default:sign_wall',
|
||||
recipe = {
|
||||
{'arrow_signs:wall'},
|
||||
}
|
||||
})
|
||||
|
||||
--Redefinition
|
||||
minetest.register_abm({
|
||||
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"
|
||||
},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
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,
|
||||
})
|
||||
local MODPATH = minetest.get_modpath("arrow_signs")
|
||||
|
||||
-- Wooden Sign
|
||||
dofile(MODPATH.."/wood.lua")
|
||||
-- Steel Sign
|
||||
dofile(MODPATH.."/steel.lua")
|
||||
|
||||
--Shared Locked sign
|
||||
if minetest.get_modpath("locks") then
|
||||
dofile(MODPATH.."/shared_locked.lua")
|
||||
end
|
||||
|
23
license.txt
Normal file
@ -0,0 +1,23 @@
|
||||
Code: addi CC BY-SA 3.0
|
||||
Textures: Hectic CC BY-SA 3.0
|
||||
|
||||
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.
|
||||
|
||||
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
You are free to:
|
||||
|
||||
Share — copy and redistribute the material in any medium or format
|
||||
Adapt — remix, transform, and build upon the material
|
||||
for any purpose, even commercially.
|
||||
|
||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
|
@ -1,129 +0,0 @@
|
||||
# Blender v2.74 (sub 0) OBJ File: 'untitled.blend'
|
||||
# www.blender.org
|
||||
mtllib arrow_sign.mtl
|
||||
o arrow_sign
|
||||
v -0.187500 -0.312500 0.500000
|
||||
v -0.187500 -0.312500 0.470000
|
||||
v -0.187500 -0.250000 0.470000
|
||||
v -0.187500 -0.250000 0.500000
|
||||
v 0.187500 -0.312500 0.500000
|
||||
v 0.187500 -0.312500 0.470000
|
||||
v 0.187500 -0.250000 0.470000
|
||||
v 0.187500 -0.250000 0.500000
|
||||
v -0.250000 -0.250000 0.500000
|
||||
v -0.250000 -0.250000 0.470000
|
||||
v -0.250000 0.500000 0.470000
|
||||
v -0.250000 0.500000 0.500000
|
||||
v 0.250000 -0.250000 0.500000
|
||||
v 0.250000 -0.250000 0.470000
|
||||
v 0.250000 0.500000 0.470000
|
||||
v 0.250000 0.500000 0.500000
|
||||
v 0.125000 -0.312500 0.500000
|
||||
v 0.125000 -0.312500 0.470000
|
||||
v 0.125000 -0.375000 0.470000
|
||||
v 0.125000 -0.375000 0.500000
|
||||
v -0.125000 -0.312500 0.500000
|
||||
v -0.125000 -0.312500 0.470000
|
||||
v -0.125000 -0.375000 0.470000
|
||||
v -0.125000 -0.375000 0.500000
|
||||
v 0.062500 -0.375000 0.500000
|
||||
v 0.062500 -0.375000 0.470000
|
||||
v 0.062500 -0.437000 0.470000
|
||||
v 0.062500 -0.437000 0.500000
|
||||
v -0.062500 -0.375000 0.500000
|
||||
v -0.062500 -0.375000 0.470000
|
||||
v -0.062500 -0.437000 0.470000
|
||||
v -0.062500 -0.437000 0.500000
|
||||
v 0.000000 -0.437000 0.470000
|
||||
v 0.000000 -0.437000 0.500000
|
||||
vt 0.562500 0.062500
|
||||
vt 0.562500 0.125000
|
||||
vt 0.500000 0.062500
|
||||
vt 0.250000 0.250000
|
||||
vt 0.750000 0.250000
|
||||
vt 0.750000 1.000000
|
||||
vt 0.250000 1.000000
|
||||
vt 0.437500 0.062500
|
||||
vt 0.437500 0.125000
|
||||
vt 0.687500 0.250000
|
||||
vt 0.312500 0.250000
|
||||
vt 0.687500 0.187500
|
||||
vt 0.625000 0.187500
|
||||
vt 0.625000 0.125000
|
||||
vt 0.375000 0.125000
|
||||
vt 0.375000 0.187500
|
||||
vt 0.312500 0.187500
|
||||
vt 1.000000 0.875000
|
||||
vt 0.000000 0.875000
|
||||
vt 0.000000 0.125000
|
||||
vt 1.000000 0.125000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt -0.000000 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 1.000000 0.250000
|
||||
vt 1.000000 0.750000
|
||||
vt 0.000000 0.750000
|
||||
vt 0.000000 0.250000
|
||||
vt 1.000000 0.375000
|
||||
vt 1.000000 0.500000
|
||||
vt 1.000000 0.625000
|
||||
vt 0.000000 0.625000
|
||||
vt 0.000000 0.500000
|
||||
vt 0.000000 0.375000
|
||||
vt 0.812500 1.000000
|
||||
vt 0.812500 0.000000
|
||||
vt 0.875000 0.000000
|
||||
vt 0.875000 1.000000
|
||||
vt 0.000119 1.000000
|
||||
vt 0.000119 -0.000007
|
||||
vt 0.937500 1.000000
|
||||
vt 0.937500 0.000000
|
||||
vt 0.866899 0.000000
|
||||
vt 0.866899 1.000000
|
||||
vn 0.000000 0.000000 1.000000
|
||||
vn 0.000000 0.000000 -1.000000
|
||||
vn 0.000000 -1.000000 0.000000
|
||||
vn 1.000000 0.000000 0.000000
|
||||
vn -1.000000 0.000000 0.000000
|
||||
vn 0.000000 1.000000 0.000000
|
||||
g aa
|
||||
usemtl none
|
||||
s off
|
||||
f 28/1/1 25/2/1 34/3/1
|
||||
f 9/4/1 13/5/1 16/6/1 12/7/1
|
||||
f 10/4/2 11/7/2 15/6/2 14/5/2
|
||||
f 32/8/1 34/3/1 29/9/1
|
||||
f 8/10/1 4/11/1 34/3/1
|
||||
f 7/10/2 33/3/2 3/11/2
|
||||
f 27/1/2 33/3/2 26/2/2
|
||||
f 6/12/2 18/13/2 7/10/2
|
||||
f 19/14/2 26/2/2 18/13/2
|
||||
f 23/15/2 22/16/2 30/9/2
|
||||
f 20/14/1 17/13/1 25/2/1
|
||||
f 24/15/1 29/9/1 21/16/1
|
||||
f 17/13/1 5/12/1 8/10/1
|
||||
f 1/17/1 21/16/1 4/11/1
|
||||
f 31/8/2 30/9/2 33/3/2
|
||||
f 22/16/2 2/17/2 3/11/2
|
||||
g bb
|
||||
usemtl none_arrow_sign_border_down.png
|
||||
f 1/18/3 2/19/3 6/20/3 5/21/3
|
||||
f 9/22/3 10/23/3 14/24/3 13/25/3
|
||||
f 20/26/3 24/27/3 23/28/3 19/29/3
|
||||
f 28/30/3 34/31/3 32/32/3 31/33/3 33/34/3 27/35/3
|
||||
g cc
|
||||
usemtl none_arrow_sign_border_left.png
|
||||
f 5/36/4 6/37/4 7/38/4 8/39/4
|
||||
f 13/40/4 14/41/4 15/37/4 16/36/4
|
||||
f 17/42/4 20/39/4 19/38/4 18/43/4
|
||||
f 25/22/4 28/42/4 27/43/4 26/25/4
|
||||
g dd
|
||||
usemtl none_arrow_sign_border_right.png
|
||||
f 1/44/5 4/43/5 3/42/5 2/45/5
|
||||
f 9/24/5 12/37/5 11/36/5 10/23/5
|
||||
f 21/38/5 22/39/5 23/36/5 24/37/5
|
||||
f 29/25/5 30/22/5 31/42/5 32/43/5
|
||||
g ee
|
||||
usemtl none_arrow_sign_border_up.png
|
||||
f 12/25/6 16/22/6 15/23/6 11/24/6
|
BIN
screenshot.png
Normal file
After Width: | Height: | Size: 462 B |
88
shared_locked.lua
Normal file
@ -0,0 +1,88 @@
|
||||
--[[
|
||||
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", {
|
||||
description = "Shared locked sign",
|
||||
drawtype = "nodebox",
|
||||
node_box = arrow_signs.nodebox,
|
||||
selection_box = arrow_signs.selection_box,
|
||||
tiles = {"arrow_signs_wood.png^arrow_signs_wood_border.png"},
|
||||
inventory_image = "arrow_signs_wood.png",
|
||||
wield_image = "arrow_signs_wood.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 3 },
|
||||
legacy_wallmounted = true,
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
itemstack = arrow_signs.on_place(itemstack, placer, pointed_thing);
|
||||
locks:lock_set_owner( pointed_thing.above, placer, "Shared locked sign");
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
-- prepare the lock of the sign
|
||||
locks:lock_init( pos,
|
||||
"size[8,4]"..
|
||||
"field[0.3,0.6;6,0.7;text;Text:;${text}]"..
|
||||
"field[0.3,3.6;6,0.7;locks_sent_lock_command;Locked sign. Type /help for help:;]"..
|
||||
"button_exit[6.3,3.2;1.7,0.7;locks_sent_input;Proceed]" );
|
||||
end,
|
||||
|
||||
can_dig = function(pos,player)
|
||||
return locks:lock_allow_dig( pos, player );
|
||||
end,
|
||||
|
||||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
|
||||
-- if the user already has the right to use this and did input text
|
||||
if( fields.text
|
||||
and ( not(fields.locks_sent_lock_command)
|
||||
or fields.locks_sent_lock_command=="")
|
||||
and locks:lock_allow_use( pos, sender )) then
|
||||
--then save the text to the sign meta
|
||||
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
|
||||
local meta = minetest.get_meta(pos)
|
||||
fields.text = fields.text or "";
|
||||
minetest.log("action", (sender:get_player_name() or "").." wrote \""..fields.text..
|
||||
"\" to sign at "..minetest.pos_to_string(pos));
|
||||
meta:set_string("text", fields.text);
|
||||
local text = arrow_signs.create_lines(fields.text)
|
||||
meta:set_string("infotext", '"'..text..'"'.." ["..sender:get_player_name().."]");
|
||||
|
||||
-- a command for the lock?
|
||||
else
|
||||
--do nothing, because user does not have the right to change the sign
|
||||
--a warning message is also printed by the locks mod
|
||||
--arrow_signs.savetext( pos, formname, fields, sender );
|
||||
end
|
||||
|
||||
end,
|
||||
});
|
||||
|
||||
minetest.register_craft({
|
||||
type = 'shapeless',
|
||||
output = 'arrow_signs:shared_locked',
|
||||
recipe = {'arrow_signs:wall', 'locks:lock'},
|
||||
})
|
||||
|
||||
--Redefinition
|
||||
minetest.register_lbm({
|
||||
name = "arrow_signs:replace_old_shared_locked",
|
||||
nodenames = {"arrow_signs:shared_locked_right", "arrow_signs:shared_locked_left", "arrow_signs:shared_locked_up", "arrow_signs:shared_locked_down"},
|
||||
action = function(pos, node)
|
||||
local convert_facedir={
|
||||
["arrow_signs:shared_locked_right"]={6,4,5,11,16,14},
|
||||
["arrow_signs:shared_locked_left"]={8,10,9,7,12,18},
|
||||
["arrow_signs:shared_locked_up"]={15,19,23,21,20,22},
|
||||
["arrow_signs:shared_locked_down"]={17,13,1,3,0,2}
|
||||
}
|
||||
minetest.swap_node(pos, {name="arrow_signs:shared_locked",param2=convert_facedir[node.name][node.param2-1]})
|
||||
end,
|
||||
})
|
44
steel.lua
Normal file
@ -0,0 +1,44 @@
|
||||
--[[
|
||||
Steel 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:steel", {
|
||||
description = "Steel Arrow Sign",
|
||||
drawtype = "nodebox",
|
||||
node_box = arrow_signs.nodebox,
|
||||
selection_box = arrow_signs.selection_box,
|
||||
tiles = {"arrow_signs_steel.png^arrow_signs_steel_border.png"},
|
||||
inventory_image = "arrow_signs_steel.png",
|
||||
wield_image = "arrow_signs_steel.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
groups = {cracky = 2},
|
||||
sounds = default.node_sound_defaults(),
|
||||
on_place = arrow_signs.on_place,
|
||||
on_construct = function(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,
|
||||
})
|
||||
|
||||
--Recipe
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "arrow_signs:steel",
|
||||
recipe = {"default:sign_wall_steel", "group:stick"},
|
||||
})
|
||||
|
||||
--Recycling
|
||||
minetest.register_craft({
|
||||
output = "default:sign_wall_steel",
|
||||
recipe = {
|
||||
{"arrow_signs:steel"},
|
||||
}
|
||||
})
|
Before Width: | Height: | Size: 404 B |
Before Width: | Height: | Size: 116 B |
Before Width: | Height: | Size: 91 B |
Before Width: | Height: | Size: 91 B |
Before Width: | Height: | Size: 117 B |
BIN
textures/arrow_signs_steel.png
Normal file
After Width: | Height: | Size: 220 B |
BIN
textures/arrow_signs_steel_border.png
Normal file
After Width: | Height: | Size: 151 B |
BIN
textures/arrow_signs_wood.png
Normal file
After Width: | Height: | Size: 318 B |
BIN
textures/arrow_signs_wood_border.png
Normal file
After Width: | Height: | Size: 187 B |
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 sign",
|
||||
drawtype = "nodebox",
|
||||
node_box = arrow_signs.nodebox,
|
||||
selection_box = arrow_signs.selection_box,
|
||||
tiles = {"arrow_signs_wood.png^arrow_signs_wood_border.png"},
|
||||
inventory_image = "arrow_signs_wood.png",
|
||||
wield_image = "arrow_signs_wood.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
groups = {choppy = 2, flammable = 2, oddly_breakable_by_hand = 3},
|
||||
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_wood",
|
||||
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,
|
||||
})
|