Skip to content

Commit 789611b

Browse files
committed
Initial commit
0 parents  commit 789611b

8 files changed

Lines changed: 179 additions & 0 deletions

File tree

CrowdedMod.HostOnlyKick.sln

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrowdedMod.HostOnlyKick", "CrowdedMod.HostOnlyKick\CrowdedMod.HostOnlyKick\CrowdedMod.HostOnlyKick.csproj", "{B6CB4747-C1D1-489E-99B5-1C07CF12A8C3}"
4+
EndProject
5+
Global
6+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7+
Debug|Any CPU = Debug|Any CPU
8+
Release|Any CPU = Release|Any CPU
9+
EndGlobalSection
10+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
11+
{B6CB4747-C1D1-489E-99B5-1C07CF12A8C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
12+
{B6CB4747-C1D1-489E-99B5-1C07CF12A8C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
13+
{B6CB4747-C1D1-489E-99B5-1C07CF12A8C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
14+
{B6CB4747-C1D1-489E-99B5-1C07CF12A8C3}.Release|Any CPU.Build.0 = Release|Any CPU
15+
EndGlobalSection
16+
EndGlobal
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: CI
2+
3+
on: [ "push", "pull_request" ]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-20.04
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
with:
12+
submodules: true
13+
14+
- name: Setup .NET
15+
uses: actions/setup-dotnet@v1
16+
with:
17+
dotnet-version: 6.x
18+
19+
- name: Run the Cake script
20+
uses: cake-build/cake-action@v1
21+
with:
22+
verbosity: Diagnostic
23+
24+
- uses: actions/upload-artifact@v2
25+
with:
26+
name: CrowdedMod.HostOnlyKick.dll
27+
path: CrowdedMod.HostOnlyKick/bin/Release/netstandard2.1/CrowdedMod.HostOnlyKick.dll
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrowdedMod.HostOnlyKick", "CrowdedMod.HostOnlyKick\CrowdedMod.HostOnlyKick.csproj", "{11FBC798-BAF5-4EE5-9511-BE6DB0592F99}"
4+
EndProject
5+
Global
6+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7+
Debug|Any CPU = Debug|Any CPU
8+
Release|Any CPU = Release|Any CPU
9+
EndGlobalSection
10+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
11+
{11FBC798-BAF5-4EE5-9511-BE6DB0592F99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
12+
{11FBC798-BAF5-4EE5-9511-BE6DB0592F99}.Debug|Any CPU.Build.0 = Debug|Any CPU
13+
{11FBC798-BAF5-4EE5-9511-BE6DB0592F99}.Release|Any CPU.ActiveCfg = Release|Any CPU
14+
{11FBC798-BAF5-4EE5-9511-BE6DB0592F99}.Release|Any CPU.Build.0 = Release|Any CPU
15+
EndGlobalSection
16+
EndGlobal
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>netstandard2.1</TargetFramework>
4+
<LangVersion>latest</LangVersion>
5+
<DebugType>embedded</DebugType>
6+
7+
<VersionPrefix>1.0.0</VersionPrefix>
8+
<VersionSuffix>dev</VersionSuffix>
9+
<Description>Addon mod for CrowdedMod to prevent players targeting someone to get kicked</Description>
10+
<Authors>CrowdedMods</Authors>
11+
</PropertyGroup>
12+
13+
<PropertyGroup>
14+
<GamePlatform Condition="'$(GamePlatform)' == ''">Steam</GamePlatform>
15+
<GameVersion Condition="'$(GamePlatform)' == 'Steam'">2022.3.29</GameVersion>
16+
<GameVersion Condition="'$(GamePlatform)' == 'Itch'">2022.3.29</GameVersion>
17+
</PropertyGroup>
18+
19+
<ItemGroup>
20+
<PackageReference Include="Reactor" Version="1.1.0" />
21+
<PackageReference Include="BepInEx.IL2CPP" Version="6.0.0-be.540" />
22+
<PackageReference Include="AmongUs.GameLibs.$(GamePlatform)" Version="$(GameVersion)" PrivateAssets="all" />
23+
24+
<PackageReference Include="BepInEx.AutoPlugin" Version="1.0.1" PrivateAssets="all" />
25+
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="1.0.2" PrivateAssets="all" />
26+
</ItemGroup>
27+
28+
<Target Name="Copy" AfterTargets="Build" Condition="'$(AmongUs)' != ''">
29+
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(AmongUs)/BepInEx/plugins/" UseSymboliclinksIfPossible="true" />
30+
</Target>
31+
</Project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using BepInEx;
2+
using BepInEx.IL2CPP;
3+
using HarmonyLib;
4+
using Reactor;
5+
6+
namespace CrowdedMod.HostOnlyKick;
7+
8+
[BepInAutoPlugin]
9+
[BepInProcess("Among Us.exe")]
10+
[BepInDependency(ReactorPlugin.Id)]
11+
public partial class HostOnlyKickPlugin : BasePlugin
12+
{
13+
public Harmony Harmony { get; } = new(Id);
14+
15+
public override void Load()
16+
{
17+
Harmony.PatchAll();
18+
}
19+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using HarmonyLib;
2+
3+
namespace CrowdedMod.HostOnlyKick;
4+
5+
internal static class Patches
6+
{
7+
[HarmonyPatch(typeof(VoteBanSystem), nameof(VoteBanSystem.AddVote))]
8+
public static class VoteBanSystemAddVotePatch
9+
{
10+
private static bool Prefix()
11+
{
12+
return false;
13+
}
14+
}
15+
16+
[HarmonyPatch(typeof(VoteBanSystem), nameof(VoteBanSystem.CmdAddVote))]
17+
public static class VoteBanSystemCmdAddVotePatch
18+
{
19+
private static bool Prefix([HarmonyArgument(0)] int clientId)
20+
{
21+
if (AmongUsClient.Instance.AmHost)
22+
{
23+
AmongUsClient.Instance.KickPlayer(clientId, false);
24+
}
25+
26+
return false;
27+
}
28+
}
29+
}

CrowdedMod.HostOnlyKick/build.cake

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
var target = Argument("target", "Build");
2+
3+
var buildId = EnvironmentVariable("GITHUB_RUN_NUMBER");
4+
5+
var @ref = EnvironmentVariable("GITHUB_REF");
6+
const string prefix = "refs/tags/";
7+
var tag = !string.IsNullOrEmpty(@ref) && @ref.StartsWith(prefix) ? @ref.Substring(prefix.Length) : null;
8+
9+
Task("Build")
10+
.Does(() =>
11+
{
12+
var settings = new DotNetCoreBuildSettings
13+
{
14+
Configuration = "Release",
15+
MSBuildSettings = new DotNetCoreMSBuildSettings()
16+
};
17+
18+
if (tag != null)
19+
{
20+
settings.MSBuildSettings.Properties["Version"] = new[] { tag };
21+
}
22+
else if (buildId != null)
23+
{
24+
settings.VersionSuffix = "ci." + buildId;
25+
}
26+
27+
foreach (var gamePlatform in new[] { "Steam", "Itch" })
28+
{
29+
settings.MSBuildSettings.Properties["GamePlatform"] = new[] { gamePlatform };
30+
DotNetCoreBuild(".", settings);
31+
}
32+
});
33+
34+
RunTarget(target);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<configuration>
4+
<packageSources>
5+
<add key="BepInEx" value="https://nuget.bepinex.dev/v3/index.json" />
6+
</packageSources>
7+
</configuration>

0 commit comments

Comments
 (0)