forked from Mirrorlandia_minetest/digistuff
Finish the wall knob
This commit is contained in:
parent
d773a87c6a
commit
855c1b219d
@ -5,7 +5,8 @@ digistuff.remove_receiver = function(pos,node)
|
|||||||
if rnode.name == "digistuff:receiver" then
|
if rnode.name == "digistuff:receiver" then
|
||||||
rnode.name = "digilines:wire_std_00000000"
|
rnode.name = "digilines:wire_std_00000000"
|
||||||
minetest.remove_node(rpos)
|
minetest.remove_node(rpos)
|
||||||
minetest.place_node(rpos,rnode)
|
minetest.set_node(rpos,rnode)
|
||||||
|
digilines.update_autoconnect(rpos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
1043
models/digistuff_wall_knob.obj
Normal file
1043
models/digistuff_wall_knob.obj
Normal file
File diff suppressed because it is too large
Load Diff
42
switches.lua
42
switches.lua
@ -181,9 +181,6 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("digistuff:wall_knob", {
|
minetest.register_node("digistuff:wall_knob", {
|
||||||
tiles = {
|
|
||||||
"digistuff_digibutton_sides.png",
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
@ -195,10 +192,17 @@ minetest.register_node("digistuff:wall_knob", {
|
|||||||
rules = digistuff.button_get_rules,
|
rules = digistuff.button_get_rules,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
drawtype = "nodebox",
|
drawtype = "mesh",
|
||||||
node_box = {
|
mesh = "digistuff_wall_knob.obj",
|
||||||
|
tiles = {
|
||||||
|
"digistuff_digibutton_sides.png",
|
||||||
|
"digistuff_digiline_full.png",
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.2,-0.2,0.4,0.2,0.2,0.5,},
|
fixed = {
|
||||||
|
{-0.4,-0.4,0,0.4,0.4,0.5},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
groups = {dig_immediate = 2,digiline_receiver = 1,},
|
groups = {dig_immediate = 2,digiline_receiver = 1,},
|
||||||
description = "Digilines Wall Knob",
|
description = "Digilines Wall Knob",
|
||||||
@ -232,9 +236,6 @@ minetest.register_node("digistuff:wall_knob", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("digistuff:wall_knob_configured", {
|
minetest.register_node("digistuff:wall_knob_configured", {
|
||||||
tiles = {
|
|
||||||
"digistuff_digibutton_sides.png",
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
@ -246,30 +247,39 @@ minetest.register_node("digistuff:wall_knob_configured", {
|
|||||||
rules = digistuff.button_get_rules,
|
rules = digistuff.button_get_rules,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
drawtype = "nodebox",
|
drawtype = "mesh",
|
||||||
node_box = {
|
mesh = "digistuff_wall_knob.obj",
|
||||||
|
tiles = {
|
||||||
|
"digistuff_digibutton_sides.png",
|
||||||
|
"digistuff_digiline_full.png",
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.2,-0.2,0.4,0.2,0.2,0.5,},
|
fixed = {
|
||||||
|
{-0.4,-0.4,0,0.4,0.4,0.5},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
groups = {dig_immediate = 2,digiline_receiver = 1,not_in_creative_inventory = 1,},
|
groups = {dig_immediate = 2,digiline_receiver = 1,not_in_creative_inventory = 1,},
|
||||||
description = "Digilines Wall Knob (configured state - you hacker you!)",
|
description = "Digilines Wall Knob (configured state - you hacker you!)",
|
||||||
drop = "digistuff:wall_knob",
|
drop = "digistuff:wall_knob",
|
||||||
after_place_node = digistuff.place_receiver,
|
after_place_node = digistuff.place_receiver,
|
||||||
after_destruct = digistuff.remove_receiver,
|
after_destruct = digistuff.remove_receiver,
|
||||||
on_punch = function(pos,node)
|
on_punch = function(pos,node,player)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local max = meta:get_int("max")
|
local max = meta:get_int("max")
|
||||||
local value = meta:get_int("value")
|
local value = meta:get_int("value")
|
||||||
value = math.min(max,value+1)
|
local full = player:get_player_control().aux1
|
||||||
|
value = full and max or math.min(max,value+1)
|
||||||
meta:set_int("value",value)
|
meta:set_int("value",value)
|
||||||
meta:set_string("infotext",string.format("Current setting: %d\nLeft-click to turn up or right-click to turn down",math.floor(tonumber(value))))
|
meta:set_string("infotext",string.format("Current setting: %d\nLeft-click to turn up or right-click to turn down",math.floor(tonumber(value))))
|
||||||
digiline:receptor_send(pos,digistuff.button_get_rules(node),meta:get_string("channel"),value)
|
digiline:receptor_send(pos,digistuff.button_get_rules(node),meta:get_string("channel"),value)
|
||||||
end,
|
end,
|
||||||
on_rightclick = function(pos,node)
|
on_rightclick = function(pos,node,player)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local min = meta:get_int("min")
|
local min = meta:get_int("min")
|
||||||
local value = meta:get_int("value")
|
local value = meta:get_int("value")
|
||||||
value = math.max(min,value-1)
|
local full = player:get_player_control().aux1
|
||||||
|
value = full and min or math.max(min,value-1)
|
||||||
meta:set_int("value",value)
|
meta:set_int("value",value)
|
||||||
meta:set_string("infotext",string.format("Current setting: %d\nLeft-click to turn up or right-click to turn down",math.floor(tonumber(value))))
|
meta:set_string("infotext",string.format("Current setting: %d\nLeft-click to turn up or right-click to turn down",math.floor(tonumber(value))))
|
||||||
digiline:receptor_send(pos,digistuff.button_get_rules(node),meta:get_string("channel"),value)
|
digiline:receptor_send(pos,digistuff.button_get_rules(node),meta:get_string("channel"),value)
|
||||||
|
Loading…
Reference in New Issue
Block a user