7 Commits
v4.3 ... master

8 changed files with 81 additions and 20 deletions

13
README.md Normal file
View File

@ -0,0 +1,13 @@
# README #
This mod adds arrow signs (wood and steel) that can used for showing the goal of a road.
### Installation ###
Install it like each other mod for minetest.
See: http://wiki.minetest.net/Installing_Mods
### Craft rezieps ###
![craft_steel_sign.png](https://bitbucket.org/repo/65EL85/images/1707723039-craft_steel_sign.png)
![craft_wood_sign.png](https://bitbucket.org/repo/65EL85/images/1728731753-craft_wood_sign.png)

View File

@ -1,3 +0,0 @@
default
signs_lib?
locks?

View File

@ -1,2 +0,0 @@
This mods adds arrowsigns into Minetest.
Rotatable in all directions.

View File

@ -13,7 +13,7 @@
arrow_signs={} arrow_signs={}
arrow_signs.formspec = "field[text;Sign text: (Hint: Use / or | to create a new line);${text}]"; arrow_signs.formspec = "size[6,2]real_coordinates[true]field[0.375,0.5;5.25,0.8;text;Sign text: (Hit 'Enter' key to validate);${text}]label[0.375,1.5;(Hint: Use / or | to create a new line)]";
arrow_signs.on_place = function(itemstack, placer, pointed_thing) arrow_signs.on_place = function(itemstack, placer, pointed_thing)
@ -94,6 +94,50 @@ arrow_signs.on_place = function(itemstack, placer, pointed_thing)
return minetest.item_place_node(itemstack, placer, pointed_thing, param2) return minetest.item_place_node(itemstack, placer, pointed_thing, param2)
end end
local matrix = {
-- Mounted on Ground (-Y)
[10]=19,
[19]=4,
[4]=13,
[13]=10,
-- Mounted on Top (+Y)
[8]=17,
[17]=6,
[6]=15,
[15]=8,
-- Mounted at South (-Z)
[2]=18, -- down
[18]=22, -- left
[22]=14, -- up
[14]=2, -- right
-- Mounted at North (+Z)
[0]=12, -- down
[12]=20, -- left
[20]=16, -- up
[16]=0, -- right
-- Mounted at West (-X)
[3]=7, -- down
[7]=21, -- left
[21]=11, -- up
[11]=3, -- right
-- Mounted at East (+X)
[1]=9, -- down
[9]=23, -- left
[23]=5, -- up
[5]=1, -- right
}
arrow_signs.on_rotate = function(pos, node, player, mode, new_param2)
node.param2 = matrix[node.param2] or 0 --in case of error
minetest.swap_node(pos,node)
return true
end
arrow_signs.savetext = function(pos, formname, fields, sender) arrow_signs.savetext = function(pos, formname, fields, sender)
if fields.text then if fields.text then
local playername = sender:get_player_name() or "" local playername = sender:get_player_name() or ""
@ -148,3 +192,5 @@ dofile(MODPATH.."/steel.lua")
if minetest.get_modpath("locks") then if minetest.get_modpath("locks") then
dofile(MODPATH.."/shared_locked.lua") dofile(MODPATH.."/shared_locked.lua")
end end
minetest.log("action", "[arrow_signs] loaded.")

5
mod.conf Normal file
View File

@ -0,0 +1,5 @@
name = arrow_signs
title = Arrow Signs
description = This mods adds arrowsigns into Minetest. Rotatable in all directions.
depends = default
optional_depends = signs_lib,locks,basic_materials

View File

@ -1,16 +1,16 @@
--[[ --[[
Shared Locked Arrow sign Shared Locked Arrow sign
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. 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. 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 arrow sign",
drawtype = "nodebox", drawtype = "nodebox",
node_box = arrow_signs.nodebox, node_box = arrow_signs.nodebox,
selection_box = arrow_signs.selection_box, selection_box = arrow_signs.selection_box,
tiles = {"arrow_signs_wood.png^arrow_signs_wood_border.png"}, tiles = {"arrow_signs_wood.png^arrow_signs_wood_border.png"},
inventory_image = "arrow_signs_wood.png", inventory_image = "arrow_signs_wood.png^[transformR90",
wield_image = "arrow_signs_wood.png", wield_image = "arrow_signs_wood.png",
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
@ -24,7 +24,7 @@ minetest.register_node("arrow_signs:shared_locked", {
locks:lock_set_owner( pointed_thing.above, placer, "Shared locked sign"); locks:lock_set_owner( pointed_thing.above, placer, "Shared locked sign");
return itemstack return itemstack
end, end,
on_rotate = arrow_signs.on_rotate,
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
-- prepare the lock of the sign -- prepare the lock of the sign
@ -40,7 +40,7 @@ minetest.register_node("arrow_signs:shared_locked", {
end, end,
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
if not locks:lock_handle_input(pos, formname, fields, sender) then
-- if the user already has the right to use this and did input text -- if the user already has the right to use this and did input text
if( fields.text if( fields.text
and ( not(fields.locks_sent_lock_command) and ( not(fields.locks_sent_lock_command)
@ -62,14 +62,14 @@ minetest.register_node("arrow_signs:shared_locked", {
--a warning message is also printed by the locks mod --a warning message is also printed by the locks mod
--arrow_signs.savetext( pos, formname, fields, sender ); --arrow_signs.savetext( pos, formname, fields, sender );
end end
end
end, end,
}); });
minetest.register_craft({ minetest.register_craft({
type = 'shapeless', type = 'shapeless',
output = 'arrow_signs:shared_locked', output = 'arrow_signs:shared_locked',
recipe = {'arrow_signs:wall', 'locks:lock'}, recipe = {'arrow_signs:wall', 'locks:lock', minetest.get_modpath("basic_materials") and "basic_materials:ic" or ""},
}) })
--Redefinition --Redefinition

View File

@ -1,7 +1,7 @@
--[[ --[[
Steel Arrow Sign Steel Arrow Sign
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. 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. 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.
]] ]]
@ -11,7 +11,7 @@ minetest.register_node("arrow_signs:steel", {
node_box = arrow_signs.nodebox, node_box = arrow_signs.nodebox,
selection_box = arrow_signs.selection_box, selection_box = arrow_signs.selection_box,
tiles = {"arrow_signs_steel.png^arrow_signs_steel_border.png"}, tiles = {"arrow_signs_steel.png^arrow_signs_steel_border.png"},
inventory_image = "arrow_signs_steel.png", inventory_image = "arrow_signs_steel.png^[transformR90",
wield_image = "arrow_signs_steel.png", wield_image = "arrow_signs_steel.png",
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
@ -20,6 +20,7 @@ minetest.register_node("arrow_signs:steel", {
groups = {cracky = 2}, groups = {cracky = 2},
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
on_place = arrow_signs.on_place, on_place = arrow_signs.on_place,
on_rotate = arrow_signs.on_rotate,
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("formspec", arrow_signs.formspec) meta:set_string("formspec", arrow_signs.formspec)

View File

@ -1,7 +1,7 @@
--[[ --[[
Wooden Arrow sign Wooden Arrow sign
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. 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. 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.
]] ]]
@ -11,7 +11,7 @@ minetest.register_node("arrow_signs:wall", {
node_box = arrow_signs.nodebox, node_box = arrow_signs.nodebox,
selection_box = arrow_signs.selection_box, selection_box = arrow_signs.selection_box,
tiles = {"arrow_signs_wood.png^arrow_signs_wood_border.png"}, tiles = {"arrow_signs_wood.png^arrow_signs_wood_border.png"},
inventory_image = "arrow_signs_wood.png", inventory_image = "arrow_signs_wood.png^[transformR90",
wield_image = "arrow_signs_wood.png", wield_image = "arrow_signs_wood.png",
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
@ -20,6 +20,7 @@ minetest.register_node("arrow_signs:wall", {
groups = {choppy = 2, flammable = 2, oddly_breakable_by_hand = 3}, groups = {choppy = 2, flammable = 2, oddly_breakable_by_hand = 3},
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
on_place = arrow_signs.on_place, on_place = arrow_signs.on_place,
on_rotate = arrow_signs.on_rotate,
on_construct = function(pos) on_construct = function(pos)
--local n = minetest.get_node(pos) --local n = minetest.get_node(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)