Files
CHOMPStation2/code/modules/persistence/graffiti.dm
Rykka ad6870c78d Persistence Patch
- Fixes Paper and font tags stacking across rounds, as shown in: ![](https://cdn.discordapp.com/attachments/187013248309002240/741937939382141000/164fdd3a37fb22f18dfa9b5c431ffc04.png)

- Fixes Graffiti being persistent for over 50 rounds (10+ days)
- Sets Trash to be persistent for 4 rounds instead of 5
- Fixes Persistence being always-on because of if("persistence_enabled") config.persistence_enabled = 1. As explained: 
> it's on by default, which means config.txt will be read and if it's not there it stays at 1. If it is there,it gets set to 1. There is no way to disable it

- Adds config options to enable/disable **Persistence for Maploaded objects**, as well as a verb to toggle such.
- Adds Persistence to config.

Currently IGNORE_MAPLOAD for Persistance is **Disabled.**
Maploaded objects/dirt/etc will be saved by persistence, preserving current behavior.
2020-08-16 09:48:46 -04:00

66 lines
2.3 KiB
Plaintext

/obj/effect/decal/writing
name = "hand graffiti"
icon_state = "writing1"
icon = 'icons/effects/writing.dmi'
desc = "It looks like someone has scratched something here."
plane = DIRTY_PLANE
gender = PLURAL
blend_mode = BLEND_MULTIPLY
color = "#000000"
alpha = 120
var/message
var/graffiti_age = 0
var/author = "unknown"
/obj/effect/decal/writing/New(var/newloc, var/_age, var/_message, var/_author)
..(newloc)
if(!isnull(_age))
graffiti_age = _age
message = _message
if(!isnull(author))
author = _author
/obj/effect/decal/writing/Initialize()
var/list/random_icon_states = icon_states(icon)
for(var/obj/effect/decal/writing/W in loc)
random_icon_states.Remove(W.icon_state)
if(random_icon_states.len)
icon_state = pick(random_icon_states)
if(!mapload || !config.persistence_ignore_mapload)
SSpersistence.track_value(src, /datum/persistent/graffiti)
. = ..()
/obj/effect/decal/writing/Destroy()
SSpersistence.forget_value(src, /datum/persistent/graffiti)
. = ..()
/obj/effect/decal/writing/examine(mob/user)
. = ..()
to_chat(user, "It reads \"[message]\".")
/obj/effect/decal/writing/attackby(var/obj/item/thing, var/mob/user)
if(istype(thing, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/welder = thing
if(welder.isOn() && welder.remove_fuel(0,user) && do_after(user, 5, src) && !QDELETED(src))
playsound(src.loc, welder.usesound, 50, 1)
user.visible_message("<span class='notice'>\The [user] clears away some graffiti.</span>")
qdel(src)
else if(thing.sharp)
if(jobban_isbanned(user, "Graffiti"))
to_chat(user, SPAN_WARNING("You are banned from leaving persistent information across rounds."))
return
var/_message = sanitize(input("Enter an additional message to engrave.", "Graffiti") as null|text, trim = TRUE)
if(_message && loc && user && !user.incapacitated() && user.Adjacent(loc) && thing.loc == user)
user.visible_message("<span class='warning'>\The [user] begins carving something into \the [loc].</span>")
if(do_after(user, max(20, length(_message)), src) && loc)
user.visible_message("<span class='danger'>\The [user] carves some graffiti into \the [loc].</span>")
message = "[message] [_message]"
author = user.ckey
if(lowertext(message) == "elbereth")
to_chat(user, "<span class='notice'>You feel much safer.</span>")
else
. = ..()