-
-
Notifications
You must be signed in to change notification settings - Fork 416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Погребок #12282
Погребок #12282
Changes from all commits
49fe23e
1bdb7cb
8820428
6ab37bb
a52ec35
ea0d265
39972b8
b9f375a
483932f
1b9813b
ad9954f
de3f45e
9e054c3
99f8ab8
8302870
04434e2
7af6da1
bb697d1
9ea22c1
3cf7ef7
a7dcf6e
02c3643
1388b15
574e5df
97c185d
7dacce8
f9bcc67
72200e8
bfc72c1
4a01240
982d6d2
e88b7bc
2fd7d53
ac9beeb
65c3060
a1cf9e4
d7361f0
371b12d
fac76df
b95b348
599c662
6ce8dfe
ea1a276
bedef29
2e9df0f
116fe2b
ff706de
671b692
778646b
a991f80
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
SUBSYSTEM_DEF(continuity) | ||
name = "Continuity" | ||
init_order = SS_INIT_DEFAULT | ||
flags = SS_NO_FIRE | ||
var/list/continuity_objects = list() | ||
|
||
/datum/controller/subsystem/continuity/proc/generate_continuity_objects() | ||
for(var/datum/continuity_object/object_type as anything in subtypesof(/datum/continuity_object)) | ||
if(initial(object_type.filename)) | ||
continuity_objects += new object_type | ||
|
||
/datum/controller/subsystem/continuity/proc/read_files() | ||
generate_continuity_objects() | ||
|
||
for(var/datum/continuity_object/object in continuity_objects) | ||
var/savefile/S = new /savefile("[PERSISTENT_CACHE_FOLDER]/[object.filename].sav") | ||
object.load(S) | ||
|
||
/datum/controller/subsystem/continuity/proc/write_files() | ||
for(var/datum/continuity_object/object in continuity_objects) | ||
var/savefile/S = new /savefile("[PERSISTENT_CACHE_FOLDER]/[object.filename].sav") | ||
object.save(S) | ||
|
||
// Add new subtype of this datum to include your object into continuity subsystem. | ||
/datum/continuity_object | ||
var/filename = null | ||
|
||
/datum/continuity_object/proc/load(savefile/S) | ||
return | ||
|
||
/datum/continuity_object/proc/save(savefile/S) | ||
return |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
/datum/continuity_object/barrels | ||
filename = "Preservation_Barrels" | ||
|
||
/datum/continuity_object/barrels/proc/spawn_maintenance_barrel() | ||
var/turf/T = pick(global.maintenance_barrels_landmarks) | ||
new /obj/structure/preservation_barrel/maintenance(T) | ||
|
||
/datum/continuity_object/barrels/load(savefile/S) | ||
spawn_maintenance_barrel() | ||
|
||
var/params_holder | ||
S["Barrels_Save"] >> params_holder | ||
if(!params_holder) | ||
return | ||
|
||
var/list/barrels_saves = params2list(params_holder) | ||
for(var/save_id in barrels_saves) | ||
barrels_saves[save_id] = params2list(barrels_saves[save_id]) | ||
|
||
for(var/obj/structure/preservation_barrel/Barrel in global.preservation_barrels) | ||
if(!barrels_saves[Barrel.save_id]) | ||
continue | ||
var/barrel_record = pick(barrels_saves[Barrel.save_id]) | ||
if(barrel_record) | ||
Barrel.continuity_read(params2list(barrel_record)) | ||
barrels_saves[Barrel.save_id] -= barrel_record | ||
|
||
/datum/continuity_object/barrels/save(savefile/S) | ||
var/list/barrels_saves = list() | ||
|
||
for(var/obj/structure/preservation_barrel/Barrel in global.preservation_barrels) | ||
var/barrel_record = Barrel.continuity_write() | ||
|
||
if(!barrels_saves[Barrel.save_id]) | ||
barrels_saves[Barrel.save_id] = list(barrel_record) | ||
else | ||
barrels_saves[Barrel.save_id] += barrel_record | ||
|
||
for(var/save_id in barrels_saves) | ||
barrels_saves[save_id] = list2params(barrels_saves[save_id]) | ||
|
||
S["Barrels_Save"] << list2params(barrels_saves) | ||
|
||
|
||
/datum/continuity_object/tables | ||
filename = "Preservation_Tables" | ||
|
||
/datum/continuity_object/tables/load(savefile/S) | ||
var/params_holder | ||
S["Tables_Save"] >> params_holder | ||
if(!params_holder) | ||
return | ||
|
||
var/list/tables_saves = params2list(params_holder) | ||
for(var/save_id in tables_saves) | ||
tables_saves[save_id] = params2list(tables_saves[save_id]) | ||
|
||
for(var/obj/structure/preservation_table/Table in global.preservation_tables) | ||
var/table_record = pick(tables_saves[Table.save_id]) | ||
if(table_record) | ||
Table.continuity_read(params2list(table_record)) | ||
tables_saves[Table.save_id] -= table_record | ||
|
||
/datum/continuity_object/tables/save(savefile/S) | ||
var/list/tables_saves = list() | ||
|
||
for(var/obj/structure/preservation_table/Table in global.preservation_tables) | ||
var/table_record = Table.continuity_write() | ||
|
||
if(!tables_saves[Table.save_id]) | ||
tables_saves[Table.save_id] = list(table_record) | ||
else | ||
tables_saves[Table.save_id] += table_record | ||
|
||
for(var/save_id in tables_saves) | ||
tables_saves[save_id] = list2params(tables_saves[save_id]) | ||
|
||
S["Tables_Save"] << list2params(tables_saves) | ||
|
||
|
||
/datum/continuity_object/boxes | ||
filename = "Preservation_Boxes" | ||
|
||
/datum/continuity_object/boxes/load(savefile/S) | ||
var/params_holder | ||
S["Boxes_Save"] >> params_holder | ||
if(!params_holder) | ||
return | ||
|
||
var/list/boxes_saves = params2list(params_holder) | ||
for(var/save_id in boxes_saves) | ||
boxes_saves[save_id] = params2list(boxes_saves[save_id]) | ||
|
||
for(var/obj/structure/preservation_box/Box in global.preservation_boxes) | ||
var/box_record = pick(boxes_saves[Box.save_id]) | ||
if(box_record) | ||
Box.continuity_read(params2list(box_record)) | ||
boxes_saves[Box.save_id] -= box_record | ||
|
||
/datum/continuity_object/boxes/save(savefile/S) | ||
var/list/boxes_saves = list() | ||
|
||
for(var/obj/structure/preservation_box/Box in global.preservation_boxes) | ||
var/box_record = Box.continuity_write() | ||
|
||
if(!boxes_saves[Box.save_id]) | ||
boxes_saves[Box.save_id] = list(box_record) | ||
else | ||
boxes_saves[Box.save_id] += box_record | ||
|
||
for(var/save_id in boxes_saves) | ||
boxes_saves[save_id] = list2params(boxes_saves[save_id]) | ||
|
||
S["Boxes_Save"] << list2params(boxes_saves) | ||
|
||
|
||
/datum/continuity_object/composters | ||
filename = "Preservation_Composters" | ||
|
||
/datum/continuity_object/composters/load(savefile/S) | ||
var/params_holder | ||
S["Composters_Save"] >> params_holder | ||
if(!params_holder) | ||
return | ||
|
||
var/list/composters_saves = params2list(params_holder) | ||
for(var/save_id in composters_saves) | ||
composters_saves[save_id] = params2list(composters_saves[save_id]) | ||
|
||
for(var/obj/structure/composter/Comp in global.composters) | ||
var/composter_record = pick(composters_saves[Comp.save_id]) | ||
if(composter_record) | ||
Comp.continuity_read(params2list(composter_record)) | ||
composters_saves[Comp.save_id] -= composter_record | ||
|
||
/datum/continuity_object/composters/save(savefile/S) | ||
var/list/composters_saves = list() | ||
|
||
for(var/obj/structure/composter/Comp in global.composters) | ||
var/composter_record = Comp.continuity_write() | ||
|
||
if(!composters_saves[Comp.save_id]) | ||
composters_saves[Comp.save_id] = list(composter_record) | ||
else | ||
composters_saves[Comp.save_id] += composter_record | ||
|
||
for(var/save_id in composters_saves) | ||
composters_saves[save_id] = list2params(composters_saves[save_id]) | ||
|
||
S["Composters_Save"] << list2params(composters_saves) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -805,3 +805,9 @@ | |
animate(visual, pixel_x = (tile.x - our_tile.x) * world.icon_size + pointed_atom.pixel_x, pixel_y = (tile.y - our_tile.y) * world.icon_size + pointed_atom.pixel_y, time = 1.7, easing = EASE_OUT) | ||
|
||
return TRUE | ||
|
||
/atom/proc/continuity_read(list/arguments) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Сейчас система полностью хендлит всё:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @volas Впиши своё мнение если не утрудняет пожалуйста, я в сомнениях. |
||
return | ||
|
||
/atom/proc/continuity_write() | ||
return "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
теперь сделай так, чтобы датум отвечал только за хранение и сериализацию данных. Он абстрактный, он не должен сам дергать и искать объекты в игре (и тем более что-то спавнить). Это уже объекты в игре должны каким-то образом опрашивать соответствующий датум о возможно сохраненных для них данных, и забирать их из датума.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
чего бля, он ничего не спавнит, одумайся
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
я вижу