So a couple possibilities:
- The 2nd if is somehow being globbed into the 1st else if due to lack of braces, but unlikely as C# generally only handles the first line after an if
- It isn't actually handling both, and is just being mistaken somehow ;)
I also tried:
if (CH47NetIDs.Contains(entityNetID))
{
Puts("Contains");
Puts("Entity ID: " + entityNetID.ToString());
Puts("Entity ID List: " + CH47NetIDs.ToSentence());
CH47NetIDs.Remove(entityNetID);
}
else if (CH47DespawnAnnouncements)
{
Puts("why");
CreateAnnouncement(CH47DespawnAnnouncementText, CH47DespawnAnnouncementBannerColor, CH47DespawnAnnouncementTextColor);
}
Which outputs into console:
[GUIAnnouncements] Contains
[GUIAnnouncements] Entity ID: 81229
[GUIAnnouncements] Entity ID List: 81229
[GUIAnnouncements] why
Both if else if statements are not right next to each other.
However if I do:
Puts("OnEntityKill called");
if (CH47NetIDs.Contains(entityNetID))
CH47NetIDs.Remove(entityNetID);
else if (CH47DespawnAnnouncements)
CreateAnnouncement(CH47DespawnAnnouncementText, CH47DespawnAnnouncementBannerColor, CH47DespawnAnnouncementTextColor);
Then I get:
[GUIAnnouncements] OnEntityKill called
[GUIAnnouncements] OnEntityKill called
So you're right, it was being mistaken. Apparently when you shoot a Chinook down it calls OnEntityKill twice.