Godot 4 enum flags

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By AcoAlex

In Godot 3 you were able to use:
enum TEST {ITEM1 = 0, ITEM2, ITEM3} export(TEST, FLAGS) var test_flags

But I can’t get this to work in Godot 4 or find a function that is replaced with that

Also: Can I put enums with flags into a function parameter? A exapmle for that would be:

func _ready():
add_attack("attack1",  ATTACK_TYPES.FIRE.WATER) #Instead of ATTACK_TYPES.FIRE:WATER there would  be the correct method to do that
:bust_in_silhouette: Reply From: spaceyjase

The docs got you covered:

Although you’re also using an enum; pick one (flags or enums?):

Example using flags:

@export_flags ("FIRE", "WATER", "EARTH") var test_flags: int = 0

func _ready():
    add_attack("attack1",  test_flags)

func add_attack(attack_name: String, type: int):

Which looks like this in the Inspector:

enter image description here