Don't Starve Together

Don't Starve Together

Auto Sort Inventory/Bags/Chests
Paul  [developer] 14 Jun @ 6:31pm
崩溃问题讨论
麻烦发下更详细的崩溃日志
< >
Showing 1-9 of 9 comments
一共开了50+mod,带包整理只是有时候发生,大概1/4概率。
[00:55:43]: [string "../mods/workshop-3485622209/scripts/sort.lu..."]:430: invalid order function for sorting
LUA ERROR stack traceback:
=[C]:-1 in (field) sort (C) <-1--1>
../mods/workshop-3485622209/scripts/sort.lua:430 in (upvalue) CXZ_SortUp (Lua) <367-528>
inst = 121731 - wortox (valid:true)
union = true
lockedslots = table: 00000000385071C0
items = table: 000000005568FD50
additemcount = 153
container = table: 0000000017C74820
containernumslots = 150
../mods/workshop-3485622209/scripts/sort.lua:552 in (field) CXZSort (Lua) <549-554>
inst = 121731 - wortox (valid:true)
doer = 121731 - wortox (valid:true)
union = true
lockedslots = table: 0000000038506F40
../mods/workshop-3485622209/modmain.lua:234 in (field) fn (Lua) <227-238>
act = 带包整理 121731 - wortox (valid:true)
targ = 121731 - wortox (valid:true)
scripts/bufferedaction.lua:26 in (method) Do (Lua) <22-36>
self (valid:true) =
action = table: 00000000117D0010
doer = 121731 - wortox (valid:true)
onfail = table: 0000000014969190
doerownsobject = false
rotation = 0
onsuccess = table: 0000000014969280
options = table: 0000000014969AA0
target = 121731 - wortox (valid:true)
scripts/entityscript.lua:1578 in (method) PerformBufferedAction (Lua) <1560-1593>
self (valid:true) =
speedupcost = net_shortint (000000005292A740)
_freesoulhop_counter = 0
currentwickerbook = net_shortint (0000000052923FD0)
SetCameraDistance = function - scripts/prefabs/player_common.lua:1517
CanSeePointOnMiniMap = function - scripts/prefabs/player_common_extensions.lua:899
skeleton_prefab = skeleton_player
currentspiderqueen = net_shortint (0000000052927270)
currentbirchnut = net_shortint (0000000052927680)
AddOrRemoveTag = function - ../mods/workshop-1909182187/scripts/medal_moretags.lua:235
IsActing = function - scripts/prefabs/player_common_extensions.lua:961
currentcarnivalcraft = net_shortint (0000000052929FC0)
currenteternalicebox = net_shortint (000000005292C9F0)
currenteatmonsterlasagna = net_shortint (0000000052921820)
currenttask5 = net_shortint (0000000052921500)
taskprize1 = net_bool (000000005291ED50)
medal_build_list = net_string (000000004DACD8A0)
data_player = table: 0000000038512D40
checkpacifist = net_shortint (0000000052927900)
currentlunacy = net_shortint (00000000529242F0)
LoadForReroll_legion = function - ../mods/workshop-3016346770/scripts/se_functionse.lua:282
OnWakeUp = function - scripts/prefabs/player_common.lua:1347
Transform = Transform (000000004DA992D0)
checkmutatedbearger = net_shortint (0000000052923F80)
currentfertilizemaster = net_shortint (00000000529222C0)
currentpigkingtrading = net_shortint (0000000052923080)
currentexpertwx1 = net_shortint (00000000529299D0)
checkkillgloomer = net_shortint (0000000052922F90)
currenteasyfarm = net_shortint (0000000052931220)
checkkillfriendlyfruitfly = net_shortint (0000000052922040)
currentcriticaldmgup = net_shortint (000000005292FA60)
checksitting = net_shortint (0000000052923440)
repairitemupcost = net_shortint (000000005292C540)
HasOneOfTags = function - ../mods/workshop-1909182187/scripts/medal_moretags.lua:224
currentexpertwanda1 = net_shortint (000000005292CE50)
checkdamagedeal = net_shortint (000000005291F110)
checksaladmander = net_shortint (000000005291F750)
currentclustercraft = net_shortint (000000005292CC70)
checkbosswinter = net_shortint (00000000529246B0)
checkdiecharlie = net_shortint (0000000052923800)
currentplanardamageup = net_shortint (000000005292BC30)
currentcrittercraft = net_shortint (0000000052929C50)
checkdeath = net_shortint (0000000052922400)
currentbuildmaster = net_shortint (00000000529277C0)
currentgrassgator = net_shortint (000000005291E940)
SetCameraZoomed = function - scripts/prefabs/player_common.lua:1539
currentexpertwa
[00:55:43]: (崩溃检测)报错相关的mod:
workshop-3485622209 (自动整理)
[string "../mods/workshop-3485622209/scripts/sort.lu..."]:430: invalid order function for sorting
LUA ERROR stack traceback:
=[C]:-1 in (field) sort (C) <-1--1>
../mods/workshop-3485622209/scripts/sort.lua:430 in (upvalue) CXZ_SortUp (Lua) <367-528>
../mods/workshop-3485622209/scripts/sort.lua:552 in (field) CXZSort (Lua) <549-554>
../mods/workshop-3485622209/modmain.lua:234 in (field) fn (Lua) <227-238>
scripts/bufferedaction.lua:26 in (method) Do (Lua) <22-36>
scripts/entityscript.lua:1578 in (method) PerformBufferedAction (Lua) <1560-1593>
scripts/stategraphs/SGwilson.lua:7553 in (field) ontimeout (Lua) <7545-7554>
scripts/stategraph.lua:648 in (method) UpdateState (Lua) <634-678>
scripts/stategraph.lua:704 in (method) Update (Lua) <697-723>
scripts/stategraph.lua:128 in (method) Update (Lua) <109-146>
scripts/update.lua:288 in () ? (Lua) <224-298>

