Positive moodlets when examining high-value paintings, plus tgui nitpicks (#84646)

## About The Pull Request
This PR makes it so that, when framed, paintings can give positive
moodlets based on their art element, which is based upon their
patronage, meaning, the higher tha patronage, the better the positive
moodlets.

This PR also adjusts the tgui states to allow observers to interact with
the painting, but only for zooming in and out. And expands the tgui
window a little so hopefully you can see the plaquette when it's framed.

## Why It's Good For The Game
Higher-valued pieces tend to also look better, right? . . . right?
Ok, jokes apart, I think this is a nice touch to paintings.

## Changelog

🆑
add: Examining high-value paintings now can give a positive moodlet.
qol: Observers can now zoom paintings in and out in the UI.
/🆑
This commit is contained in:
Ghom
2024-07-15 14:13:24 +01:00
committed by GitHub
parent c79faaa8d1
commit 86d9bae412
4 changed files with 58 additions and 19 deletions
+43
View File
@@ -91,6 +91,14 @@
painting_metadata.height = height
ADD_KEEP_TOGETHER(src, INNATE_TRAIT)
/obj/item/canvas/Destroy()
last_patron = null
if(istype(loc,/obj/structure/sign/painting))
var/obj/structure/sign/painting/frame = loc
frame.remove_art_element(painting_metadata.credit_value)
painting_metadata = null
return ..()
/obj/item/canvas/proc/reset_grid()
grid = new/list(width,height)
for(var/x in 1 to width)
@@ -102,6 +110,8 @@
ui_interact(user)
/obj/item/canvas/ui_state(mob/user)
if(isobserver(user))
return GLOB.observer_state
if(finalized)
return GLOB.physical_obscured_state
else
@@ -154,6 +164,9 @@
if(.)
return
var/mob/user = usr
///this is here to allow observers to zoom in and out but not do anything else.
if(action != "zoom_in" && action != "zoom_out" && isobserver(user))
return
switch(action)
if("paint")
if(finalized)
@@ -286,10 +299,16 @@
curator.adjust_money(curator_cut, "Painting: Patronage cut")
curator.bank_card_talk("Cut on patronage received, account now holds [curator.account_balance] cr.")
if(istype(loc, /obj/structure/sign/painting))
var/obj/structure/sign/painting/frame = loc
frame.remove_art_element(painting_metadata.credit_value)
frame.add_art_element(offer_amount)
painting_metadata.patron_ckey = user.ckey
painting_metadata.patron_name = user.real_name
painting_metadata.credit_value = offer_amount
last_patron = WEAKREF(user.mind)
to_chat(user, span_notice("Nanotrasen Trust Foundation thanks you for your contribution. You're now an official patron of this painting."))
var/list/possible_frames = SSpersistent_paintings.get_available_frames(offer_amount)
if(possible_frames.len <= 1) // Not much room for choices here.
@@ -566,6 +585,8 @@
/obj/structure/sign/painting/Exited(atom/movable/movable, atom/newloc)
. = ..()
if(movable == current_canvas)
if(!QDELETED(current_canvas))
remove_art_element(current_canvas.painting_metadata.credit_value)
current_canvas = null
update_appearance()
@@ -585,6 +606,7 @@
if(!current_canvas.finalized)
current_canvas.finalize(user)
to_chat(user,span_notice("You frame [current_canvas]."))
add_art_element()
update_appearance()
return TRUE
return FALSE
@@ -654,10 +676,31 @@
new_canvas.finalized = TRUE
new_canvas.name = "painting - [painting.title]"
current_canvas = new_canvas
add_art_element()
current_canvas.update_appearance()
update_appearance()
return TRUE
/obj/structure/sign/painting/proc/add_art_element()
var/artistic_value = get_art_value(current_canvas.painting_metadata.credit_value)
if(artistic_value)
AddElement(/datum/element/art, artistic_value)
/obj/structure/sign/painting/proc/remove_art_element(patronage)
var/artistic_value = get_art_value(patronage)
if(artistic_value)
RemoveElement(/datum/element/art, artistic_value)
/obj/structure/sign/painting/proc/get_art_value(patronage)
switch(patronage)
if(PATRONAGE_SUPERB_FRAME to INFINITY)
return GREAT_ART
if(PATRONAGE_EXCELLENT_FRAME to PATRONAGE_SUPERB_FRAME)
return GOOD_ART
if(PATRONAGE_NICE_FRAME to PATRONAGE_EXCELLENT_FRAME)
return OK_ART
return 0
/obj/structure/sign/painting/proc/save_persistent()
if(!persistence_id || !current_canvas || current_canvas.no_save || current_canvas.painting_metadata.loaded_from_json)
return