mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-16 02:17:06 +01:00
Add ashtray persistence & fixes (#21925)
# Summary This PR adds persistency to ash trays. This in turn fixes cigarettes butts spawning a round later in locations where non-empty ash trays were found. ## Changes - Add persistence to ash trays and prevent (fixes) cigarette butt persistence if in an ash tray. - Fixed cigarette butts not being persistent if the cigarette was put out on purpose and landing on the floor. - Fixed loss of registered persistence track on item pickup. - Fixed persistent tracks when item is held by player. - Removed all ash trays on the Horizon as their existence is now persistent. One-time job for operations after merge. - Fixed matter configuration on `/obj/item/material` not being set during `set_material()`. - Fixed persistent trash on space turfs. - Minor adjustments in SQL/Readme.md. --------- Signed-off-by: FabianK3 <21039694+FabianK3@users.noreply.github.com> Co-authored-by: VMSolidus <evilexecutive@gmail.com>
This commit is contained in:
@@ -37,6 +37,10 @@ SUBSYSTEM_DEF(persistence)
|
||||
var/typepath = text2path(data["type"])
|
||||
if (!ispath(typepath)) // Type checking
|
||||
continue
|
||||
// Note that the object here is instantiated without init args.
|
||||
// Objects that require init args should fall back to INITALIZE_HINT_LATELOAD during Init,
|
||||
// as this will give the subsystem the chance to apply the content and
|
||||
// the object to continue with init logic after the subsystem is done in LateInitialize.
|
||||
var/obj/instance = new typepath()
|
||||
instance.persistence_track_id = data["id"]
|
||||
track_apply_content(instance, data["content"], data["x"], data["y"], data["z"])
|
||||
@@ -61,6 +65,15 @@ SUBSYSTEM_DEF(persistence)
|
||||
// Update tracked objects that have an ID (already existing from previous rounds)
|
||||
// Delete persistent records that no longer exist in the registry (removed during the round)
|
||||
|
||||
// Run checks on each track that might prevent further persistence
|
||||
for (var/obj/track in GLOB.persistence_register)
|
||||
CHECK_TICK
|
||||
var/turf/T = get_turf(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
|
||||
deregister_track(track)
|
||||
if(astype(track, /obj/item)?.in_inventory) // Objects that are held by players won't become persistent
|
||||
deregister_track(track)
|
||||
|
||||
var/created = 0
|
||||
var/updated = 0
|
||||
var/expired = 0
|
||||
@@ -205,7 +218,7 @@ SUBSYSTEM_DEF(persistence)
|
||||
log_subsystem_persistence("SQL ERROR during persistence database_add_entry. Failed to connect.")
|
||||
else
|
||||
var/turf/T = get_turf(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
|
||||
if(!T)
|
||||
return
|
||||
|
||||
var/datum/db_query/insert_query = SSdbcore.NewQuery(
|
||||
@@ -235,7 +248,7 @@ SUBSYSTEM_DEF(persistence)
|
||||
log_subsystem_persistence("SQL ERROR during persistence database_update_entry. Failed to connect.")
|
||||
else
|
||||
var/turf/T = get_turf(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
|
||||
if(!T)
|
||||
return
|
||||
|
||||
var/datum/db_query/update_query = SSdbcore.NewQuery(
|
||||
|
||||
Reference in New Issue
Block a user