[00:55:43]: [workshop-2189004162 (Insight)]: A crash has occured (THIS DOES NOT MEAN IT WAS INSIGHT, THIS IS JUST HERE FOR DEBUGGING PURPOSES)
[00:55:43]: [workshop-2189004162 (Insight)]: Title: 警告!
[00:55:43]: [workshop-2189004162 (Insight)]: Text: (崩溃检测)报错相关的mod:
workshop-3485622209 (自动整理)
[string "../mods/workshop-3485622209/scripts/sort.lu..."]:430: invalid order function for sorting
LUA ERROR stack traceback:
=[C]:-1 in (field) sort (C) <-1--1>
../mods/workshop-3485622209/scripts/sort.lua:430 in (upvalue) CXZ_SortUp (Lua) <367-528>
../mods/workshop-3485622209/scripts/sort.lua:552 in (field) CXZSort (Lua) <549-554>
../mods/workshop-3485622209/modmain.lua:234 in (field) fn (Lua) <227-238>
scripts/bufferedaction.lua:26 in (method) Do (Lua) <22-36>
scripts/entityscript.lua:1578 in (method) PerformBufferedAction (Lua) <1560-1593>
scripts/stategraphs/SGwilson.lua:7553 in (field) ontimeout (Lua) <7545-7554>
scripts/stategraph.lua:648 in (method) UpdateState (Lua) <634-678>
scripts/stategraph.lua:704 in (method) Update (Lua) <697-723>
scripts/stategraph.lua:128 in (method) Update (Lua) <109-146>
scripts/update.lua:288 in () ? (Lua) <224-298>

[00:55:43]: [workshop-2189004162 (Insight)]: Additionaltext: 此错误可能是由于你启用的某个模组所致!
你启用了下列模组:
"史诗血量条" "Craftable Butter" "[AnL] Achievement and Perk Config" "四/五/六格装备栏(留言适配模组)" "Infinite Light" "Insight for Functional Medal" " 简单经济学改(适配MOD)" "AUTO Store Into Chest" "Auto Stack and Pick Up" "Craftable Mobs" "Durability Tweaks 调整耐久度" "Growing Sword Extended" "Improved Additional Set Pieces (w/ Caves, Lunar Islands, Ruins and Lunar Grotto)" "Insight for Legion" "Marblestack Beans" "Mass Tree Planting" "Moving objects with mouse" "Upgradeable Chest" "WX自动化" "minimapicon" "全能力" "原生作物" "堆肥桶智能自动填充" "大力士勋章" "开锯" "彩虹罐" "更好的随从" "木牌传送(皮肤版)" "消除间距" "石果修正" "神奇组合包" "超级打包" "近期bug修复" "镰刀" "香脆松子" "Prefab ID Concatenator" "开摆!" "简易存储" "储藏室 (新地窖)" "食趣" "[DST] 棱镜" "[DST]海洋传说" "成就与等级" "Wormholes/Sinkholes Icons For Server 虫洞/天坑的服务器图标" "Insight" "能力勋章" "更多格子 For 能力勋章" "欧皇模拟器" "Smart Minisign Revisited" "自动整理" " Simple Health Bar DST" "More cooking/整组烹饪、整组喂鸟" "House" "曼德拉物品" "超级手提袋" "󰀏馨食记󰀏" "禁止树木循环生长"
[00:55:43]: [workshop-2189004162 (Insight)]: SERVER_OWNER_HAS_OPTED_IN: false
[00:55:43]: [workshop-2189004162 (Insight)]: Status: [Insight]: Crash reporter not enabled [Server].
[00:55:43]: [workshop-2189004162 (Insight)]: State: 0

