Compare commits

...

5 Commits

Author SHA1 Message Date
OldCoder 228c2e35bd Rename directory named as a literal newline to "n" 2022-09-04 21:11:17 -07:00
HybridDog 9c537f7c69 🐈 2016-05-26 12:17:17 +02:00
HybridDog ad18562479 🐈 2015-10-18 16:23:22 +02:00
HybridDog 5a2a075081 🐈 2015-07-09 20:23:51 +02:00
HybridDog bc53d6c447 automatic update 2015-03-15 11:37:05 +01:00
5 changed files with 108 additions and 98 deletions

206
init.lua
View File

@ -36,28 +36,6 @@ local function deepcopy(orig)
return copy
end
--Change the old nodes
for _,node in pairs({
{"lavacooling:obsidian", "default:obsidian"},
{"lavacooling:obsidian_brick", "default:obsidianbrick"},
{"default:obsidian_brick", "default:obsidianbrick"},
{"lavacooling:basalt", "default:basalt"},
}) do
local input = node[1]
local output = node[2]
minetest.register_node(":"..input, {})
minetest.register_abm ({
nodenames = {input},
interval = 0,
chance = 1,
action = function (pos)
minetest.add_node (pos, {name = output})
print("[lavacooling] "..input.." changed to "..output.." at ("..pos.x..", "..pos.y..", "..pos.z..")")
end,
})
end
--Nodes/Items
@ -70,6 +48,8 @@ minetest.register_node(":default:basalt", {
})
if not minetest.registered_nodes["default:obsidianbrick"] then
minetest.log("error", "[lavacooling] default obsidian brick missing")
local tmp = deepcopy(minetest.registered_nodes["default:obsidian"])
tmp.description = tmp.description.." brick"
tmp.tiles = {"lavacooling_obsidian_brick.png"}
@ -255,90 +235,120 @@ minetest.register_abm ({
if minetest.get_modpath("sumpf") then
lavacooling_abm("default:lava_source", {"sumpf:dirtywater_flowing", "sumpf:dirtywater_source"}, "default:obsidian")
lavacooling_abm("default:lava_source", {"sumpf:dirtywater_flowing", "sumpf:dirtywater_source"}, "default:obsidian")
local sw_ore_list = {
{"sumpf:kohle", 37},
{"sumpf:eisen", 50},
{"default:mese", 200},
{"default:obsidian", 250},
}
local sw_ore_list = {
{"sumpf:kohle", 37},
{"sumpf:eisen", 50},
{"default:mese", 200},
{"default:obsidian", 250},
}
local function dirtyblocks(pos)
local node_under = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
if node_under == "sumpf:dirtywater_flowing" then
return "default:dirt"
end
for i=-1,1,2 do
if minetest.get_node({x=pos.x+i, y=pos.y, z=pos.z}).name == "sumpf:dirtywater_flowing"
or minetest.get_node({x=pos.x, y=pos.y, z=pos.z+i}).name == "sumpf:dirtywater_flowing" then
return "default:sand"
local function dirtyblocks(pos)
local node_under = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
if node_under == "sumpf:dirtywater_flowing" then
return "default:dirt"
end
for i=-1,1,2 do
if minetest.get_node({x=pos.x+i, y=pos.y, z=pos.z}).name == "sumpf:dirtywater_flowing"
or minetest.get_node({x=pos.x, y=pos.y, z=pos.z+i}).name == "sumpf:dirtywater_flowing" then
return "default:sand"
end
end
if node_under == "sumpf:dirtywater_source" then
local sw_ore = ret_ore(sw_ore_list)
if sw_ore then
return sw_ore
end
return "sumpf:junglestone"
end
end
if node_under == "sumpf:dirtywater_source" then
local sw_ore = ret_ore(sw_ore_list)
if sw_ore then
return sw_ore
local function dirtyblocks2(pos)
if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "default:lava_flowing" then
return "default:clay"
end
for i=-1,1,2 do
if minetest.get_node({x=pos.x+i, y=pos.y, z=pos.z}).name == "default:lava_flowing" then
return "sumpf:sumpf"
end
if minetest.get_node({x=pos.x, y=pos.y, z=pos.z+i}).name == "default:lava_flowing" then
return "sumpf:peat"
end
end
return "sumpf:junglestone"
end
local function dirtyblocks3(pos)
if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "default:lava_flowing" then
return "default:gravel"
end
end
minetest.register_abm ({
nodenames = {"sumpf:dirtywater_flowing"},
interval = 0,
chance = 1,
action = function (pos)
local nam = dirtyblocks3(pos)
if nam then
coolnode(nam, pos)
end
end,
})
minetest.register_abm ({
nodenames = {"sumpf:dirtywater_source"},
interval = 0,
chance = 1,
action = function (pos)
local nam = dirtyblocks2(pos)
if nam then
coolnode(nam, pos)
end
end,
})
minetest.register_abm ({
nodenames = {"default:lava_flowing"},
interval = 0,
chance = 1,
action = function (pos)
local nam = dirtyblocks(pos)
if nam then
coolnode(nam, pos)
end
end,
})
end
local function dirtyblocks2(pos)
if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "default:lava_flowing" then
return "default:clay"
end
for i=-1,1,2 do
if minetest.get_node({x=pos.x+i, y=pos.y, z=pos.z}).name == "default:lava_flowing" then
return "sumpf:sumpf"
end
if minetest.get_node({x=pos.x, y=pos.y, z=pos.z+i}).name == "default:lava_flowing" then
return "sumpf:peat"
end
end
-- legacy
--Change the old nodes
for _,node in pairs({
{"lavacooling:obsidian", "default:obsidian"},
{"lavacooling:obsidian_brick", "default:obsidianbrick"},
{"default:obsidian_brick", "default:obsidianbrick"},
{"lavacooling:basalt", "default:basalt"},
}) do
local input = node[1]
local output = node[2]
minetest.register_node(":"..input, {})
minetest.register_abm ({
nodenames = {input},
interval = 0,
chance = 1,
action = function (pos)
minetest.add_node (pos, {name = output})
print("[lavacooling] "..input.." changed to "..output.." at ("..pos.x..", "..pos.y..", "..pos.z..")")
end,
})
end
local function dirtyblocks3(pos)
if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "default:lava_flowing" then
return "default:gravel"
end
local time = math.floor(tonumber(os.clock()-load_time_start)*100+0.5)/100
local msg = "[lavacooling] loaded after ca. "..time
if time > 0.05 then
print(msg)
else
minetest.log("info", msg)
end
minetest.register_abm ({
nodenames = {"sumpf:dirtywater_flowing"},
interval = 0,
chance = 1,
action = function (pos)
local nam = dirtyblocks3(pos)
if nam then
coolnode(nam, pos)
end
end,
})
minetest.register_abm ({
nodenames = {"sumpf:dirtywater_source"},
interval = 0,
chance = 1,
action = function (pos)
local nam = dirtyblocks2(pos)
if nam then
coolnode(nam, pos)
end
end,
})
minetest.register_abm ({
nodenames = {"default:lava_flowing"},
interval = 0,
chance = 1,
action = function (pos)
local nam = dirtyblocks(pos)
if nam then
coolnode(nam, pos)
end
end,
})
end
print(string.format("[lavacooling] loaded after ca. %.2fs", os.clock() - load_time_start))

View File

Before

Width:  |  Height:  |  Size: 346 B

After

Width:  |  Height:  |  Size: 346 B

View File

Before

Width:  |  Height:  |  Size: 396 B

After

Width:  |  Height:  |  Size: 396 B

View File

Before

Width:  |  Height:  |  Size: 308 B

After

Width:  |  Height:  |  Size: 308 B

View File

Before

Width:  |  Height:  |  Size: 346 B

After

Width:  |  Height:  |  Size: 346 B