mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-28 23:51:17 +01:00
Persistence code refactoring (#22044)
# Summary This PR refactores code and structure of the current persistence subsystem, in preparation for Persistency: Circles, Squares and Triangles. This should not contain any user facing changes. ~~This PR is based of branch #21925 and **needs** to be merged in order. The files changed display will be meaningless until then.~~ *Done.* ## Changes - Split subsystem in partial files. - Refactored proc names, added "persistentObject" format for current code. - Renamed SQL table. - Refactored logging and call hiearachy. - Fix CI labeler adding DB label on non-SQL files.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/* This partial file contains all procs that are meant for public access. */
|
||||
/* Other procs should be made private. */
|
||||
|
||||
/**
|
||||
* Adds the given object to the list of tracked objects. At shutdown the tracked object will be either created or updated in the database.
|
||||
* The ckey is an optional argument and is used for tracking user generated content by adding an author to the persistent data.
|
||||
*/
|
||||
/datum/controller/subsystem/persistence/proc/objectsRegisterTrack(obj/new_track, ckey)
|
||||
if(new_track.persistent_objects_track_active) // Prevent multiple registers per object and removes the need to check the register if it's already in there
|
||||
return
|
||||
|
||||
var/turf/T = get_turf(new_track)
|
||||
if(!T || !is_station_level(T.z)) // The persistence system only supports objects from the main map levels for multiple reasons, e.g. Z level value, mapping support
|
||||
return
|
||||
|
||||
new_track.persistent_objects_track_active = TRUE
|
||||
new_track.persistent_objects_author_ckey = ckey
|
||||
GLOB.persistence_object_track_register += new_track
|
||||
|
||||
/**
|
||||
* Removes the given object from the list of tracked objects. At shutdown the tracked object will be remove from the database.
|
||||
*/
|
||||
/datum/controller/subsystem/persistence/proc/objectsDeregisterTrack(obj/old_track)
|
||||
if(!old_track.persistent_objects_track_active) // Prevent multiple deregisters per object and removes the need to check the register if it's not in there
|
||||
return
|
||||
|
||||
old_track.persistent_objects_track_active = FALSE
|
||||
GLOB.persistence_object_track_register -= old_track
|
||||
Reference in New Issue
Block a user