mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-21 15:44:23 +00:00
Refactor SpawnerChoice
This commit is contained in:
parent
10f17c1e9e
commit
b172e919d9
3 changed files with 86 additions and 1 deletions
|
@ -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():
|
||||
|
|
41
behaviours/spawner_choice.svg
Normal file
41
behaviours/spawner_choice.svg
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
viewBox="0 0 640 640"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
sodipodi:docname="spawner_choice.svg"
|
||||
width="16"
|
||||
height="16"
|
||||
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
|
||||
xml:space="preserve"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||
id="defs1" /><sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:zoom="26.34375"
|
||||
inkscape:cx="6.3582444"
|
||||
inkscape:cy="10.192171"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1020"
|
||||
inkscape:window-x="3200"
|
||||
inkscape:window-y="32"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg1" /><!--! Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc. --><path
|
||||
d="M 0,546.3 C 0,447.8 79.8,368 178.3,368 h 91.4 c 98.5,0 178.3,79.8 178.3,178.3 0,16.4 -13.3,29.7 -29.7,29.7 H 29.7 C 13.3,576 0,562.7 0,546.3 Z"
|
||||
id="path2"
|
||||
style="fill:#e0e0e0" /><path
|
||||
d="m 96,192 a 128,128 0 1 1 256,0 128,128 0 1 1 -256,0 z"
|
||||
id="path1"
|
||||
style="fill:#e0e0e0" /><path
|
||||
d="m 453.31589,247.44634 c 0,-26.67855 21.69051,-48.36908 48.36905,-48.36908 h 24.18458 c 26.67854,0 48.36905,21.69053 48.36905,48.36908 v 2.72078 c 0,16.47571 -8.389,31.81779 -22.21955,40.66023 l -31.89337,20.48129 c -19.0453,12.24343 -30.53295,33.32934 -30.53295,55.92674 v 1.13366 c 0,13.37704 10.80745,24.18458 24.18453,24.18458 13.37708,0 24.18453,-10.80754 24.18453,-24.18458 v -1.05808 c 0,-6.19727 3.17423,-11.94108 8.31346,-15.26646 l 31.89336,-20.48131 c 27.66105,-17.83607 44.43909,-48.44463 44.43909,-81.39607 v -2.72078 c 0,-53.43272 -43.30545,-96.73815 -96.73815,-96.73815 h -24.18458 c -53.4327,0 -96.73815,43.30543 -96.73815,96.73815 0,13.37708 10.80748,24.18454 24.18454,24.18454 13.37708,0 24.18456,-10.80746 24.18456,-24.18454 z m 60.46134,241.84541 a 30.230704,30.230704 0 1 0 0,-60.46127 30.230704,30.230704 0 1 0 0,60.46127 z"
|
||||
id="path1-7"
|
||||
style="fill:#e0e0e0;stroke-width:0.755768" /></svg>
|
After Width: | Height: | Size: 2.5 KiB |
37
behaviours/spawner_choice.svg.import
Normal file
37
behaviours/spawner_choice.svg.import
Normal file
|
@ -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
|
Loading…
Reference in a new issue