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

Method link_using_block

scratchattach/editor/inputs.py:112–138  ·  view source on GitHub ↗

Link the Input object to any menu blocks, obscurer blocks, sprites, and links any of its subcomponents

(self)

Source from the content-addressed store, hash-verified

110 return data
111
112 def link_using_block(self):
113 """
114 Link the Input object to any menu blocks, obscurer blocks, sprites, and links any of its subcomponents
115 """
116
117 # Link to value
118 if self._id is not None:
119 new_value = self.sprite.find_block(self._id, "id")
120 if new_value is not None:
121 self.value = new_value
122 self._id = None
123
124 # Link to obscurer
125 if self._obscurer_id is not None:
126 new_block = self.sprite.find_block(self._obscurer_id, "id")
127 if new_block is not None:
128 self.obscurer = new_block
129 self._obscurer_id = None
130
131 # Link value to sprite
132 if isinstance(self.value, prim.Prim):
133 self.value.sprite = self.sprite
134 self.value.link_using_sprite()
135
136 # Link obscurer to sprite
137 if self.obscurer is not None:
138 self.obscurer.sprite = self.sprite

Callers 1

link_using_spriteMethod · 0.80

Calls 2

find_blockMethod · 0.80
link_using_spriteMethod · 0.45

Tested by

no test coverage detected