mirror of
https://cheapiesystems.com/git/digistuff
synced 2024-11-28 10:03:49 +01:00
Add dimmable lamp and junction box
This commit is contained in:
parent
bc19da21d3
commit
ff236643af
@ -1,2 +1,3 @@
|
|||||||
|
default?
|
||||||
digilines
|
digilines
|
||||||
mesecons?
|
mesecons?
|
||||||
|
125
init.lua
125
init.lua
@ -360,7 +360,7 @@ minetest.register_node("digistuff:digimese", {
|
|||||||
light_source = 3,
|
light_source = 3,
|
||||||
groups = {cracky = 3, level = 2},
|
groups = {cracky = 3, level = 2},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default and default.node_sound_stone_defaults(),
|
||||||
digiline = { wire = { rules = {
|
digiline = { wire = { rules = {
|
||||||
{x = 1, y = 0, z = 0},
|
{x = 1, y = 0, z = 0},
|
||||||
{x =-1, y = 0, z = 0},
|
{x =-1, y = 0, z = 0},
|
||||||
@ -417,7 +417,7 @@ minetest.register_node("digistuff:button", {
|
|||||||
minetest.chat_send_player(sender:get_player_name(),"Channel and message must both be set!")
|
minetest.chat_send_player(sender:get_player_name(),"Channel and message must both be set!")
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default and default.node_sound_stone_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("digistuff:button_off", {
|
minetest.register_node("digistuff:button_off", {
|
||||||
@ -460,7 +460,7 @@ minetest.register_node("digistuff:button_off", {
|
|||||||
if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_push", {pos=pos}) end
|
if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_push", {pos=pos}) end
|
||||||
minetest.after(0.5, digistuff.button_turnoff, pos)
|
minetest.after(0.5, digistuff.button_turnoff, pos)
|
||||||
end,
|
end,
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default and default.node_sound_stone_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("digistuff:button_on", {
|
minetest.register_node("digistuff:button_on", {
|
||||||
@ -477,7 +477,7 @@ minetest.register_node("digistuff:button_on", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
legacy_wallmounted = true,
|
legacy_wallmounted = true,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
light_source = default.LIGHT_MAX-7,
|
light_source = 7,
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
@ -502,7 +502,7 @@ minetest.register_node("digistuff:button_on", {
|
|||||||
if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_push", {pos=pos}) end
|
if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_push", {pos=pos}) end
|
||||||
end,
|
end,
|
||||||
description = "Digilines Button (on state - you hacker you!)",
|
description = "Digilines Button (on state - you hacker you!)",
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default and default.node_sound_stone_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
@ -553,7 +553,7 @@ minetest.register_node("digistuff:detector", {
|
|||||||
if fields.msg then meta:set_string("msg",fields.msg) end
|
if fields.msg then meta:set_string("msg",fields.msg) end
|
||||||
if fields.radius then meta:set_string("radius",fields.radius) end
|
if fields.radius then meta:set_string("radius",fields.radius) end
|
||||||
end,
|
end,
|
||||||
sounds = default.node_sound_stone_defaults()
|
sounds = default and default.node_sound_stone_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
@ -877,7 +877,7 @@ minetest.register_node("digistuff:camera", {
|
|||||||
if fields.distance and tonumber(fields.distance) then meta:set_int("distance",math.max(math.min(20,fields.distance),0)) end
|
if fields.distance and tonumber(fields.distance) then meta:set_int("distance",math.max(math.min(20,fields.distance),0)) end
|
||||||
if fields.radius and tonumber(fields.radius) then meta:set_int("radius",math.max(math.min(10,fields.radius),1)) end
|
if fields.radius and tonumber(fields.radius) then meta:set_int("radius",math.max(math.min(10,fields.radius),1)) end
|
||||||
end,
|
end,
|
||||||
sounds = default.node_sound_stone_defaults()
|
sounds = default and default.node_sound_stone_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
@ -989,3 +989,114 @@ if minetest.get_modpath("mesecons_noteblock") then
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for i=0,14,1 do
|
||||||
|
local mult = 255 - ((14-i)*16)
|
||||||
|
minetest.register_node("digistuff:light_"..i, {
|
||||||
|
drop = "digistuff:light_0",
|
||||||
|
description = "Digilines Dimmable Light"..(i > 0 and " (on state - you hacker you!)" or ""),
|
||||||
|
tiles = {"digistuff_light.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.25,0.4,-0.25,0.25,0.5,0.25},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
groups = i > 0 and {cracky = 1, not_in_creative_inventory = 1} or {cracky = 1},
|
||||||
|
is_ground_content = false,
|
||||||
|
light_source = i,
|
||||||
|
color = {r = mult,g = mult,b = mult},
|
||||||
|
sounds = default and default.node_sound_glass_defaults(),
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("formspec","field[channel;Channel;${channel}")
|
||||||
|
end,
|
||||||
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
|
local name = sender:get_player_name()
|
||||||
|
if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
|
||||||
|
minetest.record_protection_violation(pos,name)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
if fields.channel then meta:set_string("channel",fields.channel) end
|
||||||
|
end,
|
||||||
|
digiline = {
|
||||||
|
receptor = {},
|
||||||
|
wire = {
|
||||||
|
rules = {
|
||||||
|
{x = 1,y = 0,z = 0},
|
||||||
|
{x = -1,y = 0,z = 0},
|
||||||
|
{x = 0,y = 0,z = 1},
|
||||||
|
{x = 0,y = 0,z = -1},
|
||||||
|
{x = 0,y = 1,z = 0},
|
||||||
|
{x = 0,y = -1,z = 0},
|
||||||
|
{x = 0,y = 2,z = 0},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
effector = {
|
||||||
|
action = function(pos,node,channel,msg)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
if meta:get_string("channel") ~= channel then return end
|
||||||
|
if type(msg) ~= "number" or msg > 14 or msg < 0 then return end
|
||||||
|
node.name = "digistuff:light_"..math.floor(msg)
|
||||||
|
minetest.swap_node(pos,node)
|
||||||
|
end
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("digistuff:junctionbox", {
|
||||||
|
description = "Digilines Junction Box",
|
||||||
|
tiles = {"digistuff_junctionbox.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky = 3},
|
||||||
|
is_ground_content = false,
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.1,-0.15,0.35,0.1,0.15,0.5},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sounds = default and default.node_sound_stone_defaults(),
|
||||||
|
digiline = {
|
||||||
|
receptor = {},
|
||||||
|
wire = {
|
||||||
|
rules = {
|
||||||
|
{x = 1,y = 0,z = 0},
|
||||||
|
{x = -1,y = 0,z = 0},
|
||||||
|
{x = 0,y = 0,z = 1},
|
||||||
|
{x = 0,y = 0,z = -1},
|
||||||
|
{x = 0,y = 1,z = 0},
|
||||||
|
{x = 0,y = -1,z = 0},
|
||||||
|
{x = 0,y = -2,z = 0},
|
||||||
|
{x = 0,y = 2,z = 0},
|
||||||
|
{x = -2,y = 0,z = 0},
|
||||||
|
{x = 2,y = 0,z = 0},
|
||||||
|
{x = 0,y = 0,z = -2},
|
||||||
|
{x = 0,y = 0,z = 2},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "digistuff:light_0",
|
||||||
|
recipe = {
|
||||||
|
{"digilines:wire_std_00000000","mesecons_lamp:lamp_off",},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "digistuff:junctionbox",
|
||||||
|
recipe = {
|
||||||
|
{"homedecor:plastic_sheeting","digilines:wire_std_00000000","homedecor:plastic_sheeting",},
|
||||||
|
{"digilines:wire_std_00000000","digilines:wire_std_00000000","digilines:wire_std_00000000",},
|
||||||
|
{"homedecor:plastic_sheeting","digilines:wire_std_00000000","homedecor:plastic_sheeting",},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
BIN
textures/digistuff_junctionbox.png
Normal file
BIN
textures/digistuff_junctionbox.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
BIN
textures/digistuff_light.png
Normal file
BIN
textures/digistuff_light.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 181 B |
Loading…
Reference in New Issue
Block a user