mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-11 23:23:28 +01:00
Add serialization support to Modsuit modules (#22702)
* Save my supersuit * Glazed over it when trying to make cores work * Used contra's code, with a fix to stop runtiming
This commit is contained in:
@@ -91,6 +91,23 @@
|
||||
/// Is the jetpack on so we should make ion effects?
|
||||
var/jetpack_active = FALSE
|
||||
|
||||
/obj/item/mod/control/serialize()
|
||||
var/list/data = ..()
|
||||
var/list/modules_list = list()
|
||||
for(var/obj/item/mod/module/mod as anything in modules)
|
||||
modules_list.Add(list(mod.serialize()))
|
||||
data["modules"] = modules_list
|
||||
return data
|
||||
|
||||
/obj/item/mod/control/deserialize(list/data)
|
||||
if(data["modules"])
|
||||
for(var/old_mods in modules)
|
||||
uninstall(old_mods, deleting = TRUE)
|
||||
for(var/obj/item/mod/module/module as anything in data["modules"])
|
||||
module = list_to_object(module, src)
|
||||
install(module)
|
||||
..()
|
||||
|
||||
/obj/item/mod/control/Initialize(mapload, datum/mod_theme/new_theme, new_skin, obj/item/mod/core/new_core)
|
||||
. = ..()
|
||||
if(new_theme)
|
||||
|
||||
@@ -16,6 +16,17 @@
|
||||
var/max_items = 7
|
||||
var/obj/item/storage/backpack/modstorage/bag
|
||||
|
||||
/obj/item/mod/module/storage/serialize()
|
||||
var/list/data = ..()
|
||||
data["bag"] = bag.serialize()
|
||||
return data
|
||||
|
||||
/obj/item/mod/module/storage/deserialize(list/data)
|
||||
. = ..()
|
||||
qdel(bag)
|
||||
bag = list_to_object(data["bag"], src)
|
||||
bag.source = src
|
||||
|
||||
/obj/item/mod/module/storage/Initialize(mapload)
|
||||
. = ..()
|
||||
var/obj/item/storage/backpack/modstorage/S = new(src)
|
||||
|
||||
Reference in New Issue
Block a user