diff --git a/Mods/0-SCore/ModInfo.xml b/Mods/0-SCore/ModInfo.xml index f86ba998..fc7385a7 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 6a070160..523f5205 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.45.1058")] -[assembly: AssemblyFileVersion("1.0.45.1058")] +[assembly: AssemblyVersion("1.0.46.1010")] +[assembly: AssemblyFileVersion("1.0.46.1010")] diff --git a/Mods/0-SCore/ReadMe.md b/Mods/0-SCore/ReadMe.md index 1f847724..f52133de 100644 --- a/Mods/0-SCore/ReadMe.md +++ b/Mods/0-SCore/ReadMe.md @@ -23,6 +23,23 @@ Direct Download to the 0-SCore.zip available on gitlab mirror: ### Change Logs [ Change Log ] +Version: 1.0.46.1010 + [ EntitySwimingSDX / EntitySwimmingSDX ] + - Fixed an issue where fish were leaving the water. + - Each fish searches for water blocks in its area, and uses that to validate it's pathing. + - If a fish has less than 20 water blocks, it'll despawn. + - If a fish leaves the water, it'll despawn. + - Added new class reference to fix spelling error in Swimming. + EntitySwimmingSDX and EntitySwimingSDX are the same, code-wise. + - Kept spelling error to maintain references + + + [ A Better Life 1.0.0.732 ] + - Adjusted the ModInfo.xml's Name value + - Added the ability to auto-generate the version number. + - Adjusted the entityclasses.xml for class reference for extends. + + Version: 1.0.45.1058 [ Check Items For Valid Containers ] - Fixed another null reference when blocking an item from the NPC's loot container. diff --git a/Mods/0-SCore/SCore.dll b/Mods/0-SCore/SCore.dll index 50abd1a0..8000cde9 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 5b17fa7b..24e27e00 100644 Binary files a/Mods/0-SCore/SCore.pdb and b/Mods/0-SCore/SCore.pdb differ diff --git a/Mods/0-SCore/Scripts/Entities/EntitySwimingSDX.cs b/Mods/0-SCore/Scripts/Entities/EntitySwimingSDX.cs index 622420ec..15e8b255 100644 --- a/Mods/0-SCore/Scripts/Entities/EntitySwimingSDX.cs +++ b/Mods/0-SCore/Scripts/Entities/EntitySwimingSDX.cs @@ -31,16 +31,16 @@ * */ +using System.Collections.Generic; using UnityEngine; -internal class EntitySwimingSDX : EntityZombieFlyingSDX +public class EntitySwimmingSDX : EntitySwimingSDX { +} + +public class EntitySwimingSDX : EntityZombieFlyingSDX { - //public static System.Random random = new System.Random(); - //public DynamicProperties Properties = new DynamicProperties(); + public List WaterBlocks = new List(); - //public override void Init(int _entityClass) - //{ - // base.Init(_entityClass); public override void Init(int _entityClass) { base.Init(_entityClass); @@ -50,10 +50,7 @@ public override void Init(int _entityClass) getNavigator().setCanDrown(false); - //base.getNavigator().setInWater(true); - //useVanillaAI = true; } - //} public override bool IsAirBorne() { @@ -62,41 +59,58 @@ public override bool IsAirBorne() public override void OnAddedToWorld() { base.OnAddedToWorld(); - // Debug.Log("Position: " + this.position.ToString()); - //Debug.Log("Spawning Fish: " + this.entityName); + RefreshWaterBlocks(); } - public override void OnUpdateLive() - { + public override void OnUpdateLive() { base.OnUpdateLive(); - + if (!IsGoingToWater()) + AdjustWayPoint(); if (!IsInWater()) - { MarkToUnload(); + } + + public bool IsGoingToWater() { + var vector = new Vector3i(Waypoint); + return WaterBlocks.Contains(vector); + } + public void RefreshWaterBlocks(int range = 10, int maxY = 5) { + var blockPos = Vector3i.zero; + var vector = new Vector3i(position); + for (var x = vector.x - range; x < vector.x + range; x++) + { + for (var z = vector.z - range; z < vector.z + range; z++) + { + for (var y = vector.y - maxY; y < vector.y + maxY; y++) + { + blockPos.x = x; + blockPos.z = z; + blockPos.y = y; + var waterPercent = GameManager.Instance.World.GetWaterPercent(blockPos); + if (waterPercent < 0.1) continue; + if (WaterBlocks.Contains(blockPos)) continue; + WaterBlocks.Add(blockPos); + } + } } + // If there's not enough water, then just despawn. + if ( WaterBlocks.Count < 20) + MarkToUnload(); } - // While the fish are birds, we do want to adjust the way point settings, so they are not attracted to the air, but rather the water. - public override void AdjustWayPoint() - { - var num = 255; - - var num2 = (int)aiManager.interestDistance; + private Vector3i GetRandomPosition() { + if (WaterBlocks.Count == 0) + RefreshWaterBlocks(); - num2 *= 2; - var waypoint = RandomPositionGenerator.CalcAway(this, 0, num2, 10, this.LastTargetPos); - var localWaypoint = new Vector3i(waypoint); + if (WaterBlocks.Count == 0) + return Vector3i.zero; - // if waypoint is in the air, keep dropping it until it's out of the air, and into the water. - while (world.GetBlock(localWaypoint).type == BlockValue.Air.type && num > 0) - { - localWaypoint.y -= 1; - num--; - } - // Attempt to get rid of the vector zero errors. - if (world.GetBlock(localWaypoint + Vector3i.down).Block.shape.IsTerrain()) - localWaypoint.y++; - Waypoint = localWaypoint.ToVector3(); + var index = rand.RandomRange(0, WaterBlocks.Count); + return WaterBlocks[index]; + } + + public void AdjustWayPoint() { + Waypoint = GetRandomPosition(); } diff --git a/Mods/0-SCore/Scripts/Entities/EntityZombieFlyingSDX.cs b/Mods/0-SCore/Scripts/Entities/EntityZombieFlyingSDX.cs index 739e7aef..c041c8dc 100644 --- a/Mods/0-SCore/Scripts/Entities/EntityZombieFlyingSDX.cs +++ b/Mods/0-SCore/Scripts/Entities/EntityZombieFlyingSDX.cs @@ -4,7 +4,7 @@ using UnityEngine; using Random = UnityEngine.Random; -internal class EntityZombieFlyingSDX : EntityFlying +public class EntityZombieFlyingSDX : EntityFlying { // flocking logic constants and variables private const float BS = 0.25f; diff --git a/Mods/SphereII A Better Life/Config/entityclasses.xml b/Mods/SphereII A Better Life/Config/entityclasses.xml index 85e92d22..0f64cfff 100644 --- a/Mods/SphereII A Better Life/Config/entityclasses.xml +++ b/Mods/SphereII A Better Life/Config/entityclasses.xml @@ -3,8 +3,8 @@ - - + + @@ -76,7 +76,6 @@ - @@ -85,7 +84,6 @@ - @@ -94,7 +92,6 @@ - @@ -103,14 +100,12 @@ - - diff --git a/Mods/SphereII A Better Life/ModInfo.xml b/Mods/SphereII A Better Life/ModInfo.xml index 973f671d..045ea3d8 100644 --- a/Mods/SphereII A Better Life/ModInfo.xml +++ b/Mods/SphereII A Better Life/ModInfo.xml @@ -2,8 +2,8 @@ - - + + - + \ No newline at end of file diff --git a/Mods/SphereII A Better Life/Properties/versionTemplate.cs b/Mods/SphereII A Better Life/Properties/versionTemplate.cs index 0f380613..87424134 100644 --- a/Mods/SphereII A Better Life/Properties/versionTemplate.cs +++ b/Mods/SphereII A Better Life/Properties/versionTemplate.cs @@ -5,5 +5,5 @@ using System.Reflection; -[assembly: AssemblyVersion("20.0.22.1123")] -[assembly: AssemblyFileVersion("20.0.22.1123")] +[assembly: AssemblyVersion("1.0.0.732")] +[assembly: AssemblyFileVersion("1.0.0.732")] diff --git a/Mods/SphereII A Better Life/Properties/versionTemplate.tt b/Mods/SphereII A Better Life/Properties/versionTemplate.tt index 49c20b30..4490832c 100644 --- a/Mods/SphereII A Better Life/Properties/versionTemplate.tt +++ b/Mods/SphereII A Better Life/Properties/versionTemplate.tt @@ -6,10 +6,10 @@ using System.Reflection; -[assembly: AssemblyVersion("20.0.<#= this.RevisionNumber #>.<#= this.BuildNumberHour #><#= this.BuildNumberMinute #>")] -[assembly: AssemblyFileVersion("20.0.<#= this.RevisionNumber #>.<#= this.BuildNumberHour #><#= this.BuildNumberMinute #>")] +[assembly: AssemblyVersion("1.0.<#= this.RevisionNumber #>.<#= this.BuildNumberHour #><#= this.BuildNumberMinute #>")] +[assembly: AssemblyFileVersion("1.0.<#= this.RevisionNumber #>.<#= this.BuildNumberHour #><#= this.BuildNumberMinute #>")] <#+ - int RevisionNumber = (int)(DateTime.UtcNow - new DateTime(2022,1,1)).TotalDays; + int RevisionNumber = (int)(DateTime.UtcNow - new DateTime(2024,08,10)).TotalDays; int BuildNumberHour = (int)DateTime.Now.Hour; int BuildNumberMinute = (int)DateTime.Now.Minute; #> \ No newline at end of file diff --git a/Mods/SphereII A Better Life/SphereII A Better Life.csproj b/Mods/SphereII A Better Life/SphereII A Better Life.csproj index 817429e9..8721e0b1 100644 --- a/Mods/SphereII A Better Life/SphereII A Better Life.csproj +++ b/Mods/SphereII A Better Life/SphereII A Better Life.csproj @@ -29,6 +29,10 @@ TRACE prompt 4 + + + true + false @@ -71,11 +75,28 @@ - + + + + + + - del "$(TargetDir)*.dll" /Q + +del "$(TargetDir)*.dll" /Q del "$(TargetDir)*.pdb" /Q rmdir "$(TargetDir)bin" /Q /S 2> nul -rmdir "$(TargetDir)obj" /Q /S 2> nul +rmdir "$(TargetDir)obj" /Q /S 2> nul + + :: Update the ModInfo.xml + IF EXIST $(ProjectDir)\ModInfo.xml ( + IF EXIST ..\Tools\bin\sed.exe ( + :: Sort out the version number from the Configuration, and grab the last digits of the Version number + echo Updating Version number to @(VersionNumber) + ..\Tools\bin\sed.exe -i "s/Version value=\"*.*.*.*\"/Version value=\"@(VersionNumber)\"/g" ModInfo.xml + ) + ) + + \ No newline at end of file diff --git a/Mods/SphereII.sln b/Mods/SphereII.sln index a0ac343c..79a1cf18 100644 --- a/Mods/SphereII.sln +++ b/Mods/SphereII.sln @@ -49,6 +49,7 @@ Global {72AD7F34-D420-4770-BC20-6F74D1B619FB}.Release|Any CPU.Build.0 = Release|Any CPU {3C6345E6-FD0A-46F3-82E9-2B60700F4B74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3C6345E6-FD0A-46F3-82E9-2B60700F4B74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3C6345E6-FD0A-46F3-82E9-2B60700F4B74}.Debug|Any CPU.Build.0 = Debug|Any CPU {D7753B76-3B71-452A-BEE1-0378EA492ADC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D7753B76-3B71-452A-BEE1-0378EA492ADC}.Release|Any CPU.ActiveCfg = Release|Any CPU {8067F976-E450-4127-8C5C-8C2D58F97DE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU