Skip to content

Commit

Permalink
1.2.4.1601
Browse files Browse the repository at this point in the history
  • Loading branch information
SphereII committed Dec 10, 2024
1 parent 89b552c commit 1a8b99b
Show file tree
Hide file tree
Showing 17 changed files with 62 additions and 101 deletions.
24 changes: 12 additions & 12 deletions Mods/0-SCore/Config/spawning.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
<!-- General purpose Cave and DeepCave, used when a biome-specific one isn't set. -->
<append xpath="/spawning">
<biome name="Cave">
<spawn maxcount="1" respawndelay="2.6" time="Any" entitygroup="ZombiesAll" />
<spawn maxcount="1" respawndelay="1.7" time="Night" entitygroup="ZombiesNight" />
<spawn maxcount="1" respawndelay="3.1" time="Any" entitygroup="ZombiesWasteland" spawnDeadChance="0" />
<spawn id="ca01" maxcount="1" respawndelay="2.6" time="Any" entitygroup="ZombiesAll" />
<spawn id="ca02" maxcount="1" respawndelay="1.7" time="Night" entitygroup="ZombiesNight" />
<spawn id="ca03" maxcount="1" respawndelay="3.1" time="Any" entitygroup="ZombiesWasteland" spawnDeadChance="0" />
</biome>

<biome name="DeepCave">
<spawn maxcount="1" respawndelay="2.6" time="Any" entitygroup="ZombieBadassGroup" />
<spawn maxcount="1" respawndelay="1.7" time="Night" entitygroup="ZombiesWasteland" />
<spawn maxcount="1" respawndelay="2.6" time="Any" entitygroup="ZombiesWastelandNight" />
<spawn id="dc01" maxcount="1" respawndelay="2.6" time="Any" entitygroup="ZombieBadassGroup" />
<spawn id="dc02" maxcount="1" respawndelay="1.7" time="Night" entitygroup="ZombiesWasteland" />
<spawn id="dc03" maxcount="1" respawndelay="2.6" time="Any" entitygroup="ZombiesWastelandNight" />
</biome>

<!-- Special spawner for Desert Caves -->
<biome name="desert_Cave">
<spawn maxcount="1" respawndelay="2.6" time="Any" entitygroup="ZombiesAll" />
<spawn maxcount="1" respawndelay="1.7" time="Night" entitygroup="ZombiesNight" />
<spawn maxcount="1" respawndelay="3.1" time="Any" entitygroup="ZombiesWasteland" spawnDeadChance="0" />
<spawn id="de01" maxcount="1" respawndelay="2.6" time="Any" entitygroup="ZombiesAll" />
<spawn id="de02" maxcount="1" respawndelay="1.7" time="Night" entitygroup="ZombiesNight" />
<spawn id="de03" maxcount="1" respawndelay="3.1" time="Any" entitygroup="ZombiesWasteland" spawnDeadChance="0" />
</biome>

