1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2026-03-23 05:23:28 +08:00

修复喷涂增产剂的物品会卡住储物仓垃圾桶的问题

Fix issue where items with productivity spray get stuck in storage dustbin
This commit is contained in:
SSSSSSSan
2025-11-23 21:15:58 +08:00
committed by Soar Qin
parent f7fc9aaab0
commit 7e9f9ee1ce
3 changed files with 98 additions and 12 deletions

View File

@@ -58,13 +58,31 @@ public class Dustbin : BaseUnityPlugin, IModCanSave, IMultiplayerMod
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int CalcGetSands(int itemId, int count)
public static int CalcGetSands(int itemId, int count, int inc)
{
var sandsPerItem = itemId <= 12000 ? Dustbin.SandsFactors[itemId] : 0;
if (sandsPerItem <= 0) return count;
// Log item information for debugging
var itemProto = LDB.items.Select(itemId);
if (itemProto != null)
{
Logger.LogInfo($"Item destroyed - ID: {itemId}, Name: {itemProto.name}, Type: {itemProto.Type}, StackSize: {itemProto.StackSize}, Grade: {itemProto.Grade}, Count: {count}, Inc: {inc}");
}
else
{
Logger.LogInfo($"Item destroyed - ID: {itemId}, Name: Unknown, Count: {count}, Inc: {inc}");
}
if (sandsPerItem <= 0)
{
Logger.LogInfo($"No sands generated for item {itemId} (SandsFactor: {sandsPerItem}, Inc: {inc}) - Returning {count} to indicate item destroyed");
return count;
}
var player = GameMain.mainPlayer;
var addCount = count * sandsPerItem;
player.sandCount += addCount;
Logger.LogInfo($"Sands calculation - ItemID: {itemId}, SandsFactor: {sandsPerItem}, Total sands: {addCount}, Inc: {inc} - Returning {count} to indicate item destroyed");
return count;
}