@@ -23,11 +23,11 @@ enum LimitBehavior { REPLACE, NO_SPAWN }
2323
2424## The period of time in seconds to spawn another component. If zero, they won't spawn
2525## automatically. Use the "Spawn" block.
26- @export_range (0.0 , 10.0 , 0.1 , "or_greater" ) var spawn_frequency : float = 0.0 :
27- set = _set_spawn_fraquency
26+ @export_range (0.0 , 10.0 , 0.1 , "or_greater" , "suffix:s" ) var spawn_period : float = 0.0 :
27+ set = _set_spawn_period
2828
2929## How many spawned scenes are allowed. If zero, there is no limit.
30- @export_range (0 , 50 , 0.1 , "or_greater" ) var spawn_limit : int = 50
30+ @export_range (0 , 50 , 0.1 , "or_greater" , "suffix:scenes" ) var spawn_limit : int = 50
3131
3232## What happens when the limit is reached and a new spawn is attempted:
3333## - Replace: Remove the oldest spawned scene and spawn a new one.
@@ -53,20 +53,20 @@ func _remove_oldest_spawned():
5353 spawned .get_parent ().remove_child (spawned )
5454
5555
56- func _set_spawn_fraquency ( new_frequency : float ):
57- spawn_frequency = new_frequency
56+ func _set_spawn_period ( new_period : float ):
57+ spawn_period = new_period
5858 if not _timer or not is_instance_valid (_timer ):
5959 return
60- _timer .wait_time = spawn_frequency
60+ _timer .wait_time = spawn_period
6161
6262
6363func spawn_start ():
64- if spawn_frequency == 0.0 :
64+ if spawn_period == 0.0 :
6565 return
6666 if not _timer or not is_instance_valid (_timer ):
6767 _timer = Timer .new ()
6868 add_child (_timer )
69- _timer .wait_time = spawn_frequency
69+ _timer .wait_time = spawn_period
7070 _timer .timeout .connect (spawn_once )
7171 _timer .start ()
7272 spawn_once .call_deferred ()
@@ -107,10 +107,6 @@ func spawn_once():
107107 spawned .position = global_position
108108
109109
110- func do_set_spawn_frequency (new_frequency : float ):
111- _set_spawn_fraquency (new_frequency )
112-
113-
114110static func setup_custom_blocks ():
115111 var _class_name = "SimpleSpawner"
116112 var block_list : Array [BlockDefinition ] = []
@@ -153,22 +149,22 @@ static func setup_custom_blocks():
153149 block_list .append (block_definition )
154150
155151 block_definition = BlockDefinition .new ()
156- block_definition .name = & "simplespawner_set_spawn_frequency "
152+ block_definition .name = & "simplespawner_set_spawn_period "
157153 block_definition .target_node_class = _class_name
158154 block_definition .category = "Lifecycle | Spawn"
159155 block_definition .type = Types .BlockType .STATEMENT
160- block_definition .display_template = "set spawn frequency to {new_frequency : FLOAT} "
161- block_definition .code_template = "do_set_spawn_frequency( {new_frequency} ) "
156+ block_definition .display_template = "set spawn period to {new_period : FLOAT} "
157+ block_definition .code_template = "spawn_period = {new_period} "
162158 block_list .append (block_definition )
163159
164160 block_definition = BlockDefinition .new ()
165- block_definition .name = & "simplespawner_get_spawn_frequency "
161+ block_definition .name = & "simplespawner_get_spawn_period "
166162 block_definition .target_node_class = _class_name
167163 block_definition .category = "Lifecycle | Spawn"
168164 block_definition .type = Types .BlockType .VALUE
169165 block_definition .variant_type = TYPE_FLOAT
170- block_definition .display_template = "spawn frequency "
171- block_definition .code_template = "spawn_frequency "
166+ block_definition .display_template = "spawn period "
167+ block_definition .code_template = "spawn_period "
172168 block_list .append (block_definition )
173169
174170 BlocksCatalog .add_custom_blocks (_class_name , block_list , [], {})
0 commit comments