robot fixes: boost move, books

master
ac-minetest 2020-11-27 17:19:17 +01:00
parent 4224116bbf
commit 11cc95c3e0
3 changed files with 9 additions and 8 deletions

View File

@ -444,8 +444,9 @@ basic_robot.commands.write_book = function(name,title,text) -- returns itemstack
local data = {}
if title == "" or not title then title = "program book "..minetest.get_gametime() end
data.title = title or ""
data.text = text or ""
if text == "" or not text then text = "empty" end
data.text = text
data.title = title
data.text_len = #data.text
data.page = 1
data.description = title or ""
@ -747,7 +748,7 @@ basic_robot.commands.craftcache = {};
basic_robot.commands.craft = function(item, mode, idx,amount, name)
amount = amount and tonumber(amount) or 1;
if amount<1 then amount = 1 end
if amount<0 then amount = 1 end
if not item then return false end
@ -1152,7 +1153,7 @@ basic_robot.commands.machine = {
energy = data.menergy or 0;
if amount>energy then return nil,"energy too low" end
if amount>energy or amount<0 then return nil,"energy too low" end
if not tdata.menergy then tdata.menergy = 0 end
tdata.menergy = tdata.menergy + amount

View File

@ -26,7 +26,7 @@ basic_robot.bad_inventory_blocks = { -- disallow taking from these nodes invento
basic_robot.http_api = minetest.request_http_api();
basic_robot.version = "2020/10/14a";
basic_robot.version = "2020/11/27a";
basic_robot.gui = {}; local robogui = basic_robot.gui -- gui management
basic_robot.data = {}; -- stores all robot related data
@ -74,7 +74,7 @@ function getSandboxEnv (name)
return
end
local yaw = obj:get_yaw();
obj:set_velocity({x=v*math.cos(yaw),y=0,z=v*math.sin(yaw)});
obj:set_velocity({x=-v*math.sin(yaw),y=0,z=v*math.cos(yaw)});
end,
turn = {

View File

@ -172,8 +172,8 @@ local help_pages = {
" activate.direction(mode) activates target block",
" pickup(r) picks up all items around robot in radius r<8 and returns list",
" or nil",
" craft(item,idx,mode,amount) crafts item if required materials are present in",
" inventory, mode = 1 returns recipe, optional recipe idx, optional ammount",
" craft(item,idx,mode) crafts item if required materials are present in",
" inventory, mode = 1 returns recipe, optional recipe idx",
" take.direction(item, inventory) takes item from target inventory into",
" robot inventory",
},