x_marketplace/nodes.lua

159 lines
5.2 KiB
Lua

--
-- Bones sign (sellhead)
--
minetest.register_node("x_marketplace:sign_wall_bones", {
description = "Bones Sign - write '/mp sellhead' to sell heads",
drawtype = "nodebox",
tiles = {"x_marketplace_sign_wall_bones.png"},
inventory_image = "x_marketplace_sign_bones.png",
wield_image = "x_marketplace_sign_bones.png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
is_ground_content = false,
walkable = false,
node_box = {
type = "wallmounted",
wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125},
wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375},
},
groups = {crumbly = 2},
sounds = default.node_sound_gravel_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "field[text;;${text}]")
end,
on_receive_fields = function(pos, formname, fields, sender)
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
local player_name = sender:get_player_name()
if minetest.is_protected(pos, player_name) then
minetest.record_protection_violation(pos, player_name)
return
end
local meta = minetest.get_meta(pos)
if not fields.text then return end
minetest.log("action", (player_name or "") .. " wrote \"" ..
fields.text .. "\" to sign at " .. minetest.pos_to_string(pos))
meta:set_string("text", fields.text)
meta:set_string("infotext", '"' .. fields.text .. '"')
end,
})
--
-- Mese sign (sell)
--
minetest.register_node("x_marketplace:sign_wall_mese", {
description = "Mese Sign - write '/mp sell' to sell to marketplace",
drawtype = "nodebox",
tiles = {"x_marketplace_sign_wall_mese.png"},
inventory_image = "x_marketplace_sign_mese.png",
wield_image = "x_marketplace_sign_mese.png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
is_ground_content = false,
walkable = false,
node_box = {
type = "wallmounted",
wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125},
wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375},
},
groups = {cracky = 1, level = 2},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "field[text;;${text}]")
end,
on_receive_fields = function(pos, formname, fields, sender)
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
local player_name = sender:get_player_name()
if minetest.is_protected(pos, player_name) then
minetest.record_protection_violation(pos, player_name)
return
end
local meta = minetest.get_meta(pos)
if not fields.text then return end
minetest.log("action", (player_name or "") .. " wrote \"" ..
fields.text .. "\" to sign at " .. minetest.pos_to_string(pos))
meta:set_string("text", fields.text)
meta:set_string("infotext", '"' .. fields.text .. '"')
end,
})
--
-- Diamond sign (buy)
--
minetest.register_node("x_marketplace:sign_wall_diamond", {
description = "Diamond Sign - write '/mp buy' to buy from marketplace",
drawtype = "nodebox",
tiles = {"x_marketplace_sign_wall_diamond.png"},
inventory_image = "x_marketplace_sign_diamond.png",
wield_image = "x_marketplace_sign_diamond.png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
is_ground_content = false,
walkable = false,
node_box = {
type = "wallmounted",
wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125},
wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375},
},
groups = {cracky = 1, level = 3},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "field[text;;${text}]")
end,
on_receive_fields = function(pos, formname, fields, sender)
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
local player_name = sender:get_player_name()
if minetest.is_protected(pos, player_name) then
minetest.record_protection_violation(pos, player_name)
return
end
local meta = minetest.get_meta(pos)
if not fields.text then return end
minetest.log("action", (player_name or "") .. " wrote \"" ..
fields.text .. "\" to sign at " .. minetest.pos_to_string(pos))
meta:set_string("text", fields.text)
meta:set_string("infotext", '"' .. fields.text .. '"')
end,
})
--
-- CRAFTING
--
minetest.register_craft({
output = "x_marketplace:sign_wall_bones",
recipe = {
{"bones:bones", "bones:bones", "bones:bones"},
{"bones:bones", "bones:bones", "bones:bones"},
{"", "group:stick", ""},
}
})
minetest.register_craft({
output = "x_marketplace:sign_wall_mese",
recipe = {
{"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"},
{"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"},
{"", "group:stick", ""},
}
})
minetest.register_craft({
output = "x_marketplace:sign_wall_diamond",
recipe = {
{"default:diamond", "default:diamond", "default:diamond"},
{"default:diamond", "default:diamond", "default:diamond"},
{"", "group:stick", ""},
}
})