我在本地换成了AI说的代码:
① 找到文件
Steam\steamapps\workshop\content\322330\3485622209\scripts\sort.lua

② 精确替换
lua
Copy
Edit
-- ★★★ 把原来的 430 行整段删掉,换成下方代码 ★★★

-- 生成排序用 key,任何物品都会得到一个字符串
local function makekey(item)
if item == nil then
return "zzz_nil"
end
-- 示范:优先按 prefab,再按皮肤,再按 stacksize 做二级排序
local pf = item.prefab or "zzz_no_prefab"
local skin = (item.skinname or "")
local sz = (item.components.stackable and ("%03d"):format(item.components.stackable:StackSize())) or "000"
return table.concat({pf, skin, sz}, "|")
end

-- 永远返回 true/false
local function safelt(a, b)
return makekey(a) < makekey(b)
end

-- 真·安全排序
table.sort(items, safelt)
注意

只要有 makekey 就几乎不会再返回 nil。

没改其它逻辑,对原 UI/快捷键无影响。

③ 保存 → 重启 → OK
玩儿了一两小时目前带包整理还没有崩溃。待会儿继续试试看是不是这个有用。
Paul  [developer] 15 Jun @ 2:55am 
ok,这mod确实多,我先挨个装上
大佬,我本地改成上面那样就没有崩了。可能有什么特殊模组物品在我包里,整理报错了。装这么多mod启动挺慢的,麻烦了。如果不好修就算了,感觉是边缘案例,极限测试。
Paul  [developer] 15 Jun @ 7:25pm 
没事,bug还是要修的,gpt给的代码省略了我的一些逻辑,排出来会有些不一样,现在的版本我尝试在几个可能会崩溃的点做了修复,你有空的话可以更新了试试。这么多mod我得找时间慢慢复现你的bug
好的,谢谢~更新之后新crash log是这个:
[01:33:13]: [string "../mods/workshop-3485622209/scripts/sort.lu..."]:434: invalid order function for sorting
LUA ERROR stack traceback:
=[C]:-1 in (field) sort (C) <-1--1>
../mods/workshop-3485622209/scripts/sort.lua:434 in (upvalue) CXZ_SortUp (Lua) <371-532>
inst = 124281 - wortox (valid:true)
union = true
lockedslots = table: 00000000415EA380
items = table: 00000000630D2F80
additemcount = 156
container = table: 000000002AB2B080
containernumslots = 150
../mods/workshop-3485622209/scripts/sort.lua:556 in (field) CXZSort (Lua) <553-558>
inst = 124281 - wortox (valid:true)
doer = 124281 - wortox (valid:true)
union = true
lockedslots = table: 00000000415E9D40
../mods/workshop-3485622209/modmain.lua:234 in (field) fn (Lua) <227-238>
act = 带包整理 124281 - wortox (valid:true)
targ = 124281 - wortox (valid:true)
scripts/bufferedaction.lua:26 in (method) Do (Lua) <22-36>
self (valid:true) =
action = table: 00000000132F3E30
doer = 124281 - wortox (valid:true)
onfail = table: 00000000322DCD90
doerownsobject = false
rotation = 0
onsuccess = table: 00000000322DC980
options = table: 00000000322DCDE0
target = 124281 - wortox (valid:true)
scripts/entityscript.lua:1578 in (method) PerformBufferedAction (Lua) <1560-1593>
self (valid:true) =
speedupcost = net_shortint (000000000A8BB790)
_freesoulhop_counter = 0
currentwickerbook = net_shortint (000000000A8D4F10)
SetCameraDistance = function - scripts/prefabs/player_common.lua:1517
CanSeePointOnMiniMap = function - scripts/prefabs/player_common_extensions.lua:899
skeleton_prefab = skeleton_player
currentspiderqueen = net_shortint (000000000A8D79E0)
currentbirchnut = net_shortint (000000000A8B8F90)
AddOrRemoveTag = function - ../mods/workshop-1909182187/scripts/medal_moretags.lua:235
IsActing = function - scripts/prefabs/player_common_extensions.lua:961
currentcarnivalcraft = net_shortint (000000000A8BB880)
currenteternalicebox = net_shortint (000000000A8DE6A0)
currenteatmonsterlasagna = net_shortint (000000000A8D1400)
currenttask5 = net_shortint (000000000A8D2710)
taskprize1 = net_bool (000000000A8CF9C0)
medal_build_list = net_string (000000002A67E110)
data_player = table: 00000000415F5730
checkpacifist = net_shortint (000000000A8B9260)
currentlunacy = net_shortint (000000000A8D59B0)
LoadForReroll_legion = function - ../mods/workshop-3016346770/scripts/se_functionse.lua:282
OnWakeUp = function - scripts/prefabs/player_common.lua:1347
Transform = Transform (00000000142E4D50)
checkmutatedbearger = net_shortint (000000000A8D5820)
currentfertilizemaster = net_shortint (000000000A8D1DB0)
currentpigkingtrading = net_shortint (000000000A8D57D0)
currentexpertwx1 = net_shortint (000000000A8B9B20)
checkkillgloomer = net_shortint (000000000A8D3610)
currenteasyfarm = net_shortint (000000000A8DFA50)
checkkillfriendlyfruitfly = net_shortint (000000000A8D1E00)
currentcriticaldmgup = net_shortint (000000000A8DDF70)
checksitting = net_shortint (000000000A8D4A60)
repairitemupcost = net_shortint (000000000A8DDD90)
HasOneOfTags = function - ../mods/workshop-1909182187/scripts/medal_moretags.lua:224
currentexpertwanda1 = net_shortint (000000000A8DE1A0)
checkdamagedeal = net_shortint (000000000A8CECA0)
checksaladmander = net_shortint (000000000A8D19A0)
currentclustercraft = net_shortint (000000000A8DED30)
checkbosswinter = net_shortint (000000000A8D5C80)
checkdiecharlie = net_shortint (000000000A8D2530)
currentplanardamageup = net_shortint (000000000A8DD160)
currentcrittercraft = net_shortint (000000000A8B9D50)
checkdeath = net_shortint (000000000A8D1AE0)
currentbuildmaster = net_shortint (000000000A8B9DA0)
currentgrassgator = net_shortint (000000000A8D0370)
SetCameraZoomed = function - scripts/prefabs/player_common.lua:1539
currentexpertwa
[01:33:13]: (崩溃检测)报错相关的mod:
workshop-3485622209 (自动整理)
[string "../mods/workshop-3485622209/scripts/sort.lu..."]:434: invalid order function for sorting
LUA ERROR stack traceback:
=[C]:-1 in (field) sort (C) <-1--1>
../mods/workshop-3485622209/scripts/sort.lua:434 in (upvalue) CXZ_SortUp (Lua) <371-532>
../mods/workshop-3485622209/scripts/sort.lua:556 in (field) CXZSort (Lua) <553-558>
../mods/workshop-3485622209/modmain.lua:234 in (field) fn (Lua) <227-238>
scripts/bufferedaction.lua:26 in (method) Do (Lua) <22-36>
scripts/entityscript.lua:1578 in (method) PerformBufferedAction (Lua) <1560-1593>
scripts/stategraphs/SGwilson.lua:7553 in (field) ontimeout (Lua) <7545-7554>
scripts/stategraph.lua:648 in (method) UpdateState (Lua) <634-678>
scripts/stategraph.lua:704 in (method) Update (Lua) <697-723>
scripts/stategraph.lua:128 in (method) Update (Lua) <109-146>
scripts/update.lua:288 in () ? (Lua) <224-298>

[01:33:13]: [workshop-2189004162 (Insight)]: A crash has occured (THIS DOES NOT MEAN IT WAS INSIGHT, THIS IS JUST HERE FOR DEBUGGING PURPOSES)
[01:33:13]: [workshop-2189004162 (Insight)]: Title: 警告!
[01:33:13]: [workshop-2189004162 (Insight)]: Text: (崩溃检测)报错相关的mod:
workshop-3485622209 (自动整理)
[string "../mods/workshop-3485622209/scripts/sort.lu..."]:434: invalid order function for sorting
LUA ERROR stack traceback:
=[C]:-1 in (field) sort (C) <-1--1>
../mods/workshop-3485622209/scripts/sort.lua:434 in (upvalue) CXZ_SortUp (Lua) <371-532>
../mods/workshop-3485622209/scripts/sort.lua:556 in (field) CXZSort (Lua) <553-558>
../mods/workshop-3485622209/modmain.lua:234 in (field) fn (Lua) <227-238>
scripts/bufferedaction.lua:26 in (method) Do (Lua) <22-36>
scripts/entityscript.lua:1578 in (method) PerformBufferedAction (Lua) <1560-1593>
scripts/stategraphs/SGwilson.lua:7553 in (field) ontimeout (Lua) <7545-7554>
scripts/stategraph.lua:648 in (method) UpdateState (Lua) <634-678>
scripts/stategraph.lua:704 in (method) Update (Lua) <697-723>
scripts/stategraph.lua:128 in (method) Update (Lua) <109-146>
scripts/update.lua:288 in () ? (Lua) <224-298>

