Add persistent smartfridges with lossiness

This commit is contained in:
Chompstation Bot
2021-05-19 08:08:40 -04:00
committed by Darlantan
parent faad3af89e
commit 9784331cdb
21 changed files with 682 additions and 183 deletions
+10 -14
View File
@@ -1,26 +1,22 @@
/datum/persistent/filth
name = "filth"
tokens_per_line = 5
entries_expire_at = 4 // 4 rounds, 24 hours.
/datum/persistent/filth/LabelTokens(var/list/tokens)
var/list/labelled_tokens = ..()
labelled_tokens["path"] = text2path(tokens[LAZYLEN(labelled_tokens)+1])
return labelled_tokens
/datum/persistent/filth/IsValidEntry(var/atom/entry)
. = ..() && entry.invisibility == 0
/datum/persistent/filth/CheckTokenSanity(var/list/tokens)
return ..() && ispath(tokens["path"])
/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"])
/datum/persistent/filth/CheckTurfContents(var/turf/T, var/list/tokens)
var/_path = tokens["path"]
/datum/persistent/filth/CheckTurfContents(var/turf/T, var/list/token)
var/_path = token["path"]
return (locate(_path) in T) ? FALSE : TRUE
/datum/persistent/filth/CreateEntryInstance(var/turf/creating, var/list/tokens)
var/_path = tokens["path"]
new _path(creating, tokens["age"]+1)
/datum/persistent/filth/CreateEntryInstance(var/turf/creating, var/list/token)
var/_path = token["path"]
new _path(creating, token["age"]+1)
/datum/persistent/filth/GetEntryAge(var/atom/entry)
var/obj/effect/decal/cleanable/filth = entry
@@ -32,4 +28,4 @@
/datum/persistent/filth/CompileEntry(var/atom/entry)
. = ..()
LAZYADD(., "[GetEntryPath(entry)]")
LAZYADDASSOC(., "path", "[GetEntryPath(entry)]")