Add few games
This commit is contained in:
143
Projects/TerraTech/TerraTech/Class1.cs
Normal file
143
Projects/TerraTech/TerraTech/Class1.cs
Normal file
@@ -0,0 +1,143 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using HarmonyLib.Tools;
|
||||
using UnityEngine;
|
||||
|
||||
// TODO: Make magnet better
|
||||
// TODO: Make more energy generate
|
||||
// TODO: Make attractor more range
|
||||
// TODO: Make battery bigger
|
||||
|
||||
namespace TerraTech {
|
||||
[BepInPlugin(pluginGuid, pluginName, pluginVersion)]
|
||||
public class Main : BaseUnityPlugin {
|
||||
private const string pluginGuid = "CykaMod";
|
||||
private const string pluginName = "CykaMod";
|
||||
private const string pluginVersion = "1.0.0";
|
||||
|
||||
public static ConfigEntry<int> xpMultiplier;
|
||||
public static ConfigEntry<int> moneyMultiplier;
|
||||
public static ConfigEntry<float> energyGenMultiplier;
|
||||
public static ConfigEntry<bool> allProjectilesHoming;
|
||||
public static ConfigEntry<float> shootingSpeedMultiplier;
|
||||
public static ConfigEntry<float> muzzleVelocityMultiplier;
|
||||
|
||||
public void Awake() {
|
||||
xpMultiplier = Config.Bind("General", "XP Multiplier", 1);
|
||||
moneyMultiplier = Config.Bind("General", "Money Multiplier", 1);
|
||||
energyGenMultiplier = Config.Bind("General", "Energy Generation Multiplier", 1f);
|
||||
shootingSpeedMultiplier = Config.Bind("General", "Shooting Speed Multiplier", 1f);
|
||||
muzzleVelocityMultiplier = Config.Bind("General", "Muzzle Velocity Multiplier", 1f);
|
||||
allProjectilesHoming = Config.Bind("General", "Make All Projectiles Home", false);
|
||||
|
||||
shootingSpeedMultiplier.SettingChanged += (sender, args) => WeaponPropertiesManager.DoPatch();
|
||||
WeaponPropertiesManager.DoPatch();
|
||||
|
||||
Logger.LogInfo("Cyka mod loaded");
|
||||
HarmonyFileLog.Enabled = true;
|
||||
Harmony harmony = new Harmony(pluginGuid);
|
||||
harmony.PatchAll();
|
||||
var originalMethods = harmony.GetPatchedMethods();
|
||||
Logger.LogInfo("Patched " + originalMethods.Count() + " methods");
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ManLicenses), "AddXP")]
|
||||
public class XPMultiplierPatch {
|
||||
static void Prefix(FactionSubTypes corporation, ref int xp, bool showUI = true) {
|
||||
xp *= Main.xpMultiplier.Value;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ManPlayer), "AddMoney")]
|
||||
public class MoneyMultiplierPatch {
|
||||
static void Prefix(ref int amount) {
|
||||
amount *= Main.moneyMultiplier.Value;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ModuleEnergy), "Supply")]
|
||||
public class EnergyGenerationMultiplierPatch {
|
||||
static void Prefix(EnergyRegulator.EnergyType type, ref float energyAmount) {
|
||||
if (energyAmount > 0) {
|
||||
energyAmount *= Main.energyGenMultiplier.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Projectile), "Fire")]
|
||||
public class HomingProjectilePatch {
|
||||
private static Dictionary<FireData, bool> patchedObjects = new Dictionary<FireData, bool>();
|
||||
|
||||
static void Prefix(Vector3 fireDirection, ref FireData fireData, ref ModuleWeaponGun weapon, Tank shooter, ref bool seekingRounds, bool replayRounds) {
|
||||
if (Main.allProjectilesHoming.Value) {
|
||||
seekingRounds = true;
|
||||
}
|
||||
if (Main.muzzleVelocityMultiplier.Value != -1f && !patchedObjects.ContainsKey(fireData)) {
|
||||
fireData.m_MuzzleVelocity *= Main.muzzleVelocityMultiplier.Value;
|
||||
patchedObjects.Add(fireData, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
public class WeaponPropertiesManager {
|
||||
private static Dictionary<ModuleWeaponGun, float> cooldowns = new Dictionary<ModuleWeaponGun, float>();
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(ModuleWeaponGun), "OnPool")]
|
||||
static void Postfix1WeaponCreate(ModuleWeaponGun __instance) {
|
||||
cooldowns.Add(__instance, __instance.m_ShotCooldown);
|
||||
if (ShouldPatch()) {
|
||||
DoPatchSingle(__instance);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(ModuleWeaponGun), "OnRecycle")]
|
||||
static void Postfix1WeaponDestroy(ModuleWeaponGun __instance) {
|
||||
cooldowns.Remove(__instance);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ModuleWeaponGun), "ProcessFiring")]
|
||||
static void PrefixProcessFiring(ModuleWeaponGun __instance, ref bool firing) {
|
||||
if (firing) {
|
||||
if (!cooldowns.ContainsKey(__instance)) {
|
||||
cooldowns.Add(__instance, __instance.m_ShotCooldown);
|
||||
DoPatchSingle(__instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void DoPatch() {
|
||||
Console.WriteLine("Modifying " + cooldowns.Count + " weapons");
|
||||
Console.WriteLine("Should patch: " + ShouldPatch());
|
||||
foreach (KeyValuePair<ModuleWeaponGun, float> keyValuePair in cooldowns) {
|
||||
if (ShouldPatch()) {
|
||||
DoPatchSingle(keyValuePair.Key);
|
||||
} else {
|
||||
DoRestoreSingle(keyValuePair.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void DoPatchSingle(ModuleWeaponGun weapon) {
|
||||
weapon.m_ShotCooldown /= Main.shootingSpeedMultiplier.Value;
|
||||
}
|
||||
|
||||
static void DoRestoreSingle(ModuleWeaponGun weapon) {
|
||||
if (cooldowns.ContainsKey(weapon)) {
|
||||
weapon.m_ShotCooldown = cooldowns[weapon];
|
||||
}
|
||||
}
|
||||
|
||||
static bool ShouldPatch() {
|
||||
return Math.Abs(Main.shootingSpeedMultiplier.Value - 1f) > 0.0001f;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
Projects/TerraTech/TerraTech/Properties/AssemblyInfo.cs
Normal file
35
Projects/TerraTech/TerraTech/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("TerraTech")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TerraTech")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2023")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
66
Projects/TerraTech/TerraTech/TerraTech.csproj
Normal file
66
Projects/TerraTech/TerraTech/TerraTech.csproj
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TerraTech</RootNamespace>
|
||||
<AssemblyName>TerraTech</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Class1.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>..\libs\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>..\libs\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BepInEx">
|
||||
<HintPath>..\libs\BepInEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ConfigurationManager">
|
||||
<HintPath>..\libs\ConfigurationManager.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>..\libs\UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>..\libs\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
BIN
Projects/TerraTech/TerraTech/bin/Debug/0Harmony.dll
Normal file
BIN
Projects/TerraTech/TerraTech/bin/Debug/0Harmony.dll
Normal file
Binary file not shown.
BIN
Projects/TerraTech/TerraTech/bin/Debug/Assembly-CSharp.dll
Normal file
BIN
Projects/TerraTech/TerraTech/bin/Debug/Assembly-CSharp.dll
Normal file
Binary file not shown.
BIN
Projects/TerraTech/TerraTech/bin/Debug/BepInEx.dll
Normal file
BIN
Projects/TerraTech/TerraTech/bin/Debug/BepInEx.dll
Normal file
Binary file not shown.
BIN
Projects/TerraTech/TerraTech/bin/Debug/ConfigurationManager.dll
Normal file
BIN
Projects/TerraTech/TerraTech/bin/Debug/ConfigurationManager.dll
Normal file
Binary file not shown.
BIN
Projects/TerraTech/TerraTech/bin/Debug/TerraTech.dll
Normal file
BIN
Projects/TerraTech/TerraTech/bin/Debug/TerraTech.dll
Normal file
Binary file not shown.
BIN
Projects/TerraTech/TerraTech/bin/Debug/TerraTech.pdb
Normal file
BIN
Projects/TerraTech/TerraTech/bin/Debug/TerraTech.pdb
Normal file
Binary file not shown.
Binary file not shown.
BIN
Projects/TerraTech/TerraTech/bin/Debug/UnityEngine.dll
Normal file
BIN
Projects/TerraTech/TerraTech/bin/Debug/UnityEngine.dll
Normal file
Binary file not shown.
BIN
Projects/TerraTech/TerraTech/bin/Release/0Harmony.dll
Normal file
BIN
Projects/TerraTech/TerraTech/bin/Release/0Harmony.dll
Normal file
Binary file not shown.
BIN
Projects/TerraTech/TerraTech/bin/Release/Assembly-CSharp.dll
Normal file
BIN
Projects/TerraTech/TerraTech/bin/Release/Assembly-CSharp.dll
Normal file
Binary file not shown.
BIN
Projects/TerraTech/TerraTech/bin/Release/BepInEx.dll
Normal file
BIN
Projects/TerraTech/TerraTech/bin/Release/BepInEx.dll
Normal file
Binary file not shown.
BIN
Projects/TerraTech/TerraTech/bin/Release/TerraTech.dll
Normal file
BIN
Projects/TerraTech/TerraTech/bin/Release/TerraTech.dll
Normal file
Binary file not shown.
BIN
Projects/TerraTech/TerraTech/bin/Release/TerraTech.pdb
Normal file
BIN
Projects/TerraTech/TerraTech/bin/Release/TerraTech.pdb
Normal file
Binary file not shown.
Binary file not shown.
BIN
Projects/TerraTech/TerraTech/bin/Release/UnityEngine.dll
Normal file
BIN
Projects/TerraTech/TerraTech/bin/Release/UnityEngine.dll
Normal file
Binary file not shown.
@@ -0,0 +1,11 @@
|
||||
C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\TerraTech.dll
|
||||
C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\TerraTech.pdb
|
||||
C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\0Harmony.dll
|
||||
C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\Assembly-CSharp.dll
|
||||
C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\BepInEx.dll
|
||||
C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\UnityEngine.CoreModule.dll
|
||||
C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\UnityEngine.dll
|
||||
C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.csprojResolveAssemblyReference.cache
|
||||
C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.dll
|
||||
C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.pdb
|
||||
C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\ConfigurationManager.dll
|
||||
Binary file not shown.
BIN
Projects/TerraTech/TerraTech/obj/Debug/TerraTech.dll
Normal file
BIN
Projects/TerraTech/TerraTech/obj/Debug/TerraTech.dll
Normal file
Binary file not shown.
BIN
Projects/TerraTech/TerraTech/obj/Debug/TerraTech.pdb
Normal file
BIN
Projects/TerraTech/TerraTech/obj/Debug/TerraTech.pdb
Normal file
Binary file not shown.
Reference in New Issue
Block a user