[01:33:13]: [workshop-2189004162 (Insight)]: Additionaltext: 此错误可能是由于你启用的某个模组所致!
你启用了下列模组:
"史诗血量条" "Craftable Butter" "[AnL] Achievement and Perk Config" "四/五/六格装备栏(留言适配模组)" "Infinite Light" "Insight for Functional Medal" " 简单经济学改(适配MOD)" "AUTO Store Into Chest" "Auto Stack and Pick Up" "Craftable Mobs" "Durability Tweaks 调整耐久度" "Growing Sword Extended" "Improved Additional Set Pieces (w/ Caves, Lunar Islands, Ruins and Lunar Grotto)" "Insight for Legion" "Marblestack Beans" "Mass Tree Planting" "Moving objects with mouse" "Upgradeable Chest" "WX自动化" "minimapicon" "全能力" "原生作物" "堆肥桶智能自动填充" "大力士勋章" "开锯" "彩虹罐" "更好的随从" "木牌传送(皮肤版)" "消除间距" "石果修正" "神奇组合包" "超级打包" "近期bug修复" "镰刀" "香脆松子" "Prefab ID Concatenator" "开摆!" "简易存储" "储藏室 (新地窖)" "食趣" "[DST] 棱镜" "[DST]海洋传说" "成就与等级" "Wormholes/Sinkholes Icons For Server 虫洞/天坑的服务器图标" "姐姐救救我(Sister, save me)" "Insight" "能力勋章" "更多格子 For 能力勋章" "欧皇模拟器" "Smart Minisign Revisited" "自动整理" " Simple Health Bar DST" "More cooking/整组烹饪、整组喂鸟" "House" "曼德拉物品" "超级手提袋" "󰀏馨食记󰀏" "禁止树木循环生长"
[01:33:13]: [workshop-2189004162 (Insight)]: SERVER_OWNER_HAS_OPTED_IN: false
[01:33:13]: [workshop-2189004162 (Insight)]: Status: [Insight]: Crash reporter not enabled [Server].
[01:33:13]: [workshop-2189004162 (Insight)]: State: 0
Paul  [developer] 16 Jun @ 1:09am 
比较函数的重要规则:
严格弱序 (Strict Weak Ordering): 你的 comp 函数必须满足严格弱序的数学性质,否则排序结果将是未定义的或不正确的。这些性质包括:
非自反性: comp(x, x) 必须为 false。
非对称性: 如果 comp(x, y) 为 true,则 comp(y, x) 必须为 false。
传递性: 如果 comp(x, y) 为 true 且 comp(y, z) 为 true,则 comp(x, z) 必须为 true。
可比性: 对于任何 x 和 y,要么 comp(x, y) 为 true,要么 comp(y, x) 为 true,要么两者都为 false(表示 x 和 y 等价)。
避免副作用: 比较函数不应该有任何副作用(例如修改全局变量或表格元素),因为它可能会被调用多次,并且每次调用的次数和顺序是不确定的。
原文链接:https://blog.csdn.net/qq_15074547/article/details/148289847

知道错误根源了
Paul  [developer] 16 Jun @ 1:47am 
@ModernEngineer 麻烦再更新试一下
厉害!好的,我上游戏试了告诉你
现在很稳定啦~谢谢!
< >
Showing 1-9 of 9 comments
Per page: 1530 50