Upload from upload_mods.ps1

This commit is contained in:
Nathaniel Cosford
2025-06-04 16:44:53 +09:30
commit f1fbbe67bb
1722 changed files with 165268 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
namespace Features.Fire.Harmony
{
[HarmonyPatch(typeof(Chunk))]
[HarmonyPatch("SetBlock")]
public class ChunkSetBlock
{
public static void Postfix(Chunk __instance, int ___m_X, int ___m_Z, int x, int y, int z, bool _fromReset)
{
if (!_fromReset) return;
// If the POI is being reset, clear the fire.
var vector3I = new Vector3i((___m_X << 4) + x, y, (___m_Z << 4) + z);
var fireMap = FireManager.Instance?.GetFireMap();
if (fireMap == null) return;
if (fireMap.ContainsKey(vector3I))
{
FireManager.Instance?.RemoveFire(vector3I);
}
}
}
}

View File

@@ -0,0 +1,43 @@
namespace Features.Fire.Harmony
{
// Allows the spread of the particles to catch things on fire.
[HarmonyPatch(typeof(Explosion))]
[HarmonyPatch("AttackBlocks")]
public class SCoreExplosionattackBlocks
{
public static void Postfix(Explosion __instance, int _entityThatCausedExplosion, ExplosionData ___explosionData)
{
if (FireManager.Instance == null) return;
if (FireManager.Instance.Enabled == false) return;
// BlockDamage set to 0 does nothing.
if (___explosionData.BlockDamage == 0) return;
if (___explosionData.ParticleIndex == 0) return;
var entityAlive = GameManager.Instance.World.GetEntity(_entityThatCausedExplosion) as EntityAlive;
if (entityAlive != null)
{
if (entityAlive.EntityClass.Properties.Contains("SpreadFire"))
{
if (entityAlive.EntityClass.Properties.GetBool("SpreadFire") == false)
return;
}
if (entityAlive.Buffs.HasCustomVar("SpreadFire"))
{
var spreadFire = entityAlive.Buffs.GetCustomVar("SpreadFire");
if (spreadFire == -1f) return;
}
}
foreach (var position in __instance.ChangedBlockPositions)
{
// Negative block damages extinguishes
if (___explosionData.BlockDamage < 0f)
FireManager.Instance.Extinguish(position.Key);
else
FireManager.Instance.Add(position.Key);
}
}
}
}

View File

@@ -0,0 +1,28 @@
using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Features.Fire.Harmony
{
// Allows the spread of the particles to catch things on fire.
/*[HarmonyPatch(typeof(GameStateManager))]
[HarmonyPatch("StartGame")]
public class GameStateManagerStartGame
{
public static void Postfix()
{
if (GamePrefs.GetString(EnumGamePrefs.GameWorld) == "Empty"
|| GamePrefs.GetString(EnumGamePrefs.GameWorld) == "Playtesting"
|| GamePrefs.GetString(EnumGamePrefs.GameMode) == "GameModeEditWorld")
{
Debug.Log("Disabling Fire Manager in Play Testing / Prefab editor");
return;
}
FireManager.Init();
}
}*/
}

View File

@@ -0,0 +1,34 @@
namespace Features.Fire.Harmony
{
// Light reduction patch from ocbMaurice
[HarmonyPatch(typeof(ParticleEffect))]
[HarmonyPatch("SpawnParticleEffect")]
public class ParticleEffectspawnParticleEffect
{
private const int Odds = 4;
private static int _count = Odds;
public static void Postfix(ref Transform __result)
{
if (__result == null) return;
bool optionFireManager = CustomGameOptions.GetBool("CustomFireManager");
if (!optionFireManager) return;
if (__result.GetComponentInChildren<Light>() is not Light light) return;
if (_count == Odds)
{
_count = 0;
return;
}
light.enabled = false;
var go = light.gameObject;
//Log.Out($"SpawnParticleEffect - Destroy Light gameObject: {go}, parent: {go.transform.parent}");
go.transform.parent = null;
UnityEngine.Object.Destroy(go);
_count += 1;
}
}
}

View File

@@ -0,0 +1,27 @@
namespace Features.Fire.Harmony
{
[HarmonyPatch(typeof(Block))]
[HarmonyPatch("OnEntityWalking")]
public class BlockOnEntityWalking
{
public static void Postfix(int _x, int _y, int _z, Entity entity)
{
if (FireManager.Instance == null) return;
var blockPosition = new Vector3i(_x, _y, _z);
if (!FireManager.IsBurning(blockPosition)) return;
if (!GameManager.IsDedicatedServer)
if (!GameManager.Instance.HasBlockParticleEffect(blockPosition)) return;
if (entity is not EntityAlive entityAlive) return;
var buff = "buffBurningMolotov";
if (!string.IsNullOrEmpty(buff))
{
entityAlive.Buffs.AddBuff(buff, -1, entityAlive.isEntityRemote);
}
}
}
}