Skip to content

Commit 532e759

Browse files
first commit
0 parents  commit 532e759

28 files changed

+766
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build/
2+
include/
3+
Releases/*
4+
Releases/*.*
5+
!Releases/build.bat
Binary file not shown.
Binary file not shown.
317 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

.vs/WackyCosmetics/FileContentIndex/read.lock

Whitespace-only changes.

.vs/WackyCosmetics/v17/.futdcache.v2

167 Bytes
Binary file not shown.

.vs/WackyCosmetics/v17/.suo

37.5 KB
Binary file not shown.

.vscode/tasks.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "dotnet: debug build",
6+
"type": "process",
7+
"command": "dotnet",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/Coroner.sln",
11+
"-c Release",
12+
"/property:GenerateFullPaths=true",
13+
"/consoleloggerparameters:NoSummary",
14+
"--no-dependencies"
15+
],
16+
"problemMatcher": [
17+
"$msCompile"
18+
]
19+
}
20+
]
21+
}

Art/StungByBees.png

449 KB
Loading

Art/icon.png

25.4 KB
Loading

Art/manifest.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "Coroner",
3+
"version_number": "1.0.0",
4+
"website_url": "https://github.com/EliteMasterEric/Coroner",
5+
"description": "Rework the Performance Report with new info, including cause of death.",
6+
"dependencies": []
7+
}

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Changelog
2+
3+
## 1.0.0
4+
Initial release.
5+
- Added cause of death to the results screen.
6+
- Added advanced cause-of-death tracking for specific enemies, falling back to built-in tracking on failure.

Coroner.sln

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.5.002.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Coroner", "Coroner\Coroner.csproj", "{04FD6926-5D80-4206-8FDF-1ACC140E9DD7}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{04FD6926-5D80-4206-8FDF-1ACC140E9DD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{04FD6926-5D80-4206-8FDF-1ACC140E9DD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{04FD6926-5D80-4206-8FDF-1ACC140E9DD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{04FD6926-5D80-4206-8FDF-1ACC140E9DD7}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {9973961F-F45A-4406-8788-DFF58FC1CA65}
24+
EndGlobalSection
25+
EndGlobal

Coroner/AdvancedCauseOfDeath.cs

+203
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using GameNetcodeStuff;
4+
using Steamworks;
5+
6+
namespace Coroner {
7+
class AdvancedDeathTracker {
8+
private static readonly Dictionary<int, AdvancedCauseOfDeath> PlayerCauseOfDeath = new Dictionary<int, AdvancedCauseOfDeath>();
9+
10+
public static void ClearDeathTracker() {
11+
PlayerCauseOfDeath.Clear();
12+
}
13+
14+
public static void SetCauseOfDeath(int playerIndex, AdvancedCauseOfDeath causeOfDeath) {
15+
PlayerCauseOfDeath[playerIndex] = causeOfDeath;
16+
}
17+
18+
public static void SetCauseOfDeath(int playerIndex, CauseOfDeath causeOfDeath) {
19+
SetCauseOfDeath(playerIndex, ConvertCauseOfDeath(causeOfDeath));
20+
}
21+
22+
public static void SetCauseOfDeath(PlayerControllerB playerController, CauseOfDeath causeOfDeath) {
23+
SetCauseOfDeath((int) playerController.playerClientId, ConvertCauseOfDeath(causeOfDeath));
24+
}
25+
26+
public static void SetCauseOfDeath(PlayerControllerB playerController, AdvancedCauseOfDeath causeOfDeath) {
27+
SetCauseOfDeath((int) playerController.playerClientId, causeOfDeath);
28+
}
29+
30+
public static AdvancedCauseOfDeath GetCauseOfDeath(int playerIndex) {
31+
PlayerControllerB playerController = StartOfRound.Instance.allPlayerScripts[playerIndex];
32+
33+
return GetCauseOfDeath(playerController);
34+
}
35+
36+
public static AdvancedCauseOfDeath GetCauseOfDeath(PlayerControllerB playerController) {
37+
if (!PlayerCauseOfDeath.ContainsKey((int) playerController.playerClientId)) {
38+
return GuessCauseOfDeath(playerController);
39+
}
40+
return PlayerCauseOfDeath[(int) playerController.playerClientId];
41+
}
42+
43+
public static AdvancedCauseOfDeath GuessCauseOfDeath(PlayerControllerB playerController) {
44+
if (playerController.isPlayerDead) {
45+
if (playerController.causeOfDeath == CauseOfDeath.Suffocation && playerController.isSinking) {
46+
return AdvancedCauseOfDeath.Quicksand;
47+
} else if (IsHoldingJetpack(playerController)) {
48+
if (playerController.causeOfDeath == CauseOfDeath.Gravity) {
49+
return AdvancedCauseOfDeath.Jetpack_Gravity;
50+
} else if (playerController.causeOfDeath == CauseOfDeath.Blast) {
51+
return AdvancedCauseOfDeath.Jetpack_Blast;
52+
}
53+
}
54+
55+
return ConvertCauseOfDeath(playerController.causeOfDeath);
56+
} else {
57+
return AdvancedCauseOfDeath.Unknown;
58+
}
59+
}
60+
61+
public static bool IsHoldingJetpack(PlayerControllerB playerController) {
62+
var heldObject = playerController.currentlyHeldObjectServer.gameObject.GetComponent<GrabbableObject>();
63+
if (heldObject == null) {
64+
return false;
65+
}
66+
if (heldObject is JetpackItem) {
67+
return true;
68+
} else {
69+
return false;
70+
}
71+
}
72+
73+
public static AdvancedCauseOfDeath ConvertCauseOfDeath(CauseOfDeath causeOfDeath) {
74+
switch (causeOfDeath) {
75+
case CauseOfDeath.Unknown:
76+
return AdvancedCauseOfDeath.Unknown;
77+
case CauseOfDeath.Bludgeoning:
78+
return AdvancedCauseOfDeath.Bludgeoning;
79+
case CauseOfDeath.Gravity:
80+
return AdvancedCauseOfDeath.Gravity;
81+
case CauseOfDeath.Blast:
82+
return AdvancedCauseOfDeath.Blast;
83+
case CauseOfDeath.Strangulation:
84+
return AdvancedCauseOfDeath.Strangulation;
85+
case CauseOfDeath.Suffocation:
86+
return AdvancedCauseOfDeath.Suffocation;
87+
case CauseOfDeath.Mauling:
88+
return AdvancedCauseOfDeath.Mauling;
89+
case CauseOfDeath.Gunshots:
90+
return AdvancedCauseOfDeath.Gunshots;
91+
case CauseOfDeath.Crushing:
92+
return AdvancedCauseOfDeath.Crushing;
93+
case CauseOfDeath.Drowning:
94+
return AdvancedCauseOfDeath.Drowning;
95+
case CauseOfDeath.Abandoned:
96+
return AdvancedCauseOfDeath.Abandoned;
97+
case CauseOfDeath.Electrocution:
98+
return AdvancedCauseOfDeath.Electrocution;
99+
default:
100+
return AdvancedCauseOfDeath.Unknown;
101+
}
102+
}
103+
104+
public static string StringifyCauseOfDeath(CauseOfDeath causeOfDeath) {
105+
return StringifyCauseOfDeath(ConvertCauseOfDeath(causeOfDeath));
106+
}
107+
108+
public static string StringifyCauseOfDeath(AdvancedCauseOfDeath causeOfDeath) {
109+
switch (causeOfDeath) {
110+
case AdvancedCauseOfDeath.Bludgeoning:
111+
return "Bludgeoned to death.";
112+
case AdvancedCauseOfDeath.Gravity:
113+
return "Fell to their death.";
114+
case AdvancedCauseOfDeath.Blast:
115+
return "Exploded.";
116+
case AdvancedCauseOfDeath.Strangulation:
117+
return "Strangled to death.";
118+
case AdvancedCauseOfDeath.Suffocation:
119+
return "Suffocated to death.";
120+
case AdvancedCauseOfDeath.Mauling:
121+
return "Mauled to death.";
122+
case AdvancedCauseOfDeath.Gunshots:
123+
return "Shot to death by a turret.";
124+
case AdvancedCauseOfDeath.Crushing:
125+
return "Crushed to death.";
126+
case AdvancedCauseOfDeath.Drowning:
127+
return "Drowned to death.";
128+
case AdvancedCauseOfDeath.Abandoned:
129+
return "Abandoned by their coworkers.";
130+
case AdvancedCauseOfDeath.Electrocution:
131+
return "Electrocuted to death.";
132+
133+
case AdvancedCauseOfDeath.Enemy_DepositItemsDesk:
134+
return "Received a demotion.";
135+
case AdvancedCauseOfDeath.Enemy_Bracken:
136+
return "Had their neck snapped by a Bracken.";
137+
case AdvancedCauseOfDeath.Enemy_EyelessDog:
138+
return "Was eaten by an Eyeless Dog.";
139+
case AdvancedCauseOfDeath.Enemy_ForestGiant:
140+
return "Swallowed whole by a Forest Giant.";
141+
case AdvancedCauseOfDeath.Enemy_CircuitBees:
142+
return "Electro-stung to death by Circuit Bees.";
143+
case AdvancedCauseOfDeath.Enemy_GhostGirl:
144+
return "Died a mysterious death.";
145+
case AdvancedCauseOfDeath.Enemy_EarthLeviathan:
146+
return "Swallowed whole by an Earth Leviathan.";
147+
case AdvancedCauseOfDeath.Enemy_BaboonHawk:
148+
return "Was eaten by a Baboon Hawk.";
149+
case AdvancedCauseOfDeath.Enemy_Jester:
150+
return "Was the butt of a joke.";
151+
152+
case AdvancedCauseOfDeath.Quicksand:
153+
return "Got stuck in quicksand.";
154+
case AdvancedCauseOfDeath.Jetpack_Gravity:
155+
return "Flew too close to the sun.";
156+
case AdvancedCauseOfDeath.Jetpack_Blast:
157+
return "Went up in a fiery blaze.";
158+
159+
case AdvancedCauseOfDeath.Unknown:
160+
return "Died somehow.";
161+
default:
162+
return "Died somehow.";
163+
}
164+
}
165+
166+
internal static void SetCauseOfDeath(PlayerControllerB playerControllerB, object enemy_BaboonHawk)
167+
{
168+
throw new NotImplementedException();
169+
}
170+
}
171+
172+
enum AdvancedCauseOfDeath {
173+
// Basic causes of death
174+
Unknown,
175+
Bludgeoning,
176+
Gravity,
177+
Blast,
178+
Strangulation,
179+
Suffocation,
180+
Mauling,
181+
Gunshots,
182+
Crushing,
183+
Drowning,
184+
Abandoned,
185+
Electrocution,
186+
187+
// Custom causes (enemies)
188+
Enemy_DepositItemsDesk,
189+
Enemy_Bracken, // Also known as Flowerman
190+
Enemy_EyelessDog, // Also known as MouthDog
191+
Enemy_ForestGiant,
192+
Enemy_CircuitBees, // Also known as RedLocustBees
193+
Enemy_GhostGirl, // Also known as DressGirl
194+
Enemy_EarthLeviathan, // Also known as SandWorm
195+
Enemy_BaboonHawk, // Also known as BaboonBird
196+
197+
// Custom causes (other)
198+
Quicksand,
199+
Enemy_Jester,
200+
Jetpack_Gravity,
201+
Jetpack_Blast,
202+
}
203+
}

Coroner/Coroner.csproj

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.1</TargetFramework>
5+
6+
<Company>EliteMasterEric</Company>
7+
<AssemblyName>Coroner</AssemblyName>
8+
<GUID>com.elitemastereric.coroner</GUID>
9+
<Version>1.0.0</Version>
10+
11+
<Title>Coroner</Title>
12+
<Description>Rework the Performance Report with new info, including cause of death.</Description>
13+
14+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
15+
<LangVersion>latest</LangVersion>
16+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
17+
</PropertyGroup>
18+
19+
<ItemGroup>
20+
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all" />
21+
<PackageReference Include="BepInEx.Core" Version="5.*" />
22+
<PackageReference Include="HarmonyX" Version="2.10.2" />
23+
<!-- <PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" /> -->
24+
<PackageReference Include="UnityEngine.Modules" Version="2022.3.9" IncludeAssets="compile" />
25+
</ItemGroup>
26+
27+
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
28+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all" />
29+
</ItemGroup>
30+
31+
<ItemGroup>
32+
<Reference Include="Assembly-CSharp">
33+
<Private>false</Private>
34+
<HintPath>..\include\Assembly-CSharp.dll</HintPath>
35+
</Reference>
36+
<Reference Include="DissonanceVoip">
37+
<Private>false</Private>
38+
<HintPath>..\include\DissonanceVoip.dll</HintPath>
39+
</Reference>
40+
<Reference Include="Facepunch Transport for Netcode for GameObjects">
41+
<Private>false</Private>
42+
<HintPath>..\include\Facepunch Transport for Netcode for GameObjects.dll</HintPath>
43+
</Reference>
44+
<Reference Include="Facepunch.Steamworks.Win64">
45+
<Private>false</Private>
46+
<HintPath>..\include\Facepunch.Steamworks.Win64.dll</HintPath>
47+
</Reference>
48+
<Reference Include="Unity.Collections">
49+
<Private>false</Private>
50+
<HintPath>..\include\Unity.Collections.dll</HintPath>
51+
</Reference>
52+
<Reference Include="Unity.RenderPipelines.HighDefinition.Config.Runtime">
53+
<Private>false</Private>
54+
<HintPath>..\include\Unity.RenderPipelines.HighDefinition.Config.Runtime.dll</HintPath>
55+
</Reference>
56+
<Reference Include="Unity.RenderPipelines.HighDefinition.Runtime">
57+
<Private>false</Private>
58+
<HintPath>..\include\Unity.RenderPipelines.HighDefinition.Runtime.dll</HintPath>
59+
</Reference>
60+
<Reference Include="Unity.Netcode.Components">
61+
<Private>false</Private>
62+
<HintPath>..\include\Unity.Netcode.Components.dll</HintPath>
63+
</Reference>
64+
<Reference Include="Unity.Netcode.Runtime">
65+
<Private>false</Private>
66+
<HintPath>..\include\Unity.Netcode.Runtime.dll</HintPath>
67+
</Reference>
68+
<Reference Include="Unity.TextMeshPro">
69+
<Private>false</Private>
70+
<HintPath>..\include\Unity.TextMeshPro.dll</HintPath>
71+
</Reference>
72+
<Reference Include="UnityEngine.UI">
73+
<Private>false</Private>
74+
<HintPath>..\include\UnityEngine.UI.dll</HintPath>
75+
</Reference>
76+
</ItemGroup>
77+
78+
<ItemGroup>
79+
<!--
80+
<EmbeddedResource Include="..\Bundles\**\*.*">
81+
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
82+
</EmbeddedResource>
83+
-->
84+
<EmbeddedResource Include="..\Bundles\**\*">
85+
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
86+
</EmbeddedResource>
87+
</ItemGroup>
88+
89+
<!-- Fuck you. -->
90+
<Target Name="PostBuild" BeforeTargets="PostBuildEvent">
91+
<Exec Command="del %22$(TargetDir)$(TargetName).deps.json%22" />
92+
<Exec Command="del %22$(TargetDir)$(TargetName).pdb%22" />
93+
</Target>
94+
</Project>

Coroner/Directory.Build.props

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project>
2+
<PropertyGroup>
3+
<BaseOutputPath>./build/bin</BaseOutputPath>
4+
<BaseIntermediateOutputPath>./build/obj</BaseIntermediateOutputPath>
5+
</PropertyGroup>
6+
</Project>

0 commit comments

Comments
 (0)