Simplify & focus

This commit is contained in:
nyje 2019-07-29 13:11:29 +00:00
parent 97171280fb
commit a219cdc68d
66 changed files with 37 additions and 28 deletions

View File

@ -60,8 +60,8 @@ local function panel_commands()
--{"case_repeat","case_test","case_end","case_success","case_failure","case_yes","case_no" },
--{"mode_examine","mode_pause","mode_wait"},
{},
{"number_0","number_1","number_2","number_3","number_4"},
{"number_5","number_6","number_7","number_8","number_9"},
{"number_2","number_3","number_4","number_5"},
{"number_6","number_7","number_8","number_9"},
{"run_1","run_2","run_3","run_4","run_5","run_6"}
}
local panel = highlight(0,1,7,8,"a","a","f")

View File

@ -29,6 +29,12 @@ minetest.register_on_player_receive_fields(function(player, bot_key, fields)
if fields.commands then
meta:set_int("panel", 0)
end
if fields.save then
--
end
if fields.load then
--
end
if fields.player_inv then
meta:set_int("panel", 1)
end
@ -62,7 +68,7 @@ minetest.register_on_player_receive_fields(function(player, bot_key, fields)
end
end
end
minetest.after(0, vbots.show_formspec, player, bot_data.pos)
minetest.after(0.2, vbots.show_formspec, player, bot_data.pos)
end
end
end

View File

@ -7,6 +7,8 @@
vbots={}
vbots.modpath = minetest.get_modpath("vbots")
vbots.bot_info = {}
vbots.storage = minetest.get_mod_storage()
vbots.steptime = 0.3
local trashInv = minetest.create_detached_inventory(
"bottrash",
@ -16,7 +18,9 @@ local trashInv = minetest.create_detached_inventory(
end
})
trashInv:set_size("main", 1)
local STEPTIME = 0.3
-------------------------------------
-- Generate 32 bit key for formspec identification
-------------------------------------
@ -45,7 +49,7 @@ vbots.bot_togglestate = function(pos,mode)
if mode == "on" then
newname = "vbots:on"
timer:start(1)
meta:set_int("PC",STEPTIME)
meta:set_int("PC",vbots.steptime)
meta:set_int("PR",0)
meta:set_string("stack","")
elseif mode == "off" then

View File

@ -1,5 +1,4 @@
local STEPTIME = 0.3
-------------------------------------
-- Cute 'unique' bot name generator
-------------------------------------
@ -180,7 +179,7 @@ local function move_bot(pos,direction)
local elapsed = minetest.get_node_timer(pos):get_elapsed()
minetest.set_node(pos,{name="air"})
minetest.set_node(newpos,{name=node.name, param2=node.param2})
minetest.get_node_timer(newpos):set(STEPTIME,0)
minetest.get_node_timer(newpos):set(vbots.steptime,0)
if hold then
minetest.get_meta(newpos):from_table(hold)
end
@ -239,7 +238,7 @@ local function bot_build(pos,buildy)
a=a+1
end
if found then
print(found)
-- print(found)
minetest.set_node(buildpos,{name=found})
end
end
@ -300,8 +299,6 @@ local function punch_bot(pos,player)
local item = player:get_wielded_item():get_name()
if item == "" then
vbots.bot_togglestate(pos)
else
bot_parsecommand(pos,item)
end
end
end
@ -341,14 +338,14 @@ local function bot_handletimer(pos)
meta:set_int("PR",PR)
meta:set_string("stack",stack)
if PC<56 then
print("mainloop PR:"..meta:get_int("PR")..
" PC:"..meta:get_int("PC")..
" R:"..meta:get_int("repeat")..
" : "..command)
-- print("mainloop PR:"..meta:get_int("PR")..
-- " PC:"..meta:get_int("PC")..
-- " R:"..meta:get_int("repeat")..
-- " : "..command)
bot_parsecommand(pos, command)
return true
else
print("Program "..PR.." ending.")
-- print("Program "..PR.." ending.")
if PR ~=0 then
pull_state(pos)
return true

View File

@ -4,7 +4,7 @@ local register_command = function(itemname,description,image)
inventory_image = image,
wield_image = "wieldhand.png",
stack_max = 1,
groups = { bot_commands = 1 },
groups = { bot_commands = 1, not_in_creative_inventory = 1},
on_place = function(itemstack, placer, pointed_thing)
return nil
end,
@ -26,25 +26,27 @@ register_command("turn_clockwise","Turn bot 90° clockwise","vbots_turn_clockwis
register_command("turn_anticlockwise","Move bot 90° anti-clockwise","vbots_turn_anticlockwise.png")
register_command("turn_random","Move bot 90° in a random direction","vbots_turn_random.png")
register_command("case_end","End section","vbots_case_end.png")
register_command("case_failure","Last action failed","vbots_case_failure.png")
register_command("case_success","Last action succeeded","vbots_case_success.png")
register_command("case_yes","Yes","vbots_case_yes.png")
register_command("case_no","No","vbots_case_no.png")
register_command("case_test","Test","vbots_case_test.png")
register_command("case_repeat","Repeat","vbots_case_repeat.png")
-- register_command("case_end","End section","vbots_case_end.png")
-- register_command("case_failure","Last action failed","vbots_case_failure.png")
-- register_command("case_success","Last action succeeded","vbots_case_success.png")
-- register_command("case_yes","Yes","vbots_case_yes.png")
-- register_command("case_no","No","vbots_case_no.png")
-- register_command("case_test","Test","vbots_case_test.png")
-- register_command("case_repeat","Repeat","vbots_case_repeat.png")
register_command("mode_build","Place a block behind the bot","vbots_mode_build.png")
register_command("mode_build_up","Place a block above the block behind the bot","vbots_mode_build_up.png")
register_command("mode_build_down","Place a block below the block behind the bot","vbots_mode_build_down.png")
register_command("mode_dig","Dig the block in front","vbots_mode_dig.png")
register_command("mode_dig_up","Dig the block above the block in front","vbots_mode_dig_up.png")
register_command("mode_dig_down","Dig the block below the block in front","vbots_mode_dig_down.png")
register_command("mode_examine","Examine the block in the direction of the next command","vbots_mode_examine.png")
register_command("mode_pause","Wait for a few seconds","vbots_mode_pause.png")
register_command("mode_wait","Wait until next event","vbots_mode_wait.png")
register_command("number_1","1","vbots_number_1.png")
-- register_command("mode_examine","Examine the block in the direction of the next command","vbots_mode_examine.png")
-- register_command("mode_pause","Wait for a few seconds","vbots_mode_pause.png")
-- register_command("mode_wait","Wait until next event","vbots_mode_wait.png")
--register_command("number_1","1","vbots_number_1.png")
register_command("number_2","2","vbots_number_2.png")
register_command("number_3","3","vbots_number_3.png")
register_command("number_4","4","vbots_number_4.png")
@ -53,7 +55,7 @@ register_command("number_6","6","vbots_number_6.png")
register_command("number_7","7","vbots_number_7.png")
register_command("number_8","8","vbots_number_8.png")
register_command("number_9","9","vbots_number_9.png")
register_command("number_0","0","vbots_number_0.png")
--register_command("number_0","0","vbots_number_0.png")
register_command("run_1","Run sub-program 1","vbots_run_1.png")
register_command("run_2","Run sub-program 2","vbots_run_2.png")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 908 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 890 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 377 B

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 798 B

After

Width:  |  Height:  |  Size: 851 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 968 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 586 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 589 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 559 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 B

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 B

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

After

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 B

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 355 B

After

Width:  |  Height:  |  Size: 893 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B

After

Width:  |  Height:  |  Size: 856 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 411 B

After

Width:  |  Height:  |  Size: 998 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 559 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 852 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 599 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 489 B

After

Width:  |  Height:  |  Size: 958 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 550 B

After

Width:  |  Height:  |  Size: 865 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 594 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 612 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 868 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 708 B

After

Width:  |  Height:  |  Size: 924 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1011 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1007 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1010 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 609 B