2014-10-31 00:10:10 +01:00
|
|
|
minetest.register_node("sponge:sponge", {
|
2015-04-14 01:59:22 +02:00
|
|
|
description = "Sponge Dry",
|
2014-10-31 00:10:10 +01:00
|
|
|
drawtype = "normal",
|
|
|
|
tiles = {"sponge_sponge.png"},
|
|
|
|
paramtype = 'light',
|
|
|
|
walkable = true,
|
|
|
|
pointable = true,
|
|
|
|
diggable = true,
|
|
|
|
buildable_to = false,
|
2015-02-08 23:30:30 +01:00
|
|
|
stack_max = 99,
|
2014-10-31 00:10:10 +01:00
|
|
|
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,flammable=3},
|
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
|
|
local pn = placer:get_player_name()
|
|
|
|
if pointed_thing.type ~= "node" then
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
if minetest.is_protected(pointed_thing.above, pn) then
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
local change = false
|
|
|
|
local on_water = false
|
|
|
|
local pos = pointed_thing.above
|
|
|
|
-- verifier si il est dans l'eau ou a cotée
|
2015-06-10 17:14:58 +02:00
|
|
|
if string.find(minetest.get_node(pointed_thing.above).name, "water_source")
|
2014-11-08 18:36:57 +01:00
|
|
|
or string.find(minetest.get_node(pointed_thing.above).name, "water_flowing") then
|
2014-10-31 00:10:10 +01:00
|
|
|
on_water = true
|
|
|
|
end
|
|
|
|
for i=-1,1 do
|
|
|
|
p = {x=pos.x+i, y=pos.y, z=pos.z}
|
2014-11-08 18:36:57 +01:00
|
|
|
n = minetest.get_node(p)
|
2014-10-31 00:10:10 +01:00
|
|
|
-- On verifie si il y a de l'eau
|
|
|
|
if (n.name=="default:water_flowing") or (n.name == "default:water_source") then
|
|
|
|
on_water = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for i=-1,1 do
|
|
|
|
p = {x=pos.x, y=pos.y+i, z=pos.z}
|
2014-11-08 18:36:57 +01:00
|
|
|
n = minetest.get_node(p)
|
2014-10-31 00:10:10 +01:00
|
|
|
-- On verifie si il y a de l'eau
|
|
|
|
if (n.name=="default:water_flowing") or (n.name == "default:water_source") then
|
|
|
|
on_water = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for i=-1,1 do
|
|
|
|
p = {x=pos.x, y=pos.y, z=pos.z+i}
|
2014-11-08 18:36:57 +01:00
|
|
|
n = minetest.get_node(p)
|
2014-10-31 00:10:10 +01:00
|
|
|
-- On verifie si il y a de l'eau
|
|
|
|
if (n.name=="default:water_flowing") or (n.name == "default:water_source") then
|
|
|
|
on_water = true
|
|
|
|
end
|
|
|
|
end
|
2015-06-10 17:14:58 +02:00
|
|
|
|
2014-10-31 00:10:10 +01:00
|
|
|
if on_water == true then
|
|
|
|
for i=-3,3 do
|
|
|
|
for j=-3,3 do
|
|
|
|
for k=-3,3 do
|
|
|
|
p = {x=pos.x+i, y=pos.y+j, z=pos.z+k}
|
2014-11-08 18:36:57 +01:00
|
|
|
n = minetest.get_node(p)
|
2014-10-31 00:10:10 +01:00
|
|
|
-- On Supprime l'eau
|
|
|
|
if (n.name=="default:water_flowing") or (n.name == "default:water_source")then
|
2014-11-08 18:36:57 +01:00
|
|
|
minetest.add_node(p, {name="air"})
|
2014-10-31 00:10:10 +01:00
|
|
|
change = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
p = {x=pos.x, y=pos.y, z=pos.z}
|
2014-11-08 18:36:57 +01:00
|
|
|
n = minetest.get_node(p)
|
2014-10-31 00:10:10 +01:00
|
|
|
if change == true then
|
2015-06-10 17:14:58 +02:00
|
|
|
minetest.add_node(pointed_thing.above, {name = "sponge:sponge_wet"})
|
2014-10-31 00:10:10 +01:00
|
|
|
else
|
2015-06-10 17:14:58 +02:00
|
|
|
minetest.add_node(pointed_thing.above, {name = "sponge:sponge"})
|
2014-10-31 00:10:10 +01:00
|
|
|
end
|
2015-04-20 20:40:16 +02:00
|
|
|
itemstack:take_item()
|
2014-10-31 00:10:10 +01:00
|
|
|
return itemstack
|
2015-06-10 17:14:58 +02:00
|
|
|
|
2014-10-31 00:10:10 +01:00
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("sponge:sponge_wet", {
|
|
|
|
description = "Wet Sponge",
|
|
|
|
drawtype = "normal",
|
|
|
|
tiles = {"sponge_sponge_wet.png"},
|
|
|
|
paramtype = 'light',
|
|
|
|
walkable = true,
|
|
|
|
pointable = true,
|
|
|
|
diggable = true,
|
|
|
|
buildable_to = false,
|
2015-02-08 23:31:25 +01:00
|
|
|
stack_max = 99,
|
2014-10-31 00:10:10 +01:00
|
|
|
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3},
|
|
|
|
})
|
2015-02-08 23:34:15 +01:00
|
|
|
|
2015-04-14 22:17:42 +02:00
|
|
|
-- Sponge wet back to Sponge Dry if coocked in a furnace
|
2015-04-14 01:59:22 +02:00
|
|
|
minetest.register_craft({
|
|
|
|
type = "cooking", output = "sponge:sponge", recipe = "sponge:sponge_wet",
|
|
|
|
})
|
|
|
|
|
2015-02-08 23:34:15 +01:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "sponge:sponge",
|
|
|
|
recipe = {
|
|
|
|
{"", "dye:black", ""},
|
2015-04-14 22:00:43 +02:00
|
|
|
{"dye:yellow", "wool:white", "dye:yellow"},
|
2015-02-08 23:34:15 +01:00
|
|
|
{"", "farming:wheat", ""},
|
|
|
|
},
|
|
|
|
})
|