<biome name="desert_DeepCave">
<spawn maxcount="1" respawndelay="2.6" time="Any" entitygroup="ZombieBadassGroup" />
<spawn maxcount="1" respawndelay="1.7" time="Night" entitygroup="ZombiesWasteland" />
<spawn maxcount="1" respawndelay="2.6" time="Any" entitygroup="ZombiesWastelandNight" />
<spawn id="dd01" maxcount="1" respawndelay="2.6" time="Any" entitygroup="ZombieBadassGroup" />
<spawn id="dd02" maxcount="1" respawndelay="1.7" time="Night" entitygroup="ZombiesWasteland" />
<spawn id="dd03" maxcount="1" respawndelay="2.6" time="Any" entitygroup="ZombiesWastelandNight" />
</biome>
</append>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Features.LockPicking {
public class LockPickingUtils {
public static bool CheckForMiniGame(EntityAlive entityAlive) {

if (entityAlive == null) return false;

if (entityAlive.Buffs.HasCustomVar("LegacyLockPick") && entityAlive.Buffs.GetCustomVar("LegacyLockPick") > 0)
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static bool Prefix(BlockEntityData _bed) {
}

[HarmonyPatch(typeof(Chunk))]
[HarmonyPatch("setBlockEntityRendering")]
[HarmonyPatch("SetBlockEntityRendering")]
public class ChunksetBlockEntityRendering {
public static bool Prefix(BlockEntityData _bed) {
// Check if this feature is enabled.
Expand Down
97 changes: 22 additions & 75 deletions Mods/0-SCore/Harmony/WorldGen/CaveProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,63 +78,6 @@ private static bool isPositionMinDistanceAwayFromAllPlayers(Vector3 _position, i
return true;
}

// This is a slightly modified version of the underground code from vanilla. The range of y is a bit throttled, as we want to spawn creatures near the player, and the original
// underground code did not check if they were within the view spawn code, so you could see them spawn in front of you.
// public static bool FindRandomSpawnPointNearPositionUnderground(Rect _area, int _minDistance, int _maxDistance, bool _bConsiderBedrolls, out Vector3 _position, Vector3i PlayerPosition)
// {
// _position = Vector3.zero;
// if (GameManager.Instance.World.Players.list.Count == 0) return false;
//
// // Since the cave system can be eratic in its location, we want to try 20 times to find a random spot where they can spawn at.
// for (var i = 0; i < 40; i++)
// {
// var rangeY = new Vector2(PlayerPosition.y - 10, PlayerPosition.y + 10);
// if (rangeY.x < 1)
// rangeY.x = 2;
//
// _position = new Vector3(_area.x + GameManager.Instance.World.RandomRange(0f, _area.width - 1f), GameManager.Instance.World.RandomRange(rangeY.x, rangeY.y),
// _area.y + GameManager.Instance.World.RandomRange(0f, _area.height - 1f));
// if (_position.y < 1)
// _position.y = 2;
// var vector3i = World.worldToBlockPos(_position);
// var chunk = (Chunk)GameManager.Instance.World.GetChunkFromWorldPos(vector3i);
// if (chunk == null) continue;
//
// var x = World.toBlockXZ(vector3i.x);
// var z = World.toBlockXZ(vector3i.z);
//
// // Grab the terrian height. If it's above the terrain level, ignore it.
// float terrainLevel = chunk.GetHeight(x, z) + 1;
// float maxLevel = PlayerPosition.y + 10;
// vector3i.y = (int)GameManager.Instance.World.RandomRange((float)PlayerPosition.y - 10, maxLevel);
// if (vector3i.y < 1)
// vector3i.y = PlayerPosition.y;
//
// if (maxLevel >= terrainLevel)
// vector3i.y = PlayerPosition.y;
//
// if (!chunk.CanMobsSpawnAtPos(x, vector3i.y, z)) continue;
//
// var flag = isPositionMinDistanceAwayFromAllPlayers(_position, _minDistance);
// var num = 0;
// while (flag && num < GameManager.Instance.World.Players.list.Count)
// {
// if ((_position - GameManager.Instance.World.Players.list[num].GetPosition()).sqrMagnitude < 2500f &&
// GameManager.Instance.World.Players.list[num].IsInViewCone(_position)) flag = false;
// num++;
// }
//
// if (!flag) continue;
//
// // Set the y position correctly.
// _position.y = vector3i.y;
// return true;
// }
//
// _position = Vector3.zero;
// return false;
// }


// This method is a modified version of vanilla, doing the same checks and balances. However, we do use the player position a bit more, and we change which biome spawning group we
// will use, when below the terrain.
Expand Down Expand Up @@ -220,13 +163,14 @@ public static void SpawnUpdate(string _spawnerName, bool _bSpawnEnemyEntities, C
var num = -1;
var num2 = gameRandom.RandomRange(biomeSpawnEntityGroupList.list.Count);
var j = 0;


var idHash = 0;
while (j < 5)
{
BiomeSpawnEntityGroupData biomeSpawnEntityGroupData2 = biomeSpawnEntityGroupList.list[num2];
if (biomeSpawnEntityGroupData2.daytime == EDaytime.Any || biomeSpawnEntityGroupData2.daytime == edaytime)
{
bool flag2 = EntityGroups.IsEnemyGroup(biomeSpawnEntityGroupData2.entityGroupRefName);
bool flag2 = EntityGroups.IsEnemyGroup(biomeSpawnEntityGroupData2.entityGroupName);
if (!flag2 || _bSpawnEnemyEntities)
{
int num4 = biomeSpawnEntityGroupData2.maxCount;
Expand All @@ -235,17 +179,17 @@ public static void SpawnUpdate(string _spawnerName, bool _bSpawnEnemyEntities, C
num4 = EntitySpawner.ModifySpawnCountByGameDifficulty(num4);
}

entityGroupName = biomeSpawnEntityGroupData2.entityGroupRefName + "_" + biomeSpawnEntityGroupData2.daytime.ToStringCached<EDaytime>();
ulong respawnDelayWorldTime = _chunkBiomeSpawnData.GetRespawnDelayWorldTime(entityGroupName);
if (respawnDelayWorldTime > 0UL)
idHash = biomeSpawnEntityGroupData2.idHash;

entityGroupName = biomeSpawnEntityGroupData2.entityGroupName + "_" + biomeSpawnEntityGroupData2.daytime.ToStringCached<EDaytime>();
ulong respawnDelayWorldTime = _chunkBiomeSpawnData.GetDelayWorldTime(idHash);
if (GameManager.Instance.World.worldTime > respawnDelayWorldTime )
{
if (GameManager.Instance.World.worldTime < respawnDelayWorldTime)
{
break;
}
_chunkBiomeSpawnData.ClearRespawn(entityGroupName);
int num7 = biomeSpawnEntityGroupData2.maxCount;

_chunkBiomeSpawnData.ResetRespawn(idHash, GameManager.Instance.World, num7);
}
if (_chunkBiomeSpawnData.GetEntitiesSpawned(entityGroupName) < num4)
if (_chunkBiomeSpawnData.CanSpawn(idHash))
{

num = num2;
Expand All @@ -266,19 +210,15 @@ public static void SpawnUpdate(string _spawnerName, bool _bSpawnEnemyEntities, C
if (count > 0)
return;
var biomeSpawnEntityGroupData3 = biomeSpawnEntityGroupList.list[num];
var randomFromGroup = EntityGroups.GetRandomFromGroup(biomeSpawnEntityGroupData3.entityGroupRefName, ref lastClassId);
var spawnDeadChance = biomeSpawnEntityGroupData3.spawnDeadChance;
_chunkBiomeSpawnData.IncEntitiesSpawned(entityGroupName);
var randomFromGroup = EntityGroups.GetRandomFromGroup(biomeSpawnEntityGroupData3.entityGroupName, ref lastClassId);
_chunkBiomeSpawnData.IncCount(idHash);
var entity = EntityFactory.CreateEntity(randomFromGroup, vector);
entity.SetSpawnerSource(EnumSpawnerSource.Dynamic, _chunkBiomeSpawnData.chunk.Key, entityGroupName);
entity.SetSpawnerSource(EnumSpawnerSource.Dynamic, _chunkBiomeSpawnData.chunk.Key, idHash);
var myEntity = entity as global::EntityAlive;
if (myEntity) myEntity.SetSleeper();

// Debug.Log("Spawning: " + myEntity.entityId + " " + vector );
GameManager.Instance.World.SpawnEntityInWorld(entity);


if (spawnDeadChance > 0f && gameRandom.RandomFloat < spawnDeadChance) entity.Kill(DamageResponse.New(true));
GameManager.Instance.World.DebugAddSpawnedEntity(entity);
}
}
Expand Down Expand Up @@ -318,6 +258,9 @@ public static void Postfix(TerrainGeneratorWithBiomeResource __instance, Chunk _
SCoreCavesUtils.SetTexture();
SCoreCavesTexture.AddCaveToChunk(_chunk);
break;
case "SCoreCavesSplat3":
SCoreCavesSplat3.AddCaveToChunk(_chunk);
break;
//case "FastNosieSIMD":
// TerrainGeneratorSIMD_Caves.GenerateChunk(_chunk);
// break;
Expand Down Expand Up @@ -354,6 +297,10 @@ public static void Postfix(Chunk _chunk)
case "Texture2D":
SCoreCavesTexture.AddDecorationsToCave(_chunk);
break;
case "SCoreCavesSplat3":
SCoreCavesSplat3.AddDecorationsToCave(_chunk);
break;

default:
break;
}
Expand Down
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.1.62.918" />
<Version value="1.2.4.1601" />
</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.1.62.0918")]
[assembly: AssemblyFileVersion("1.1.62.0918")]
[assembly: AssemblyVersion("1.2.4.1601")]
[assembly: AssemblyFileVersion("1.2.4.1601")]
6 changes: 3 additions & 3 deletions Mods/0-SCore/Properties/AssemblyInfo.tt
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("20.0.*")]

[assembly: AssemblyVersion("1.1.<#= this.RevisionNumber #>.<#= this.BuildNumber #>")]
[assembly: AssemblyFileVersion("1.1.<#= this.RevisionNumber #>.<#= this.BuildNumber #>")]
[assembly: AssemblyVersion("1.2.<#= this.RevisionNumber #>.<#= this.BuildNumber #>")]
[assembly: AssemblyFileVersion("1.2.<#= this.RevisionNumber #>.<#= this.BuildNumber #>")]
<#+
int RevisionNumber = (int)(DateTime.UtcNow - new DateTime(2024,10,01)).TotalDays + 1;
int RevisionNumber = (int)(DateTime.UtcNow - new DateTime(2024,12,07)).TotalDays + 1;
string BuildNumber = DateTime.Now.ToString("HHmm");

#>
14 changes: 14 additions & 0 deletions Mods/0-SCore/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ Direct Download to the 0-SCore.zip available on gitlab mirror: https://github.co
### Change Logs

[ Change Log ]
Version: 1.2.4.1601
[ Block Triggered SDX ]
- Fixed an issue with the ActivateOnLook check

Version: 1.2.2.2032
- Updated Cave Spawning to fix against 1.2
- Updated other broken code from the 1.2... minor adjustments

[ Lock Pick ]
- Added a null check on entityalive before checking if they have a cvar.

[ Challenges ]
- Fixed a grammar issue in a comment

Version: 1.1.62.918
[ Repair Counter ]
- Added a new Harmony patch to monitor how often an item can be repaired, before blocking the repair.
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.
2 changes: 1 addition & 1 deletion Mods/0-SCore/Scripts/Blocks/BlockMortSpawner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ private void Update()
var ClassID = 0;
var entityId = EntityGroups.GetRandomFromGroup(EntityGroup, ref ClassID);
var spawnEntity = EntityFactory.CreateEntity(entityId, new Vector3(x, y, z));
spawnEntity.SetSpawnerSource(EnumSpawnerSource.StaticSpawner, 0, EntityGroup);
spawnEntity.SetSpawnerSource(EnumSpawnerSource.StaticSpawner);
world.SpawnEntityInWorld(spawnEntity);

if (NumberToPauseCounter > 0) NumberToPauseCounter--;
Expand Down
2 changes: 1 addition & 1 deletion Mods/0-SCore/Scripts/Blocks/BlockTriggeredSDX.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public override void Init() {
_isLootContainer = StringParsers.ParseBool(Properties.Values["IsContainer"]);

// Should the block activate when you look at it?
if (!Properties.Values.ContainsKey("ActivateOnLook"))
if (Properties.Values.ContainsKey("ActivateOnLook"))
_activateOnLook = StringParsers.ParseBool(Properties.Values["ActivateOnLook"]);

if (Properties.Values.ContainsKey("CopyCVarToAnimator"))
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 @@ -10,7 +10,7 @@ public class EntityZombieFlyingSDX : EntityFlying
private const float BS = 0.25f;
private const float ES = 10f;
private const float EE = 80f;
public static EAIFactory AiFactory = new EAIFactory();

public int maxHeight = 80; // maximum height modifier, used to prevent the birds from flying too high

public Vector3 Waypoint;
Expand Down
2 changes: 1 addition & 1 deletion Mods/SphereII Legacy Distant Terrain/ModInfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<DisplayName value="SphereII Legacy Distant Terrain"/>
<Description value="Re-enables Legacy Distant Terrain"/>
<Author value="sphereii"/>
<Version value="20.0.1052.171"/>
<Version value="20.0.1072.715"/>
<Website value=""/>
</xml>
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

using System.Reflection;

[assembly: AssemblyVersion("20.0.1052.171")]
[assembly: AssemblyFileVersion("20.0.1052.171")]
[assembly: AssemblyVersion("20.0.1072.715")]
[assembly: AssemblyFileVersion("20.0.1072.715")]
Binary file not shown.
Binary file not shown.

0 comments on commit 1a8b99b

Please sign in to comment.