TA4 chest/tank: Add 'public' checkbox to allow public access
This commit is contained in:
parent
b5bc1751b5
commit
90e1af7e85
@ -178,7 +178,7 @@ techage.register_node({"techage:chest_ta2", "techage:chest_ta3"}, {
|
||||
|
||||
local function formspec4(pos)
|
||||
return "size[10,9]"..
|
||||
"tabheader[0,0;tab;"..S("Inventory,Configuration")..";1;;true]"..
|
||||
"tabheader[0,0;tab;"..S("Inventory,Pre-Assignment,Config")..";1;;true]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
@ -189,9 +189,9 @@ local function formspec4(pos)
|
||||
"listring[current_player;main]"
|
||||
end
|
||||
|
||||
local function formspec4_cfg(pos)
|
||||
local function formspec4_pre(pos)
|
||||
return "size[10,9]"..
|
||||
"tabheader[0,0;tab;"..S("Inventory,Configuration")..";2;;true]"..
|
||||
"tabheader[0,0;tab;"..S("Inventory,Pre-Assignment,Config")..";2;;true]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
@ -201,8 +201,23 @@ local function formspec4_cfg(pos)
|
||||
"listring[current_player;main]"
|
||||
end
|
||||
|
||||
local function formspec4_cfg(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local label = meta:get_string("label") or ""
|
||||
local public = dump((meta:get_int("public") or 0) == 1)
|
||||
return "size[10,5]"..
|
||||
"tabheader[0,0;tab;"..S("Inventory,Pre-Assignment,Config")..";3;;true]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"field[0.5,1;9,1;label;"..S("Node label:")..";"..label.."]" ..
|
||||
"checkbox[1,2;public;"..S("Allow public access to the chest")..";"..public.."]"..
|
||||
"button_exit[3.5,4;3,1;exit;"..S("Save").."]"
|
||||
end
|
||||
|
||||
local function ta4_allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
local public = M(pos):get_int("public") == 1
|
||||
if not public and minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
@ -214,7 +229,8 @@ local function ta4_allow_metadata_inventory_put(pos, listname, index, stack, pla
|
||||
end
|
||||
|
||||
local function ta4_allow_metadata_inventory_take(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
local public = M(pos):get_int("public") == 1
|
||||
if not public and minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
@ -226,7 +242,8 @@ local function ta4_allow_metadata_inventory_take(pos, listname, index, stack, pl
|
||||
end
|
||||
|
||||
local function ta4_allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
local public = M(pos):get_int("public") == 1
|
||||
if not public and minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
@ -276,10 +293,25 @@ minetest.register_node("techage:chest_ta4", {
|
||||
mem.filter = nil
|
||||
meta:set_string("formspec", formspec4(pos))
|
||||
elseif fields.tab == "2" then
|
||||
meta:set_string("formspec", formspec4_pre(pos))
|
||||
elseif fields.tab == "3" then
|
||||
meta:set_string("formspec", formspec4_cfg(pos))
|
||||
elseif fields.quit == "true" then
|
||||
mem.filter = nil
|
||||
end
|
||||
if fields.public then
|
||||
meta:set_int("public", fields.public == "true" and 1 or 0)
|
||||
end
|
||||
if fields.exit then
|
||||
local number = meta:get_string("node_number")
|
||||
if fields.label ~= "" then
|
||||
meta:set_string("infotext", minetest.formspec_escape(fields.label).." #"..number)
|
||||
else
|
||||
meta:set_string("infotext", S("TA4 Protected Chest").." "..number)
|
||||
end
|
||||
meta:set_string("label", fields.label)
|
||||
meta:set_string("formspec", formspec4_cfg(pos))
|
||||
end
|
||||
end,
|
||||
|
||||
techage_set_numbers = function(pos, numbers, player_name)
|
||||
|
@ -36,14 +36,28 @@ function techage.liquid.formspec(pos, nvm)
|
||||
if nvm.liquid and nvm.liquid.amount and nvm.liquid.amount > 0 and nvm.liquid.name then
|
||||
itemname = nvm.liquid.name.." "..nvm.liquid.amount
|
||||
end
|
||||
return "size[4,2]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"box[0,-0.1;3.8,0.5;#c6e8ff]"..
|
||||
"label[1,-0.1;"..minetest.colorize("#000000", title).."]"..
|
||||
help(3.4, -0.1)..
|
||||
techage.item_image(1.5, 1, itemname)
|
||||
local name = minetest.get_node(pos).name
|
||||
if name == "techage:ta4_tank" then
|
||||
local public = dump((M(pos):get_int("public") or 0) == 1)
|
||||
return "size[5,3]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"box[0,-0.1;4.8,0.5;#c6e8ff]"..
|
||||
"label[1.5,-0.1;"..minetest.colorize("#000000", title).."]"..
|
||||
help(4.4, -0.1)..
|
||||
techage.item_image(2, 1, itemname)..
|
||||
"checkbox[0.1,2.5;public;"..S("Allow public access to the tank")..";"..public.."]"
|
||||
else
|
||||
return "size[4,2]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"box[0,-0.1;3.8,0.5;#c6e8ff]"..
|
||||
"label[1,-0.1;"..minetest.colorize("#000000", title).."]"..
|
||||
help(3.4, -0.1)..
|
||||
techage.item_image(1.5, 1, itemname)
|
||||
end
|
||||
end
|
||||
|
||||
function techage.liquid.is_empty(pos)
|
||||
@ -205,7 +219,8 @@ local function empty_on_punch(pos, nvm, full_container, item_count)
|
||||
end
|
||||
|
||||
function techage.liquid.on_punch(pos, node, puncher, pointed_thing)
|
||||
if minetest.is_protected(pos, puncher:get_player_name()) then
|
||||
local public = M(pos):get_int("public") == 1
|
||||
if not public and minetest.is_protected(pos, puncher:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -41,7 +41,7 @@ function techage.valid_place_for_windturbine(pos, player_name, num_turbines)
|
||||
if data then
|
||||
local name = minetest.get_biome_name(data.biome)
|
||||
if not string.find(name, "ocean") then
|
||||
chat_message(player_name, S("This is a "..name.." biome and no ocean!"))
|
||||
chat_message(player_name, S("This is a").." "..name.." "..S("biome and no ocean!"))
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
@ -217,6 +217,14 @@ minetest.register_node("techage:ta4_tank", {
|
||||
tubelib2_on_update2 = function(pos, outdir, tlib2, node)
|
||||
liquid.update_network(pos, outdir)
|
||||
end,
|
||||
on_receive_fields = function(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
if fields.public then
|
||||
M(pos):set_int("public", fields.public == "true" and 1 or 0)
|
||||
end
|
||||
end,
|
||||
on_timer = node_timer,
|
||||
on_punch = liquid.on_punch,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
|
@ -4,6 +4,8 @@
|
||||
Accu Box=Akkublock
|
||||
Active:=Aktiv:
|
||||
All nodes:=Alle Blöcke:
|
||||
Allow public access to the chest=Erlaube öffentlichen Zugriff auf die Kiste
|
||||
Allow public access to the tank=Erlaube öffentlichen Zugriff auf den Tank
|
||||
Allow public chest access=Erlaube öffentlichen Zugriff
|
||||
Allow to dig/place Techage power lines nearby power poles=Erlaubt TODO
|
||||
Aluminum=Aluminium
|
||||
@ -85,6 +87,8 @@ Grinder=Mühle
|
||||
Grinding=Mahlen
|
||||
Heat=Hitze
|
||||
Heat Exchanger=Wärmetauscher
|
||||
Here is not enough water (41x41 m)!=Hier ist nicht genug Wasser (41x41 m)!
|
||||
Here is not enough wind (A free air space of 41x41x21 m is necessary)!=Hier ist nicht genug Wind (Ein freier Luftraum von 41x41x21 m ist notwendig)!
|
||||
High Performance Distributor=Hochleistungs-Verteiler
|
||||
Hole size=Lochgröße
|
||||
Hydrogen Cylinder Large=Wasserstoffflasche groß
|
||||
@ -95,7 +99,7 @@ Input=Einspeisung
|
||||
Insert destination node number(s)=Gebe Zielnummer(n) ein
|
||||
Insert door/gate block number(s)=Gebe Tür-/Tornummer(n) ein
|
||||
Intake=Stromaufnahme
|
||||
Inventory,Configuration=Inventar,Konfiguration
|
||||
Inventory,Pre-Assignment,Config=Inventar,Vorbelegung,Konfiguration
|
||||
Inverter=Wechselrichter
|
||||
Iron Powder=Eisen Pulver
|
||||
Leave Powder=Laub Pulver
|
||||
@ -128,6 +132,7 @@ No network or active generator available!=Kein Stromnetz oder aktiver Generator
|
||||
No plan available=Kein Plan verfügar
|
||||
No power grid or running generator!=Kein Stromnetz oder Generator verfügbar!
|
||||
No wind at this altitude!=Kein Wind auf dieser Höhe
|
||||
Node label:= Blockbeschriftung:
|
||||
Node number to send the events to=Knotennummer zum Senden der Events
|
||||
Node numbers to read the states from=Knotennummern zum Lesen der Zustände
|
||||
Node owner=Blockbesitzer
|
||||
@ -379,8 +384,12 @@ Techage Forceload Block=Techage Forceload Block
|
||||
Techage Forceload Tile=Techage Forceload Kachel
|
||||
The network is overloaded!=Das Stromnetz ist überlastet!
|
||||
The network load is almost at the limit!=Das Stromnetz ist ziemlich am Limit!
|
||||
The next wind turbines is too close!= Die nächste Windkraftanlagen iat zu nahe!
|
||||
The wind turbines are too close together!=Die Windkraftanlagen stehen zu eng beisammen!
|
||||
Thermal=Wärme
|
||||
This is a=Dies ist ein
|
||||
This is no ocean water!= Dies ist kein Meerwasser!
|
||||
This is not the surface of the ocean!=Das ist nicht die Meeresoberfläche!
|
||||
Time=Zeit
|
||||
Tiny Generator=Kleingenerator
|
||||
Tiny generator=Kleingenerator
|
||||
@ -420,6 +429,7 @@ accept=akzeptieren
|
||||
added=hinzugefügt wird
|
||||
added or removed=hinzugefügt oder entfernt wird
|
||||
area is protected=Bereich ist geschützt
|
||||
biome and no ocean!=Biom und keine Meer (ocean)!
|
||||
blocking mode=Blockiert
|
||||
catalyst missing=Katalysator fehlt
|
||||
commands like: help=Kommandos wie: help
|
||||
@ -431,6 +441,7 @@ finished=fertig
|
||||
full=voll
|
||||
inlet/pipe error=Einlass/Röhrenfehler
|
||||
inventory full=Inventar ist voll
|
||||
is a suitable place for a wind turbine!=ist ein geeigneter Ort für eine Windkraftanlage!
|
||||
item output blocked=Ausgang blockiert
|
||||
keep assignment=Zuordnung beibehalten
|
||||
ku is needed=ku wird benötigt
|
||||
|
@ -2,6 +2,8 @@
|
||||
Accu Box=
|
||||
Active:=
|
||||
All nodes:=
|
||||
Allow public access to the chest=
|
||||
Allow public access to the tank=
|
||||
Allow public chest access=
|
||||
Allow to dig/place Techage power lines nearby power poles=
|
||||
Aluminum=
|
||||
@ -83,6 +85,8 @@ Grinder=
|
||||
Grinding=
|
||||
Heat=
|
||||
Heat Exchanger=
|
||||
Here is not enough water (41x41 m)!=
|
||||
Here is not enough wind (A free air space of 41x41x21 m is necessary)!=
|
||||
High Performance Distributor=
|
||||
Hole size=
|
||||
Hydrogen Cylinder Large=
|
||||
@ -93,7 +97,7 @@ Input=
|
||||
Insert destination node number(s)=
|
||||
Insert door/gate block number(s)=
|
||||
Intake=
|
||||
Inventory,Configuration=
|
||||
Inventory,Pre-Assignment,Config=
|
||||
Inverter=
|
||||
Iron Powder=
|
||||
Leave Powder=
|
||||
@ -126,6 +130,7 @@ No network or active generator available!=
|
||||
No plan available=
|
||||
No power grid or running generator!=
|
||||
No wind at this altitude!=
|
||||
Node label:=
|
||||
Node number to send the events to=
|
||||
Node numbers to read the states from=
|
||||
Node owner=
|
||||
@ -377,8 +382,12 @@ Techage Forceload Block=
|
||||
Techage Forceload Tile=
|
||||
The network is overloaded!=
|
||||
The network load is almost at the limit!=
|
||||
The next wind turbines is too close!=
|
||||
The wind turbines are too close together!=
|
||||
Thermal=
|
||||
This is a=
|
||||
This is no ocean water!=
|
||||
This is not the surface of the ocean!=
|
||||
Time=
|
||||
Tiny Generator=
|
||||
Tiny generator=
|
||||
@ -418,6 +427,7 @@ accept=
|
||||
added=
|
||||
added or removed=
|
||||
area is protected=
|
||||
biome and no ocean!=
|
||||
blocking mode=
|
||||
catalyst missing=
|
||||
commands like: help=
|
||||
@ -429,6 +439,7 @@ finished=
|
||||
full=
|
||||
inlet/pipe error=
|
||||
inventory full=
|
||||
is a suitable place for a wind turbine!=
|
||||
item output blocked=
|
||||
keep assignment=
|
||||
ku is needed=
|
||||
|
@ -579,7 +579,7 @@ The TA4 8x2000 chest does not have a normal inventory like other chest, but has
|
||||
|
||||
If the chest is filled with a pusher, all stores fill from left to right. If all 8 stores are full and no further items can be added, further items are rejected.
|
||||
|
||||
** Row function **
|
||||
**Row function**
|
||||
|
||||
Several TA4 8x2000 chests can be connected to a large chest with more content. To do this, the chests must be placed in a row one after the other.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user