Support for minicoptersSuggestion
Would be nice if you could add deaths from minicopter crashes.
Thank you.
UP! :-)
Is there a way to add in minicopters
Here's how to add Minicopter support to DeathNotes. It requires updating the CS file and your config.

Update GetCombatEntityType around line 307 and add this entity check after Barricade:
if (entity is MiniCopter)
    return CombatEntityType.Minicopter;​

 

Update the CombatEntityType Enum around line 400 to add a Minicopter entity type after None:
None = 15,
Minicopter = 16​

 

Update GetEntityName around line 356 to handle Minicopters.
From:
if (entity == null &&
    combatEntityType != CombatEntityType.Helicopter &&
    combatEntityType != CombatEntityType.Bradley)
    return null;​

 

To:
if (entity == null &&
    combatEntityType != CombatEntityType.Helicopter &&
    combatEntityType != CombatEntityType.Bradley &&
    combatEntityType != CombatEntityType.Minicopter)
    return null;​

and then add this after CombatEntityType.Helicopter in the switch statement just below that around line 365

case CombatEntityType.Minicopter:
    return "Minicopter";

You then need to update your config to add Minicopter.

Add Minicopter to Names:
"Minicopter": "Minicopter"​

Then add a DeathNote

{
        "KillerType": "Minicopter",
        "VictimType": "Player",
        "DamageType": "Explosion",
        "Messages": [
          "{victim} died in a fiery explosion after crashing their {killer}."
        ]
  }
5d7082d52afbb.png cisox
Here's how to add Minicopter support to DeathNotes. It requires updating the CS file and your config.
Hence a good backup is mandatory! Thanks for this upgrade!! :-D
5d7082d52afbb.png cisox
Here's how to add Minicopter support to DeathNotes.

CombatEntityType.Helicopter in the switch statement just below that around line 365
case CombatEntityType.Minicopter: return "Minicopter";


