mirror of
https://github.com/joe7575/techpack.git
synced 2024-12-25 15:14:31 +01:00
Invisible Lamp added
This commit is contained in:
parent
bcd5e363f7
commit
5528fd9ea3
@ -21,6 +21,9 @@ end
|
||||
local function switch_off(pos, node)
|
||||
node.name = "tubelib_addons2:ceilinglamp"
|
||||
minetest.swap_node(pos, node)
|
||||
local pos1 = {x=pos.x-5, y=pos.y-5, z=pos.z-5}
|
||||
local pos2 = {x=pos.x+5, y=pos.y+5, z=pos.z+5}
|
||||
minetest.fix_light(pos1, pos2)
|
||||
end
|
||||
|
||||
minetest.register_node("tubelib_addons2:ceilinglamp", {
|
||||
@ -108,7 +111,7 @@ minetest.register_node("tubelib_addons2:ceilinglamp_on", {
|
||||
paramtype2 = "wallmounted",
|
||||
groups = {crumbly=0, not_in_creative_inventory=1},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
@ -19,6 +19,8 @@ dofile(minetest.get_modpath("tubelib_addons2") .. "/programmer.lua")
|
||||
dofile(minetest.get_modpath("tubelib_addons2") .. "/accesscontrol.lua")
|
||||
dofile(minetest.get_modpath("tubelib_addons2") .. "/streetlamp.lua")
|
||||
dofile(minetest.get_modpath("tubelib_addons2") .. "/ceilinglamp.lua")
|
||||
dofile(minetest.get_modpath("tubelib_addons2") .. "/invisiblelamp.lua")
|
||||
|
||||
if minetest.get_modpath("mesecons") and mesecon then
|
||||
dofile(minetest.get_modpath("tubelib_addons2") .. "/mesecons_converter.lua")
|
||||
end
|
||||
|
103
tubelib_addons2/invisiblelamp.lua
Normal file
103
tubelib_addons2/invisiblelamp.lua
Normal file
@ -0,0 +1,103 @@
|
||||
--[[
|
||||
|
||||
Tubelib Addons 2
|
||||
================
|
||||
|
||||
Copyright (C) 2017-2018 Joachim Stolberg
|
||||
|
||||
LGPLv2.1+
|
||||
See LICENSE.txt for more information
|
||||
|
||||
invisiblelamp.lua:
|
||||
|
||||
]]--
|
||||
|
||||
|
||||
local function switch_on(pos, node)
|
||||
node.name = "tubelib_addons2:invisiblelamp_on"
|
||||
minetest.swap_node(pos, node)
|
||||
end
|
||||
|
||||
local function switch_off(pos, node)
|
||||
node.name = "tubelib_addons2:invisiblelamp"
|
||||
minetest.swap_node(pos, node)
|
||||
local pos1 = {x=pos.x-5, y=pos.y-5, z=pos.z-5}
|
||||
local pos2 = {x=pos.x+5, y=pos.y+5, z=pos.z+5}
|
||||
minetest.fix_light(pos1, pos2)
|
||||
end
|
||||
|
||||
minetest.register_node("tubelib_addons2:invisiblelamp", {
|
||||
description = "Tubelib Invisible Lamp",
|
||||
drawtype = "glasslike_framed_optional",
|
||||
tiles = {"tubelib_addons2_invisiblelamp.png"},
|
||||
inventory_image = 'tubelib_addons2_invisiblelamp_inventory.png',
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local number = tubelib.add_node(pos, "tubelib_addons2:invisiblelamp")
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Tubelib Invisible Lamp "..number)
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
if not minetest.is_protected(pos, clicker:get_player_name()) then
|
||||
switch_on(pos, node)
|
||||
end
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos)
|
||||
tubelib.remove_node(pos)
|
||||
end,
|
||||
|
||||
paramtype = "light",
|
||||
light_source = 0,
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 3, oddly_breakable_by_hand = 3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("tubelib_addons2:invisiblelamp_on", {
|
||||
description = "Tubelib Invisible Lamp",
|
||||
drawtype = "glasslike_framed_optional",
|
||||
tiles = {"tubelib_addons2_invisiblelamp.png"},
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
if not minetest.is_protected(pos, clicker:get_player_name()) then
|
||||
switch_off(pos, node)
|
||||
end
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos)
|
||||
tubelib.remove_node(pos)
|
||||
end,
|
||||
|
||||
paramtype = "light",
|
||||
light_source = minetest.LIGHT_MAX,
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
is_ground_content = false,
|
||||
drop = "tubelib_addons2:invisiblelamp",
|
||||
groups = {cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "tubelib_addons2:invisiblelamp 2",
|
||||
recipe = {
|
||||
{"", "default:torch", ""},
|
||||
{"default:torch", "tubelib:wlanchip", "default:torch"},
|
||||
{"", "default:torch", ""},
|
||||
}
|
||||
})
|
||||
|
||||
tubelib.register_node("tubelib_addons2:invisiblelamp", {"tubelib_addons2:invisiblelamp_on"}, {
|
||||
on_recv_message = function(pos, topic, payload)
|
||||
local node = minetest.get_node(pos)
|
||||
if topic == "on" then
|
||||
switch_on(pos, node)
|
||||
elseif topic == "off" then
|
||||
switch_off(pos, node)
|
||||
end
|
||||
end,
|
||||
})
|
Loading…
Reference in New Issue
Block a user