Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteMasterEric committed Dec 1, 2023
0 parents commit 532e759
Show file tree
Hide file tree
Showing 28 changed files with 766 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build/
include/
Releases/*
Releases/*.*
!Releases/build.bat
Binary file not shown.
Binary file not shown.
Binary file added .vs/WackyCosmetics/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file added .vs/WackyCosmetics/v17/.futdcache.v2
Binary file not shown.
Binary file added .vs/WackyCosmetics/v17/.suo
Binary file not shown.
21 changes: 21 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "dotnet: debug build",
"type": "process",
"command": "dotnet",
"args": [
"build",
"${workspaceFolder}/Coroner.sln",
"-c Release",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"--no-dependencies"
],
"problemMatcher": [
"$msCompile"
]
}
]
}
Binary file added Art/StungByBees.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Art/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions Art/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Coroner",
"version_number": "1.0.0",
"website_url": "https://github.com/EliteMasterEric/Coroner",
"description": "Rework the Performance Report with new info, including cause of death.",
"dependencies": []
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog

## 1.0.0
Initial release.
- Added cause of death to the results screen.
- Added advanced cause-of-death tracking for specific enemies, falling back to built-in tracking on failure.
25 changes: 25 additions & 0 deletions Coroner.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Coroner", "Coroner\Coroner.csproj", "{04FD6926-5D80-4206-8FDF-1ACC140E9DD7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{04FD6926-5D80-4206-8FDF-1ACC140E9DD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{04FD6926-5D80-4206-8FDF-1ACC140E9DD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{04FD6926-5D80-4206-8FDF-1ACC140E9DD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{04FD6926-5D80-4206-8FDF-1ACC140E9DD7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9973961F-F45A-4406-8788-DFF58FC1CA65}
EndGlobalSection
EndGlobal
203 changes: 203 additions & 0 deletions Coroner/AdvancedCauseOfDeath.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
using System;
using System.Collections.Generic;
using GameNetcodeStuff;
using Steamworks;

namespace Coroner {
class AdvancedDeathTracker {
private static readonly Dictionary<int, AdvancedCauseOfDeath> PlayerCauseOfDeath = new Dictionary<int, AdvancedCauseOfDeath>();

public static void ClearDeathTracker() {
PlayerCauseOfDeath.Clear();
}

public static void SetCauseOfDeath(int playerIndex, AdvancedCauseOfDeath causeOfDeath) {
PlayerCauseOfDeath[playerIndex] = causeOfDeath;
}

public static void SetCauseOfDeath(int playerIndex, CauseOfDeath causeOfDeath) {
SetCauseOfDeath(playerIndex, ConvertCauseOfDeath(causeOfDeath));
}

public static void SetCauseOfDeath(PlayerControllerB playerController, CauseOfDeath causeOfDeath) {
SetCauseOfDeath((int) playerController.playerClientId, ConvertCauseOfDeath(causeOfDeath));
}

public static void SetCauseOfDeath(PlayerControllerB playerController, AdvancedCauseOfDeath causeOfDeath) {
SetCauseOfDeath((int) playerController.playerClientId, causeOfDeath);
}

public static AdvancedCauseOfDeath GetCauseOfDeath(int playerIndex) {
PlayerControllerB playerController = StartOfRound.Instance.allPlayerScripts[playerIndex];

return GetCauseOfDeath(playerController);
}

public static AdvancedCauseOfDeath GetCauseOfDeath(PlayerControllerB playerController) {
if (!PlayerCauseOfDeath.ContainsKey((int) playerController.playerClientId)) {
return GuessCauseOfDeath(playerController);
}
return PlayerCauseOfDeath[(int) playerController.playerClientId];
}

public static AdvancedCauseOfDeath GuessCauseOfDeath(PlayerControllerB playerController) {
if (playerController.isPlayerDead) {
if (playerController.causeOfDeath == CauseOfDeath.Suffocation && playerController.isSinking) {
return AdvancedCauseOfDeath.Quicksand;
} else if (IsHoldingJetpack(playerController)) {
if (playerController.causeOfDeath == CauseOfDeath.Gravity) {
return AdvancedCauseOfDeath.Jetpack_Gravity;
} else if (playerController.causeOfDeath == CauseOfDeath.Blast) {
return AdvancedCauseOfDeath.Jetpack_Blast;
}
}

return ConvertCauseOfDeath(playerController.causeOfDeath);
} else {
return AdvancedCauseOfDeath.Unknown;
}
}

public static bool IsHoldingJetpack(PlayerControllerB playerController) {
var heldObject = playerController.currentlyHeldObjectServer.gameObject.GetComponent<GrabbableObject>();
if (heldObject == null) {
return false;
}
if (heldObject is JetpackItem) {
return true;
} else {
return false;
}
}

public static AdvancedCauseOfDeath ConvertCauseOfDeath(CauseOfDeath causeOfDeath) {
switch (causeOfDeath) {
case CauseOfDeath.Unknown:
return AdvancedCauseOfDeath.Unknown;
case CauseOfDeath.Bludgeoning:
return AdvancedCauseOfDeath.Bludgeoning;
case CauseOfDeath.Gravity:
return AdvancedCauseOfDeath.Gravity;
case CauseOfDeath.Blast:
return AdvancedCauseOfDeath.Blast;
case CauseOfDeath.Strangulation:
return AdvancedCauseOfDeath.Strangulation;
case CauseOfDeath.Suffocation:
return AdvancedCauseOfDeath.Suffocation;
case CauseOfDeath.Mauling:
return AdvancedCauseOfDeath.Mauling;
case CauseOfDeath.Gunshots:
return AdvancedCauseOfDeath.Gunshots;
case CauseOfDeath.Crushing:
return AdvancedCauseOfDeath.Crushing;
case CauseOfDeath.Drowning:
return AdvancedCauseOfDeath.Drowning;
case CauseOfDeath.Abandoned:
return AdvancedCauseOfDeath.Abandoned;
case CauseOfDeath.Electrocution:
return AdvancedCauseOfDeath.Electrocution;
default:
return AdvancedCauseOfDeath.Unknown;
}
}

public static string StringifyCauseOfDeath(CauseOfDeath causeOfDeath) {
return StringifyCauseOfDeath(ConvertCauseOfDeath(causeOfDeath));
}

public static string StringifyCauseOfDeath(AdvancedCauseOfDeath causeOfDeath) {
switch (causeOfDeath) {
case AdvancedCauseOfDeath.Bludgeoning:
return "Bludgeoned to death.";
case AdvancedCauseOfDeath.Gravity:
return "Fell to their death.";
case AdvancedCauseOfDeath.Blast:
return "Exploded.";
case AdvancedCauseOfDeath.Strangulation:
return "Strangled to death.";
case AdvancedCauseOfDeath.Suffocation:
return "Suffocated to death.";
case AdvancedCauseOfDeath.Mauling:
return "Mauled to death.";
case AdvancedCauseOfDeath.Gunshots:
return "Shot to death by a turret.";
case AdvancedCauseOfDeath.Crushing:
return "Crushed to death.";
case AdvancedCauseOfDeath.Drowning:
return "Drowned to death.";
case AdvancedCauseOfDeath.Abandoned:
return "Abandoned by their coworkers.";
case AdvancedCauseOfDeath.Electrocution:
return "Electrocuted to death.";

case AdvancedCauseOfDeath.Enemy_DepositItemsDesk:
return "Received a demotion.";
case AdvancedCauseOfDeath.Enemy_Bracken:
return "Had their neck snapped by a Bracken.";
case AdvancedCauseOfDeath.Enemy_EyelessDog:
return "Was eaten by an Eyeless Dog.";
case AdvancedCauseOfDeath.Enemy_ForestGiant:
return "Swallowed whole by a Forest Giant.";
case AdvancedCauseOfDeath.Enemy_CircuitBees:
return "Electro-stung to death by Circuit Bees.";
case AdvancedCauseOfDeath.Enemy_GhostGirl:
return "Died a mysterious death.";
case AdvancedCauseOfDeath.Enemy_EarthLeviathan:
return "Swallowed whole by an Earth Leviathan.";
case AdvancedCauseOfDeath.Enemy_BaboonHawk:
return "Was eaten by a Baboon Hawk.";
case AdvancedCauseOfDeath.Enemy_Jester:
return "Was the butt of a joke.";

case AdvancedCauseOfDeath.Quicksand:
return "Got stuck in quicksand.";
case AdvancedCauseOfDeath.Jetpack_Gravity:
return "Flew too close to the sun.";
case AdvancedCauseOfDeath.Jetpack_Blast:
return "Went up in a fiery blaze.";

case AdvancedCauseOfDeath.Unknown:
return "Died somehow.";
default:
return "Died somehow.";
}
}

internal static void SetCauseOfDeath(PlayerControllerB playerControllerB, object enemy_BaboonHawk)
{
throw new NotImplementedException();
}
}

enum AdvancedCauseOfDeath {
// Basic causes of death
Unknown,
Bludgeoning,
Gravity,
Blast,
Strangulation,
Suffocation,
Mauling,
Gunshots,
Crushing,
Drowning,
Abandoned,
Electrocution,

// Custom causes (enemies)
Enemy_DepositItemsDesk,
Enemy_Bracken, // Also known as Flowerman
Enemy_EyelessDog, // Also known as MouthDog
Enemy_ForestGiant,
Enemy_CircuitBees, // Also known as RedLocustBees
Enemy_GhostGirl, // Also known as DressGirl
Enemy_EarthLeviathan, // Also known as SandWorm
Enemy_BaboonHawk, // Also known as BaboonBird

// Custom causes (other)
Quicksand,
Enemy_Jester,
Jetpack_Gravity,
Jetpack_Blast,
}
}
94 changes: 94 additions & 0 deletions Coroner/Coroner.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>

<Company>EliteMasterEric</Company>
<AssemblyName>Coroner</AssemblyName>
<GUID>com.elitemastereric.coroner</GUID>
<Version>1.0.0</Version>

<Title>Coroner</Title>
<Description>Rework the Performance Report with new info, including cause of death.</Description>

<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all" />
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="HarmonyX" Version="2.10.2" />
<!-- <PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" /> -->
<PackageReference Include="UnityEngine.Modules" Version="2022.3.9" IncludeAssets="compile" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<Reference Include="Assembly-CSharp">
<Private>false</Private>
<HintPath>..\include\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="DissonanceVoip">
<Private>false</Private>
<HintPath>..\include\DissonanceVoip.dll</HintPath>
</Reference>
<Reference Include="Facepunch Transport for Netcode for GameObjects">
<Private>false</Private>
<HintPath>..\include\Facepunch Transport for Netcode for GameObjects.dll</HintPath>
</Reference>
<Reference Include="Facepunch.Steamworks.Win64">
<Private>false</Private>
<HintPath>..\include\Facepunch.Steamworks.Win64.dll</HintPath>
</Reference>
<Reference Include="Unity.Collections">
<Private>false</Private>
<HintPath>..\include\Unity.Collections.dll</HintPath>
</Reference>
<Reference Include="Unity.RenderPipelines.HighDefinition.Config.Runtime">
<Private>false</Private>
<HintPath>..\include\Unity.RenderPipelines.HighDefinition.Config.Runtime.dll</HintPath>
</Reference>
<Reference Include="Unity.RenderPipelines.HighDefinition.Runtime">
<Private>false</Private>
<HintPath>..\include\Unity.RenderPipelines.HighDefinition.Runtime.dll</HintPath>
</Reference>
<Reference Include="Unity.Netcode.Components">
<Private>false</Private>
<HintPath>..\include\Unity.Netcode.Components.dll</HintPath>
</Reference>
<Reference Include="Unity.Netcode.Runtime">
<Private>false</Private>
<HintPath>..\include\Unity.Netcode.Runtime.dll</HintPath>
</Reference>
<Reference Include="Unity.TextMeshPro">
<Private>false</Private>
<HintPath>..\include\Unity.TextMeshPro.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<Private>false</Private>
<HintPath>..\include\UnityEngine.UI.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
<!--
<EmbeddedResource Include="..\Bundles\**\*.*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
</EmbeddedResource>
-->
<EmbeddedResource Include="..\Bundles\**\*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
</EmbeddedResource>
</ItemGroup>

<!-- Fuck you. -->
<Target Name="PostBuild" BeforeTargets="PostBuildEvent">
<Exec Command="del %22$(TargetDir)$(TargetName).deps.json%22" />
<Exec Command="del %22$(TargetDir)$(TargetName).pdb%22" />
</Target>
</Project>
6 changes: 6 additions & 0 deletions Coroner/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<PropertyGroup>
<BaseOutputPath>./build/bin</BaseOutputPath>
<BaseIntermediateOutputPath>./build/obj</BaseIntermediateOutputPath>
</PropertyGroup>
</Project>
Loading

0 comments on commit 532e759

Please sign in to comment.