visual aspect improved (textures, model), update some commands, added capability to generate plans

This commit is contained in:
jimy-byerley 2018-03-23 19:11:20 +01:00
parent d4d38e4b0c
commit 3266e42929
11 changed files with 25 additions and 6 deletions

View File

@ -35,7 +35,8 @@ computers.execute_oscommand = function(cmdline, pos, player)
local message = command..": command not found"
local continue = false
print("pass command to computer : "..command)
--DEBUG info:
--print("pass command to computer : "..command)
if computers.registered_commands[command] then
local func = computers.registered_commands[command].exe
if func then

28
os.lua
View File

@ -170,12 +170,12 @@ end)
-- funtion called when a "computers:laptop_connect" receive a field
computers.oscommand_com_main = function(pos, formname, fields, sender)
--get remote coordinates
local meta = minetest.env:get_meta(pos)
local meta = minetest.get_meta(pos)
local remote_pos = {}
remote_pos.x, remote_pos.y, remote_pos.z = string.match(meta:get_string("destination"), "^([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
local self = minetest.env:get_node(pos)
local node = minetest.env:get_node(remote_pos)
local self = minetest.get_node(pos)
local node = minetest.get_node(remote_pos)
if fields.text == nil then
return
@ -195,7 +195,7 @@ computers.oscommand_com_main = function(pos, formname, fields, sender)
minetest.add_node(remote_pos, node)
--set remote metadata
meta = minetest.env:get_meta(remote_pos)
meta = minetest.get_meta(remote_pos)
meta:set_string("formspec", "field[text;;${text}]")
meta:set_string("infotext", "END OF LINE\n* * * connection closed by remote host\n\n"..welcome_message)
else
@ -235,4 +235,22 @@ function (cmdline, pos, player)
print("[computers]: all computers restarted")
return welcome_message, true
end)
end)
if technology ~= nil then
computers.register_oscommand("design", "generates a plan for the asked machine", "design [machin name]",
function (cmdline, pos, player)
local command, asked_name = string.match(cmdline, "^([^ ]+) *([^ ]+)")
local plan = technology.registered_plans[asked_name]
if plan then
local inventory = player:get_inventory()
inventory:add_item("main", plan[1])
return asked_name.." successfully computed.", true
else
return asked_name..": file not found.", false
end
end)
end

0
textures/laptop_back.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 652 B

After

Width:  |  Height:  |  Size: 652 B

0
textures/laptop_bottom.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 889 B

After

Width:  |  Height:  |  Size: 889 B

0
textures/laptop_cover.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 487 B

After

Width:  |  Height:  |  Size: 487 B

0
textures/laptop_front_connect.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

0
textures/laptop_left.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 439 B

After

Width:  |  Height:  |  Size: 439 B

0
textures/laptop_right.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 435 B

0
textures/laptop_top.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB