@@ -168,7 +168,6 @@ local function forward(self, act)
168168
169169 --- @type Vector
170170 local newPosition = self .position + self .facing
171-
172171 if self .emulator :getBlock (newPosition ) ~= nil then
173172 return false , " Movement obstructed by " .. self .emulator :getBlock (newPosition ).item .name , newPosition
174173 end
364363--- @return boolean
365364--- @return string | nil
366365local function dig (turtle , block )
367- assert (block , " Block is nil in dig" )
366+ if block == nil then
367+ return false , " Nothing to dig here"
368+ end
368369 if not canDoAction (turtle , block , " dig" ) then
369370 return false , " Cannot beak block with this tool"
370371 end
422423local function place (turtle , position )
423424 local item = turtle .inventory [turtle .inventory .selectedSlot ]
424425 if item == nil then
425- return false , " No item to place"
426+ return false , " No items to place"
426427 end
427428 if item .placeAction ~= nil then
428429 return item .placeAction (turtle , item , position )
@@ -608,21 +609,18 @@ end
608609function turtleMock :dig ()
609610 local blockPos = self .position + self .facing
610611 local block = self .emulator :getBlock (blockPos )
611- assert (block , " Block not found at position: " .. tostring (blockPos ))
612612 return dig (self , block )
613613end
614614
615615function turtleMock :digUp ()
616616 local blockPos = (self .position + vector .new (0 , 1 , 0 ))
617617 local block = self .emulator :getBlock (blockPos )
618- assert (block , " Block not found at position: " .. tostring (blockPos ))
619618 return dig (self , block )
620619end
621620
622621function turtleMock :digDown ()
623622 local blockPos = (self .position + vector .new (0 , - 1 , 0 ))
624623 local block = self .emulator :getBlock (blockPos )
625- assert (block , " Block not found at position: " .. tostring (blockPos ))
626624 return dig (self , block )
627625end
628626
0 commit comments