Skip to content
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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
49fe23e
ГОТОВО, НЕВЕРОЯТНО
DarthSidiousPalpatine Oct 18, 2023
1bdb7cb
Merge remote-tracking branch 'upstream/master' into preparation_rack
DarthSidiousPalpatine Oct 18, 2023
8820428
Update preservation.dm
DarthSidiousPalpatine Oct 18, 2023
6ab37bb
Update preservation.dm
DarthSidiousPalpatine Oct 18, 2023
a52ec35
небольшая переделка карт
DarthSidiousPalpatine Oct 18, 2023
ea0d265
Revert "небольшая переделка карт"
DarthSidiousPalpatine Oct 18, 2023
39972b8
Update preservation.dm
DarthSidiousPalpatine Oct 18, 2023
b9f375a
Update preservation.dm
DarthSidiousPalpatine Oct 18, 2023
483932f
Update preservation.dm
DarthSidiousPalpatine Oct 18, 2023
1b9813b
Update preservation.dm
DarthSidiousPalpatine Oct 18, 2023
ad9954f
Update preservation.dm
DarthSidiousPalpatine Oct 18, 2023
de3f45e
g
DarthSidiousPalpatine Oct 18, 2023
9e054c3
Готово
DarthSidiousPalpatine Oct 21, 2023
99f8ab8
Delete roundstart_roundend.dm
DarthSidiousPalpatine Oct 21, 2023
8302870
Update taucetistation.dme
DarthSidiousPalpatine Oct 21, 2023
04434e2
Update continuity.dm
DarthSidiousPalpatine Oct 21, 2023
7af6da1
a
DarthSidiousPalpatine Oct 22, 2023
bb697d1
Update packs.dm
DarthSidiousPalpatine Oct 22, 2023
9ea22c1
Update preservation.dm
DarthSidiousPalpatine Oct 22, 2023
3cf7ef7
Merge branch 'master' into preparation_rack
DarthSidiousPalpatine Oct 22, 2023
a7dcf6e
Merge branch 'master' into preparation_rack
DarthSidiousPalpatine Oct 24, 2023
02c3643
Merge branch 'master' into preparation_rack
DarthSidiousPalpatine Oct 25, 2023
1388b15
Update continuity.dm
DarthSidiousPalpatine Oct 26, 2023
574e5df
Update continuity.dm
DarthSidiousPalpatine Oct 26, 2023
97c185d
Update Chemistry-Recipes.dm
DarthSidiousPalpatine Oct 26, 2023
7dacce8
s
DarthSidiousPalpatine Oct 29, 2023
f9bcc67
Merge remote-tracking branch 'upstream/master' into preparation_rack
DarthSidiousPalpatine Oct 29, 2023
72200e8
Update boxstation.dmm
DarthSidiousPalpatine Oct 29, 2023
bfc72c1
Update boxstation.dmm
DarthSidiousPalpatine Oct 29, 2023
4a01240
Update boxstation.dmm
DarthSidiousPalpatine Oct 29, 2023
982d6d2
Update boxstation.dmm
DarthSidiousPalpatine Oct 29, 2023
e88b7bc
ф
DarthSidiousPalpatine Jan 17, 2024
2fd7d53
Вишенка на торте
DarthSidiousPalpatine Jan 17, 2024
ac9beeb
Merge remote-tracking branch 'upstream/master' into preparation_rack
DarthSidiousPalpatine Jan 17, 2024
65c3060
Update preservation.dm
DarthSidiousPalpatine Jan 18, 2024
a1cf9e4
Готово. Исправил всякое, добавил компост и компостер.
DarthSidiousPalpatine Jan 18, 2024
d7361f0
Добавил компостеры на карты.
DarthSidiousPalpatine Jan 18, 2024
371b12d
Update preservation.dm
DarthSidiousPalpatine Jan 18, 2024
fac76df
Update preservation.dm
DarthSidiousPalpatine Jan 18, 2024
b95b348
Update preservation.dm
DarthSidiousPalpatine Jan 18, 2024
599c662
Update preservation.dm
DarthSidiousPalpatine Jan 18, 2024
6ce8dfe
Update preservation.dm
DarthSidiousPalpatine Jan 18, 2024
ea1a276
Пофиксил багулю. Теперь всё работает отлично.
DarthSidiousPalpatine Jan 18, 2024
bedef29
Убрал логи что были нужны для тестирования.
DarthSidiousPalpatine Jan 18, 2024
2e9df0f
Если честно, работает даже лучше.
DarthSidiousPalpatine Jan 21, 2024
116fe2b
я не пью
DarthSidiousPalpatine Jan 30, 2024
ff706de
Update can_be_saved.dm
DarthSidiousPalpatine Jan 30, 2024
671b692
Убрал датумы в отдельный файл
DarthSidiousPalpatine Jan 31, 2024
778646b
переименовал под имя системы - континуити
DarthSidiousPalpatine Jan 31, 2024
a991f80
Update taucetistation.dme
DarthSidiousPalpatine Jan 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
523 changes: 523 additions & 0 deletions code/_globalvars/lists/continuity.dm

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions code/_globalvars/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ var/global/list/datum/map_template/map_templates = list()
var/global/list/datum/map_template/shelter_templates = list()
var/global/list/datum/map_template/holoscene_templates = list()
var/global/list/datum/map_template/spacestructures_templates = list()

var/global/list/maintenance_barrels_landmarks = list()
32 changes: 32 additions & 0 deletions code/controllers/subsystem/continuity.dm
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
4 changes: 4 additions & 0 deletions code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ SUBSYSTEM_DEF(ticker)

setup_economy()

SScontinuity.read_files()

SEND_SIGNAL(src, COMSIG_TICKER_ROUND_STARTING)
current_state = GAME_STATE_PLAYING
round_start_time = world.time
Expand Down Expand Up @@ -592,6 +594,8 @@ SUBSYSTEM_DEF(ticker)
if(SSjunkyard)
SSjunkyard.save_stats()

SScontinuity.write_files()

//Ask the event manager to print round end information
SSevents.RoundEnd()

Expand Down
150 changes: 150 additions & 0 deletions code/datums/continuity/preservation.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
/datum/continuity_object/barrels
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

теперь сделай так, чтобы датум отвечал только за хранение и сериализацию данных. Он абстрактный, он не должен сам дергать и искать объекты в игре (и тем более что-то спавнить). Это уже объекты в игре должны каким-то образом опрашивать соответствующий датум о возможно сохраненных для них данных, и забирать их из датума.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

чего бля, он ничего не спавнит, одумайся

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/datum/continuity_object/barrels/load(savefile/S)
	spawn_maintenance_barrel()

я вижу

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)
7 changes: 7 additions & 0 deletions code/defines/obj/hydro.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1504,3 +1504,10 @@
icon_state = "bottle15"
mutmod = 0
yieldmod = 2

/obj/item/nutrient/compost
name = "compost"
icon = 'icons/obj/hydroponics/equipment.dmi'
icon_state = "compost"
mutmod = 0
yieldmod = 5
6 changes: 6 additions & 0 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сейчас система полностью хендлит всё:

  1. точно ли нужна эта функция
  2. точно ли она нужна всем атмомам?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@volas Впиши своё мнение если не утрудняет пожалуйста, я в сомнениях.

return

/atom/proc/continuity_write()
return ""
Loading
Loading