Skip to content

Commit

Permalink
1.0.37.1432
Browse files Browse the repository at this point in the history
  • Loading branch information
SphereII committed Aug 1, 2024
1 parent f1216d5 commit 947ff61
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 17 deletions.
6 changes: 5 additions & 1 deletion Mods/0-SCore/0-SCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
<Compile Include="Harmony\EAI\EAIManager.cs" />
<Compile Include="Harmony\EAI\EAITarget.cs" />
<Compile Include="Harmony\EntityAlive\AddScriptToTransform.cs" />
<Compile Include="Harmony\EntityAlive\EntityAliveJiggleAdjustment.cs" />
<Compile Include="Harmony\EntityAlive\EntityAlivePatches.cs" />
<Compile Include="Harmony\EntityAlive\EntityTraderRektMute.cs" />
<Compile Include="Harmony\EntityAlive\ReplicateSpeed.cs" />
Expand Down Expand Up @@ -726,6 +727,7 @@
<HintPath>..\..\7DaysToDie_Data\Managed\LogLibrary.dll</HintPath>
<Private>False</Private>
</Reference>
<!--
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualStudio.RemoteControl, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.VisualStudio.RemoteControl.16.3.44\lib\net45\Microsoft.VisualStudio.RemoteControl.dll</HintPath>
Expand Down Expand Up @@ -758,6 +760,7 @@
<Reference Include="System.Collections.Immutable, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.6.0.0\lib\net461\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
Expand All @@ -771,6 +774,7 @@
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
-->
<Reference Include="System.Xml">
<HintPath>..\..\7DaysToDie_Data\Managed\System.Xml.dll</HintPath>
<Private>False</Private>
Expand Down Expand Up @@ -825,7 +829,7 @@
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>..\..\..\..\Program Files (x86)\Steam\steamapps\common\7 Days To Die\7DaysToDie_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
<HintPath>..\..\7DaysToDie_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>..\..\7DaysToDie_Data\Managed\UnityEngine.UI.dll</HintPath>
Expand Down
4 changes: 3 additions & 1 deletion Mods/0-SCore/Config/Localization.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ npcHasItems,"NPC has items in their inventory."
xuiSCoreUtilities,"SCore Utilities",""
xuiSCoreNPCSettings,"NPC Settings",""
xuiQuietNPC,"Mute NPC Footsteps",""
xuiScoreUtilsNPCFootStep,"Mute NPC Footsteps",""
xuiScoreUtilsNPCFootStepToolTip,"Mutes NPC Footsteps",""
xuiQuietNPCToolTip,"Mutes NPC Footsteps",""
xuiLockPickingSettings,"Lock Pick Settings",""
xuiNPCSettings,"NPC Settings",""
Expand Down Expand Up @@ -114,5 +116,5 @@ xuiSCoreUtilsDisableFlickeringLights,"Disable Flickering Lights",""
xuiSCoreUtilsDisableFlickeringLightsToolTip,"Disables Flickering Lights.",""
xuiPersonalSettings,"Personal Settings",""
xuiSCoreUtilsAutoRedeemChallenges,"Auto Redeem Challenges",""
xuiSCoreUtilsAutoRedeemChallengesToolTip,"Auto Redeem Challanges as they complete.",""
xuiSCoreUtilsAutoRedeemChallengesToolTip,"Auto Redeem Challenges as they complete.",""
ObjectiveBuffSDX_keyword,"Get",""
1 change: 1 addition & 0 deletions Mods/0-SCore/Config/blocks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
<property name="LowerResolutionUMA" value="false" /> <!-- Lower resolution on UMAs drastically -->

<property name="EntityPooling" value="false" />

</property>

<property class="AdvancedProgression">
Expand Down
24 changes: 24 additions & 0 deletions Mods/0-SCore/Harmony/EntityAlive/EntityAliveJiggleAdjustment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Collections.Generic;
using HarmonyLib;
using UnityEngine;

namespace Harmony.EntityAlive {
// In vanilla, the jiggle script gets turned off at a pretty aggressive level.
// This will allow each entity to customize it's jiggle distance.
[HarmonyPatch(typeof(EModelBase))]
[HarmonyPatch("JiggleOn")]
public class EModelBaseJiggleOn {
private static bool Prefix(EModelBase __instance, ref bool _on) {
if (__instance.entity is not global::EntityAlive entityAlive) return true;

if (entityAlive.EntityClass.Properties.GetBool("AlwaysJiggle"))
_on = true;

if (entityAlive.EntityClass.Properties.GetBool("NeverScaleAI"))
entityAlive.aiActiveScale = 1f;

return true;

}
}
}
18 changes: 12 additions & 6 deletions Mods/0-SCore/Harmony/FoodSpoilage/FoodSpoilage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,13 @@ private static float GetCurrentSpoilage(ItemValue itemValue) {
return 1f;
}

