A simple fix for Andrey to keep spawn cleaner.

master
maikerumine 2015-11-13 19:57:50 -05:00
parent 87f36b6a66
commit 4f232c63d4
2 changed files with 117 additions and 21 deletions

View File

@ -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

106
init.lua
View File

@ -121,14 +121,14 @@ minetest.after(75, function(dtime)
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"})
@ -150,6 +150,102 @@ minetest.after(75, function(dtime)
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"})
@ -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
@ -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))