Sponge: minor update

This commit is contained in:
Maksim 2021-12-31 12:16:52 +01:00
parent 4d53217b2b
commit 52e3175b37

View File

@ -12,7 +12,7 @@ end
local area = 3 local area = 3
-- removing the air-like nodes -- removing the air-like nodes
local destruct = function(pos) local function destruct(pos)
for x = pos.x - area, pos.x + area do for x = pos.x - area, pos.x + area do
for y = pos.y - area, pos.y + area do for y = pos.y - area, pos.y + area do
for z = pos.z - area, pos.z + area do for z = pos.z - area, pos.z + area do
@ -25,27 +25,10 @@ local destruct = function(pos)
end end
end end
-- air-like node local function construct(pos, placer)
minetest.register_node("sponge:liquid_stop", { local player_name = placer:get_player_name()
drawtype = "airlike",
drop = "",
groups = {not_in_creative_inventory = 1},
pointable = false,
walkable = false,
sunlight_propagates = true,
paramtype = "light",
buildable_to = true
})
-- Dry Sponge if not minetest.is_protected(pos, player_name) then
minetest.register_node("sponge:sponge", {
description = S"Sponge",
tiles = {"sponge_sponge.png"},
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, flammable = 3, not_cuttable = 1},
after_place_node = function(pos, placer)
local name = placer:get_player_name()
if not minetest.is_protected(pos, name) then
local count = 0 local count = 0
for x = pos.x - area, pos.x + area do for x = pos.x - area, pos.x + area do
for y = pos.y - area, pos.y + area do for y = pos.y - area, pos.y + area do
@ -69,9 +52,28 @@ minetest.register_node("sponge:sponge", {
minetest.set_node(pos, {name = "sponge:wet_sponge"}) minetest.set_node(pos, {name = "sponge:wet_sponge"})
end end
end end
end, end
after_dig_node = destruct -- air-like node
minetest.register_node("sponge:liquid_stop", {
drawtype = "airlike",
drop = "",
groups = {not_in_creative_inventory = 1},
pointable = false,
walkable = false,
floodable = false,
sunlight_propagates = true,
paramtype = "light",
buildable_to = true
})
-- Dry Sponge
minetest.register_node("sponge:sponge", {
description = S"Sponge",
tiles = {"sponge_sponge.png"},
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, flammable = 3, not_cuttable = 1},
after_place_node = construct,
after_destruct = destruct
}) })
-- Wet Sponge -- Wet Sponge