Skip to content

Commit

Permalink
1.1.49.1701
Browse files Browse the repository at this point in the history
  • Loading branch information
SphereII committed Nov 18, 2024
1 parent 72bb756 commit 3478324
Show file tree
Hide file tree
Showing 32 changed files with 98 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public override void HandleRemoveHooks() {
private void Current_CraftItem(ItemStack stack) {
var itemClass = stack.itemValue.ItemClass;
var recipe = CraftingManager.GetRecipe(itemClass.GetItemName());
if (recipe?.ingredients == null ) return;
if ( recipe.ingredients.Count == 0) return;

foreach (var ingred in recipe.ingredients)
{
var itemName = ingred.itemValue.ItemClass.GetItemName();
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.42.847" />
<Version value="1.1.49.1701" />
</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.42.0847")]
[assembly: AssemblyFileVersion("1.1.42.0847")]
[assembly: AssemblyVersion("1.1.49.1701")]
[assembly: AssemblyFileVersion("1.1.49.1701")]
19 changes: 19 additions & 0 deletions Mods/0-SCore/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,25 @@ Direct Download to the 0-SCore.zip available on gitlab mirror: https://github.co
### Change Logs

[ Change Log ]
Version:
[ SpawnCube2SDX ]
- Added an additional check to see if an entity has already spawned, and blocks further spawns.

[ Challenges ]
- Fixed an issue with Craft With Ingredient, where an item had no recipe, causing a null reference.

[ EntityAliveSDX ]
- Removed a debug log about Weapon not found, but was actually there.

[ Take And Replace ]
- Added a new property that will trigger the drop event Harvest.
<property name="HarvestOnPickUp" value="true" />
- If this property is set to true, the following drop event style will be triggered:
<drop event="Harvest" name="resourceCrushedSand" count="9" tag="oreWoodHarvest"/>
<drop event="Harvest" name="resourceClayLump" count="9" tag="oreWoodHarvest"/>
- The block itself will only do the harvest; it will not give you the PickUpValue back.
- By default, Harvest On pick up is false.

Version: 1.1.42.847
[ ConfigurationBlock ]
- Added new section called "AdvancedQuests" to allow more control over quests.
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.
63 changes: 51 additions & 12 deletions Mods/0-SCore/Scripts/Blocks/BlockPickUpAndReplace.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using HarmonyLib;
using UniLinq;
using UnityEngine;

public class BlockTakeAndReplace : Block {

private const string AdvFeatureClass = "AdvancedPickUpAndPlace";

// By default, all blocks using this class will have a take delay of 15 seconds, unless over-ridden by the XML.
private float fTakeDelay = 6f;
private string itemNames = "meleeToolRepairT1ClawHammer";
Expand All @@ -17,6 +17,8 @@ public class BlockTakeAndReplace : Block {
private bool checkToolForMaterial;
private static FastTags<TagGroup.Global> silentTags = FastTags<TagGroup.Global>.Parse("silenttake");
private bool legacy = true;
private bool triggerHarvest = false;

public override void Init() {
base.Init();
if (Properties.Values.ContainsKey("TakeDelay"))
Expand All @@ -36,14 +38,15 @@ public override void Init() {
itemNames = takeWithTool;
}



if (Properties.Values.ContainsKey("HarvestOnPickUp"))
triggerHarvest = Properties.GetBool("HarvestOnPickUp");
Debug.Log($"HarvestOnPickUp: {triggerHarvest}");
}

public override void LateInit() {
base.LateInit();
// This needs to be in the LateInit, as all the changes to the config block won't be available.

// Check to see if we want to do the legacy or a simplistic method of pulling wood boards off.
var result = Configuration.GetPropertyValue(AdvFeatureClass, "Legacy");
if (!string.IsNullOrEmpty(result))
Expand All @@ -52,23 +55,22 @@ public override void LateInit() {
if (legacy)
{
if (Properties.Values.ContainsKey("HoldingItem")) itemNames = Properties.GetString("HoldingItem");
return;
return;
}
}

// See if we are using a key for the material in teh config block
var globalMaterial= Configuration.GetPropertyValue(AdvFeatureClass, validMaterials);
var globalMaterial = Configuration.GetPropertyValue(AdvFeatureClass, validMaterials);
if (!string.IsNullOrEmpty(globalMaterial))
validMaterials = globalMaterial;

var globalTool= Configuration.GetPropertyValue(AdvFeatureClass, takeWithTool);

var globalTool = Configuration.GetPropertyValue(AdvFeatureClass, takeWithTool);
if (!string.IsNullOrEmpty(globalTool))
{
takeWithTool = globalTool;
itemNames = globalTool;
}

}

// Override the on Block activated, so we can pop up our timer
Expand Down Expand Up @@ -101,6 +103,13 @@ private void TakeTarget(TimerEventData timerData) {
if (entityPlayerLocal == null) return;
var itemStack = CreateItemStack(blockValue.Block.GetBlockName());

if (triggerHarvest)
{
Harvest(block, entityPlayerLocal);
DamageBlock(world, clrIdx, vector3I, block, block.Block.blockMaterial.MaxDamage, entityPlayerLocal.entityId);
return;
}

// Find the block value for the pick up value, and add it to the inventory
if (!string.IsNullOrEmpty(PickedUpItemValue) && PickedUpItemValue.Contains(":"))
{
Expand All @@ -118,9 +127,39 @@ private void TakeTarget(TimerEventData timerData) {

// Damage the block for its full health
DamageBlock(world, clrIdx, vector3I, block, block.Block.blockMaterial.MaxDamage, entityPlayerLocal.entityId);

}

private void Harvest(BlockValue blockValue, EntityPlayerLocal player) {
if (!blockValue.Block.HasItemsToDropForEvent(EnumDropEvent.Harvest)) return;
if (GameUtils.random == null)
{
GameUtils.random = GameRandomManager.Instance.CreateGameRandom();
GameUtils.random.SetSeed((int)GameManager.Instance.World.GetWorldTime());
}

var itemDropProb = blockValue.Block.itemsToDrop[EnumDropEvent.Harvest];
for (var i = 0; i < itemDropProb.Count; i++)
{
var num2 = EffectManager.GetValue(PassiveEffects.HarvestCount, blockValue.ToItemValue(), 1f,
player, null, FastTags<TagGroup.Global>.Parse(itemDropProb[i].tag));
var itemValue = new ItemValue(ItemClass.GetItem(itemDropProb[i].name, false).type, false);
if (itemValue.type == 0 || ItemClass.list[itemValue.type] == null || (!(itemDropProb[i].prob > 0.999f) &&
!(GameUtils.random.RandomFloat <= itemDropProb[i].prob))) continue;

var count = (int)(GameUtils.random.RandomRange(itemDropProb[i].minCount, itemDropProb[i].maxCount + 1) * num2);
if (count <= 0) continue;
var itemStack = new ItemStack(itemValue, count);
var uiforPlayer = LocalPlayerUI.GetUIForPlayer(player);
var playerInventory = uiforPlayer.xui.PlayerInventory;
QuestEventManager.Current.HarvestedItem(itemValue, itemStack, blockValue);
if (playerInventory.AddItem(itemStack)) continue;
var dropPos = GameManager.Instance.World.GetPrimaryPlayer().GetDropPosition();
GameManager.Instance.ItemDropServer(new ItemStack(itemValue, itemStack.count),dropPos, new Vector3(0.5f, 0.5f, 0.5f));
}
}

// Displays the UI for the timer, calling TakeTarget when its done.
// Displays the UI for the timer, calling TakeTarget when its done.
public void TakeItemWithTimer(int _cIdx, Vector3i _blockPos, BlockValue _blockValue, EntityAlive _player) {
var playerUI = (_player as EntityPlayerLocal)?.PlayerUI;
if (playerUI == null) return;
Expand Down
23 changes: 14 additions & 9 deletions Mods/0-SCore/Scripts/Blocks/BlockSpawnCube2SDX.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ public override string GetActivationText(WorldBase _world, BlockValue _blockValu
return "";

}

public override void OnBlockAdded(WorldBase _world, Chunk _chunk, Vector3i _blockPos, BlockValue _blockValue)
{
public override void OnBlockAdded(WorldBase _world, Chunk _chunk, Vector3i _blockPos, BlockValue _blockValue) {
base.OnBlockAdded(_world, _chunk, _blockPos, _blockValue);
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer) return;
if (GameManager.Instance.IsEditMode()) return;
Expand Down Expand Up @@ -147,10 +145,19 @@ public void ApplySignData(EntityAlive entity, Vector3i _blockPos)

public override bool UpdateTick(WorldBase _world, int _clrIdx, Vector3i _blockPos, BlockValue _blockValue, bool _bRandomTick, ulong _ticksIfLoaded, GameRandom _rnd)
{
Vector3 myVector = new Vector3(1, 2, 1);

if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
var size = Vector3.one * 2f;
if (isMultiBlock)
{
size = multiBlockPos.dim;
}
if (GameManager.Instance.World
.GetEntitiesInBounds(null, new Bounds(_blockPos.ToVector3(), size)).Count > _maxSpawned)
{
DestroySelf(_blockPos, _blockValue);
return false;
}
if (_blockValue.meta >= _maxSpawned)
{
DestroySelf(_blockPos, _blockValue);
Expand Down Expand Up @@ -221,16 +228,14 @@ public override bool UpdateTick(WorldBase _world, int _clrIdx, Vector3i _blockPo
return false;
}
entity.SetSpawnerSource(EnumSpawnerSource.StaticSpawner);
Debug.Log($"Spawning: {entity.entityId} :: {_blockPos}");
GameManager.Instance.World.SpawnEntityInWorld(entity);

ApplySignData(entity as EntityAlive, _blockPos);
ApplySignData(entity, _blockPos);


_blockValue.meta++;
if (_blockValue.meta < _maxSpawned)
{
GameManager.Instance.World.SetBlockRPC(_blockPos, _blockValue);
}

}

Expand Down
2 changes: 1 addition & 1 deletion Mods/0-SCore/Scripts/Entities/EntityAliveSDX.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2186,7 +2186,7 @@ public void UpdateWeapon(ItemValue item, bool force = false) {
// Do we have this item?
if (!FindWeapon(_currentWeapon))
{
Debug.Log($"EntityAliveSDX: UpdateWeapon() Item not found: {_currentWeapon}");
// Debug.Log($"EntityAliveSDX: UpdateWeapon() Item not found: {_currentWeapon}");
if (string.IsNullOrEmpty(_defaultWeapon))
return;

Expand Down
Binary file modified Mods/CompoPackTweaks/CompoPackTweaks.dll
Binary file not shown.
Binary file modified Mods/CompoPackTweaks/CompoPackTweaks.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion Mods/SampleProject/ModInfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<Description value="Sample Project Mod"/>
<DisplayName value="Sample Project"/>
<Website value=""/>
<Version value="1.0.0.27256"/>
<Version value="1.0.0.30519"/>
</xml>
Binary file modified Mods/SampleProject/SampleProject.dll
Binary file not shown.
Binary file modified Mods/SampleProject/SampleProject.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion Mods/SphereII A Better Life/ModInfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<Description value="SphereII A Better Life, adding fish and birds to the game."/>
<DisplayName value="A Better Life"/>
<Website value=""/>
<Version value="1.0.48.1447"/>
<Version value="1.0.100.1657"/>
</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("1.0.48.1447")]
[assembly: AssemblyFileVersion("1.0.48.1447")]
[assembly: AssemblyVersion("1.0.100.1657")]
[assembly: AssemblyFileVersion("1.0.100.1657")]
Binary file modified Mods/SphereII A Round World/bin/Debug/SphereII_A_Round_World.dll
Binary file not shown.
Binary file modified Mods/SphereII A Round World/bin/Debug/SphereII_A_Round_World.pdb
Binary file not shown.
Binary file modified Mods/SphereII Clear UI/SphereII Clear UI.dll
Binary file not shown.
Binary file modified Mods/SphereII Clear UI/SphereII Clear UI.pdb
Binary file not shown.
Binary file modified Mods/SphereII Dedicated Tweaks/SphereII Dedicated Tweaks.dll
Binary file not shown.
Binary file modified Mods/SphereII Dedicated Tweaks/SphereII Dedicated Tweaks.pdb
Binary file not shown.
Binary file modified Mods/SphereII Disable Sway/SphereII_Disable_Sway.dll
Binary file not shown.
Binary file modified Mods/SphereII Disable Sway/SphereII_Disable_Sway.pdb
Binary file not shown.
Binary file modified Mods/SphereII Larger Parties/SphereII Larger Parties.dll
Binary file not shown.
Binary file modified Mods/SphereII Larger Parties/SphereII Larger Parties.pdb
Binary file not shown.
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.1000.1447"/>
<Version value="20.0.1052.171"/>
<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.1000.1447")]
[assembly: AssemblyFileVersion("20.0.1000.1447")]
[assembly: AssemblyVersion("20.0.1052.171")]
[assembly: AssemblyFileVersion("20.0.1052.171")]
Binary file not shown.
Binary file not shown.
Binary file modified Mods/SphereII Winter Project/SphereII_Winter_Project.dll
Binary file not shown.
Binary file modified Mods/SphereII Winter Project/SphereII_Winter_Project.pdb
Binary file not shown.

0 comments on commit 3478324

Please sign in to comment.