Hello there, I am assuming you mean this:

 switch (combatEntityType) { case CombatEntityType.Player: return StripRichText(entity.ToPlayer().displayName); case CombatEntityType.Helicopter: return "Helicopter";case CombatEntityType.Minicopter:return "Minicopter";


When I load it on the server, it outputs:

Error while compiling: DeathNotes.cs(373,51): error CS1525: Unexpected symbol `)', expecting `;' or `}'

Where lines 373 reads:

 switch (combatEntityType)


I am a little bit confused about it... Can you help me sorting it out?



Merged post

Ok, I added ";" and now the error has gone:
switch (combatEntityType); { case CombatEntityType.Player: return StripRichText(entity.ToPlayer().displayName); case CombatEntityType.Helicopter: return "Helicopter";case CombatEntityType.Minicopter:return "Minicopter";​


Yet there's another error now:

(15:00:55) | Error while compiling: DeathNotes.cs(402,42): error CS1525: Unexpected symbol `:'

Line 402 is blank, though. Just a blank line....

I'll try posting more complete sections for you.

GetCombatEntityType:
        private CombatEntityType GetCombatEntityType(BaseEntity entity)
        {
            if (entity == null)
                return CombatEntityType.None;

            if (_combatEntityTypes.Contents != null && _combatEntityTypes.Contents.ContainsKey(entity.GetType().Name))
                return _combatEntityTypes.Contents[entity.GetType().Name];

            if (entity is BaseOven)
                return CombatEntityType.HeatSource;

            if (entity is SimpleBuildingBlock)
                return CombatEntityType.ExternalWall;

            if (entity is BaseAnimalNPC)
                return CombatEntityType.Animal;

            if (entity is BaseTrap)
                return CombatEntityType.Trap;

            if (entity is Barricade)
                return CombatEntityType.Barricade;
                
            if (entity is MiniCopter)
                return CombatEntityType.Minicopter;  

            return CombatEntityType.Other;
        }​
CombatEntityType enum
        internal enum CombatEntityType
        {
            Helicopter = 0,
            Bradley = 1,
            Animal = 2,
            Murderer = 3,
            Scientist = 4,
            Player = 5,
            Trap = 6,
            Turret = 7,
            Barricade = 8,
            ExternalWall = 9,
            HeatSource = 10,
            Fire = 11,
            Lock = 12,
            ScientistSentry = 13,
            Other = 14,
            None = 15,
            Minicopter = 16
        }​
GetEntityName
        private string GetEntityName(BaseEntity entity, CombatEntityType combatEntityType)
        {
            // Entity may be null for helicopter or bradley, see HandleExceptions(...)
            if (entity == null &&
                combatEntityType != CombatEntityType.Helicopter &&
                combatEntityType != CombatEntityType.Bradley &&
                combatEntityType != CombatEntityType.Minicopter)
                return null;

            switch (combatEntityType)
            {
                case CombatEntityType.Player:
                    return StripRichText(entity.ToPlayer().displayName);

                case CombatEntityType.Helicopter:
                    return "Helicopter";

                case CombatEntityType.Scientist:
                case CombatEntityType.Murderer:
                    var name = entity.ToPlayer()?.displayName;

                    return
                        string.IsNullOrEmpty(name) || name == entity.ToPlayer()?.userID.ToString()
                            ? combatEntityType.ToString()
                            : name;

                case CombatEntityType.Bradley:
                    return "Bradley APC";

                case CombatEntityType.ScientistSentry:
                    return "Scientist Sentry";

                case CombatEntityType.Fire:
                    return entity.creatorEntity?.ToPlayer()?.displayName ?? "Fire";
                
                case CombatEntityType.Minicopter:
                    return "Minicopter";
            }
            
            if (_enemyPrefabs.Contents.ContainsKey(entity.ShortPrefabName))
                return _enemyPrefabs.Contents[entity.ShortPrefabName];

            return HumanizePascalCase(entity.GetType().Name);
        }​
Wow, thank you very much for that! So, I see where my mistake is, that's very useful!
Again, thanks a lot! :-D
I guess I wait til an update. :D
Is it possible do add Bradley APC, too? These are the messages I get when Bradley APC kills anyone.


Merged post

But it's working the other way around
Just rewrite the config. I just did. Seems to work.

"KillerType": "Bradley",
"VictimType": "Player",
"DamageType": "*",
"Messages": [
"{victim} was shredded by the Bradley APC."
]
},
{
"KillerType": "Helicopter",
"VictimType": "Player",
"DamageType": "*",
"Messages": [
"{victim} had no chance against the Patrol Helicopter."

[Player was killed by Minicopter.entity ] is not reported

Found typo

Here's how to add Minicopter support to DeathNotes. It requires updating the CS file and your config.

Update GetCombatEntityType around line 307 and add this entity check after Barricade:

if (entity is MiniCopter)
    return CombatEntityType.MiniCopter;​

 

Update the CombatEntityType Enum around line 400 to add a Minicopter entity type after None:
None = 15,
MiniCopter = 16​

 

Update GetEntityName around line 356 to handle Minicopters.
From:
if (entity == null &&
    combatEntityType != CombatEntityType.Helicopter &&
    combatEntityType != CombatEntityType.Bradley)
    return null;​

 

To:
if (entity == null &&
    combatEntityType != CombatEntityType.Helicopter &&
    combatEntityType != CombatEntityType.Bradley &&
    combatEntityType != CombatEntityType.MiniCopter)
    return null;​

and then add this after CombatEntityType.Helicopter in the switch statement just below that around line 365

case CombatEntityType.MiniCopter:
    return "MiniCopter";

You then need to update your config to add Minicopter.

Add Minicopter to Names:

"MiniCopter": "Minicopter"

Then add a DeathNote

{
"KillerType": "MiniCopter",
"VictimType": "Player",
"DamageType": "*",
"Messages": [
"{victim} died in a fiery explosion after crashing their {killer}."
]
}