From d83eb8fc99698176ba535104196bd2913d990132 Mon Sep 17 00:00:00 2001 From: Kashargul <144968721+Kashargul@users.noreply.github.com> Date: Thu, 3 Oct 2024 16:14:16 +0200 Subject: [PATCH 1/4] merges filth files --- code/modules/persistence/effects/filth.dm | 19 +++++++++++++--- code/modules/persistence/effects/filth_vr.dm | 23 -------------------- 2 files changed, 16 insertions(+), 26 deletions(-) delete mode 100644 code/modules/persistence/effects/filth_vr.dm diff --git a/code/modules/persistence/effects/filth.dm b/code/modules/persistence/effects/filth.dm index 0b2a34109b4..7143082b2ae 100644 --- a/code/modules/persistence/effects/filth.dm +++ b/code/modules/persistence/effects/filth.dm @@ -9,7 +9,7 @@ /datum/persistent/filth/CheckTokenSanity(var/list/token) // byond's json implementation is "questionable", and uses types as keys and values without quotes sometimes even though they aren't valid json token["path"] = istext(token["path"]) ? text2path(token["path"]) : token["path"] - return ..() && ispath(token["path"]) + return ..() && ispath(token["path"] && (!saves_dirt || isnum(token["dirt"])) /datum/persistent/filth/CheckTurfContents(var/turf/T, var/list/token) var/_path = token["path"] @@ -17,16 +17,29 @@ /datum/persistent/filth/CreateEntryInstance(var/turf/creating, var/list/token) var/_path = token["path"] - new _path(creating, token["age"]+1) + if (isspace(creating) || iswall(creating) ||isopenspace(creating)) + return + if (saves_dirt) + new _path(creating, token["age"]+1, token["dirt"]) + else + new _path(creating, token["age"]+1) /datum/persistent/filth/GetEntryAge(var/atom/entry) var/obj/effect/decal/cleanable/filth = entry return filth.age +/datum/persistent/filth/proc/GetEntryDirt(var/atom/entry) + var/turf/simulated/T = get_turf(entry) + if (istype(T)) + return T.dirt + return 0 + /datum/persistent/filth/proc/GetEntryPath(var/atom/entry) var/obj/effect/decal/cleanable/filth = entry return filth.generic_filth ? /obj/effect/decal/cleanable/filth : filth.type /datum/persistent/filth/CompileEntry(var/atom/entry) . = ..() - LAZYADDASSOC(., "path", "[GetEntryPath(entry)]") \ No newline at end of file + LAZYADDASSOC(., "path", "[GetEntryPath(entry)]") + if (saves_dirt) + LAZYADDASSOC(., "dirt", GetEntryDirt(entry)) diff --git a/code/modules/persistence/effects/filth_vr.dm b/code/modules/persistence/effects/filth_vr.dm deleted file mode 100644 index 34733d4bc81..00000000000 --- a/code/modules/persistence/effects/filth_vr.dm +++ /dev/null @@ -1,23 +0,0 @@ -/datum/persistent/filth/CheckTokenSanity(var/list/token) - . = ..() - return saves_dirt ? . && isnum(token["dirt"]) : . - -/datum/persistent/filth/CreateEntryInstance(var/turf/creating, var/list/token) - var/_path = token["path"] - if (isspace(creating) || iswall(creating) ||isopenspace(creating)) - return - if (saves_dirt) - new _path(creating, token["age"]+1, token["dirt"]) - else - new _path(creating, token["age"]+1) - -/datum/persistent/filth/proc/GetEntryDirt(var/atom/entry) - var/turf/simulated/T = get_turf(entry) - if (istype(T)) - return T.dirt - return 0 - -/datum/persistent/filth/CompileEntry(var/atom/entry) - . = ..() - if (saves_dirt) - LAZYADDASSOC(., "dirt", GetEntryDirt(entry)) From 67e7f1f07d32eb471115a059712582a8478a9632 Mon Sep 17 00:00:00 2001 From: Kashargul <144968721+Kashargul@users.noreply.github.com> Date: Thu, 3 Oct 2024 16:19:06 +0200 Subject: [PATCH 2/4] oups forgot that --- vorestation.dme | 1 - 1 file changed, 1 deletion(-) diff --git a/vorestation.dme b/vorestation.dme index 289d2402eba..ff71e29b458 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -3605,7 +3605,6 @@ #include "code\modules\persistence\serialize.dm" #include "code\modules\persistence\datum\persistence_datum.dm" #include "code\modules\persistence\effects\filth.dm" -#include "code\modules\persistence\effects\filth_vr.dm" #include "code\modules\persistence\effects\graffiti.dm" #include "code\modules\persistence\effects\paper.dm" #include "code\modules\persistence\effects\paper_sticky.dm" From fdffd8edc9a746031caf507feae38c6f8408edc0 Mon Sep 17 00:00:00 2001 From: Kashargul <144968721+Kashargul@users.noreply.github.com> Date: Thu, 3 Oct 2024 16:37:20 +0200 Subject: [PATCH 4/4] oups --- code/modules/persistence/effects/filth.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/persistence/effects/filth.dm b/code/modules/persistence/effects/filth.dm index 7143082b2ae..c1fa359bac0 100644 --- a/code/modules/persistence/effects/filth.dm +++ b/code/modules/persistence/effects/filth.dm @@ -9,7 +9,7 @@ /datum/persistent/filth/CheckTokenSanity(var/list/token) // byond's json implementation is "questionable", and uses types as keys and values without quotes sometimes even though they aren't valid json token["path"] = istext(token["path"]) ? text2path(token["path"]) : token["path"] - return ..() && ispath(token["path"] && (!saves_dirt || isnum(token["dirt"])) + return ..() && ispath(token["path"]) && (!saves_dirt || isnum(token["dirt"])) /datum/persistent/filth/CheckTurfContents(var/turf/T, var/list/token) var/_path = token["path"]