private static void SetSpoilageMax(ItemValue itemValue, float degradationMax) {
itemValue.SetMetadata(KeySpoilageAmount, degradationMax, TypedMetadataValue.TypeTag.Float);
}
private static float UpdateCurrentSpoilage(ItemValue itemValue, float spoiled) {
var currentSpoilageAmount = GetCurrentSpoilage(itemValue);
currentSpoilageAmount += spoiled;

itemValue.SetMetadata(KeySpoilageAmount, currentSpoilageAmount, TypedMetadataValue.TypeTag.Float);
return currentSpoilageAmount;
}
Expand Down Expand Up @@ -264,7 +268,6 @@ public static bool Prefix(XUiC_ItemStack __instance) {
strDisplay += " Spoilage Ticks Missed: " + totalSpoilageMultiplier;
strDisplay += " Total Spoilage: " + totalSpoilage;

// If we don't want any degradation, skip this step.
currentSpoilage = UpdateCurrentSpoilage(itemValue, totalSpoilage);

// Update the NextSpoilageTick value
Expand Down Expand Up @@ -304,7 +307,6 @@ public static bool Prefix(XUiC_ItemStack __instance) {
}

var itemStackSpoiled = new ItemStack(ItemClass.GetItem(strSpoiledItem, false), count);

if (itemStackSpoiled?.itemValue?.ItemClass != null &&
itemStackSpoiled.itemValue.ItemClass.GetItemName() != itemClass.GetItemName())
{
Expand All @@ -316,12 +318,14 @@ public static bool Prefix(XUiC_ItemStack __instance) {
}
}
}

if (itemStack.count > 2)
if (itemStack.count >= 2)
{
AdvLogging.DisplayLog(AdvFeatureClass, itemClass.GetItemName() + ": Reducing Stack by 1");
itemStack.count--;
currentSpoilage = UpdateCurrentSpoilage(itemValue, -degradationMax);
currentSpoilage -= degradationMax;

// Reset the spoilage counter on the item.
SetSpoilageMax(itemValue,degradationMax);
}
else
{
Expand All @@ -330,7 +334,9 @@ public static bool Prefix(XUiC_ItemStack __instance) {
break; // Nothing more to spoil
}
}


// Set the current spoilage value.
SetSpoilageMax(itemValue,currentSpoilage);
__instance.ForceRefreshItemStack();

return true;
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.0.32.940" />
<Version value="1.0.37.1500" />
</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.32.0940")]
[assembly: AssemblyFileVersion("1.0.32.0940")]
[assembly: AssemblyVersion("1.0.37.1500")]
[assembly: AssemblyFileVersion("1.0.37.1500")]
19 changes: 19 additions & 0 deletions Mods/0-SCore/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@ Direct Download to the 0-SCore.zip available on gitlab mirror:
### Change Logs

[ Change Log ]
Version: 1.0.37.1432
[ Localization ]
- Updated some missing localization entries.

[ Food Spoilage ]
- Fixed an issue where a stack was smapping unlimited rotten meat
- Issue was related to the Spoilage meter on an item not being reset properly after each spoiled item.

[ Jiggle Adjustments ]
- If you are under 18, stop reading.
- This is mostly for xyth, who is more assuredly considered old enough to view.
- Exposed two properties for EntityAlive's:
<!-- Always enable the jiggle script, regardless of distance -->
<property name="AlwaysJiggle" value="true" />

<!-- Never downscale the AI, regardless of distance -->
<property name="NeverScaleAI" value="true" />


Version: 1.0.32.940

[ CompoPackTweaks ]
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.
8 changes: 4 additions & 4 deletions Mods/0-SCore/Scripts/Blocks/BlockPickUpAndReplace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ public override void Init() {
if (Properties.Values.ContainsKey("PickUpBlock")) pickupBlock = Properties.GetString("PickUpBlock");
if (Properties.Values.ContainsKey("ValidMaterials")) validMaterials = Properties.GetString("ValidMaterials");
if (Properties.Values.ContainsKey("TakeWithTool")) takeWithTool = Properties.GetString("TakeWithTool");
if (Properties.Values.ContainsKey("CheckToolForMaterial")) validateToolToMaterial = Properties.GetBool("CheckToolForMaterial");

if (Properties.Values.ContainsKey("CheckToolForMaterial"))
validateToolToMaterial = Properties.GetBool("CheckToolForMaterial");
}

// Override the on Block activated, so we can pop up our timer
public override bool OnBlockActivated(WorldBase world, int clrIdx, Vector3i blockPos,
BlockValue blockValue, EntityPlayerLocal player) {
if (!ValidMaterialCheck(blockValue,player)) return false;
if (!ValidMaterialCheck(blockValue, player)) return false;
TakeItemWithTimer(clrIdx, blockPos, blockValue, player);
return true;
}
Expand Down Expand Up @@ -120,7 +120,6 @@ public void TakeItemWithTimer(int _cIdx, Vector3i _blockPos, BlockValue _blockVa
break;
}


xuiCTimer.SetTimer(newTakeTime, timerEventData);
}

Expand All @@ -132,6 +131,7 @@ private bool ValidMaterialCheck(BlockValue blockValue, EntityAlive entityAlive)
{
return entityAlive.inventory.holdingItem.HasAnyTags(FastTags<TagGroup.Global>.Parse(blockMaterial.id));
}

// Check to see if the material is valid to pick up
foreach (var material in validMaterials.Split(','))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Collections.Generic;
using System.Windows.Forms.VisualStyles;
using UnityEngine;

public class XUiC_SCoreCompanionList : XUiController
{
Expand Down

0 comments on commit 947ff61

Please sign in to comment.