Skip to content

Commit

Permalink
1.0.46.1010
Browse files Browse the repository at this point in the history
  • Loading branch information
SphereII committed Aug 10, 2024
1 parent 551721e commit 878668c
Show file tree
Hide file tree
Showing 13 changed files with 104 additions and 56 deletions.
2 changes: 1 addition & 1 deletion Mods/0-SCore/ModInfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<Description value="SCore Mod" />
<DisplayName value="0-SCore" />
<Website value="" />
<Version value="1.0.45.1058" />
<Version value="1.0.46.1010" />
</xml>
4 changes: 2 additions & 2 deletions Mods/0-SCore/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
17 changes: 17 additions & 0 deletions Mods/0-SCore/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Binary file modified Mods/0-SCore/SCore.dll
Binary file not shown.
Binary file modified Mods/0-SCore/SCore.pdb
Binary file not shown.
82 changes: 48 additions & 34 deletions Mods/0-SCore/Scripts/Entities/EntitySwimingSDX.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vector3i> WaterBlocks = new List<Vector3i>();

//public override void Init(int _entityClass)
//{
// base.Init(_entityClass);
public override void Init(int _entityClass)
{
base.Init(_entityClass);
Expand All @@ -50,10 +50,7 @@ public override void Init(int _entityClass)

getNavigator().setCanDrown(false);

//base.getNavigator().setInWater(true);
//useVanillaAI = true;
}
//}

public override bool IsAirBorne()
{
Expand All @@ -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();
}


Expand Down
2 changes: 1 addition & 1 deletion Mods/0-SCore/Scripts/Entities/EntityZombieFlyingSDX.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 2 additions & 7 deletions Mods/SphereII A Better Life/Config/entityclasses.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<entity_class name="PassiveFish" extends="animalChicken">
<property name="Mesh" value="Animals/Stag/STAG" />
<property name="Prefab" value="NPC"/>
<!-- The swiming class is an extended flying class-->
<property name="Class" value="EntitySwimingSDX, SCore" />
<!-- The swimming class is an extended flying class-->
<property name="Class" value="EntitySwimmingSDX, SCore" />
<property name="UseVanillaAI" value="false" />
<property name="AvatarController" value="MecanimSDX,SCore" />
<property name="MaxHealth" value="25" />
Expand Down Expand Up @@ -76,7 +76,6 @@
</entity_class>

<entity_class name="fishStingRay" extends="PassiveFish" >
<property name="Class" value="EntitySwimingSDX, SCore" />
<property name="Mesh" value="#@modfolder:Resources/Swimmers.unity3d?Stingray_X" />
<drop event="Harvest" name="foodRawMeat" count="0" tool_category="Butcher"/>
<drop event="Harvest" name="foodRawMeat" tag="butcherHarvest" count="10"/>
Expand All @@ -85,7 +84,6 @@
</entity_class>

<entity_class name="fishTurtle" extends="PassiveFish" >
<property name="Class" value="EntitySwimingSDX, SCore" />
<property name="Mesh" value="#@modfolder:Resources/Swimmers.unity3d?Turtle_X" />
<property name="AttackAnimations" value="Attack0" />
<drop event="Harvest" name="foodRawMeat" count="0" tool_category="Butcher"/>
Expand All @@ -94,7 +92,6 @@
</entity_class>

<entity_class name="fishBarracuda" extends="PassiveFish" >
<property name="Class" value="EntitySwimingSDX, SCore" />
<property name="Mesh" value="#@modfolder:Resources/Swimmers.unity3d?Barracuda_X" />
<property name="AttackAnimations" value="Attack0" />
<drop event="Harvest" name="foodRawMeat" count="0" tool_category="Butcher"/>
Expand All @@ -103,14 +100,12 @@
</entity_class>

<entity_class name="fishSardine" extends="PassiveFish" >
<property name="Class" value="EntitySwimingSDX, SCore" />
<property name="Mesh" value="#@modfolder:Resources/Swimmers.unity3d?Sardine_X" />
<drop event="Harvest" name="foodRawMeat" count="0" tool_category="Butcher"/>
<drop event="Harvest" name="foodRawMeat" tag="butcherHarvest" count="1"/>
</entity_class>

<entity_class name="fishClownfish" extends="PassiveFish" >
<property name="Class" value="EntitySwimingSDX, SCore" />
<property name="Mesh" value="#@modfolder:Resources/Swimmers.unity3d?Clownfish_X" />
<property name="AttackAnimations" value="Attack0" />
<drop event="Harvest" name="foodRawMeat" count="0" tool_category="Butcher"/>
Expand Down
6 changes: 3 additions & 3 deletions Mods/SphereII A Better Life/ModInfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<xml>
<Name value="SphereII_A_Better_Life_sphereii"/>
<Author value="sphereii"/>
<Description value="SphereII A Better Life"/>
<DisplayName value="0-ABetterLife"/>
<Description value="SphereII A Better Life, adding fish and birds to the game."/>
<DisplayName value="A Better Life"/>
<Website value=""/>
<Version value="21.0.13.1511"/>
<Version value="1.0.0.732"/>
</xml>
4 changes: 2 additions & 2 deletions Mods/SphereII A Better Life/Properties/versionTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
6 changes: 3 additions & 3 deletions Mods/SphereII A Better Life/Properties/versionTemplate.tt
Original file line number Diff line number Diff line change
Expand Up @@ -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;
#>
27 changes: 24 additions & 3 deletions Mods/SphereII A Better Life/SphereII A Better Life.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>false</Deterministic>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down Expand Up @@ -71,11 +75,28 @@
<ItemGroup>
<Folder Include="UIAtlases\ItemIconAtlas\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\Tools\Directory.Build.targets" Condition="Exists('$(SolutionDir)\Tools\Directory.Build.targets')" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>del "$(TargetDir)*.dll" /Q
<PostBuildEvent>
del "$(TargetDir)*.dll" /Q
del "$(TargetDir)*.pdb" /Q
rmdir "$(TargetDir)bin" /Q /S 2&gt; nul
rmdir "$(TargetDir)obj" /Q /S 2&gt; nul</PostBuildEvent>
rmdir "$(TargetDir)obj" /Q /S 2&gt; 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
)
)
</PostBuildEvent>
</PropertyGroup>

</Project>
1 change: 1 addition & 0 deletions Mods/SphereII.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 878668c

Please sign in to comment.