MCPcopy Create free account
hub / github.com/TimMcCool/scratchattach / slot_above

Method slot_above

scratchattach/editor/block.py:562–579  ·  view source on GitHub ↗

Place a single block directly above this block

(self, new: Block)

Source from the content-addressed store, hash-verified

560 return self.bottom_level_block.attach_chain(*map(Block.dcopy, self.attached_chain))
561
562 def slot_above(self, new: Block) -> Block:
563 """
564 Place a single block directly above this block
565 """
566 if not new.can_next:
567 raise exceptions.BadBlockShape(f"{new.block_shape} cannot be stacked onto")
568
569 elif self.block_shape.is_hat or not self.block_shape.is_stack:
570 raise exceptions.BadBlockShape(f"{self.block_shape} is not stackable")
571
572 new.parent, new.next = self.parent, self
573
574 self.parent = new
575
576 if new.parent:
577 new.parent.next = new
578
579 return self.sprite.add_block(new)
580
581 def delete_single_block(self):
582 if self.is_next_block:

Callers

nothing calls this directly

Calls 1

add_blockMethod · 0.45

Tested by

no test coverage detected