Skip to content

Commit

Permalink
Version 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteMasterEric committed Dec 17, 2023
1 parent 7187bf6 commit 7837972
Show file tree
Hide file tree
Showing 6 changed files with 278 additions and 106 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

# 1.4.0
## Additions
- Added custom death messages for specific types of explosions:
- Landmines
- Jetpack
- Lightning
- Added custom death message for Turrets.
- Added a `SeriousDeathMessages` config option to display only more to-the-point death messages. Defaults to `false`.
## Changed
- The death report now says "Cause of Death" instead of "Notes" when a player dies.
- Decreased log verbosity to improve performance.

# 1.3.1
## Fixed
- Fixed an issue where an exception in one of the cause-of-death patches would cause the player to not die.
Expand Down
83 changes: 57 additions & 26 deletions Coroner/AdvancedCauseOfDeath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ public static AdvancedCauseOfDeath GetCauseOfDeath(PlayerControllerB playerContr
{
if (!PlayerCauseOfDeath.ContainsKey((int)playerController.playerClientId))
{
Plugin.Instance.PluginLogger.LogInfo($"Player {playerController.playerClientId} has no custom cause of death stored! Using fallback...");
Plugin.Instance.PluginLogger.LogDebug($"Player {playerController.playerClientId} has no custom cause of death stored! Using fallback...");
return GuessCauseOfDeath(playerController);
}
else
{
Plugin.Instance.PluginLogger.LogInfo($"Player {playerController.playerClientId} has custom cause of death stored! {PlayerCauseOfDeath[(int)playerController.playerClientId]}");
Plugin.Instance.PluginLogger.LogDebug($"Player {playerController.playerClientId} has custom cause of death stored! {PlayerCauseOfDeath[(int)playerController.playerClientId]}");
return PlayerCauseOfDeath[(int)playerController.playerClientId];
}
}
Expand Down Expand Up @@ -171,14 +171,16 @@ public static string StringifyCauseOfDeath(AdvancedCauseOfDeath? causeOfDeath)
public static string StringifyCauseOfDeath(AdvancedCauseOfDeath? causeOfDeath, Random random)
{
var result = SelectCauseOfDeath(causeOfDeath);
if (result.Length == 1) return result[0];
if (result.Length == 1 || Plugin.Instance.PluginConfig.ShouldUseSeriousDeathMessages()) return result[0];
else return result[random.Next(result.Length)];
}

public static string[] SelectCauseOfDeath(AdvancedCauseOfDeath? causeOfDeath)
{
if (causeOfDeath == null) return FUNNY_NOTES;

// NOTE: First cause of death in the list should be the "serious" entry.

switch (causeOfDeath)
{
case AdvancedCauseOfDeath.Bludgeoning:
Expand All @@ -192,8 +194,8 @@ public static string[] SelectCauseOfDeath(AdvancedCauseOfDeath? causeOfDeath)
};
case AdvancedCauseOfDeath.Blast:
return new[] {
"Went out with a bang.",
"Exploded.",
"Went out with a bang.",
"Was blown to smithereens."
};
case AdvancedCauseOfDeath.Strangulation:
Expand Down Expand Up @@ -241,10 +243,8 @@ public static string[] SelectCauseOfDeath(AdvancedCauseOfDeath? causeOfDeath)
};
case AdvancedCauseOfDeath.Enemy_EyelessDog:
return new[] {
"Got caught using a mechanical keyboard.",
"Was eaten by an Eyeless Dog.",
"Was eaten by an Eyeless Dog.",
"Was eaten by an Eyeless Dog.",
"Got caught using a mechanical keyboard.",
"Wasn't quiet around an Eyeless Dog.",
};
case AdvancedCauseOfDeath.Enemy_ForestGiant:
Expand All @@ -258,6 +258,8 @@ public static string[] SelectCauseOfDeath(AdvancedCauseOfDeath? causeOfDeath)
case AdvancedCauseOfDeath.Enemy_GhostGirl:
return new[] {
"Died a mysterious death.",
"Lost their mind.",
"Got a real bad headache.",
"???",
};
case AdvancedCauseOfDeath.Enemy_EarthLeviathan:
Expand All @@ -271,12 +273,14 @@ public static string[] SelectCauseOfDeath(AdvancedCauseOfDeath? causeOfDeath)
};
case AdvancedCauseOfDeath.Enemy_Jester:
return new[] {
"Mauled to death by a Jester.",
"Was the butt of the Jester's joke.",
"Got pranked by the Jester.",
"Got popped like a weasel.",
};
case AdvancedCauseOfDeath.Enemy_CoilHead:
return new[] {
"Mauled to death by a Coil Head.",
"Got in a staring contest with a Coil Head.",
"Lost a staring contest with a Coil Head.",
};
Expand All @@ -288,13 +292,18 @@ public static string[] SelectCauseOfDeath(AdvancedCauseOfDeath? causeOfDeath)
return new[] {
"Was absorbed by a Hygrodere.",
"Got lost in the sauce.",
"Had an oopsie with a Hygrodere.",
};
case AdvancedCauseOfDeath.Enemy_HoarderBug:
return new[] {
"Was mauled by a Hoarder Bug.",
"Was swarmed by a Hoarder Bug.",
"Was hoarded by a Hoarder Bug.",
"Tried to steal from a Hoarder Bug.",
};
case AdvancedCauseOfDeath.Enemy_SporeLizard:
return new[] {
"Was bitten by a Spore Lizard.",
"Was puffed by a Spore Lizard.",
};
case AdvancedCauseOfDeath.Enemy_BunkerSpider:
Expand All @@ -309,74 +318,92 @@ public static string[] SelectCauseOfDeath(AdvancedCauseOfDeath? causeOfDeath)

