From 872ff3c6b62ab343c17350af0c7ee114dd47e695 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 28 Apr 2024 19:43:10 +0200 Subject: [PATCH] Convert `Sacrificable`'s enum into a `StringName` Sigh, Godot displays an array of enums as ints... --- behaviours/sacrificable.gd | 12 +----------- entities/sheep.tscn | 1 + 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/behaviours/sacrificable.gd b/behaviours/sacrificable.gd index 8d5bdde..d9e6c16 100644 --- a/behaviours/sacrificable.gd +++ b/behaviours/sacrificable.gd @@ -10,18 +10,8 @@ class_name Sacrificable signal sacrificed -@export var type: SacrificeKind = SacrificeKind.Sheep +@export var kind: StringName = &"" func sarcifice(): sacrificed.emit() - - -enum SacrificeKind { - None = 0, # I hate this but in GDScript enums can't be nulls and there aren't any sum types like in rust so this is all we can do - Sheep, - Imp, - Chupacabra, - Watcher, - Cthulhu, -} diff --git a/entities/sheep.tscn b/entities/sheep.tscn index 5d8753b..590e115 100644 --- a/entities/sheep.tscn +++ b/entities/sheep.tscn @@ -229,6 +229,7 @@ blend_times = [&"drag_start", &"drag_loop", 0.5] diet = &"Meat" [node name="Sacrificable" parent="." instance=ExtResource("8_43m1b")] +kind = &"Sheep" [node name="MovementSampler" parent="." instance=ExtResource("9_s5lod")]