#1
20th Mar 2018 at 11:52 AM
C# - issues with enums ?
Hi,
in my mod, I'm creating both new hidden traits and new occult Life States.
In vanilla, they are stored in enums : TraitNames for the Traits, and OccultTypes and OccultTypesAll for the Occults.
In my code, I use
Code:
simDes.TraitManager.RemoveElement((TraitNames)0x7A52783F65933B7E);
(which works) several times, 0x7A52783F65933B7E being my thait's guid, or
Code:
base.Actor.SimDescription.OccultManager.AddOccultType((OccultTypes)0x20000, true, false, false, new OccultArmiseDemon());
(which works too), 0x20000 being my new Occult's ID.
So, to avoid any typing errors, and to make it easier if I had to change the said guid, I wanted to do this
Code:
[Tunable]
public static TraitNames Armise_DemonTraitNames = (TraitNames)0x7A52783F65933B7E;
[Tunable]
public static OccultTypes ArmiseDemon = (OccultTypes)0x20000;
The issue is, it doesn't work
. The following test
Code:
(Armise_DemonTraitNames == (TraitNames)0x7A52783F65933B7E)
returns False !
How is it even possible ? How can ArmiseDemon be equal to anything else than (TraitNames)0x7A52783F65933B7E ? Any idea on how to successfully add stuff to an existing enum ?