mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Merge pull request #5559 from CHOMPStation2/upstream-merge-14344
[MIRROR] better persistent dirt
This commit is contained in:
@@ -38,11 +38,24 @@
|
||||
icon_state = "dirt"
|
||||
mouse_opacity = 0
|
||||
|
||||
/obj/effect/decal/cleanable/dirt/Initialize(var/mapload, var/_age) //CHOMPEdit
|
||||
/obj/effect/decal/cleanable/dirt/Initialize(var/mapload, var/_age, var/dirt)
|
||||
.=..()
|
||||
var/turf/simulated/our_turf = src.loc
|
||||
if(our_turf && istype(our_turf) && our_turf.can_dirty && _age)
|
||||
our_turf.dirt = 101
|
||||
if(our_turf && istype(our_turf) && our_turf.can_dirty)
|
||||
our_turf.dirt = clamp(max(age ? (dirt ? dirt : 101) : our_turf.dirt, our_turf.dirt), 0, 101)
|
||||
var/calcalpha = our_turf.dirt > 50 ? min((our_turf.dirt - 50) * 5, 255) : 0
|
||||
var/alreadyfound = FALSE
|
||||
for (var/obj/effect/decal/cleanable/dirt/alreadythere in our_turf) //in case of multiple
|
||||
if (alreadythere == src)
|
||||
continue
|
||||
else if (alreadyfound)
|
||||
qdel(alreadythere)
|
||||
continue
|
||||
alreadyfound = TRUE
|
||||
alreadythere.alpha = calcalpha //don't need to constantly recalc for all of them in it because it'll just max if a non-persistent dirt overlay gets added, and then the new dirt overlay will be deleted
|
||||
if (alreadyfound)
|
||||
return INITIALIZE_HINT_QDEL
|
||||
alpha = calcalpha
|
||||
|
||||
/obj/effect/decal/cleanable/flour
|
||||
name = "flour"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/datum/persistent/filth
|
||||
name = "filth"
|
||||
entries_expire_at = 4 // 4 rounds, 24 hours.
|
||||
var/saves_dirt = TRUE //VOREStation edit
|
||||
|
||||
/datum/persistent/filth/IsValidEntry(var/atom/entry)
|
||||
. = ..() && entry.invisibility == 0
|
||||
|
||||
21
code/modules/persistence/effects/filth_vr.dm
Normal file
21
code/modules/persistence/effects/filth_vr.dm
Normal file
@@ -0,0 +1,21 @@
|
||||
/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 (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))
|
||||
@@ -1,5 +1,6 @@
|
||||
/datum/persistent/filth/trash
|
||||
name = "trash"
|
||||
saves_dirt = FALSE //VOREStation edit
|
||||
|
||||
/datum/persistent/filth/trash/CheckTurfContents(var/turf/T, var/list/tokens)
|
||||
var/too_much_trash = 0
|
||||
|
||||
@@ -3698,6 +3698,7 @@
|
||||
#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"
|
||||
|
||||
Reference in New Issue
Block a user