Calinou wrote:Suggestions:
- require "xray" privilege
- make stone transform into a pointable, waklable node with "airlike" drawtype
- make /xray a toggle command for simplicity's sake, if possible?
minetest.register_abm({
nodenames = {"default:stone", "xray:stone"},
interval = 0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
if XRAY_MODE == 1 then
if node.name == "default:stone" then
minetest.env:add_node(pos,{name="xray:stone"})
end
end
end
end
})
minetest.register_abm({
nodenames = {"xray:stone", "default:stone"},
interval = 0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
if XRAY_MODE == 2 then
if node.name == "xray:stone" then
minetest.env:add_node(pos,{name="default:stone"})
end
end
end
end
})
minetest.register_abm({
nodenames = {"default:stone"},
interval = 0,
chance = 1,
action = function(pos, node)
if XRAY_MODE == 1 then
if node.name == "default:stone" then
print("turning default:stone to xray:stone at "..dump(pos))
minetest.env:add_node(pos,{name="xray:stone"})
end
end
end
})
minetest.register_abm({
nodenames = {"xray:stone"},
interval = 0,
chance = 1,
action = function(pos, node)
if XRAY_MODE == 2 then
if node.name == "xray:stone" then
print("turning xray:stone to default:stone at "..dump(pos))
minetest.env:add_node(pos,{name="default:stone"})
end
end
end
})
minetest.register_abm({
nodenames = {"default:stone", "xray:stone"},
interval = 0,
chance = 4,
action = function(pos, node, active_object_count, active_object_count_wider)
if XRAY_MODE == 1 then --<< means it should only do this...
if node.name == "default:stone" then
minetest.env:add_node(pos,{name="xray:stone"})
elseif XRAY_MODE == 2 then --<< OR this
if node.name == "xray:stone" then
minetest.env:add_node(pos,{name="xray:stone"})
end
end
end
end
})
MasterGollum wrote:I was developing a stone layer generator and this mod was just cool to find the layers I was creating, but it didn't work fine to me. Even if the stones are transparent, many nodes are not visible until the invisible stone is removed. When I turned the xray off the invisible stones, kept being invisibles, so I messed up a huge area of my map :) luckily it was a world I was using for test purposes ;)
cornernote wrote:My version fixes that:
https://github.com/cornernote/minetest-xray
Try that until InfinityProject releases his next version.
irksomeduck wrote:Doesn't work... I mean it runs and loads it, understands the commands, but just doesn't work. Nothing goes invisible.
if
XRAY_MODE == off
then
xray(on) == nil
end
if
XRAY_MODE == on
then
xray(off) == nil
end
if
XRAY_MODE == off
then
xray(on) = nil
InfinityProject wrote:Can someone help?
I keep getting "unexpected symbol near ==" at the xray(on) == nilYour phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
if
XRAY_MODE == off
then
xray(on) == nil
end
if
XRAY_MODE == on
then
xray(off) == nil
end
Calinou wrote:Some suggestion: hide some more common blocks: dirt, grass, leaves (but not trees), sand (and desert sand/stone) and gravel (set them to an invisible node different than invisible stone, and it should revert just fine, make the invisible gravel fall). :)
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 = 0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
if XRAY_MODE == on and XRAY_ON ~= nil then
if node.name == "default:stone" then
minetest.env:add_node(pos,{name="xray:stone"})
elseif node.name == "default:gravel" then
minetest.env:add_node(pos,{name="xray:gravel"})
elseif XRAY_MODE == off and XRAY_OFF ~= nil then
if node.name == "xray:stone" then
minetest.env:add_node(pos,{name="default:stone"})
elseif node.name == "xray:gravel" then
minetest.env:add_node(pos,{name="default:gravel"})
end
end
end
end
})
Users browsing this forum: No registered users and 50 guests