A simple fix for Andrey to keep spawn cleaner.
parent
87f36b6a66
commit
4f232c63d4
|
@ -3,7 +3,7 @@ Minetest 0.4 mod: spawn_sanitizer
|
||||||
|
|
||||||
License of source code:
|
License of source code:
|
||||||
-----------------------
|
-----------------------
|
||||||
Andrey's mod for minetest
|
Andrey's mod for minetest modified to clean more items from spawn like steel doors, chests, gravel, sand, vending, etc. by maikerumine.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
|
136
init.lua
136
init.lua
|
@ -1,6 +1,6 @@
|
||||||
-- Minetest 0.4 mod: spawn_sanitizer
|
-- Minetest 0.4 mod: spawn_sanitizer
|
||||||
-- Bones are eventually removed from spawn.
|
-- Bones are eventually removed from spawn.
|
||||||
--
|
--
|
||||||
-- See README.txt for licensing and other information.
|
-- See README.txt for licensing and other information.
|
||||||
|
|
||||||
spawn_sanitizer = {}
|
spawn_sanitizer = {}
|
||||||
|
@ -20,7 +20,7 @@ minetest.register_abm({
|
||||||
local node=minetest.get_node(pos)
|
local node=minetest.get_node(pos)
|
||||||
local nodeinventory = minetest.get_meta(pos):get_inventory()
|
local nodeinventory = minetest.get_meta(pos):get_inventory()
|
||||||
if node.param2 ~= facedir_for_bones then
|
if node.param2 ~= facedir_for_bones then
|
||||||
if nodeinventory:is_empty("main") then
|
if nodeinventory:is_empty("main") then
|
||||||
node.param2=facedir_for_bones
|
node.param2=facedir_for_bones
|
||||||
minetest.swap_node(pos, node)
|
minetest.swap_node(pos, node)
|
||||||
end
|
end
|
||||||
|
@ -61,13 +61,13 @@ minetest.register_abm({
|
||||||
interval = 3000,
|
interval = 3000,
|
||||||
chance = 8,
|
chance = 8,
|
||||||
action = function(pos)
|
action = function(pos)
|
||||||
if pos.x>-40 and pos.x<40 and pos.z>-40 and pos.z<40 and pos.y>-45 then
|
if pos.x>-40 and pos.x<40 and pos.z>-40 and pos.z<40 and pos.y>-45 then
|
||||||
local owner = minetest.get_meta(pos):get_string("owner")
|
local owner = minetest.get_meta(pos):get_string("owner")
|
||||||
if owner=="" then
|
if owner=="" then
|
||||||
local node=minetest.get_node(pos)
|
local node=minetest.get_node(pos)
|
||||||
local nodeinventory = minetest.get_meta(pos):get_inventory()
|
local nodeinventory = minetest.get_meta(pos):get_inventory()
|
||||||
if node.param2 == facedir_for_bones then
|
if node.param2 == facedir_for_bones then
|
||||||
if nodeinventory:is_empty("main") then
|
if nodeinventory:is_empty("main") then
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -77,11 +77,11 @@ minetest.register_abm({
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.after(75, function(dtime)
|
minetest.after(75, function(dtime)
|
||||||
|
|
||||||
if spawn_sanitizer.cleaned==true then
|
if spawn_sanitizer.cleaned==true then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local positions1 = minetest.find_nodes_in_area(
|
local positions1 = minetest.find_nodes_in_area(
|
||||||
{x=-20, y=-4, z=-20},
|
{x=-20, y=-4, z=-20},
|
||||||
{x=20, y=1, z=20},
|
{x=20, y=1, z=20},
|
||||||
|
@ -117,23 +117,23 @@ minetest.after(75, function(dtime)
|
||||||
for _, pos in ipairs(positions5) do
|
for _, pos in ipairs(positions5) do
|
||||||
minetest.set_node(pos, {name="default:cobble"})
|
minetest.set_node(pos, {name="default:cobble"})
|
||||||
end
|
end
|
||||||
|
|
||||||
local positions6 = minetest.find_nodes_in_area(
|
local positions6 = minetest.find_nodes_in_area(
|
||||||
{x=-19, y=2, z=-19},
|
{x=-19, y=2, z=-19},
|
||||||
{x=19, y=70, z=19},
|
{x=19, y=70, z=19},
|
||||||
{"default:cobble", "default:stone", "default:water_source", "default:lava_source"})
|
{"default:cobble", "default:water_source", "default:lava_source"})
|
||||||
for _, pos in ipairs(positions6) do
|
for _, pos in ipairs(positions6) do
|
||||||
minetest.set_node(pos, {name="air"})
|
minetest.set_node(pos, {name="air"})
|
||||||
end
|
end
|
||||||
|
|
||||||
local positions7 = minetest.find_nodes_in_area(
|
local positions7 = minetest.find_nodes_in_area(
|
||||||
{x=-50, y=-50, z=-50},
|
{x=-20, y=-50, z=-20},
|
||||||
{x=50, y=50, z=50},
|
{x=20, y=50, z=20},
|
||||||
{"default:furnace"})
|
{"default:furnace"})
|
||||||
for _, pos in ipairs(positions7) do
|
for _, pos in ipairs(positions7) do
|
||||||
minetest.set_node(pos, {name="air"})
|
minetest.set_node(pos, {name="air"})
|
||||||
end
|
end
|
||||||
|
|
||||||
local positions8 = minetest.find_nodes_in_area(
|
local positions8 = minetest.find_nodes_in_area(
|
||||||
{x=-3, y=-3, z=-3},
|
{x=-3, y=-3, z=-3},
|
||||||
{x=3, y=0, z=3},
|
{x=3, y=0, z=3},
|
||||||
|
@ -141,7 +141,7 @@ minetest.after(75, function(dtime)
|
||||||
for _, pos in ipairs(positions8) do
|
for _, pos in ipairs(positions8) do
|
||||||
minetest.set_node(pos, {name="air"})
|
minetest.set_node(pos, {name="air"})
|
||||||
end
|
end
|
||||||
|
|
||||||
local positions9 = minetest.find_nodes_in_area(
|
local positions9 = minetest.find_nodes_in_area(
|
||||||
{x=-2, y=1, z=-2},
|
{x=-2, y=1, z=-2},
|
||||||
{x=2, y=2, z=2},
|
{x=2, y=2, z=2},
|
||||||
|
@ -149,8 +149,104 @@ minetest.after(75, function(dtime)
|
||||||
for _, pos in ipairs(positions9) do
|
for _, pos in ipairs(positions9) do
|
||||||
minetest.set_node(pos, {name="air"})
|
minetest.set_node(pos, {name="air"})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local positions10 = minetest.find_nodes_in_area(
|
||||||
|
{x=-20, y=1, z=-20},
|
||||||
|
{x=20, y=20, z=20},
|
||||||
|
{"default:ice"})
|
||||||
|
for _, pos in ipairs(positions10) do
|
||||||
|
minetest.set_node(pos, {name="air"})
|
||||||
|
end
|
||||||
|
|
||||||
|
local positions11 = minetest.find_nodes_in_area(
|
||||||
|
{x=-18, y=-2, z=-18},
|
||||||
|
{x=18, y=20, z=18},
|
||||||
|
{"default:chest_locked"})
|
||||||
|
for _, pos in ipairs(positions11) do
|
||||||
|
minetest.set_node(pos, {name="air"})
|
||||||
|
end
|
||||||
|
|
||||||
|
local positions12 = minetest.find_nodes_in_area(
|
||||||
|
{x=-20, y=-10, z=-20},
|
||||||
|
{x=20, y=20, z=20},
|
||||||
|
{"default:jungletree"})
|
||||||
|
for _, pos in ipairs(positions12) do
|
||||||
|
minetest.set_node(pos, {name="air"})
|
||||||
|
end
|
||||||
|
|
||||||
|
local positions13 = minetest.find_nodes_in_area(
|
||||||
|
{x=-20, y=-10, z=-20},
|
||||||
|
{x=20, y=20, z=20},
|
||||||
|
{"vendor:vendor"})
|
||||||
|
for _, pos in ipairs(positions13) do
|
||||||
|
minetest.set_node(pos, {name="air"})
|
||||||
|
end
|
||||||
|
|
||||||
|
local positions14 = minetest.find_nodes_in_area(
|
||||||
|
{x=-20, y=-10, z=-20},
|
||||||
|
{x=20, y=20, z=20},
|
||||||
|
{"vendor:depositor"})
|
||||||
|
for _, pos in ipairs(positions14) do
|
||||||
|
minetest.set_node(pos, {name="air"})
|
||||||
|
end
|
||||||
|
|
||||||
|
local positions15 = minetest.find_nodes_in_area(
|
||||||
|
{x=-20, y=-20, z=-20},
|
||||||
|
{x=20, y=20, z=20},
|
||||||
|
{"doors:door_steel_t_1"})
|
||||||
|
for _, pos in ipairs(positions15) do
|
||||||
|
minetest.set_node(pos, {name="air"})
|
||||||
|
end
|
||||||
|
|
||||||
|
local positions16 = minetest.find_nodes_in_area(
|
||||||
|
{x=-20, y=-20, z=-20},
|
||||||
|
{x=20, y=20, z=20},
|
||||||
|
{"doors:door_steel_b_1"})
|
||||||
|
for _, pos in ipairs(positions16) do
|
||||||
|
minetest.set_node(pos, {name="air"})
|
||||||
|
end
|
||||||
|
|
||||||
|
local positions17 = minetest.find_nodes_in_area(
|
||||||
|
{x=-20, y=-20, z=-20},
|
||||||
|
{x=20, y=20, z=20},
|
||||||
|
{"doors:door_steel_t_2"})
|
||||||
|
for _, pos in ipairs(positions17) do
|
||||||
|
minetest.set_node(pos, {name="air"})
|
||||||
|
end
|
||||||
|
|
||||||
|
local positions18 = minetest.find_nodes_in_area(
|
||||||
|
{x=-20, y=-20, z=-20},
|
||||||
|
{x=20, y=20, z=20},
|
||||||
|
{"doors:door_steel_b_2"})
|
||||||
|
for _, pos in ipairs(positions18) do
|
||||||
|
minetest.set_node(pos, {name="air"})
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local positions18 = minetest.find_nodes_in_area(
|
||||||
|
{x=-20, y=1, z=-20},
|
||||||
|
{x=20, y=20, z=20},
|
||||||
|
{"bones:bones"})
|
||||||
|
for _, pos in ipairs(positions18) do
|
||||||
|
minetest.set_node(pos, {name="air"})
|
||||||
|
end
|
||||||
|
|
||||||
|
local positions18 = minetest.find_nodes_in_area(
|
||||||
|
{x=-20, y=1, z=-20},
|
||||||
|
{x=20, y=20, z=20},
|
||||||
|
{"default:gravel"})
|
||||||
|
for _, pos in ipairs(positions18) do
|
||||||
|
minetest.set_node(pos, {name="air"})
|
||||||
|
end
|
||||||
|
|
||||||
|
local positions18 = minetest.find_nodes_in_area(
|
||||||
|
{x=-20, y=1, z=-20},
|
||||||
|
{x=20, y=20, z=20},
|
||||||
|
{"default:sand"})
|
||||||
|
for _, pos in ipairs(positions18) do
|
||||||
|
minetest.set_node(pos, {name="air"})
|
||||||
|
end
|
||||||
|
|
||||||
for z1=-27, -16 do
|
for z1=-27, -16 do
|
||||||
minetest.set_node({x=37, y=2, z=z1}, {name="default:rail"})
|
minetest.set_node({x=37, y=2, z=z1}, {name="default:rail"})
|
||||||
minetest.set_node({x=37, y=1, z=z1}, {name="default:stonebrick"})
|
minetest.set_node({x=37, y=1, z=z1}, {name="default:stonebrick"})
|
||||||
|
@ -200,7 +296,7 @@ local old_node_place = minetest.item_place
|
||||||
function minetest.item_place(itemstack, placer, pointed_thing)
|
function minetest.item_place(itemstack, placer, pointed_thing)
|
||||||
if itemstack:get_definition().type == "node" then
|
if itemstack:get_definition().type == "node" then
|
||||||
local ok=true
|
local ok=true
|
||||||
if itemstack:get_name() == "protector_mese:protect" then
|
if itemstack:get_name() == "protector:protect" then
|
||||||
local pos = pointed_thing.above
|
local pos = pointed_thing.above
|
||||||
if not placer or not placer.get_player_name then return false end
|
if not placer or not placer.get_player_name then return false end
|
||||||
if pos.x>-21 and pos.x<21 and pos.z>-21 and pos.z<21 then
|
if pos.x>-21 and pos.x<21 and pos.z>-21 and pos.z<21 then
|
||||||
|
@ -211,13 +307,13 @@ function minetest.item_place(itemstack, placer, pointed_thing)
|
||||||
ok=false
|
ok=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if ok == true then
|
if ok == true then
|
||||||
return old_node_place(itemstack, placer, pointed_thing)
|
return old_node_place(itemstack, placer, pointed_thing)
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return old_node_place(itemstack, placer, pointed_thing)
|
return old_node_place(itemstack, placer, pointed_thing)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -225,7 +321,7 @@ end
|
||||||
local old_bucket_lava_on_place=minetest.registered_craftitems["bucket:bucket_lava"].on_place
|
local old_bucket_lava_on_place=minetest.registered_craftitems["bucket:bucket_lava"].on_place
|
||||||
minetest.registered_craftitems["bucket:bucket_lava"].on_place=function(itemstack, placer, pointed_thing)
|
minetest.registered_craftitems["bucket:bucket_lava"].on_place=function(itemstack, placer, pointed_thing)
|
||||||
local pos = pointed_thing.above
|
local pos = pointed_thing.above
|
||||||
if pos.x>-35 and pos.x<35 and pos.y>16 and pos.z>-35 and pos.z<35 then
|
if pos.x>-35 and pos.x<35 and pos.y>56 and pos.z>-35 and pos.z<35 then
|
||||||
minetest.log("action", "Player warned for placing lava!")
|
minetest.log("action", "Player warned for placing lava!")
|
||||||
minetest.set_node({x=pos.x, y=pos.y-1, z=pos.z}, {name="tnt:tnt_burning"})
|
minetest.set_node({x=pos.x, y=pos.y-1, z=pos.z}, {name="tnt:tnt_burning"})
|
||||||
boom({x=pos.x, y=pos.y-1, z=pos.z}, math.random(1, 3))
|
boom({x=pos.x, y=pos.y-1, z=pos.z}, math.random(1, 3))
|
||||||
|
|
Loading…
Reference in New Issue