Upload from upload_mods.ps1
This commit is contained in:
30
Dayuppy/Harmony/Harmony_AIDirectorBloodMoonParty.cs
Normal file
30
Dayuppy/Harmony/Harmony_AIDirectorBloodMoonParty.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
internal class Dayuppy_AIDirectorBloodMoonPartyPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(AIDirectorBloodMoonParty))]
|
||||
[HarmonyPatch("IsPlayerATarget")]
|
||||
public class IsPlayerATargetPatch
|
||||
{
|
||||
public static void Postfix(AIDirectorBloodMoonParty __instance, ref bool __result, EntityPlayer player)
|
||||
{
|
||||
__result = !player.IsDead() && player.IsSpawned() && !player.IsIgnoredByAI() && player.entityId != -1;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AIDirectorBloodMoonParty))]
|
||||
[HarmonyPatch("SpawnZombie")]
|
||||
public class SpawnZombiePatch
|
||||
{
|
||||
public static bool Prefix(AIDirectorBloodMoonParty __instance, ref bool __result, World _world, EntityPlayer _target, Vector3 _focusPos, Vector3 _radiusV)
|
||||
{
|
||||
if (RebirthUtilities.ScenarioSkip())
|
||||
{
|
||||
//Log.Out("Dayuppy_AIDirectorBloodMoonPartyPatches-SpawnZombie START: " + _target.biomeStandingOn.m_sBiomeName + $" ({_target.position})");
|
||||
|
||||
string biomeName = RebirthUtilities.GetBiomeName(_target);
|
||||
RebirthUtilities.SetHiveSpawnGroup(biomeName);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
186
Dayuppy/Harmony/Harmony_AIDirectorWanderingHordeComponent.cs
Normal file
186
Dayuppy/Harmony/Harmony_AIDirectorWanderingHordeComponent.cs
Normal file
@@ -0,0 +1,186 @@
|
||||
internal class Dayuppy_AIDirectorWanderingHordeComponentPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(AIDirectorWanderingHordeComponent))]
|
||||
[HarmonyPatch("StartSpawning")]
|
||||
public class StartSpawningPatch
|
||||
{
|
||||
public static bool Prefix(AIDirectorWanderingHordeComponent __instance, AIWanderingHordeSpawner.SpawnType _spawnType)
|
||||
{
|
||||
string optionWanderingHordeFrequencyMultiplier = RebirthVariables.customWanderingHordeFrequency;
|
||||
|
||||
if (optionWanderingHordeFrequencyMultiplier == "0")
|
||||
{
|
||||
//Log.Out("Dayuppy_AIDirectorWanderingHordeComponentPatches-StartSpawning EXIT");
|
||||
__instance.CleanupType(_spawnType);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AIDirectorWanderingHordeComponent))]
|
||||
[HarmonyPatch("ChooseNextTime")]
|
||||
public class AIDirectorWanderingHordeComponentChooseNextTime
|
||||
{
|
||||
public static void Postfix(AIDirectorWanderingHordeComponent __instance, AIWanderingHordeSpawner.SpawnType _spawnType, ref ulong ___HordeNextTime)
|
||||
{
|
||||
string optionWanderingHordeFrequencyMultiplier = RebirthVariables.customWanderingHordeFrequency;
|
||||
|
||||
if (optionWanderingHordeFrequencyMultiplier == "0")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Log.Out("Dayuppy_AIDirectorWanderingHordeComponentPatches-ChooseNextTime START, optionWanderingHordeFrequencyMultiplier: " + optionWanderingHordeFrequencyMultiplier);
|
||||
|
||||
int multiplier = 1;
|
||||
switch (_spawnType)
|
||||
{
|
||||
case AIWanderingHordeSpawner.SpawnType.Horde:
|
||||
|
||||
//Log.Out("Dayuppy_AIDirectorWanderingHordeComponentPatches-ChooseNextTime HORDE");
|
||||
if (optionWanderingHordeFrequencyMultiplier.Length == 1)
|
||||
{
|
||||
multiplier = int.Parse(optionWanderingHordeFrequencyMultiplier);
|
||||
|
||||
//Log.Out("Dayuppy_AIDirectorWanderingHordeComponentPatches-ChooseNextTime 1 multiplier: " + multiplier);
|
||||
|
||||
___HordeNextTime = __instance.Director.World.worldTime + (ulong)__instance.Random.RandomRange(12000 / multiplier, 24000 / multiplier);
|
||||
|
||||
//Log.Out("Dayuppy_AIDirectorWanderingHordeComponentPatches-ChooseNextTime 1 Current Time: " + __instance.Director.World.worldTime);
|
||||
//Log.Out("Dayuppy_AIDirectorWanderingHordeComponentPatches-ChooseNextTime 1 ___HordeNextTime: " + ___HordeNextTime);
|
||||
}
|
||||
else if (optionWanderingHordeFrequencyMultiplier == "random")
|
||||
{
|
||||
GameRandom gameRandom = GameManager.Instance.World.GetGameRandom();
|
||||
multiplier = gameRandom.RandomRange(1, RebirthVariables.maxWanderingHordeFrequency);
|
||||
|
||||
//Log.Out("Dayuppy_AIDirectorWanderingHordeComponentPatches-ChooseNextTime 2 multiplier: " + multiplier);
|
||||
|
||||
___HordeNextTime = __instance.Director.World.worldTime + (ulong)__instance.Random.RandomRange(12000 / multiplier, 24000 / multiplier);
|
||||
|
||||
//Log.Out("Dayuppy_AIDirectorWanderingHordeComponentPatches-ChooseNextTime 2 Current Time: " + __instance.Director.World.worldTime);
|
||||
//Log.Out("Dayuppy_AIDirectorWanderingHordeComponentPatches-ChooseNextTime 2 ___HordeNextTime: " + ___HordeNextTime);
|
||||
}
|
||||
else if (optionWanderingHordeFrequencyMultiplier.Contains("gradual"))
|
||||
{
|
||||
int currentDay = GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime);
|
||||
|
||||
int dayDivisor = 14;
|
||||
|
||||
if (optionWanderingHordeFrequencyMultiplier.Contains("slower"))
|
||||
{
|
||||
dayDivisor = dayDivisor * 2;
|
||||
}
|
||||
else if (optionWanderingHordeFrequencyMultiplier.Contains("faster"))
|
||||
{
|
||||
dayDivisor = dayDivisor / 2;
|
||||
}
|
||||
|
||||
//Log.Out("Dayuppy_AIDirectorWanderingHordeComponentPatches-ChooseNextTime 3 currentDay: " + currentDay);
|
||||
//Log.Out("Dayuppy_AIDirectorWanderingHordeComponentPatches-ChooseNextTime 3 dayDivisor: " + dayDivisor);
|
||||
|
||||
multiplier = 1 + (int)(currentDay / dayDivisor);
|
||||
|
||||
if (multiplier > RebirthVariables.maxWanderingHordeFrequency - 1)
|
||||
{
|
||||
multiplier = RebirthVariables.maxWanderingHordeFrequency - 1;
|
||||
}
|
||||
|
||||
//Log.Out("Dayuppy_AIDirectorWanderingHordeComponentPatches-ChooseNextTime 3 multiplier: " + multiplier);
|
||||
|
||||
___HordeNextTime = __instance.Director.World.worldTime + (ulong)__instance.Random.RandomRange(12000 / multiplier, 24000 / multiplier);
|
||||
//Log.Out("Dayuppy_AIDirectorWanderingHordeComponentPatches-ChooseNextTime 3 Current Time: " + __instance.Director.World.worldTime);
|
||||
//Log.Out("Dayuppy_AIDirectorWanderingHordeComponentPatches-ChooseNextTime 3 ___HordeNextTime: " + ___HordeNextTime);
|
||||
}
|
||||
|
||||
//Log.Out("Dayuppy_AIDirectorWanderingHordeComponentPatches-ChooseNextTime multiplier: " + multiplier);
|
||||
|
||||
int whSizeMultiplierMax = RebirthVariables.maxWanderingHordeMultiplier;
|
||||
string optionWanderingHordeSizeMultiplier = RebirthVariables.customWanderingHordeSizeMultiplier;
|
||||
|
||||
int whSizeMultiplier = 1;
|
||||
|
||||
if (optionWanderingHordeSizeMultiplier == "random")
|
||||
{
|
||||
GameRandom gameRandom = GameManager.Instance.World.GetGameRandom();
|
||||
whSizeMultiplier = gameRandom.RandomRange(2, whSizeMultiplierMax);
|
||||
}
|
||||
else if (optionWanderingHordeSizeMultiplier.Contains("gradual"))
|
||||
{
|
||||
int currentDay = GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime);
|
||||
|
||||
int dayDivisor = 14;
|
||||
|
||||
if (optionWanderingHordeSizeMultiplier.Contains("slower"))
|
||||
{
|
||||
dayDivisor = dayDivisor * 2;
|
||||
}
|
||||
else if (optionWanderingHordeSizeMultiplier.Contains("faster"))
|
||||
{
|
||||
dayDivisor = dayDivisor / 2;
|
||||
}
|
||||
|
||||
whSizeMultiplier = 1 + (int)(currentDay / dayDivisor);
|
||||
|
||||
if (whSizeMultiplier > whSizeMultiplierMax - 1)
|
||||
{
|
||||
whSizeMultiplier = whSizeMultiplierMax - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
whSizeMultiplier = int.Parse(optionWanderingHordeSizeMultiplier);
|
||||
}
|
||||
|
||||
if (whSizeMultiplier > whSizeMultiplierMax)
|
||||
{
|
||||
whSizeMultiplier = whSizeMultiplierMax;
|
||||
}
|
||||
|
||||
RebirthVariables.wanderingHordeMultiplier = whSizeMultiplier;
|
||||
|
||||
//Log.Out("Dayuppy_AIDirectorWanderingHordeComponentPatches-ChooseNextTime RebirthVariables.wanderingHordeMultiplier: " + RebirthVariables.wanderingHordeMultiplier);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
__instance.LogTimes();
|
||||
}
|
||||
}
|
||||
|
||||
// had to override this function to catch if the list was decreased in the Update patch - UpdateSpawn
|
||||
[HarmonyPatch(typeof(AIDirectorWanderingHordeComponent), nameof(AIDirectorWanderingHordeComponent.TickActiveSpawns))]
|
||||
public class TickActiveSpawnsPatch
|
||||
{
|
||||
public static bool Prefix(AIDirectorWanderingHordeComponent __instance, float dt)
|
||||
{
|
||||
for (int index = __instance.spawners.Count - 1; index >= 0; index--)
|
||||
{
|
||||
int spawnersCount = __instance.spawners.Count;
|
||||
AIWanderingHordeSpawner aIWanderingHordeSpawner = __instance.spawners[index];
|
||||
if (aIWanderingHordeSpawner.Update(__instance.Director.World, dt))
|
||||
{
|
||||
AIDirector.LogAIExtra("Wandering spawner finished {0}", aIWanderingHordeSpawner.spawnType);
|
||||
aIWanderingHordeSpawner.Cleanup();
|
||||
int curCount = __instance.spawners.Count;
|
||||
Log.Out($"TickActiveSpawns - Update true - starting spawnersCount: {spawnersCount}, current spawners count: {curCount}, current index: {index}");
|
||||
|
||||
if (curCount > index)
|
||||
{
|
||||
Log.Out($"Removing spawner at index: {index}");
|
||||
__instance.spawners.RemoveAt(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Out($"Unable to remove spawner at index: {index}, current spawners count: {curCount}");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Dayuppy/Harmony/Harmony_BuildIIntervalPatch.cs
Normal file
18
Dayuppy/Harmony/Harmony_BuildIIntervalPatch.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
internal class Dayuppy_BuildIntervalPatches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public class GameManagercreateWorldBuildInterval
|
||||
{
|
||||
private static IEnumerable<MethodInfo> TargetMethods()
|
||||
{
|
||||
yield return AccessTools.EnumeratorMoveNext(AccessTools.Method(typeof(GameManager), "createWorld"));
|
||||
}
|
||||
|
||||
public static void Postfix(GameManager __instance)
|
||||
{
|
||||
Constants.cBuildIntervall = 0.5f; //Default setting. PrefabEditor is 0.2f.
|
||||
}
|
||||
}
|
||||
}
|
||||
23
Dayuppy/Harmony/Harmony_VehicleSpeedPatch.cs
Normal file
23
Dayuppy/Harmony/Harmony_VehicleSpeedPatch.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
internal class Dayuppy_VehicleSpeedPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(EntityVehicle))]
|
||||
[HarmonyPatch("PhysicsFixedUpdate")]
|
||||
public class EntityVehicleRigidBodyPhysicsFixedUpdate
|
||||
{
|
||||
public static void Postfix(EntityVehicle __instance)
|
||||
{
|
||||
__instance.ScalePhysicsMulConstant(0f);
|
||||
Rigidbody vehicleRB = __instance.PhysicsTransform.GetComponent<Rigidbody>();
|
||||
vehicleRB.maxAngularVelocity = 100f;
|
||||
vehicleRB.maxDepenetrationVelocity = 100f;
|
||||
vehicleRB.drag = 0f;
|
||||
vehicleRB.angularDrag = 0f;
|
||||
vehicleRB.interpolation = RigidbodyInterpolation.Extrapolate;
|
||||
|
||||
/*if(__instance.HasDriver)
|
||||
{
|
||||
Log.Out($"CurrentForwardVelocity: {__instance.vehicle.CurrentForwardVelocity}");
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Dayuppy/Harmony/Inactive/Harmony_ZoomMapPatch.cs
Normal file
36
Dayuppy/Harmony/Inactive/Harmony_ZoomMapPatch.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
using HarmonyLib;
|
||||
|
||||
internal class Dayuppy_ZoomMapPatches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public class XUiC_MapAreaUpdate
|
||||
{
|
||||
private static IEnumerable<MethodInfo> TargetMethods()
|
||||
{
|
||||
yield return AccessTools.Method(typeof(XUiC_MapArea), nameof(XUiC_MapArea.Update));
|
||||
yield return AccessTools.Method(typeof(XUiC_MapArea), "onMapScrolled");
|
||||
}
|
||||
|
||||
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
List<CodeInstruction> codes = new List<CodeInstruction>(instructions);
|
||||
|
||||
float newMaxZoomOut = 50f;
|
||||
|
||||
for(int i = 0; i < codes.Count; i++)
|
||||
{
|
||||
if(codes[i].opcode == OpCodes.Ldc_R4 && codes[i].operand is 6.15f)
|
||||
{
|
||||
codes[i].operand = newMaxZoomOut;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return codes;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user