remove depends

This commit is contained in:
Bruno Rybársky 2022-07-12 13:44:45 +02:00
parent b6932befb6
commit fdfb0507dc
3 changed files with 4 additions and 130 deletions

@ -1 +0,0 @@
default

@ -14,9 +14,9 @@ local wdir = { 8, 17, 6, 15 } -- wall direction
minetest.register_alias("memorandum:letter_empty_2" ,"memorandum:letter_empty" )
minetest.register_alias("memorandum:letter_written_2","memorandum:letter_written")
minetest.register_craftitem(":default:paper", {
minetest.register_craftitem("memorandum:paper", {
description = "Paper",
inventory_image = "default_paper.png",
inventory_image = "paper.png",
on_place = function(itemstack, placer, pointed_thing)
local pt = pointed_thing
local above = pt.above
@ -48,7 +48,6 @@ minetest.register_node("memorandum:letter_empty", {
walkable = false,
node_box = {type = "fixed", fixed = sheet},
groups = {snappy=3,dig_immediate=3,not_in_creative_inventory=1},
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string(
@ -80,7 +79,7 @@ minetest.register_node("memorandum:letter_empty", {
end,
on_dig = function(pos, node, digger)
if digger:is_player() and digger:get_inventory() then
digger:get_inventory():add_item("main", {name="default:paper", count=1, wear=0, metadata=""})
digger:get_inventory():add_item("main", {name="memorandum:paper", count=1, wear=0, metadata=""})
end
minetest.remove_node(pos)
end,
@ -88,7 +87,7 @@ minetest.register_node("memorandum:letter_empty", {
minetest.register_craftitem("memorandum:letter", {
description = "Letter",
inventory_image = "default_paper.png^memorandum_letters.png",
inventory_image = "paper.png^memorandum_letters.png",
stack_max = 1,
groups = {not_in_creative_inventory=1},
on_use = function(itemstack, user, pointed_thing)
@ -160,7 +159,6 @@ minetest.register_node("memorandum:letter_written", {
walkable = false,
node_box = {type = "fixed", fixed = sheet},
groups = {snappy=3,dig_immediate=3,not_in_creative_inventory=1},
sounds = default.node_sound_leaves_defaults(),
on_receive_fields = function(pos, formname, fields, sender)
local item = sender:get_wielded_item()
if item:get_name() == "memorandum:eraser" then
@ -196,12 +194,6 @@ minetest.register_node("memorandum:letter_written", {
if signed == '" Unsigned' then
signcount = "00"
end
if item:get_name() == "vessels:glass_bottle" then
inv:remove_item("main", "vessels:glass_bottle")
inv:add_item("main", {name="memorandum:message", count=1, wear=0, metadata=text..signed..signcount})
else
inv:add_item("main", {name="memorandum:letter", count=1, wear=0, metadata=text..signed..signcount})
end
end
minetest.remove_node(pos)
end,
@ -243,123 +235,6 @@ minetest.register_tool("memorandum:eraser", {
end
end,
})
minetest.register_node("memorandum:message", {
description = "Message in a Bottle",
drawtype = "plantlike",
tiles = {"vessels_glass_bottle.png^memorandum_message.png"},
inventory_image = "vessels_glass_bottle_inv.png^memorandum_message.png",
wield_image = "vessels_glass_bottle.png^memorandum_message.png",
paramtype = "light",
selection_box = {
type = "fixed",
fixed = {-1/4, -1/2, -1/4, 1/4, 4/10, 1/4}
},
stack_max = 1,
groups = {vessel=1,dig_immediate=3,attached_node=1,not_in_creative_inventory=1},
--sounds = default.node_sound_glass_defaults(),
on_use = function(itemstack, user, pointed_thing)
local pt = pointed_thing
if pt.under then
local meta = minetest.get_meta(pt.above)
local text = itemstack:get_metadata()
local scnt = string.sub (text, -2, -1)
if scnt == "00" then
mssg = string.sub (text, 1, -3)
sgnd = ""
elseif tonumber(scnt) == nil then -- to support previous versions
mssg = string.sub (text, 37, -1)
sgnd = ""
else
mssg = string.sub (text, 1, -scnt -3)
sgnd = string.sub (text, -scnt-2, -3)
end
if minetest.get_node(pt.above).name == "air" then
minetest.add_node(pt.above, {name="memorandum:letter_written", param2=math.random(0,3)})
if scnt == "00" or tonumber(scnt) == nil then
meta:set_string("infotext", info..mssg..'" Unsigned')
else
meta:set_string("infotext", info..mssg..sign..sgnd)
end
meta:set_string("text", mssg)
meta:set_string("signed", sgnd)
itemstack:take_item()
user:get_inventory():add_item("main", {name="vessels:glass_bottle", count=1, wear=0, metadata=""})
return itemstack
end
end
end,
on_place = function(itemstack, placer, pointed_thing)
local pt = pointed_thing
local meta = minetest.get_meta(pt.above)
local text = itemstack:get_metadata()
local scnt = string.sub (text, -2, -1)
if scnt == "00" then
mssg = string.sub (text, 1, -3)
sgnd = ""
elseif tonumber(scnt) == nil then -- to support previous versions
mssg = string.sub (text, 37, -1)
sgnd = ""
else
mssg = string.sub (text, 1, -scnt -3)
sgnd = string.sub (text, -scnt-2, -3)
end
if minetest.get_node(pt.above).name == "air" then
minetest.add_node(pt.above, {name="memorandum:message"})
meta:set_string("text", mssg)
meta:set_string("signed", sgnd)
itemstack:take_item()
return itemstack
end
end,
on_dig = function(pos, node, digger)
if digger:is_player() and digger:get_inventory() then
local meta = minetest.get_meta(pos)
local text = meta:get_string("text")
local signed = meta:get_string("signed")
local signcount = string.len(signed)
local item = digger:get_wielded_item()
if string.len(signed) < 10 then
signcount = "0"..string.len(signed)
end
if signed == '" Unsigned' then
signcount = "00"
end
digger:get_inventory():add_item("main", {name="memorandum:message", count=1, wear=0, metadata=text..signed..signcount})
end
minetest.remove_node(pos)
end,
})
if minetest.get_modpath("farming") ~= nil then
minetest.register_craft({
type = "shapeless",
output = "memorandum:eraser",
recipe = {"farming:bread"},
})
end
if minetest.get_modpath("candles") ~= nil then
minetest.register_craft({
type = "shapeless",
output = "memorandum:eraser",
recipe = {"candles:wax"},
})
end
if minetest.get_modpath("bees") ~= nil then
minetest.register_craft({
type = "shapeless",
output = "memorandum:eraser",
recipe = {"bees:honey_comb"},
})
end
if minetest.get_modpath("technic") ~= nil then
minetest.register_craft({
type = "shapeless",
output = "memorandum:eraser",
recipe = {"technic:raw_latex"},
})
end
-----------------------------------------------------------------------------------------------
print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
-----------------------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B