From fea55de44f9bda3ddb46ca38a37582420d6918ea Mon Sep 17 00:00:00 2001 From: XuuXiao Date: Mon, 12 May 2025 00:58:32 +0100 Subject: [PATCH 1/2] changed item weight to be a clamp, whoopsie --- CHANGELOG.md | 6 ++++++ LethalLib/Modules/Items.cs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d56459..bda9dec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## LethalLib [1.0.3] + +### Fixed + +- Changed the validation to be a clamp and not forced to be 1. + ## LethalLib [1.0.2] ### Added diff --git a/LethalLib/Modules/Items.cs b/LethalLib/Modules/Items.cs index 590aae8..c34adc3 100644 --- a/LethalLib/Modules/Items.cs +++ b/LethalLib/Modules/Items.cs @@ -867,7 +867,7 @@ private static void ValidateItemProperties(Item item) if (item.weight < 1 || item.weight > 4) { Plugin.logger.LogWarning($"Item {item.itemName} has an invalid weight of {item.weight}, resetting to weight of 1, please check the lethal.wiki for how to give an item a valid weight, anything below 1 or above 4 gets reset to 1."); - item.weight = 1; + item.weight = Mathf.Clamp(item.weight, 1, 4); } } /// From 5816efbc22e06ec33445a75d7afc09f162cf86c5 Mon Sep 17 00:00:00 2001 From: XuuXiao Date: Mon, 12 May 2025 01:07:05 +0100 Subject: [PATCH 2/2] updated the warning message --- LethalLib/Modules/Items.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LethalLib/Modules/Items.cs b/LethalLib/Modules/Items.cs index c34adc3..52f7dd6 100644 --- a/LethalLib/Modules/Items.cs +++ b/LethalLib/Modules/Items.cs @@ -866,7 +866,7 @@ private static void ValidateItemProperties(Item item) if (item.weight < 1 || item.weight > 4) { - Plugin.logger.LogWarning($"Item {item.itemName} has an invalid weight of {item.weight}, resetting to weight of 1, please check the lethal.wiki for how to give an item a valid weight, anything below 1 or above 4 gets reset to 1."); + Plugin.logger.LogWarning($"Item {item.itemName} has an invalid weight of {item.weight}, resetting to weight of 1, please check the lethal.wiki for the weight calculation and give it a valid number, anything below 1 or above 4 gets forced to be 1 or 4."); item.weight = Mathf.Clamp(item.weight, 1, 4); } }