signal lamp added
This commit is contained in:
parent
b2ff68fe8c
commit
1a2888d9b6
1
init.lua
1
init.lua
@ -155,6 +155,7 @@ else
|
|||||||
dofile(MP.."/logic/detector.lua")
|
dofile(MP.."/logic/detector.lua")
|
||||||
dofile(MP.."/logic/repeater.lua")
|
dofile(MP.."/logic/repeater.lua")
|
||||||
dofile(MP.."/logic/programmer.lua")
|
dofile(MP.."/logic/programmer.lua")
|
||||||
|
dofile(MP.."/logic/signallamp.lua")
|
||||||
|
|
||||||
-- Test
|
-- Test
|
||||||
dofile(MP.."/recipe_checker.lua")
|
dofile(MP.."/recipe_checker.lua")
|
||||||
|
@ -94,8 +94,8 @@ minetest.register_craft({
|
|||||||
output = "techage:programmer",
|
output = "techage:programmer",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"", "default:steel_ingot", ""},
|
{"", "default:steel_ingot", ""},
|
||||||
{"", "techage:wlanchip", ""},
|
{"", "techage:ta4_wlanchip", ""},
|
||||||
{"", "dye:red", ""},
|
{"", "dye:red", ""},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
133
logic/signallamp.lua
Normal file
133
logic/signallamp.lua
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
TechAge
|
||||||
|
=======
|
||||||
|
|
||||||
|
Copyright (C) 2019 Joachim Stolberg
|
||||||
|
|
||||||
|
GPL v3
|
||||||
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
|
Colored Signal Lamp (requires unifieddyes)
|
||||||
|
|
||||||
|
]]--
|
||||||
|
|
||||||
|
-- for lazy programmers
|
||||||
|
local M = minetest.get_meta
|
||||||
|
local S = techage.S
|
||||||
|
|
||||||
|
local logic = techage.logic
|
||||||
|
|
||||||
|
local COLORED = minetest.get_modpath("unifieddyes") and unifieddyes
|
||||||
|
|
||||||
|
|
||||||
|
local function switch_on(pos, node)
|
||||||
|
node.name = "techage:signal_lamp_on"
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function switch_off(pos, node)
|
||||||
|
node.name = "techage:signal_lamp_off"
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("techage:signal_lamp_off", {
|
||||||
|
description = S("Techage Signal Lamp (can be colored)"),
|
||||||
|
tiles = {"techage_signal_lamp.png^[colorize:#000000:100"},
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-6/16, -6/16, -6/16, 6/16, 6/16, 6/16},
|
||||||
|
{-4/16, -10/16, -4/16, 4/16, -6/16, 4/16},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
|
logic.after_place_node(pos, placer, "techage:signal_lamp_off", S("Techage Signal Lamp"))
|
||||||
|
logic.infotext(M(pos), S("Techage Signal Lamp"))
|
||||||
|
if COLORED then
|
||||||
|
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_rightclick = switch_on,
|
||||||
|
|
||||||
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
|
techage.remove_node(pos)
|
||||||
|
if COLORED then
|
||||||
|
unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_construct = COLORED and unifieddyes.on_construct,
|
||||||
|
on_dig = COLORED and unifieddyes.on_dig,
|
||||||
|
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "color",
|
||||||
|
palette = "unifieddyes_palette_extended.png",
|
||||||
|
place_param2 = 241,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
groups = {choppy=2, cracky=1, ud_param2_colorable = 1},
|
||||||
|
is_ground_content = false,
|
||||||
|
drop = "techage:signal_lamp_off"
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("techage:signal_lamp_on", {
|
||||||
|
description = S("Techage Signal Lamp"),
|
||||||
|
tiles = {"techage_signal_lamp.png"},
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-6/16, -6/16, -6/16, 6/16, 6/16, 6/16},
|
||||||
|
{-4/16, -10/16, -4/16, 4/16, -6/16, 4/16},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
on_rightclick = switch_off,
|
||||||
|
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "color",
|
||||||
|
palette = "unifieddyes_palette_extended.png",
|
||||||
|
groups = {choppy=2, cracky=1, not_in_creative_inventory=1, ud_param2_colorable = 1},
|
||||||
|
|
||||||
|
on_construct = COLORED and unifieddyes.on_construct,
|
||||||
|
after_place_node = COLORED and unifieddyes.recolor_on_place,
|
||||||
|
|
||||||
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
|
techage.remove_node(pos)
|
||||||
|
if COLORED then
|
||||||
|
unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_dig = COLORED and unifieddyes.on_dig,
|
||||||
|
light_source = 10,
|
||||||
|
is_ground_content = false,
|
||||||
|
drop = "techage:signal_lamp_off"
|
||||||
|
})
|
||||||
|
|
||||||
|
techage.register_node({"techage:signal_lamp_off", "techage:signal_lamp_on"}, {
|
||||||
|
on_recv_message = function(pos, topic, payload)
|
||||||
|
print("on_recv_message", topic)
|
||||||
|
if topic == "on" then
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
switch_on(pos, node)
|
||||||
|
elseif topic == "off" then
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
switch_off(pos, node)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techage:signal_lamp_off",
|
||||||
|
recipe = {
|
||||||
|
{"", "wool:white", ""},
|
||||||
|
{"", "default:torch", ""},
|
||||||
|
{"", "techage:vacuum_tube", ""},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
BIN
textures/techage_signal_lamp.png
Normal file
BIN
textures/techage_signal_lamp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 264 B |
Loading…
x
Reference in New Issue
Block a user