Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Innokenty committed Aug 2, 2023
1 parent ee4765d commit 9c7060c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
37 changes: 20 additions & 17 deletions examples/5_lumberjack3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,23 +628,26 @@ def loop(self, target = None):
# '/say @p get stone_pickaxe'
# '/say @p stop'
# '/say @p terminate'
chat = self.rob.getCachedObserve('getChat')[0]
if chat is not None and chat[0] is not None:
print("Receive chat: ", chat[0])
words = chat[0].split(' ')
if words[-2] == 'get':
target = {'type': words[-1]}
else:
if words[-1] == 'stop':
target = None
self.skill = None
self.rob.sendCommand('move 0')
self.rob.sendCommand('jump 0')
self.rob.sendCommand('attack 0')
elif words[-1] == 'terminate':
break
self.rob.cached['getChat'] = (None, self.rob.cached['getChat'][1])

commands = self.rob.getCachedObserve('getChat')
for command in reversed(commands):
chat = command[0]
if chat is not None:
print("Receive chat: ", chat[0])
words = chat[0].split(' ')
if words[-2] == 'get':
target = {'type': words[-1]}
else:
if words[-1] == 'stop':
target = None
self.skill = None
self.rob.sendCommand('move 0')
self.rob.sendCommand('jump 0')
self.rob.sendCommand('attack 0')
elif words[-1] == 'terminate':
target = 'terminate'
break
if target == 'terminate':
continue
if self.skill is not None:
if self.ccycle():
continue
Expand Down
2 changes: 1 addition & 1 deletion tests/vereya/test_placement.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TestPlacement(BaseTest):
def setUpClass(cls, *args, **kwargs):
start = (-125.0, 73)
mc, obs = init_mission(None, start_x=start[0], start_y=start[1], seed=4,
forceReset='false', forceReuse='true')
forceReset='true')
cls.mc = mc
cls.rob = obs
mc.safeStart()
Expand Down

0 comments on commit 9c7060c

Please sign in to comment.