mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-15 19:46:38 +00:00
Converts most spans into span procs. Mostly used regex for this and sorted out any compile time errors afterwards so there could be some bugs. Was initially going to do defines, but ninja said to make it into a proc, and if there's any overhead, they can easily be changed to defines. Makes it easier to control the formatting and prevents typos when creating spans as it'll runtime if you misspell instead of silently failing. Reduces the code you need to write when writing spans, as you don't need to close the span as that's automatically handled by the proc. (Note from Lemon: This should be converted to defines once we update the minimum version to 514. Didn't do it now because byond pain and such)
67 lines
2.7 KiB
Plaintext
67 lines
2.7 KiB
Plaintext
/datum/element/art
|
|
element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH
|
|
id_arg_index = 2
|
|
var/impressiveness = 0
|
|
|
|
/datum/element/art/Attach(datum/target, impress)
|
|
. = ..()
|
|
if(!isatom(target) || isarea(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
impressiveness = impress
|
|
RegisterSignal(target, COMSIG_PARENT_EXAMINE, .proc/on_examine)
|
|
|
|
/datum/element/art/Detach(datum/target)
|
|
UnregisterSignal(target, COMSIG_PARENT_EXAMINE)
|
|
return ..()
|
|
|
|
/datum/element/art/proc/apply_moodlet(atom/source, mob/user, impress)
|
|
SIGNAL_HANDLER
|
|
|
|
var/msg
|
|
switch(impress)
|
|
if(GREAT_ART to INFINITY)
|
|
SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "artgreat", /datum/mood_event/artgreat)
|
|
msg = "What \a [pick("masterpiece", "chef-d'oeuvre")] [source.p_theyre()]. So [pick("trascended", "awe-inspiring", "bewitching", "impeccable")]!"
|
|
if (GOOD_ART to GREAT_ART)
|
|
SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "artgood", /datum/mood_event/artgood)
|
|
msg = "[source.p_theyre(TRUE)] a [pick("respectable", "commendable", "laudable")] art piece, easy on the keen eye."
|
|
if (BAD_ART to GOOD_ART)
|
|
SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "artok", /datum/mood_event/artok)
|
|
msg = "[source.p_theyre(TRUE)] fair to middling, enough to be called an \"art object\"."
|
|
if (0 to BAD_ART)
|
|
SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "artbad", /datum/mood_event/artbad)
|
|
msg = "Wow, [source.p_they()] sucks."
|
|
|
|
user.visible_message(span_notice("[user] stops and looks intently at [source]."), \
|
|
span_notice("You appraise [source]... [msg]"))
|
|
|
|
/datum/element/art/proc/on_examine(atom/source, mob/user, list/examine_texts)
|
|
SIGNAL_HANDLER
|
|
|
|
if(!DOING_INTERACTION_WITH_TARGET(user, source))
|
|
INVOKE_ASYNC(src, .proc/appraise, source, user) //Do not sleep the proc.
|
|
|
|
/datum/element/art/proc/appraise(atom/source, mob/user)
|
|
to_chat(user, span_notice("You start appraising [source]..."))
|
|
if(!do_after(user, 2 SECONDS, target = source))
|
|
return
|
|
var/mult = 1
|
|
if(isobj(source))
|
|
var/obj/art_piece = source
|
|
mult = art_piece.get_integrity() / art_piece.max_integrity
|
|
|
|
apply_moodlet(source, user, impressiveness * mult)
|
|
|
|
/datum/element/art/rev
|
|
|
|
/datum/element/art/rev/apply_moodlet(atom/source, mob/user, impress)
|
|
var/msg
|
|
if(user.mind?.has_antag_datum(/datum/antagonist/rev))
|
|
SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "artgreat", /datum/mood_event/artgreat)
|
|
msg = "What \a [pick("masterpiece", "chef-d'oeuvre")] [source.p_theyre()]. So [pick("subversive", "revolutionary", "unitizing", "egalitarian")]!"
|
|
SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "artbad", /datum/mood_event/artbad)
|
|
msg = "Wow, [source.p_they()] sucks."
|
|
|
|
user.visible_message(span_notice("[user] stops to inspect [source]."), \
|
|
span_notice("You appraise [source], inspecting the fine craftsmanship of the proletariat... [msg]"))
|