Add rack version for techage:ta4_server
This commit is contained in:
parent
c920910d75
commit
49fd5bc29a
@ -81,14 +81,13 @@ local function formspec_help(meta, manual)
|
|||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
"item_image[9.6,0;1,1;techage:construction_board]"..
|
"item_image[9.6,0;1,1;techage:construction_board]"..
|
||||||
|
"tablecolumns[tree,width=1;text,width=10,align=inline]"..
|
||||||
|
"tableoptions[opendepth=1]"..
|
||||||
|
"table[0.1,0;9,5;page;"..table.concat(aTitel, ",")..";"..idx.."]"..
|
||||||
bttn..
|
bttn..
|
||||||
"style_type[textarea;textcolor=#FFFFFF]"..
|
"style_type[textarea;textcolor=#FFFFFF]"..
|
||||||
"textarea[0.3,5.7;11,5.3;;"..(aText[idx] or "")..";]"..
|
"textarea[0.3,5.7;11,5.3;;"..(aText[idx] or "")..";]"..
|
||||||
|
"box[0,5.75;10.775,4.45;#000000]"
|
||||||
"box[0,5.75;10.775,4.45;#000000]"..
|
|
||||||
"tablecolumns[tree,width=1;text,width=10,align=inline]"..
|
|
||||||
"tableoptions[opendepth=1]"..
|
|
||||||
"table[0.1,0;9,5;page;"..table.concat(aTitel, ",")..";"..idx.."]"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function formspec_plan(meta, manual)
|
local function formspec_plan(meta, manual)
|
||||||
|
@ -36,7 +36,8 @@ minetest.register_craft({
|
|||||||
{"techage:clay_powder", "techage:aluminum_powder", ""},
|
{"techage:clay_powder", "techage:aluminum_powder", ""},
|
||||||
{"techage:silver_sandstone_powder", "bucket:bucket_water", ""},
|
{"techage:silver_sandstone_powder", "bucket:bucket_water", ""},
|
||||||
{"", "", ""},
|
{"", "", ""},
|
||||||
}
|
},
|
||||||
|
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("techage:ta4_furnace_ceramic", {
|
minetest.register_craftitem("techage:ta4_furnace_ceramic", {
|
||||||
|
@ -263,7 +263,11 @@ techage.register_node({"techage:ta3_sequencer"}, {
|
|||||||
elseif topic == "off" then
|
elseif topic == "off" then
|
||||||
-- do not stop immediately
|
-- do not stop immediately
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
nvm.endless = false
|
if not nvm.running then
|
||||||
|
nvm.endless = not (nvm.endless or false)
|
||||||
|
else
|
||||||
|
nvm.endless = false
|
||||||
|
end
|
||||||
else
|
else
|
||||||
return "unsupported"
|
return "unsupported"
|
||||||
end
|
end
|
||||||
|
@ -38,6 +38,18 @@ techage.lua_ctlr.register_function("get_input", {
|
|||||||
" The device has to be connected with the controller."
|
" The device has to be connected with the controller."
|
||||||
})
|
})
|
||||||
|
|
||||||
|
techage.lua_ctlr.register_function("get_next_input", {
|
||||||
|
cmnd = function(self)
|
||||||
|
return techage.lua_ctlr.get_next_input(self.meta.number)
|
||||||
|
end,
|
||||||
|
help = ' $get_next_input() --> number and state\n'..
|
||||||
|
' Similar to $get_input(), but provides the\n'..
|
||||||
|
' input node number in addition.\n'..
|
||||||
|
' example: num, state = $get_next_input()\n'..
|
||||||
|
' This function deletes the input and returns\n'..
|
||||||
|
' nil if no further input value is available.'
|
||||||
|
})
|
||||||
|
|
||||||
techage.lua_ctlr.register_function("read_data", {
|
techage.lua_ctlr.register_function("read_data", {
|
||||||
cmnd = function(self, num, cmnd, data)
|
cmnd = function(self, num, cmnd, data)
|
||||||
num = tostring(num or "")
|
num = tostring(num or "")
|
||||||
|
@ -605,6 +605,18 @@ function techage.lua_ctlr.get_input(number, input)
|
|||||||
return "off"
|
return "off"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function techage.lua_ctlr.get_next_input(number)
|
||||||
|
if Cache[number] and Cache[number].inputs then
|
||||||
|
local num, state = next(Cache[number].inputs or {})
|
||||||
|
if num ~= "msg" and num ~= "term" then
|
||||||
|
if num then
|
||||||
|
Cache[number].inputs[num] = nil
|
||||||
|
end
|
||||||
|
return num, state
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- used for Terminal commands
|
-- used for Terminal commands
|
||||||
function techage.lua_ctlr.get_command(number)
|
function techage.lua_ctlr.get_command(number)
|
||||||
if Cache[number] and Cache[number].inputs then
|
if Cache[number] and Cache[number].inputs then
|
||||||
|
@ -93,7 +93,7 @@ minetest.register_node("techage:ta4_server", {
|
|||||||
techage.remove_node(pos, oldnode, oldmetadata)
|
techage.remove_node(pos, oldnode, oldmetadata)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_timer = function(pos, elasped)
|
on_timer = function(pos, elasped)
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
nvm.size = nvm.size or 0
|
nvm.size = nvm.size or 0
|
||||||
@ -120,6 +120,111 @@ minetest.register_craft({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_node("techage:ta4_server2", {
|
||||||
|
description = "TA4 Lua Rack Server",
|
||||||
|
tiles = {
|
||||||
|
-- up, down, right, left, back, front
|
||||||
|
"techage_server2_top.png",
|
||||||
|
"techage_server2_top.png",
|
||||||
|
"techage_server2_side.png",
|
||||||
|
"techage_server2_side.png^[transformFX",
|
||||||
|
"techage_server2_back.png",
|
||||||
|
{
|
||||||
|
image = "techage_server2_front.png",
|
||||||
|
backface_culling = false,
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 32,
|
||||||
|
aspect_h = 32,
|
||||||
|
length = 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.5, -0.4375, -0.4375, 0.5},
|
||||||
|
{-0.5, 0.4375, -0.5, -0.4375, 0.5, 0.5},
|
||||||
|
{0.4375, -0.5, -0.5, 0.5, -0.4375, 0.5},
|
||||||
|
{0.4375, 0.4375, -0.5, 0.5, 0.5, 0.5},
|
||||||
|
{-0.5, -0.5, -0.375, -0.4375, 0.5, -0.3125},
|
||||||
|
{-0.5, -0.5, 0.3125, -0.4375, 0.5, 0.375},
|
||||||
|
{0.4375, -0.5, 0.3125, 0.5, 0.5, 0.375},
|
||||||
|
{0.4375, -0.5, -0.375, 0.5, 0.5, -0.3125},
|
||||||
|
{-0.4375, -0.3125, -0.4375, 0.4375, 0.3125, 0.4375},
|
||||||
|
{0.4375, -0.0625, -0.4375, 0.5, 0, 0.4375},
|
||||||
|
{-0.5, -0.0625, -0.4375, -0.4375, 0, 0.4375},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
after_place_node = function(pos, placer)
|
||||||
|
local meta = M(pos)
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
local number = techage.add_node(pos, "techage:ta4_server2")
|
||||||
|
meta:set_string("owner", placer:get_player_name())
|
||||||
|
meta:set_string("number", number)
|
||||||
|
meta:set_string("formspec", formspec(nvm))
|
||||||
|
nvm.size = 0
|
||||||
|
meta:set_string("infotext", "Server "..number..": ("..nvm.size.."/"..SERVER_CAPA..")")
|
||||||
|
minetest.get_node_timer(pos):start(20)
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_receive_fields = function(pos, formname, fields, player)
|
||||||
|
local meta = M(pos)
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
local owner = meta:get_string("owner")
|
||||||
|
if player:get_player_name() == owner then
|
||||||
|
if fields.names and fields.names ~= "" then
|
||||||
|
nvm.names = string.split(fields.names, " ")
|
||||||
|
meta:set_string("formspec", formspec(nvm))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_dig = function(pos, node, puncher, pointed_thing)
|
||||||
|
if minetest.is_protected(pos, puncher:get_player_name()) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
techage.del_mem(pos)
|
||||||
|
minetest.node_dig(pos, node, puncher, pointed_thing)
|
||||||
|
end,
|
||||||
|
|
||||||
|
after_dig_node = function(pos, oldnode, oldmetadata)
|
||||||
|
techage.remove_node(pos, oldnode, oldmetadata)
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_timer = function(pos, elasped)
|
||||||
|
local meta = M(pos)
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
nvm.size = nvm.size or 0
|
||||||
|
local number = meta:get_string("number")
|
||||||
|
meta:set_string("infotext", "Server "..number..": ("..nvm.size.."/"..SERVER_CAPA..")")
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
use_texture_alpha = techage.CLIP,
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {choppy=1, cracky=1, crumbly=1},
|
||||||
|
is_ground_content = false,
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "techage:ta4_server2",
|
||||||
|
recipe = {"techage:ta4_server"},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "techage:ta4_server",
|
||||||
|
recipe = {"techage:ta4_server2"},
|
||||||
|
})
|
||||||
|
|
||||||
local function calc_size(v)
|
local function calc_size(v)
|
||||||
if type(v) == "number" then
|
if type(v) == "number" then
|
||||||
return 1
|
return 1
|
||||||
@ -173,7 +278,7 @@ local function read_value(nvm, key)
|
|||||||
return item
|
return item
|
||||||
end
|
end
|
||||||
|
|
||||||
techage.register_node({"techage:ta4_server"}, {
|
techage.register_node({"techage:ta4_server", "techage:ta4_server2"}, {
|
||||||
on_recv_message = function(pos, src, topic, payload)
|
on_recv_message = function(pos, src, topic, payload)
|
||||||
return "unsupported"
|
return "unsupported"
|
||||||
end,
|
end,
|
||||||
|
BIN
textures/techage_server2_back.png
Normal file
BIN
textures/techage_server2_back.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 283 B |
BIN
textures/techage_server2_front.png
Normal file
BIN
textures/techage_server2_front.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 283 B |
BIN
textures/techage_server2_side.png
Normal file
BIN
textures/techage_server2_side.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 231 B |
BIN
textures/techage_server2_top.png
Normal file
BIN
textures/techage_server2_top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 169 B |
Loading…
Reference in New Issue
Block a user