@@ -126,13 +126,13 @@ static func get_general_categories() -> Array[BlockCategory]:
126126 signal_list .append (b )
127127
128128 b = BLOCKS ["parameter_block" ].instantiate ()
129- b .block_type = Types . BlockType . BOOL
129+ b .variant_type = TYPE_BOOL
130130 b .block_format = "Is in group {group: STRING} "
131131 b .statement = "is_in_group({group} )"
132132 signal_list .append (b )
133133
134134 b = BLOCKS ["parameter_block" ].instantiate ()
135- b .block_type = Types . BlockType . BOOL
135+ b .variant_type = TYPE_BOOL
136136 b .block_format = "Is {node: NODE} in group {group: STRING} "
137137 b .statement = "{node} .is_in_group({group} )"
138138 signal_list .append (b )
@@ -158,7 +158,7 @@ static func get_general_categories() -> Array[BlockCategory]:
158158 variable_list .append (b )
159159
160160 b = BLOCKS ["parameter_block" ].instantiate ()
161- b .block_type = Types . BlockType . INT
161+ b .variant_type = TYPE_INT
162162 b .block_format = "Get Int {var: STRING} "
163163 b .statement = "VAR_DICT[{var} ]"
164164 variable_list .append (b )
@@ -174,31 +174,31 @@ static func get_general_categories() -> Array[BlockCategory]:
174174 var math_list : Array [Block ] = []
175175
176176 b = BLOCKS ["parameter_block" ].instantiate ()
177- b .block_type = Types . BlockType . INT
177+ b .variant_type = TYPE_INT
178178 b .block_format = "{a: INT} + {b: INT} "
179179 b .statement = "({a} + {b} )"
180180 math_list .append (b )
181181
182182 b = BLOCKS ["parameter_block" ].instantiate ()
183- b .block_type = Types . BlockType . INT
183+ b .variant_type = TYPE_INT
184184 b .block_format = "{a: INT} - {b: INT} "
185185 b .statement = "({a} - {b} )"
186186 math_list .append (b )
187187
188188 b = BLOCKS ["parameter_block" ].instantiate ()
189- b .block_type = Types . BlockType . INT
189+ b .variant_type = TYPE_INT
190190 b .block_format = "{a: INT} * {b: INT} "
191191 b .statement = "({a} * {b} )"
192192 math_list .append (b )
193193
194194 b = BLOCKS ["parameter_block" ].instantiate ()
195- b .block_type = Types . BlockType . INT
195+ b .variant_type = TYPE_INT
196196 b .block_format = "{a: INT} / {b: INT} "
197197 b .statement = "({a} / {b} )"
198198 math_list .append (b )
199199
200200 b = BLOCKS ["parameter_block" ].instantiate ()
201- b .block_type = Types . BlockType . INT
201+ b .variant_type = TYPE_INT
202202 b .block_format = "{base: INT} ^ {exp: INT} "
203203 b .statement = "(pow({base} , {exp} ))"
204204 math_list .append (b )
@@ -211,20 +211,20 @@ static func get_general_categories() -> Array[BlockCategory]:
211211
212212 for op in ["==" , ">" , "<" , ">=" , "<=" , "!=" ]:
213213 b = BLOCKS ["parameter_block" ].instantiate ()
214- b .block_type = Types . BlockType . BOOL
214+ b .variant_type = TYPE_BOOL
215215 b .block_format = "{int1: INT} %s {int2: INT} " % op
216216 b .statement = "({int1} %s {int2} )" % op
217217 logic_list .append (b )
218218
219219 for op in ["and" , "or" ]:
220220 b = BLOCKS ["parameter_block" ].instantiate ()
221- b .block_type = Types . BlockType . BOOL
221+ b .variant_type = TYPE_BOOL
222222 b .block_format = "{bool1: BOOL} %s {bool2: BOOL} " % op
223223 b .statement = "({bool1} %s {bool2} )" % op
224224 logic_list .append (b )
225225
226226 b = BLOCKS ["parameter_block" ].instantiate ()
227- b .block_type = Types . BlockType . BOOL
227+ b .variant_type = TYPE_BOOL
228228 b .block_format = "Not {bool: BOOL} "
229229 b .statement = "(!{bool} )"
230230 logic_list .append (b )
@@ -264,31 +264,13 @@ static func add_to_categories(main: Array[BlockCategory], addition: Array[BlockC
264264 return main
265265
266266
267- static func built_in_type_to_block_type (type : Variant .Type ):
268- match type :
269- TYPE_BOOL :
270- return Types .BlockType .BOOL
271- TYPE_INT :
272- return Types .BlockType .INT
273- TYPE_FLOAT :
274- return Types .BlockType .FLOAT
275- TYPE_STRING :
276- return Types .BlockType .STRING
277- TYPE_VECTOR2 :
278- return Types .BlockType .VECTOR2
279- TYPE_COLOR :
280- return Types .BlockType .COLOR
281-
282- return null
283-
284-
285267static func property_to_blocklist (property : Dictionary ) -> Array [Block ]:
286268 var block_list : Array [Block ] = []
287269
288- var block_type = built_in_type_to_block_type ( property .type )
270+ var block_type = property .type
289271
290272 if block_type :
291- var type_string : String = Types .BlockType . find_key ( block_type )
273+ var type_string : String = Types .VARIANT_TYPE_TO_STRING [ block_type ]
292274
293275 var b = BLOCKS ["statement_block" ].instantiate ()
294276 b .block_format = "Set %s to {value: %s} " % [property .name .capitalize (), type_string ]
@@ -376,19 +358,19 @@ static func _get_input_blocks() -> Array[Block]:
376358
377359 for action : StringName in InputMap .get_actions ():
378360 var block : Block = BLOCKS ["parameter_block" ].instantiate ()
379- block .block_type = Types . BlockType . BOOL
361+ block .variant_type = TYPE_BOOL
380362 block .block_format = "Is action %s pressed" % action
381363 block .statement = 'Input.is_action_pressed("%s ")' % action
382364 block_list .append (block )
383365
384366 block = BLOCKS ["parameter_block" ].instantiate ()
385- block .block_type = Types . BlockType . BOOL
367+ block .variant_type = TYPE_BOOL
386368 block .block_format = "Is action %s just pressed" % action
387369 block .statement = 'Input.is_action_just_pressed("%s ")' % action
388370 block_list .append (block )
389371
390372 block = BLOCKS ["parameter_block" ].instantiate ()
391- block .block_type = Types . BlockType . BOOL
373+ block .variant_type = TYPE_BOOL
392374 block .block_format = "Is action %s just released" % action
393375 block .statement = 'Input.is_action_just_released("%s ")' % action
394376 block_list .append (block )
0 commit comments