mirror of
https://github.com/minetest-mods/technic.git
synced 2025-03-20 11:20:31 +01:00
ḿake channel setting with button
This commit is contained in:
parent
d1410524ef
commit
b20af69c43
@ -79,8 +79,7 @@ function technic.register_battery_box(data)
|
|||||||
"listring[context;src]"..
|
"listring[context;src]"..
|
||||||
"listring[current_player;main]"
|
"listring[current_player;main]"
|
||||||
if digilines_path then
|
if digilines_path then
|
||||||
formspec = formspec..
|
formspec = formspec.."button[0.6,3.7;2,1;edit_channel;edit Channel]"
|
||||||
"field[0.28,4.1;3.2,1;channel;Digiline Channel;${channel}]"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if data.upgrade then
|
if data.upgrade then
|
||||||
@ -216,16 +215,13 @@ function technic.register_battery_box(data)
|
|||||||
after_place_node = data.tube and pipeworks.after_place,
|
after_place_node = data.tube and pipeworks.after_place,
|
||||||
after_dig_node = technic.machine_after_dig_node,
|
after_dig_node = technic.machine_after_dig_node,
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
if not fields.channel then
|
if not fields.edit_channel then
|
||||||
return
|
|
||||||
end
|
|
||||||
local plname = sender:get_player_name()
|
|
||||||
if minetest.is_protected(pos, plname) then
|
|
||||||
minetest.record_protection_violation(pos, plname)
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("channel", fields.channel)
|
minetest.show_formspec(sender:get_player_name(),
|
||||||
|
"technic:battery_box_edit_channel"..minetest.pos_to_string(pos),
|
||||||
|
"field[channel;Digiline Channel;"..meta:get_string("channel").."]")
|
||||||
end,
|
end,
|
||||||
digiline = {
|
digiline = {
|
||||||
receptor = {action = function() end},
|
receptor = {action = function() end},
|
||||||
@ -264,6 +260,23 @@ function technic.register_battery_box(data)
|
|||||||
|
|
||||||
end -- End registration
|
end -- End registration
|
||||||
|
|
||||||
|
minetest.register_on_player_receive_fields(
|
||||||
|
function(player, formname, fields)
|
||||||
|
if formname:sub(1, 32) ~= "technic:battery_box_edit_channel" or
|
||||||
|
not fields.channel then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local pos = minetest.string_to_pos(formname:sub(33))
|
||||||
|
local plname = player:get_player_name()
|
||||||
|
if minetest.is_protected(pos, plname) then
|
||||||
|
minetest.record_protection_violation(pos, plname)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("channel", fields.channel)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
function technic.charge_tools(meta, batt_charge, charge_step)
|
function technic.charge_tools(meta, batt_charge, charge_step)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user