Make action parsing resilient

This commit is contained in:
Emik 2026-06-07 19:43:11 +02:00
parent 020e100eb6
commit 122d9a0210
Signed by: emik
GPG key ID: 6B0CD72A5E503BDF
2 changed files with 20 additions and 1 deletions

View file

@ -79,3 +79,22 @@ sendInfoMessage("Attempting to register the Walled Garden ruleset...", "WalledGa
end)()
"""
match_indent = true
[[patches]]
[patches.pattern]
target = '=[SMODS Multiplayer "networking/action_handlers.lua"]'
pattern = 'local parsedAction = json.decode(msg)'
position = "at"
payload = """local garden, parsedAction = pcall(function()
return json.decode(msg)
end)
if not garden or type(parsedAction) ~= "table" then
return sendErrorMessage(
"# **DESYNC MAY HAVE OCCURED!!!** | We don't know how to parse this! " ..
tostring(garden) ..
": " ..
tostring(parsedAction), "MULTIPLAYER"
)
end"""
match_indent = true

View file

@ -1,6 +1,6 @@
{
"priority": 10000001,
"version": "1.0.2",
"version": "1.0.3",
"id": "WalledGarden",
"name": "WalledGarden",
"icon_path": "icon.png",