forked from mff/sponge
Version MFF.
This commit is contained in:
parent
db1e677a45
commit
3af4a5b513
189
init.lua
Normal file → Executable file
189
init.lua
Normal file → Executable file
@ -1,132 +1,103 @@
|
||||
minetest.register_node("sponge:sponge", {
|
||||
description = "Sponge",
|
||||
description = "Sponge Dry",
|
||||
drawtype = "normal",
|
||||
tiles = {"sponge.png"},
|
||||
tiles = {"sponge_sponge.png"},
|
||||
paramtype = 'light',
|
||||
sunlight_propagates = true,
|
||||
walkable = true,
|
||||
pointable = true,
|
||||
diggable = true,
|
||||
buildable_to = false,
|
||||
groups = {snappy=2, flammable=1},
|
||||
stack_max = 99,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,flammable=3},
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local pn = placer:get_player_name()
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
if minetest.is_protected(pointed_thing.above, pn) then
|
||||
return
|
||||
end
|
||||
local change = false
|
||||
local on_water = false
|
||||
local p, n
|
||||
-- verifier si il est dans l'eau ou a cotée
|
||||
if string.find(minetest.get_node(pointed_thing.above).name, "water_source")
|
||||
or string.find(minetest.get_node(pointed_thing.above).name, "water_flowing") then
|
||||
on_water = true
|
||||
end
|
||||
for i=-1,1 do
|
||||
p = {x=pos.x+i, y=pos.y, z=pos.z}
|
||||
n = minetest.get_node(p)
|
||||
-- On verifie si il y a de l'eau
|
||||
if (n.name=="default:water_flowing") or (n.name == "default:water_source")
|
||||
or (n.name == "default:river_water_flowing") or (n.name == "default:river_water_source") then
|
||||
on_water = true
|
||||
end
|
||||
end
|
||||
for i=-1,1 do
|
||||
p = {x=pos.x, y=pos.y+i, z=pos.z}
|
||||
n = minetest.get_node(p)
|
||||
-- On verifie si il y a de l'eau
|
||||
if (n.name=="default:water_flowing") or (n.name == "default:water_source")
|
||||
or (n.name == "default:river_water_flowing") or (n.name == "default:river_water_source") then
|
||||
on_water = true
|
||||
end
|
||||
end
|
||||
for i=-1,1 do
|
||||
p = {x=pos.x, y=pos.y, z=pos.z+i}
|
||||
n = minetest.get_node(p)
|
||||
-- On verifie si il y a de l'eau
|
||||
if (n.name=="default:water_flowing") or (n.name == "default:water_source")
|
||||
or (n.name == "default:river_water_flowing") or (n.name == "default:river_water_source") then
|
||||
on_water = true
|
||||
end
|
||||
end
|
||||
|
||||
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}
|
||||
n = minetest.get_node(p)
|
||||
-- On Supprime l'eau
|
||||
if (n.name=="default:water_flowing") or (n.name == "default:water_source")
|
||||
or (n.name == "default:river_water_flowing") or (n.name == "default:river_water_source") then
|
||||
minetest.add_node(p, {name="air"})
|
||||
change = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if change then
|
||||
minetest.add_node(pos, {name = "sponge:sponge_wet"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("sponge:iron_sponge", {
|
||||
description = "Iron Sponge",
|
||||
minetest.register_node("sponge:sponge_wet", {
|
||||
description = "Wet Sponge",
|
||||
drawtype = "normal",
|
||||
tiles = {"iron_sponge.png"},
|
||||
tiles = {"sponge_sponge_wet.png"},
|
||||
paramtype = 'light',
|
||||
sunlight_propagates = true,
|
||||
walkable = true,
|
||||
pointable = true,
|
||||
diggable = true,
|
||||
buildable_to = false,
|
||||
groups = {cracky=2},
|
||||
stack_max = 99,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("sponge:fake_air", {
|
||||
description = "Fake Air",
|
||||
drawtype = "airlike",
|
||||
paramtype = 'light',
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
groups = {not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:water_source", "default:water_flowing"},
|
||||
neighbors = {"sponge:sponge", "sponge:iron_sponge"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.env:add_node(pos, {name="sponge:fake_air"})
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm(
|
||||
{nodenames = {"sponge:sponge"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
for i=-1,1 do
|
||||
for j=-1,1 do
|
||||
for k=-1,1 do
|
||||
p = {x=pos.x+i, y=pos.y+j, z=pos.z+k}
|
||||
n = minetest.env:get_node(p)
|
||||
if (n.name=="default:water_flowing")
|
||||
or (n.name == "default:water_source") then
|
||||
minetest.env:add_node(p, {name="sponge:fake_air"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm(
|
||||
{nodenames = {"sponge:iron_sponge"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
for i=-2,2 do
|
||||
for j=-2,2 do
|
||||
for k=-2,2 do
|
||||
p = {x=pos.x+i, y=pos.y+j, z=pos.z+k}
|
||||
n = minetest.env:get_node(p)
|
||||
if (n.name=="default:water_flowing")
|
||||
or (n.name == "default:water_source")
|
||||
or (n.name == "default:lava_source")
|
||||
or (n.name == "default:lava_flowing") then
|
||||
minetest.env:add_node(p, {name="sponge:fake_air"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm(
|
||||
{nodenames = {"sponge:fake_air"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
spongecount=0
|
||||
for i=-2,2 do
|
||||
for j=-2,2 do
|
||||
for k=-2,2 do
|
||||
p = {x=pos.x+i, y=pos.y+j, z=pos.z+k}
|
||||
n = minetest.env:get_node(p)
|
||||
if (n.name=="sponge:iron_sponge") or (n.name == "sponge:sponge") then
|
||||
spongecount=spongecount+1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if (spongecount==0) then
|
||||
minetest.env:add_node(pos, {name="air"})
|
||||
end
|
||||
end
|
||||
-- Sponge wet back to Sponge Dry if coocked in a furnace
|
||||
minetest.register_craft({
|
||||
type = "cooking", output = "sponge:sponge", recipe = "sponge:sponge_wet",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "sponge:sponge",
|
||||
recipe = {
|
||||
{'default:leaves', 'default:leaves', 'default:leaves'},
|
||||
{'default:leaves', 'default:mese', 'default:leaves'},
|
||||
{'default:leaves', 'default:leaves', 'default:leaves'},
|
||||
}
|
||||
{"", "dye:black", ""},
|
||||
{"dye:yellow", "wool:white", "dye:yellow"},
|
||||
{"", "farming:wheat", ""},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "sponge:iron_sponge",
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'sponge:sponge', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
}
|
||||
})
|
||||
|
||||
|
103
oldinit.lua
103
oldinit.lua
@ -1,103 +0,0 @@
|
||||
minetest.register_node("sponge:sponge", {
|
||||
description = "Sponge",
|
||||
drawtype = "normal",
|
||||
tiles = {"sponge.png"},
|
||||
paramtype = 'light',
|
||||
sunlight_propagates = true,
|
||||
walkable = true,
|
||||
pointable = true,
|
||||
diggable = true,
|
||||
buildable_to = false,
|
||||
groups = {snappy=2, flammable=1},
|
||||
after_destruct = function(pos)
|
||||
for i=-1,1 do
|
||||
for j=-1,1 do
|
||||
for k=-1,1 do
|
||||
p = {x=pos.x+i, y=pos.y+j, z=pos.z+k}
|
||||
n = minetest.env:get_node(p)
|
||||
if (n.name=="sponge:fake_air") then
|
||||
minetest.env:add_node(p, {name="air"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("sponge:iron_sponge", {
|
||||
description = "Iron Sponge",
|
||||
drawtype = "normal",
|
||||
tiles = {"iron_sponge.png"},
|
||||
paramtype = 'light',
|
||||
sunlight_propagates = true,
|
||||
walkable = true,
|
||||
pointable = true,
|
||||
diggable = true,
|
||||
buildable_to = false,
|
||||
groups = {cracky=2},
|
||||
after_destruct = function(pos)
|
||||
for i=-1,1 do
|
||||
for j=-1,1 do
|
||||
for k=-1,1 do
|
||||
p = {x=pos.x+i, y=pos.y+j, z=pos.z+k}
|
||||
n = minetest.env:get_node(p)
|
||||
if (n.name=="sponge:fake_air") then
|
||||
minetest.env:add_node(p, {name="air"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("sponge:fake_air", {
|
||||
description = "Fake Air",
|
||||
drawtype = "airlike",
|
||||
paramtype = 'light',
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
groups = {not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:water_source", "default:water_flowing"},
|
||||
neighbors = {"sponge:sponge", "sponge:iron_sponge"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.env:add_node(pos, {name="sponge:fake_air"})
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:lava_source", "default:lava_flowing"},
|
||||
neighbors = {"sponge:iron_sponge"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.env:add_node(pos, {name="sponge:fake_air"})
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "sponge:sponge",
|
||||
recipe = {
|
||||
{'default:leaves', 'default:leaves', 'default:leaves'},
|
||||
{'default:leaves', 'default:mese', 'default:leaves'},
|
||||
{'default:leaves', 'default:leaves', 'default:leaves'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "sponge:iron_sponge",
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'sponge:sponge', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
}
|
||||
})
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 942 B |
Binary file not shown.
Before Width: | Height: | Size: 942 B |
BIN
textures/sponge_sponge.png
Executable file
BIN
textures/sponge_sponge.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
textures/sponge_sponge_wet.png
Normal file
BIN
textures/sponge_sponge_wet.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
Loading…
Reference in New Issue
Block a user