mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-23 05:07:51 +01: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"
|
||||
|
||||
Reference in New Issue
Block a user