Files
Bubberstation/code/datums/elements/art.dm
LemonInTheDark ae5a4f955d Pulls apart the vestiges of components still hanging onto signals (#75914)
## About The Pull Request

Signals were initially only usable with component listeners, which while
no longer the case has lead to outdated documentation, names, and a
similar location in code.

This pr pulls the two apart. Partially because mso thinks we should, but
also because they really aren't directly linked anymore, and having them
in this midstate just confuses people.

[Renames comp_lookup to listen_lookup, since that's what it
does](102b79694f)

[Moves signal procs over to their own
file](33d07d01fd)

[Renames the PREQDELETING and QDELETING comsigs to drop the parent bit
since they can hook to more then just comps
now](335ea4ad08)

[Does something similar to the attackby comsigs (PARENT ->
ATOM)](210e57051d)

[And finally passes over the examine
signals](65917658fb)

## Why It's Good For The Game

Code makes more sense, things are better teased apart, s just good imo

## Changelog
🆑
refactor: Pulled apart the last vestiges of names/docs directly linking
signals to components
/🆑
2023-06-09 06:14:31 +00:00

89 lines
3.7 KiB
Plaintext

/datum/element/art
element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY // Detach for turfs
argument_hash_start_idx = 2
var/impressiveness = 0
/datum/element/art/Attach(datum/target, impress)
. = ..()
if(!isatom(target) || isarea(target))
return ELEMENT_INCOMPATIBLE
impressiveness = impress
RegisterSignal(target, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine))
/datum/element/art/Detach(datum/target)
UnregisterSignal(target, COMSIG_ATOM_EXAMINE)
return ..()
/datum/element/art/proc/apply_moodlet(atom/source, mob/living/user, impress)
SIGNAL_HANDLER
var/msg
switch(impress)
if(GREAT_ART to INFINITY)
user.add_mood_event("artgreat", /datum/mood_event/artgreat)
msg = "What \a [pick("masterpiece", "chef-d'oeuvre")]. So [pick("trascended", "awe-inspiring", "bewitching", "impeccable")]!"
if (GOOD_ART to GREAT_ART)
user.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)
user.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)
user.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(!isliving(user))
return
if(!DOING_INTERACTION_WITH_TARGET(user, source))
INVOKE_ASYNC(src, PROC_REF(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(source.uses_integrity)
mult = source.get_integrity() / source.max_integrity
apply_moodlet(source, user, impressiveness * mult)
/datum/element/art/rev
/datum/element/art/rev/apply_moodlet(atom/source, mob/living/user, impress)
var/msg
if(user.mind?.has_antag_datum(/datum/antagonist/rev))
user.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")]!"
else
user.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]"))
/datum/element/art/commoner
/datum/element/art/commoner/apply_moodlet(atom/source, mob/living/user, impress)
var/msg
var/list/haters = list()
for(var/hater_department_type as anything in list(/datum/job_department/security, /datum/job_department/command))
var/datum/job_department/hater_department = SSjob.get_department_type(hater_department_type)
for(var/datum/job/hater_job as anything in hater_department.department_jobs)
haters += hater_job.title
var/datum/job/quartermaster/fucking_quartermaster = SSjob.GetJobType(/datum/job/quartermaster)
haters += fucking_quartermaster.title
if(!(user.mind.assigned_role.title in haters))
user.add_mood_event("artgreat", /datum/mood_event/artgreat)
msg = "What \a [pick("masterpiece", "chef-d'oeuvre")] [source.p_theyre()]. So [pick("relatable", "down to earth", "true", "real")]!"
else
user.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]"))