mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 13:10:02 +01:00
[MIRROR] [NO GBP] Retain filtering capabilities for paintings [MDB IGNORE] (#24776)
* [NO GBP] Retain filtering capabilities for paintings (#79504) ## About The Pull Request Fixes a little whoopsie from #79495 which got rid of the ability to filter paintings ## Why It's Good For The Game Filtering good ## Changelog :cl:Tattle fix: paintings can once again be filtered /🆑 Co-authored-by: tattle <article.disaster@ gmail.com> * [NO GBP] Retain filtering capabilities for paintings --------- Co-authored-by: tattle <66640614+dragomagol@users.noreply.github.com> Co-authored-by: tattle <article.disaster@ gmail.com>
This commit is contained in:
co-authored by
tattle
tattle
parent
14eda4be9c
commit
20c5dea5fb
@@ -161,6 +161,8 @@ SUBSYSTEM_DEF(persistent_paintings)
|
||||
"creator" = painting.creator_name,
|
||||
"md5" = painting.md5,
|
||||
"ref" = REF(painting),
|
||||
"width" = painting.width,
|
||||
"height" = painting.height,
|
||||
"ratio" = painting.width/painting.height,
|
||||
))
|
||||
|
||||
@@ -177,18 +179,26 @@ SUBSYSTEM_DEF(persistent_paintings)
|
||||
*/
|
||||
/datum/controller/subsystem/persistent_paintings/proc/painting_ui_data(filter=NONE, admin=FALSE, search_text)
|
||||
var/searching = filter & (PAINTINGS_FILTER_SEARCH_TITLE|PAINTINGS_FILTER_SEARCH_CREATOR) && search_text
|
||||
for(var/datum/painting/painting as anything in paintings)
|
||||
if(filter & PAINTINGS_FILTER_AI_PORTRAIT && ((painting.width != 24 && painting.width != 23) || (painting.height != 24 && painting.height != 23)))
|
||||
|
||||
if(!searching)
|
||||
return admin ? admin_painting_data : cached_painting_data
|
||||
|
||||
var/list/filtered_paintings = list()
|
||||
var/list/searched_paintings = admin ? admin_painting_data : cached_painting_data
|
||||
|
||||
for(var/painting as anything in searched_paintings)
|
||||
if(filter & PAINTINGS_FILTER_AI_PORTRAIT && ((painting["width"] != 24 && painting["width"] != 23) || (painting["height"] != 24 && painting["height"] != 23)))
|
||||
continue
|
||||
if(searching)
|
||||
var/haystack_text = ""
|
||||
if(filter & PAINTINGS_FILTER_SEARCH_TITLE)
|
||||
haystack_text = painting.title
|
||||
haystack_text = painting["title"]
|
||||
else if(filter & PAINTINGS_FILTER_SEARCH_CREATOR)
|
||||
haystack_text = painting.creator_name
|
||||
haystack_text = painting["creator"]
|
||||
if(!findtext(haystack_text, search_text))
|
||||
continue
|
||||
return admin ? admin_painting_data : cached_painting_data
|
||||
filtered_paintings += painting
|
||||
return filtered_paintings
|
||||
|
||||
/// Returns paintings with given tag.
|
||||
/datum/controller/subsystem/persistent_paintings/proc/get_paintings_with_tag(tag_name)
|
||||
|
||||
Reference in New Issue
Block a user