case AdvancedCauseOfDeath.Enemy_MaskedPlayer_Wear:
return new[] {
"Nobody cared who they were until they put on the Mask.",
"Donned the Mask.",
"Nobody cared who they were until they put on the Mask.",
};
case AdvancedCauseOfDeath.Enemy_MaskedPlayer_Victim:
return new[] {
"Became a tragedy at the hands of the Mask.",
"Was killed by a Masked coworker.",
"Became a tragedy at the hands of the Mask.",
};
case AdvancedCauseOfDeath.Enemy_Nutcracker_Kicked:
return new[] {
"Got their nuts cracked by a Nutcracker.",
"Was kicked to death by a Nutcracker.",
"Got their nuts cracked by a Nutcracker.",
};
case AdvancedCauseOfDeath.Enemy_Nutcracker_Shot:
return new[] {
"Was at the wrong end of a 21-gun salute.",
"Got shot by a Nutcracker.",
"Was at the wrong end of a 21-gun salute.",
};

case AdvancedCauseOfDeath.Player_Jetpack_Gravity:
return new[] {
"Fell while using a jetpack.",
"Flew too close to the sun.",
"Ran out of fuel.",
};
case AdvancedCauseOfDeath.Player_Jetpack_Blast:
return new[] {
"Blew up while using a Jetpack.",
"Turned into a firework.",
"Got blown up by bad piloting.",
};
case AdvancedCauseOfDeath.Player_Murder_Melee:
return new[] {
"Was bludgeoned to death by a coworker.",
"Was the victim of a murder.",
"Got murdered.",
"Was bludgeoned to death by a coworker.",
"Got backstabbed by a coworker."
};
case AdvancedCauseOfDeath.Player_Murder_Shotgun:
return new[] {
// "Was the victim of a murder.",
// "Got murdered.",
// "Was shot to death by a coworker.",
// "Got one-pumped by a coworker.",
"Was shot to death by a coworker.",
"Was the victim of a murder.",
"Got murdered.",
"Got one-pumped by a coworker.",
"Got 360-noscoped by a coworker.",
};
case AdvancedCauseOfDeath.Player_Quicksand:
return new[] {
"Got stuck in quicksand.",
"Drowned in quicksand",
};
case AdvancedCauseOfDeath.Player_DepositItemsDesk:
case AdvancedCauseOfDeath.Player_StunGrenade:
return new[] {
"Got flashbanged by a coworker.",
"Was the victim of a murder.",
};

