Improve player detector wrench menu
This commit is contained in:
parent
ac01df763d
commit
4cb7ffe718
@ -128,9 +128,15 @@ TA4 Button/Switch=TA4 Schalter/Taster
|
|||||||
|
|
||||||
Access=Zugriff
|
Access=Zugriff
|
||||||
Button protection=Tastenschutz
|
Button protection=Tastenschutz
|
||||||
|
Type=Typ
|
||||||
|
|
||||||
|
### button.lua ###
|
||||||
|
### button_2x.lua ###
|
||||||
|
### button_4x.lua ###
|
||||||
|
### player_detector.lua ###
|
||||||
|
|
||||||
Command=Kommando
|
Command=Kommando
|
||||||
Number=Nummer
|
Number=Nummer
|
||||||
Type=Typ
|
|
||||||
|
|
||||||
### button.lua ###
|
### button.lua ###
|
||||||
### cart_detector.lua ###
|
### cart_detector.lua ###
|
||||||
@ -163,10 +169,15 @@ TA4 2x Button=TA4 2x Taster
|
|||||||
### button_4x.lua ###
|
### button_4x.lua ###
|
||||||
|
|
||||||
Command to be sent (ignored for switches)=Zu sendender Befehl (wird für Schalter ignoriert)
|
Command to be sent (ignored for switches)=Zu sendender Befehl (wird für Schalter ignoriert)
|
||||||
Destination block number=Zielblocknummer
|
|
||||||
Label for the button=Beschriftung für die Taste
|
Label for the button=Beschriftung für die Taste
|
||||||
Momentary button or on/off switch=Taster oder Ein-/Ausschalter
|
Momentary button or on/off switch=Taster oder Ein-/Ausschalter
|
||||||
|
|
||||||
|
### button_2x.lua ###
|
||||||
|
### button_4x.lua ###
|
||||||
|
### player_detector.lua ###
|
||||||
|
|
||||||
|
Destination block number=Zielblocknummer
|
||||||
|
|
||||||
### button_2x.lua ###
|
### button_2x.lua ###
|
||||||
### button_4x.lua ###
|
### button_4x.lua ###
|
||||||
### signallamp_2x.lua ###
|
### signallamp_2x.lua ###
|
||||||
@ -961,6 +972,8 @@ Plastic Granules=Plastikgranulat
|
|||||||
|
|
||||||
### player_detector.lua ###
|
### player_detector.lua ###
|
||||||
|
|
||||||
|
Command to send when player is detected=Befehl zum Senden, wenn ein Spieler erkannt wird
|
||||||
|
Command to send when player moves away=Befehl zum Senden, wenn sich der Spieler wegbewegt
|
||||||
Radius=Radius
|
Radius=Radius
|
||||||
Search radius=Suchradius
|
Search radius=Suchradius
|
||||||
TA4 Player Detector=TA4 Spieler Detektor
|
TA4 Player Detector=TA4 Spieler Detektor
|
||||||
|
@ -128,9 +128,15 @@ TA4 Button/Switch=
|
|||||||
|
|
||||||
Access=
|
Access=
|
||||||
Button protection=
|
Button protection=
|
||||||
|
Type=
|
||||||
|
|
||||||
|
### button.lua ###
|
||||||
|
### button_2x.lua ###
|
||||||
|
### button_4x.lua ###
|
||||||
|
### player_detector.lua ###
|
||||||
|
|
||||||
Command=
|
Command=
|
||||||
Number=
|
Number=
|
||||||
Type=
|
|
||||||
|
|
||||||
### button.lua ###
|
### button.lua ###
|
||||||
### cart_detector.lua ###
|
### cart_detector.lua ###
|
||||||
@ -163,10 +169,15 @@ TA4 2x Button=
|
|||||||
### button_4x.lua ###
|
### button_4x.lua ###
|
||||||
|
|
||||||
Command to be sent (ignored for switches)=
|
Command to be sent (ignored for switches)=
|
||||||
Destination block number=
|
|
||||||
Label for the button=
|
Label for the button=
|
||||||
Momentary button or on/off switch=
|
Momentary button or on/off switch=
|
||||||
|
|
||||||
|
### button_2x.lua ###
|
||||||
|
### button_4x.lua ###
|
||||||
|
### player_detector.lua ###
|
||||||
|
|
||||||
|
Destination block number=
|
||||||
|
|
||||||
### button_2x.lua ###
|
### button_2x.lua ###
|
||||||
### button_4x.lua ###
|
### button_4x.lua ###
|
||||||
### signallamp_2x.lua ###
|
### signallamp_2x.lua ###
|
||||||
@ -961,6 +972,8 @@ Plastic Granules=
|
|||||||
|
|
||||||
### player_detector.lua ###
|
### player_detector.lua ###
|
||||||
|
|
||||||
|
Command to send when player is detected=
|
||||||
|
Command to send when player moves away=
|
||||||
Radius=
|
Radius=
|
||||||
Search radius=
|
Search radius=
|
||||||
TA4 Player Detector=
|
TA4 Player Detector=
|
||||||
|
@ -68,10 +68,7 @@ local function switch_on(pos)
|
|||||||
elseif name == "techage:ta4_button_off" then
|
elseif name == "techage:ta4_button_off" then
|
||||||
logic.swap_node(pos, "techage:ta4_button_on")
|
logic.swap_node(pos, "techage:ta4_button_on")
|
||||||
end
|
end
|
||||||
local meta = M(pos)
|
logic.send_cmnd(pos, "command", "on", cycle_time)
|
||||||
local s = meta:contains("command") and meta:get_string("command") or "on"
|
|
||||||
local command, payload = unpack(string.split(s, " ", false, 1))
|
|
||||||
logic.send_cmnd(pos, M(pos), command, payload, cycle_time)
|
|
||||||
minetest.sound_play("techage_button", {
|
minetest.sound_play("techage_button", {
|
||||||
pos = pos,
|
pos = pos,
|
||||||
gain = 0.5,
|
gain = 0.5,
|
||||||
|
@ -67,13 +67,16 @@ function techage.logic.send_on(pos, meta, time)
|
|||||||
return own_num == numbers
|
return own_num == numbers
|
||||||
end
|
end
|
||||||
|
|
||||||
function techage.logic.send_cmnd(pos, meta, cmnd, payload, time)
|
function techage.logic.send_cmnd(pos, ident, default, time)
|
||||||
|
local meta = M(pos)
|
||||||
|
local s = meta:contains(ident) and meta:get_string(ident) or default
|
||||||
|
local command, payload = unpack(string.split(s, " ", false, 1))
|
||||||
local own_num = meta:get_string("node_number") or ""
|
local own_num = meta:get_string("node_number") or ""
|
||||||
local numbers = meta:get_string("numbers") or ""
|
local numbers = meta:get_string("numbers") or ""
|
||||||
if time and time > 0 then
|
if time and time > 0 then
|
||||||
minetest.get_node_timer(pos):start(time)
|
minetest.get_node_timer(pos):start(time)
|
||||||
end
|
end
|
||||||
techage.send_multi(own_num, numbers, cmnd, payload)
|
techage.send_multi(own_num, numbers, command, payload)
|
||||||
end
|
end
|
||||||
|
|
||||||
function techage.logic.send_off(pos, meta)
|
function techage.logic.send_off(pos, meta)
|
||||||
|
@ -29,17 +29,39 @@ local WRENCH_MENU = {
|
|||||||
tooltip = S("Search radius"),
|
tooltip = S("Search radius"),
|
||||||
default = "4",
|
default = "4",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type = "numbers",
|
||||||
|
name = "numbers",
|
||||||
|
label = S("Number"),
|
||||||
|
tooltip = S("Destination block number"),
|
||||||
|
default = "",
|
||||||
|
check = techage.check_numbers,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "ascii",
|
||||||
|
name = "command1",
|
||||||
|
label = "On " .. S("Command"),
|
||||||
|
tooltip = S("Command to send when player is detected"),
|
||||||
|
default = "on",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type = "ascii",
|
||||||
|
name = "command2",
|
||||||
|
label = "Off " .. S("Command"),
|
||||||
|
tooltip = S("Command to send when player moves away"),
|
||||||
|
default = "off",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local function switch_on(pos, stage)
|
local function switch_on(pos, stage)
|
||||||
if logic.swap_node(pos, "techage:ta"..stage.."_playerdetector_on") then
|
if logic.swap_node(pos, "techage:ta"..stage.."_playerdetector_on") then
|
||||||
logic.send_on(pos, M(pos))
|
logic.send_cmnd(pos, "command1", "on")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function switch_off(pos, stage)
|
local function switch_off(pos, stage)
|
||||||
if logic.swap_node(pos, "techage:ta"..stage.."_playerdetector_off") then
|
if logic.swap_node(pos, "techage:ta"..stage.."_playerdetector_off") then
|
||||||
logic.send_off(pos, M(pos))
|
logic.send_cmnd(pos, "command2", "off")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user