Skip to content

Commit

Permalink
1.0.45.1058
Browse files Browse the repository at this point in the history
  • Loading branch information
SphereII committed Aug 9, 2024
1 parent f8bbf6d commit 551721e
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 9 deletions.
3 changes: 2 additions & 1 deletion Mods/0-SCore/Config/Localization.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,5 @@ xuiPersonalSettings,"Personal Settings",""
xuiSCoreUtilsAutoRedeemChallenges,"Auto Redeem Challenges",""
xuiSCoreUtilsAutoRedeemChallengesToolTip,"Auto Redeem Challenges as they complete.",""
ObjectiveBuffSDX_keyword,"Get",""
ItemCannotBePlaced,"This item cannot go into this slot.",""
ItemCannotBePlaced,"This item cannot go into this slot.",""
npcNoStorage,"NPCs Cannot Be Placed In Storage.",""
25 changes: 22 additions & 3 deletions Mods/0-SCore/Harmony/XUIC/XUiC_ItemStack_SlotTags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,28 @@ private static bool IsStackAllowedInContainer(XUiC_ItemStack itemStack) {

// Only run on loot containers and their slots.
if (itemStack.xui.lootContainer == null) return true;

if (itemStack.StackLocation != XUiC_ItemStack.StackLocationTypes.LootContainer) return true;

var block = itemStack.xui.lootContainer.blockValue.Block;
var blockValue = GameManager.Instance.World.GetBlock(itemStack.xui.lootContainer.ToWorldPos());
var block = blockValue.Block;
return CanPlaceItemInContainerViaTags(block, currentStack, true);
}
private static bool CanPlaceItemInContainerViaTags(Block block, ItemStack itemStack, bool showToolTip = false) {

if (itemStack.itemValue.HasMetadata("NoStorage"))
{
var noStorageString = itemStack.itemValue.GetMetadata("NoStorage")?.ToString();
if (!string.IsNullOrEmpty(noStorageString))
{
var noStorageId = StringParsers.ParseSInt32(noStorageString);
if (noStorageId > 0)
{
DisplayToolTip(block, itemStack);
return false;
}
}

}
// If the tags don't exist, skip all the checks.
if (!block.Properties.Contains("AllowTags") && !block.Properties.Contains("DisallowTags")) return true;

Expand All @@ -46,6 +61,11 @@ private static bool CanPlaceItemInContainerViaTags(Block block, ItemStack itemSt


if (!showToolTip) return false;
DisplayToolTip(block, itemStack);
return false;
}

private static void DisplayToolTip(Block block, ItemStack itemStack) {
var message = Localization.Get("ItemCannotBePlaced");
if (block.Properties.Contains("DisallowedKey"))
{
Expand All @@ -59,7 +79,6 @@ private static bool CanPlaceItemInContainerViaTags(Block block, ItemStack itemSt
var primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
XUiC_PopupToolTip.ClearTooltips(primaryPlayer.playerUI.xui);
GameManager.ShowTooltip(primaryPlayer, message);
return false;
}

// For clicking and sending objects to the toolbelt/backpack/loot container
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.45.853" />
<Version value="1.0.45.1058" />
</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.0853")]
[assembly: AssemblyFileVersion("1.0.45.0853")]
[assembly: AssemblyVersion("1.0.45.1058")]
[assembly: AssemblyFileVersion("1.0.45.1058")]
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.45.1058
[ Check Items For Valid Containers ]
- Fixed another null reference when blocking an item from the NPC's loot container.
- Added filter for ItemValue's MetaData to exclude them from being added to a chest
- If an ItemValue has a Meta Data of "NoStorage", with a value greater than 0, it will be blocked.

[ NPCs ]
- Added a few new properties to NPCs to block them from being added to storage.
- These are processed regardless of tags on the storage container or item.
- When an NPC is being picked up, NoStorage is read from the entityclass.
- By default, without this property, storage is allowed.
- npcNoStorage localization is added to the 0-SCore's Localization

Example syntax:
<append xpath="/entity_classes/entity_class[@name='npcMeleeTemplate']">
<property name="NoStorage" value="true" />
<property name="DisallowedKey" value="npcNoStorage" />
</append>

Version: 1.0.45.853
[ Check Items For Valid Containers ]
- Fixed a null reference when opening up zombie loot bags, because they do not have block properties.
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.
14 changes: 12 additions & 2 deletions Mods/0-SCore/Scripts/Entities/EntityAliveSDX.cs
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,12 @@ public void ConfigureBoundaryBox(Vector3 newSize, Vector3 center) {
DisplayLog(" After BoundaryBox: " + boundingBox.ToCultureInvariantString());
}

public override void updateSpeedForwardAndStrafe(Vector3 _dist, float _partialTicks)
{
public override void updateSpeedForwardAndStrafe(Vector3 _dist, float _partialTicks) {
if (this.isEntityRemote && _partialTicks > 1f)
{
_dist /= _partialTicks;
}

this.speedForward *= 0.5f;
this.speedStrafe *= 0.5f;
this.speedVertical *= 0.5f;
Expand All @@ -408,10 +408,12 @@ public override void updateSpeedForwardAndStrafe(Vector3 _dist, float _partialTi
this.speedForward += num2 * _dist.z - num * _dist.x;
this.speedStrafe += num2 * _dist.x + num * _dist.z;
}

if (Mathf.Abs(_dist.y) > 0.001f)
{
this.speedVertical += _dist.y;
}

this.SetMovementState();
}

Expand Down Expand Up @@ -2073,6 +2075,14 @@ public ItemValue GetItemValue() {
itemValue.SetMetadata("DefaultWeapon", _defaultWeapon, TypedMetadataValue.TypeTag.String);
itemValue.SetMetadata("RightHandJointName", inventory.holdingItem.Properties.GetString("RightHandJointName"),
TypedMetadataValue.TypeTag.String);

itemValue.SetMetadata("NoStorage", 0, TypedMetadataValue.TypeTag.Integer);
if (currentEntityClass.Properties.Values.ContainsKey("NoStorage"))
{
var noStorage = currentEntityClass.Properties.GetBool("NoStorage");
itemValue.SetMetadata("NoStorage", noStorage ? 1 : 0, TypedMetadataValue.TypeTag.Integer);
}

if (lootContainer == null) return itemValue;

if (!string.IsNullOrEmpty(lootContainer.lootListName))
Expand Down

0 comments on commit 551721e

Please sign in to comment.