mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
Base64 encode things before saving them to VariableStorageComponent to avoid a potential crash.
This commit is contained in:
parent
5c3a211838
commit
26239df5ac
1 changed files with 3 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
local bitser = dofile_once("mods/quant.ew/files/lib/bitser.lua")
|
||||
local ffi = require("ffi")
|
||||
local base64 = dofile_once("mods/quant.ew/files/resource/base64.lua")
|
||||
|
||||
local util = {}
|
||||
|
||||
|
@ -45,12 +46,12 @@ function util.get_ent_variable(entity, key)
|
|||
if value == "" then
|
||||
return nil
|
||||
end
|
||||
return bitser.loads(value)
|
||||
return bitser.loads(base64.decode(value))
|
||||
end
|
||||
|
||||
function util.set_ent_variable(entity, key, value)
|
||||
local storage = EntityGetFirstComponentIncludingDisabled(entity, "VariableStorageComponent", key)
|
||||
ComponentSetValue2(storage, "value_string", bitser.dumps(value))
|
||||
ComponentSetValue2(storage, "value_string", base64.encode(bitser.dumps(value)))
|
||||
end
|
||||
|
||||
function util.get_ent_health(entity)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue