diff --git a/behaviours/spawner_choice.gd b/behaviours/spawner_choice.gd index 71def18..8af2a02 100644 --- a/behaviours/spawner_choice.gd +++ b/behaviours/spawner_choice.gd @@ -1,6 +1,11 @@ +@icon("res://behaviours/spawner_choice.svg") extends Node class_name SpawnerChoice +## Randomly choose a [Spawner] to use from [field spawners] considering [field weights]. +## +## If a null [Spawner] is selected, nothing is spawned. + @export var spawners: Array[Spawner] = [] @export var weights: Array[int] = [] @@ -24,7 +29,9 @@ func select_spawner() -> Spawner: return spawners[idx] func spawn(): - select_spawner().spawn() + var spawner = select_spawner() + if spawner != null: + spawner.spawn() func _ready(): diff --git a/behaviours/spawner_choice.svg b/behaviours/spawner_choice.svg new file mode 100644 index 0000000..6665d20 --- /dev/null +++ b/behaviours/spawner_choice.svg @@ -0,0 +1,41 @@ + + diff --git a/behaviours/spawner_choice.svg.import b/behaviours/spawner_choice.svg.import new file mode 100644 index 0000000..ad1beae --- /dev/null +++ b/behaviours/spawner_choice.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c0f5nbe7lhib6" +path="res://.godot/imported/spawner_choice.svg-91bce9cbbb63e3eb7738ffe03834ed28.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://behaviours/spawner_choice.svg" +dest_files=["res://.godot/imported/spawner_choice.svg-91bce9cbbb63e3eb7738ffe03834ed28.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false