From b7122f2d6e96b70ee68867f26ee2cf021f8a718b Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 4 Nov 2020 01:35:26 +0100 Subject: [PATCH] [MIRROR] Converting art component into element. (#1562) * Converting art component into element. (#54616) * Only art is now an element. There have been some issues with beauty. * Typo. * Update art.dm * Update art.dm * Maintainer suggestions. Reversing order of switch(impress) for correct moodlets. * Fixing some pre-existing oddities with art element. * stating the right var. * simplifying the component. * Update art.dm * lowercasing pronoun. * Converting art component into element. Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com> --- code/__DEFINES/misc.dm | 1 + code/datums/components/art.dm | 59 --------------------- code/datums/elements/art.dm | 66 ++++++++++++++++++++++++ code/game/objects/items/crayons.dm | 4 +- code/game/objects/items/weaponry.dm | 2 +- code/game/objects/structures/artstuff.dm | 2 +- code/game/objects/structures/statues.dm | 6 +-- code/modules/photography/photos/frame.dm | 2 +- tgstation.dme | 2 +- 9 files changed, 76 insertions(+), 68 deletions(-) delete mode 100644 code/datums/components/art.dm create mode 100644 code/datums/elements/art.dm diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 8274d9b2fa8..a9a4678e3c3 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -489,6 +489,7 @@ GLOBAL_LIST_INIT(pda_styles, sortList(list(MONO, VT, ORBITRON, SHARE))) // art quality defines, used in datums/components/art.dm, elsewhere #define BAD_ART 12.5 +#define OK_ART 20 #define GOOD_ART 25 #define GREAT_ART 50 diff --git a/code/datums/components/art.dm b/code/datums/components/art.dm deleted file mode 100644 index eade5a44cf8..00000000000 --- a/code/datums/components/art.dm +++ /dev/null @@ -1,59 +0,0 @@ -/datum/component/art - var/impressiveness = 0 - -/datum/component/art/Initialize(impress) - impressiveness = impress - if(isobj(parent)) - RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/on_obj_examine) - else - RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/on_other_examine) - if(isstructure(parent)) - RegisterSignal(parent, COMSIG_ATOM_ATTACK_HAND, .proc/on_attack_hand) - if(isitem(parent)) - RegisterSignal(parent, COMSIG_ITEM_ATTACK_SELF, .proc/apply_moodlet) - -/datum/component/art/proc/apply_moodlet(mob/M, impress) - SIGNAL_HANDLER - - M.visible_message("[M] stops and looks intently at [parent].", \ - "You stop to take in [parent].") - switch(impress) - if (0 to BAD_ART) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "artbad", /datum/mood_event/artbad) - if (BAD_ART to GOOD_ART) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "artok", /datum/mood_event/artok) - if (GOOD_ART to GREAT_ART) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "artgood", /datum/mood_event/artgood) - if(GREAT_ART to INFINITY) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "artgreat", /datum/mood_event/artgreat) - - -/datum/component/art/proc/on_other_examine(datum/source, mob/M) - SIGNAL_HANDLER - - apply_moodlet(M, impressiveness) - -/datum/component/art/proc/on_obj_examine(datum/source, mob/M) - SIGNAL_HANDLER - - var/obj/O = parent - apply_moodlet(M, impressiveness *(O.obj_integrity/O.max_integrity)) - -/datum/component/art/proc/on_attack_hand(datum/source, mob/M) - SIGNAL_HANDLER_DOES_SLEEP - - to_chat(M, "You start examining [parent]...") - if(!do_after(M, 20, target = parent)) - return - on_obj_examine(source, M) - -/datum/component/art/rev - -/datum/component/art/rev/apply_moodlet(mob/M, impress) - M.visible_message("[M] stops to inspect [parent].", \ - "You take in [parent], inspecting the fine craftsmanship of the proletariat.") - - if(M.mind && M.mind.has_antag_datum(/datum/antagonist/rev)) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "artgreat", /datum/mood_event/artgreat) - else - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "artbad", /datum/mood_event/artbad) diff --git a/code/datums/elements/art.dm b/code/datums/elements/art.dm new file mode 100644 index 00000000000..4a1e6a37f45 --- /dev/null +++ b/code/datums/elements/art.dm @@ -0,0 +1,66 @@ +/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("[user] stops and looks intently at [source].", \ + "You appraise [source]... [msg]") + +/datum/element/art/proc/on_examine(atom/source, mob/user, list/examine_texts) + SIGNAL_HANDLER + + if(!INTERACTING_WITH(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, "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.obj_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("[user] stops to inspect [source].", \ + "You appraise [source], inspecting the fine craftsmanship of the proletariat... [msg]") diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm index ddbea0b863c..60a2dbab5d8 100644 --- a/code/game/objects/items/crayons.dm +++ b/code/game/objects/items/crayons.dm @@ -411,9 +411,9 @@ return C.add_hiddenprint(user) if(istagger) - C.AddComponent(/datum/component/art, GOOD_ART) + C.AddElement(/datum/element/art, GOOD_ART) else - C.AddComponent(/datum/component/art, BAD_ART) + C.AddElement(/datum/element/art, BAD_ART) if(!instant) to_chat(user, "You finish drawing \the [temp].") diff --git a/code/game/objects/items/weaponry.dm b/code/game/objects/items/weaponry.dm index 78fe4e8035d..dd69f7cdf3d 100644 --- a/code/game/objects/items/weaponry.dm +++ b/code/game/objects/items/weaponry.dm @@ -536,7 +536,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 /obj/item/statuebust/Initialize() . = ..() - AddComponent(/datum/component/art, impressiveness) + AddElement(/datum/element/art, impressiveness) INVOKE_ASYNC(src, /datum.proc/_AddComponent, list(/datum/component/beauty, 1000)) /obj/item/statuebust/hippocratic diff --git a/code/game/objects/structures/artstuff.dm b/code/game/objects/structures/artstuff.dm index c058b4317b6..5425f0a01de 100644 --- a/code/game/objects/structures/artstuff.dm +++ b/code/game/objects/structures/artstuff.dm @@ -238,7 +238,7 @@ /obj/structure/sign/painting/Initialize(mapload, dir, building) . = ..() SSpersistence.painting_frames += src - AddComponent(/datum/component/art, 20) + AddElement(/datum/element/art, OK_ART) if(dir) setDir(dir) if(building) diff --git a/code/game/objects/structures/statues.dm b/code/game/objects/structures/statues.dm index f73eeeeb76d..d3771a370bf 100644 --- a/code/game/objects/structures/statues.dm +++ b/code/game/objects/structures/statues.dm @@ -12,13 +12,13 @@ /// Beauty component mood modifier var/impressiveness = 15 /// Art component subtype added to this statue - var/art_type = /datum/component/art + var/art_type = /datum/element/art /// Abstract root type var/abstract_type = /obj/structure/statue /obj/structure/statue/Initialize() . = ..() - AddComponent(art_type, impressiveness) + AddElement(art_type, impressiveness) INVOKE_ASYNC(src, /datum.proc/_AddComponent, list(/datum/component/beauty, impressiveness * 75)) AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE, CALLBACK(src, .proc/can_user_rotate), CALLBACK(src, .proc/can_be_rotated), null) @@ -271,7 +271,7 @@ name = "\improper Karl Marx bust" desc = "A bust depicting a certain 19th century economist. You get the feeling a specter is haunting the station." icon_state = "marx" - art_type = /datum/component/art/rev + art_type = /datum/element/art/rev ///////////Elder Atmosian/////////////////////////////////////////// diff --git a/code/modules/photography/photos/frame.dm b/code/modules/photography/photos/frame.dm index f464754dd6e..f28ccb4120c 100644 --- a/code/modules/photography/photos/frame.dm +++ b/code/modules/photography/photos/frame.dm @@ -77,7 +77,7 @@ /obj/structure/sign/picture_frame/Initialize(mapload, dir, building) . = ..() - AddComponent(/datum/component/art, 20) + AddElement(/datum/element/art, OK_ART) LAZYADD(SSpersistence.photo_frames, src) if(dir) setDir(dir) diff --git a/tgstation.dme b/tgstation.dme index d6e9736b754..62f066bd1ea 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -423,7 +423,6 @@ #include "code\datums\components\anti_magic.dm" #include "code\datums\components\areabound.dm" #include "code\datums\components\armor_plate.dm" -#include "code\datums\components\art.dm" #include "code\datums\components\bane.dm" #include "code\datums\components\beauty.dm" #include "code\datums\components\beetlejuice.dm" @@ -584,6 +583,7 @@ #include "code\datums\diseases\advance\symptoms\weight.dm" #include "code\datums\diseases\advance\symptoms\youth.dm" #include "code\datums\elements\_element.dm" +#include "code\datums\elements\art.dm" #include "code\datums\elements\bsa_blocker.dm" #include "code\datums\elements\cleaning.dm" #include "code\datums\elements\decal.dm"