diff --git a/Mods/0-SCore/0-SCore.csproj b/Mods/0-SCore/0-SCore.csproj
index c795c343..c06238e2 100644
--- a/Mods/0-SCore/0-SCore.csproj
+++ b/Mods/0-SCore/0-SCore.csproj
@@ -258,6 +258,7 @@
+
@@ -348,6 +349,7 @@
+
diff --git a/Mods/0-SCore/Features/ParticlesOnBlocks/Harmony/Blocks.cs b/Mods/0-SCore/Features/ParticlesOnBlocks/Harmony/Blocks.cs
index d04d2794..bb61634b 100644
--- a/Mods/0-SCore/Features/ParticlesOnBlocks/Harmony/Blocks.cs
+++ b/Mods/0-SCore/Features/ParticlesOnBlocks/Harmony/Blocks.cs
@@ -50,7 +50,7 @@ private static string GetParticle(DynamicProperties classProperty, string key, V
// No particles at all? Boring.
if (string.IsNullOrEmpty(availableParticles)) return string.Empty;
-
+
// Check if the particles are comma delimited.
var particleArray = availableParticles.Split(',');
var randomIndex = _random.RandomRange(0, particleArray.Length);
@@ -68,6 +68,8 @@ private static bool CanPlaceParticle(DynamicProperties classProperty, string key
}
private static void CheckForParticle(Block block, Vector3i blockPos) {
if (!block.Properties.Classes.ContainsKey("Particles")) return;
+ if (!GameManager.Instance.World.GetBlock(blockPos + Vector3i.up).isair) return;
+
var particles = block.Properties.Classes["Particles"];
var particle = GetParticle(particles, "OnSpawnParticle", blockPos);
if (string.IsNullOrEmpty(particle)) return;
@@ -77,6 +79,25 @@ private static void CheckForParticle(Block block, Vector3i blockPos) {
}
}
+
+ // Reloading all the particles
+ [HarmonyPatch(typeof(Block))]
+ [HarmonyPatch("Init")]
+ public class BlockInit {
+ public static void Postfix(Block __instance) {
+ if (!__instance.Properties.Classes.ContainsKey("Particles")) return;
+ var particlesProperties = __instance.Properties.Classes["Particles"];
+ foreach (var property in particlesProperties.Values.dic)
+ {
+ if (!property.Value.Contains("modfolder")) continue;
+ foreach (var particle in property.Value.Split(','))
+ {
+ if (!ParticleEffect.IsAvailable(particle))
+ ParticleEffect.LoadAsset(particle);
+ }
+ }
+ }
+ }
[HarmonyPatch(typeof(Block))]
[HarmonyPatch("OnNeighborBlockChange")]
public class BlockOnNeighborBlockChange {
@@ -88,6 +109,22 @@ public static void Postfix(Block __instance, Vector3i _myBlockPos) {
[HarmonyPatch(typeof(Block))]
[HarmonyPatch("OnBlockUnloaded")]
public class BlockOnBlockUnloaded {
+ public static void Postfix(Block __instance, Vector3i _blockPos) {
+ BlockUtilitiesSDX.removeParticles(_blockPos);
+ }
+ }
+
+ [HarmonyPatch(typeof(Block))]
+ [HarmonyPatch("OnBlockLoaded")]
+ public class BlockOnBlockloaded {
+ public static void Postfix(Block __instance, Vector3i _blockPos) {
+ CheckForParticle(__instance, _blockPos);
+ }
+ }
+
+ [HarmonyPatch(typeof(Block))]
+ [HarmonyPatch("OnBlockAdded")]
+ public class BlockOnBlockAdded {
public static void Postfix(Block __instance, Vector3i _blockPos) {
CheckForParticle(__instance, _blockPos);
}
@@ -105,7 +142,12 @@ public static void Postfix(Block __instance, Vector3i _blockPos) {
[HarmonyPatch(typeof(Block))]
[HarmonyPatch("OnBlockRemoved")]
public class BlockOnBlockRemoved {
- public static void Postfix(Vector3i _blockPos) {
+ public static void Postfix(Block __instance, Vector3i _blockPos) {
+ if (!__instance.Properties.Classes.ContainsKey("Particles")) return;
+
+ var particles = __instance.Properties.Classes["Particles"];
+ var particle = particles.GetBool("PeristAfterRemove");
+ if (particle) return;
BlockUtilitiesSDX.removeParticles(_blockPos);
}
}
diff --git a/Mods/0-SCore/ModInfo.xml b/Mods/0-SCore/ModInfo.xml
index 7dd73cf1..c801e622 100644
--- a/Mods/0-SCore/ModInfo.xml
+++ b/Mods/0-SCore/ModInfo.xml
@@ -5,5 +5,5 @@
-
+
\ No newline at end of file
diff --git a/Mods/0-SCore/Properties/AssemblyInfo.cs b/Mods/0-SCore/Properties/AssemblyInfo.cs
index caf88bca..4dd850ab 100644
--- a/Mods/0-SCore/Properties/AssemblyInfo.cs
+++ b/Mods/0-SCore/Properties/AssemblyInfo.cs
@@ -38,5 +38,5 @@
// [assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("20.0.*")]
-[assembly: AssemblyVersion("1.0.59.1007")]
-[assembly: AssemblyFileVersion("1.0.59.1007")]
+[assembly: AssemblyVersion("1.0.60.1616")]
+[assembly: AssemblyFileVersion("1.0.60.1616")]
diff --git a/Mods/0-SCore/ReadMe.md b/Mods/0-SCore/ReadMe.md
index fc09b624..ede67d71 100644
--- a/Mods/0-SCore/ReadMe.md
+++ b/Mods/0-SCore/ReadMe.md
@@ -23,6 +23,41 @@ Direct Download to the 0-SCore.zip available on gitlab mirror:
### Change Logs
[ Change Log ]
+Version: 1.0.60.1241
+ [ MinEvent ]
+ - Added a new MinEvent to allow changing local transform / rotation on a particular transform on an entity.
+
+ debug="true"
+ />
+
+ [ Console Command ]
+ - Added a new console command to assist testing of the above MinEvent.
+ - Use this cautiously.
+ - Example:
+ ReloadSCore buffs
+ ReloadSCore entityclasses
+
+ [ Particles On Block ]
+ - Fixed a few issues where particles were being loaded incorrectly, causing a hard crash
+ - Added a patch on the init to pre-load Particles
+ - Added a check for to keep a particle upon removal of its block
+
+
+ - Somewhat realistic example:
+
+
+
+
+
+
+
+
+
Version: 1.0.59.1007
[ Food Spoilage ]
- Added missing FreshnessOnly check on the ModifyCVar minevent patch.
diff --git a/Mods/0-SCore/SCore.dll b/Mods/0-SCore/SCore.dll
index 33f1f1de..2f96b2c3 100644
Binary files a/Mods/0-SCore/SCore.dll and b/Mods/0-SCore/SCore.dll differ
diff --git a/Mods/0-SCore/SCore.pdb b/Mods/0-SCore/SCore.pdb
index ea9fe1f4..9c10557c 100644
Binary files a/Mods/0-SCore/SCore.pdb and b/Mods/0-SCore/SCore.pdb differ
diff --git a/Mods/0-SCore/Scripts/ConsoleCmd/ConsoleCmdReloadSCore.cs b/Mods/0-SCore/Scripts/ConsoleCmd/ConsoleCmdReloadSCore.cs
new file mode 100644
index 00000000..2592950a
--- /dev/null
+++ b/Mods/0-SCore/Scripts/ConsoleCmd/ConsoleCmdReloadSCore.cs
@@ -0,0 +1,31 @@
+
+using System.Collections.Generic;
+using UAI;
+
+
+public class ConsoleCmdReloadBuffs : ConsoleCmdAbstract
+{
+ public override bool IsExecuteOnClient
+ {
+ get { return true; }
+ }
+
+ public override string[] getCommands()
+ {
+ return new string[]
+ {
+ "ReloadSCore"
+ };
+ }
+
+ public override void Execute(List _params, CommandSenderInfo _senderInfo) {
+ if (_params.Count != 1) return;
+ WorldStaticData.Reset(_params[0]);
+ SingletonMonoBehaviour.Instance.Output($"Reloading {_params[0]}");
+ }
+
+ public override string getDescription()
+ {
+ return "SCore: Reloads the passed in xml. This could have catastrophic results.";
+ }
+}
\ No newline at end of file
diff --git a/Mods/0-SCore/Scripts/MinEvents/MinEventActionAdjustTransformValues.cs b/Mods/0-SCore/Scripts/MinEvents/MinEventActionAdjustTransformValues.cs
new file mode 100644
index 00000000..32e79586
--- /dev/null
+++ b/Mods/0-SCore/Scripts/MinEvents/MinEventActionAdjustTransformValues.cs
@@ -0,0 +1,88 @@
+
+using System.Collections.Generic;
+using System.Xml.Linq;
+using UnityEngine;
+/*
+
+ debug="true"
+ />
+*/
+public class MinEventActionAdjustTransformValues : MinEventActionBuffModifierBase {
+ private string _transform;
+ private Vector3 _localOffset;
+ private Quaternion _localRotation;
+
+ // This is just used for debugging so the same message doesn't get spammed.
+ private static string LastMessage = string.Empty;
+ private bool _debug;
+
+ private void DisplayLog(MinEventParams _params) {
+ var message =
+ $"{_params.Self.EntityName} : Adjusting {_transform}: Local Offset: {_localOffset} Local Rotation: {_localRotation}";
+ if (LastMessage == message) return;
+ LastMessage = message;
+ Debug.Log(message);
+ }
+
+ public override void Execute(MinEventParams _params) {
+ if (_params.Self != null || _params.Self.RootTransform != null)
+ {
+ var children = new List();
+ GetAllChildren(_params.Self.RootTransform, ref children);
+ foreach (var child in children)
+ {
+ if (child.name != _transform) continue;
+ if ( _debug)
+ DisplayLog(_params);
+ child.localPosition = _localOffset;
+ child.localRotation = _localRotation;
+ break;
+ }
+ }
+
+ base.Execute(_params);
+ }
+
+ public static void GetAllChildren(Transform parent, ref List transforms) {
+ foreach (Transform t in parent)
+ {
+ transforms.Add(t);
+ GetAllChildren(t, ref transforms);
+ }
+ }
+
+ public override bool ParseXmlAttribute(XAttribute _attribute) {
+ var flag = base.ParseXmlAttribute(_attribute);
+ if (flag) return true;
+ var name = _attribute.Name.LocalName;
+
+ switch (name)
+ {
+ case null:
+ return flag;
+ case "parent_transform":
+ _transform = _attribute.Value;
+ return true;
+ case "debug":
+ _debug = StringParsers.ParseBool(_attribute.Value);
+ return true;
+ case "local_offset":
+ _localOffset = StringParsers.ParseVector3(_attribute.Value);
+ return true;
+ case "local_rotation":
+ var rotation = StringParsers.ParseVector3(_attribute.Value);
+ var newQuaternion = new Quaternion();
+ newQuaternion.Set(rotation.x, rotation.y, rotation.z,1);
+ _localRotation = newQuaternion;
+ return true;
+
+ default:
+ return false;
+ }
+ }
+}
\ No newline at end of file