case AdvancedCauseOfDeath.Other_DepositItemsDesk:
// NOTE: Since there's no performance report on Gordion this never shows.
return new[] {
"Received a demotion.",
"Was put on disciplinary leave.",
};
case AdvancedCauseOfDeath.Player_Dropship:
case AdvancedCauseOfDeath.Other_Dropship:
return new[] {
"Was crushed by the Item Dropship.",
"Couldn't wait for their items.",
"Got too impatient for their items.",
};
case AdvancedCauseOfDeath.Player_StunGrenade:
return new[] {
"Was the victim of a murder.",
case AdvancedCauseOfDeath.Other_Landmine:
return new [] {
"Stepped on a landmine."
};
case AdvancedCauseOfDeath.Other_Turret:
return new [] {
"Got shot by a turret."
};
case AdvancedCauseOfDeath.Other_Lightning:
return new [] {
"Was struck by lightning."
};

// case AdvancedCauseOfDeath.Unknown:
default:
return new[] {
"Most sincerely dead.",
"Died somehow.",
"Most sincerely dead.",
"Expired in an inexplicable manner."
};
}
}
Expand Down Expand Up @@ -433,8 +460,12 @@ enum AdvancedCauseOfDeath
Player_Quicksand,
Player_Murder_Melee,
Player_Murder_Shotgun,
Player_DepositItemsDesk,
Player_Dropship,
Player_StunGrenade, // TODO: Implement this.

Other_Landmine,
Other_Turret,
Other_Lightning,
Other_DepositItemsDesk,
Other_Dropship,
}
}
12 changes: 6 additions & 6 deletions Coroner/LCAPI/DeathBroadcasterLCAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ class DeathBroadcasterLCAPI {
const string SIGNATURE_DEATH = PluginInfo.PLUGIN_GUID + ".death";

public static void Initialize() {
Plugin.Instance.PluginLogger.LogInfo("Initializing DeathBroadcaster...");
Plugin.Instance.PluginLogger.LogDebug("Initializing DeathBroadcaster...");
if (Plugin.Instance.IsLCAPIPresent) {
Plugin.Instance.PluginLogger.LogInfo("LC_API is present! Registering signature...");
Plugin.Instance.PluginLogger.LogDebug("LC_API is present! Registering signature...");
LC_API.ServerAPI.Networking.GetString += OnBroadcastString;
} else {
Plugin.Instance.PluginLogger.LogError("LC_API is not present! Why did you try to register the DeathBroadcaster?");
Expand All @@ -16,22 +16,22 @@ public static void Initialize() {

static void OnBroadcastString(string data, string signature) {
if (signature == SIGNATURE_DEATH) {
Plugin.Instance.PluginLogger.LogInfo("Broadcast has been received from LC_API!");
Plugin.Instance.PluginLogger.LogDebug("Broadcast has been received from LC_API!");
string[] split = data.Split('|');
int playerId = int.Parse(split[0]);
int causeOfDeathInt = int.Parse(split[1]);
AdvancedCauseOfDeath causeOfDeath = (AdvancedCauseOfDeath) causeOfDeathInt;
Plugin.Instance.PluginLogger.LogInfo("Player " + playerId + " died of " + AdvancedDeathTracker.StringifyCauseOfDeath(causeOfDeath));
Plugin.Instance.PluginLogger.LogDebug("Player " + playerId + " died of " + AdvancedDeathTracker.StringifyCauseOfDeath(causeOfDeath));
AdvancedDeathTracker.SetCauseOfDeath(playerId, causeOfDeath, false);
}
}

public static void AttemptBroadcast(string data, string signature) {
if (Plugin.Instance.IsLCAPIPresent) {
Plugin.Instance.PluginLogger.LogInfo("LC_API is present! Broadcasting...");
Plugin.Instance.PluginLogger.LogDebug("LC_API is present! Broadcasting...");
LC_API.ServerAPI.Networking.Broadcast(data, signature);
} else {
Plugin.Instance.PluginLogger.LogInfo("LC_API is not present! Skipping broadcast...");
Plugin.Instance.PluginLogger.LogDebug("LC_API is not present! Skipping broadcast...");
}
}
}
Expand Down
Loading

0 comments on commit 7837972

Please sign in to comment.