evoli icon indicating copy to clipboard operation
evoli copied to clipboard

Why is CreatureType a String instead of an enum?

Open agluszak opened this issue 6 years ago • 1 comments

https://github.com/amethyst/evoli/blob/2e3b15965b31178e266dc1df3923c275b6afab60/src/components/creatures.rs#L18

Why is CreatureType defined to be a String instead of an enum? An enum would be more typesafe. As far as I can see, it's only used for an enum-like comparison here: https://github.com/amethyst/evoli/blob/2e3b15965b31178e266dc1df3923c275b6afab60/src/systems/spawner.rs#L105

agluszak avatar Jul 23 '19 22:07 agluszak

The reason for this is that this way we can keep adding more creatures without modifying the code at all. All you need is to define a prefab with a Named component.

sunreef avatar Jul 24 '19 12:07 sunreef