Created
October 11, 2012 01:01
-
-
Save cornernote/3869515 to your computer and use it in GitHub Desktop.
xray test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
--Xray mod by InfinityProject | |
--Please read the README.txt file | |
-- | |
--This is a test version | |
minetest.register_privilege("xray", { | |
description = "Can use the xray command", | |
give_to_singleplayer = false, | |
}) | |
local function xray(mode) | |
XRAY_MODE = mode | |
end | |
minetest.register_chatcommand("xray", { | |
params = "<mode>", | |
description = "Make stone invisible.", | |
privs = {xray=true}, | |
func = function(name, param) | |
if param == 'on' then | |
xray("on") | |
minetest.chat_send_player(name, "Xray turned on.") | |
elseif param == 'off' then | |
xray("off") | |
minetest.chat_send_player(name, "Xray turned off.") | |
else | |
minetest.chat_send_player(name, "Please enter 'on' or 'off'.") | |
end | |
end, | |
}) | |
minetest.register_abm({ | |
nodenames = {"default:stone", "xray:stone", "default:gravel", "xray:gravel"}, | |
interval = 1, | |
chance = 1, | |
action = function(pos, node, active_object_count, active_object_count_wider) | |
if XRAY_MODE == "on" then | |
if node.name == "default:stone" then | |
print("convert default:stone to xray:stone") | |
minetest.env:add_node(pos,{name="xray:stone"}) | |
elseif node.name == "default:gravel" then | |
print("convert default:gravel to xray:gravel") | |
minetest.env:add_node(pos,{name="xray:gravel"}) | |
end | |
else | |
if node.name == "xray:stone" then | |
print("convert xray:stone to default:stone") | |
minetest.env:add_node(pos,{name="default:stone"}) | |
elseif node.name == "xray:gravel" then | |
print("convert xray:gravel to default:gravel") | |
minetest.env:add_node(pos,{name="default:gravel"}) | |
end | |
end | |
end | |
}) | |
minetest.register_node("xray:stone", { | |
drawtype = 'airlike', | |
description = "Xray Stone", | |
tiles = {"invisible_texture.png"}, | |
is_ground_content = true, | |
groups = {cracky=3,not_in_creative_inventory=1}, | |
drop = 'default:cobble', | |
legacy_mineral = true, | |
sounds = default.node_sound_stone_defaults(), | |
}) | |
minetest.register_node("xray:gravel", { | |
drawtype = 'airlike', | |
description = "Xray Gravel", | |
tiles = {"invisible_texture.png"}, | |
is_ground_content = true, | |
groups = {crumbly=2,falling_node=1,not_in_creative_inventory=1}, | |
sounds = default.node_sound_dirt_defaults({ | |
footstep = {name="default_gravel_footstep", gain=0.45}, | |
}), | |
}) | |
print("Xray Mod Loaded!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment