From d23e1279f39a4a8c5233aeb04169c712212143df Mon Sep 17 00:00:00 2001 From: Ben10083 Date: Thu, 17 Oct 2024 20:49:09 -0400 Subject: [PATCH 1/2] Custom Stickersheets --- code/game/objects/items/sticker.dm | 2 +- .../items/weapons/storage/stickersheets.dm | 22 +++++-- .../preference_setup/loadout/gear_tweaks.dm | 2 +- .../preference_setup/loadout/items/toy.dm | 30 +++++++++- html/changelogs/Ben10083 - Custom_SSheets.yml | 60 +++++++++++++++++++ 5 files changed, 107 insertions(+), 9 deletions(-) create mode 100644 html/changelogs/Ben10083 - Custom_SSheets.yml diff --git a/code/game/objects/items/sticker.dm b/code/game/objects/items/sticker.dm index 6bb5ec5727c..12fadcde205 100644 --- a/code/game/objects/items/sticker.dm +++ b/code/game/objects/items/sticker.dm @@ -352,7 +352,7 @@ icon_state = "scarabpole" /obj/item/sticker/flagpole/coalition/xanu - name = "all xanu repiblic flag sticker" + name = "all xanu republic flag sticker" desc = "The flag of the All Xanu-Republic on a flagpole." icon_state = "xanupole" diff --git a/code/game/objects/items/weapons/storage/stickersheets.dm b/code/game/objects/items/weapons/storage/stickersheets.dm index 239db756afc..dbee6fa53b4 100644 --- a/code/game/objects/items/weapons/storage/stickersheets.dm +++ b/code/game/objects/items/weapons/storage/stickersheets.dm @@ -16,6 +16,22 @@ /obj/item/sticker ) +// List/Procs to list all stickers for custom stickersheet(similar to lunchbox code) +var/list/stickersheet_stickers_ = typesof(/obj/item/sticker) + +/proc/stickersheet_stickers() + if(!(stickersheet_stickers_[stickersheet_stickers_[1]])) + stickersheet_stickers_ = init_sticketsheet_stickers(stickersheet_stickers_) + return stickersheet_stickers_ + +/proc/init_sticketsheet_stickers(var/list/stickers) + . = list() + for(var/sticker in stickers) + var/obj/O = sticker + .[initial(O.name)] = sticker + + sortTim(., GLOBAL_PROC_REF(cmp_text_asc)) + /obj/item/storage/stickersheet/goldstar name = "gold star sticker sheet" starts_with = list( @@ -52,12 +68,6 @@ /obj/item/sticker/religious/trinary = 2 ) -/obj/item/storage/stickersheet/domadice - name = "domadice sticker sheet" - starts_with = list( - /obj/item/sticker/generic/domadice = 12 - ) - /obj/item/storage/stickersheet/biesel name = "republic of biesel sticker sheet" starts_with = list( diff --git a/code/modules/client/preference_setup/loadout/gear_tweaks.dm b/code/modules/client/preference_setup/loadout/gear_tweaks.dm index 55e50b6a6d3..287919bb660 100644 --- a/code/modules/client/preference_setup/loadout/gear_tweaks.dm +++ b/code/modules/client/preference_setup/loadout/gear_tweaks.dm @@ -192,7 +192,7 @@ Content adjustment for(var/i = metadata.len to (valid_contents.len - 1)) metadata += "Random" for(var/i = 1 to valid_contents.len) - var/entry = tgui_input_list(user, "Choose an entry.", "Character Preference", (valid_contents[i] + list("Random", "None")), metadata[i]) + var/entry = tgui_input_list(user, "Choose an entry.", "Character Preference", (list("None", "Random") + valid_contents[i]), metadata[i]) if(entry) . += entry else diff --git a/code/modules/client/preference_setup/loadout/items/toy.dm b/code/modules/client/preference_setup/loadout/items/toy.dm index fa3b57695bc..83556c6b344 100644 --- a/code/modules/client/preference_setup/loadout/items/toy.dm +++ b/code/modules/client/preference_setup/loadout/items/toy.dm @@ -132,7 +132,6 @@ var/list/stickersheet = list() stickersheet["Generic sticker sheet"] = /obj/item/storage/stickersheet/generic stickersheet["Religious sticker sheet"] = /obj/item/storage/stickersheet/religion - stickersheet["Domadice sticker sheet"] = /obj/item/storage/stickersheet/domadice stickersheet["Republic of Biesel sticker sheet"] = /obj/item/storage/stickersheet/biesel stickersheet["Republic of Elyra sticker sheet"] = /obj/item/storage/stickersheet/elyra stickersheet["Solarian Alliance sticker sheet"] = /obj/item/storage/stickersheet/sol @@ -144,3 +143,32 @@ stickersheet["Uueoa-Esa sticker sheet"] = /obj/item/storage/stickersheet/hegemony stickersheet["Anti-Establishment sticker sheet"] = /obj/item/storage/stickersheet/resistance gear_tweaks += new /datum/gear_tweak/path(stickersheet) + +/datum/gear/toy/stickersheet_custom + display_name = "sticker sheet (custom)" + description = "A sticker sheet that can hold a variety of stickers." + cost = 1 + path = /obj/item/storage/stickersheet + +/datum/gear/toy/stickersheet_custom/New() + ..() + gear_tweaks += new /datum/gear_tweak/contents/stickersheet(stickersheet_stickers(),stickersheet_stickers(),stickersheet_stickers(),stickersheet_stickers()) + +/// Same as contents/tweak_item except it adds 3 of each item into the stickersheet (4 * 3 = 12) +/datum/gear_tweak/contents/stickersheet/tweak_item(var/obj/item/storage/stickersheet/sheet, var/list/metadata, var/mob/living/carbon/human/H) + if(metadata.len != valid_contents.len) + return + for(var/i = 1 to valid_contents.len) + var/path + var/list/contents = valid_contents[i] + if(metadata[i] == "Random") + path = pick(contents) + path = contents[path] + else if(metadata[i] == "None") + continue + else + path = contents[metadata[i]] + if(path) // repeat 3 times for each item + new path(sheet) + new path(sheet) + new path(sheet) diff --git a/html/changelogs/Ben10083 - Custom_SSheets.yml b/html/changelogs/Ben10083 - Custom_SSheets.yml new file mode 100644 index 00000000000..6ea1c3fb94f --- /dev/null +++ b/html/changelogs/Ben10083 - Custom_SSheets.yml @@ -0,0 +1,60 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: Ben10083 + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Custom stickersheets added to loadout. Select 4 stickers which is put into the sheet (each selection provides 3)." + - rscdel: "Removed Domadice stickersheet." + - qol: "Random and None options now appear first in content lists (like lunchboxes)" From 01ac71f2a433e6a067b8bd6ade840831af5e458c Mon Sep 17 00:00:00 2001 From: Ben10083 Date: Thu, 17 Oct 2024 20:58:54 -0400 Subject: [PATCH 2/2] Revives Domadice --- code/game/objects/items/weapons/storage/stickersheets.dm | 6 ++++++ code/modules/client/preference_setup/loadout/items/toy.dm | 1 + html/changelogs/Ben10083 - Custom_SSheets.yml | 1 - 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/code/game/objects/items/weapons/storage/stickersheets.dm b/code/game/objects/items/weapons/storage/stickersheets.dm index dbee6fa53b4..41acdc69b36 100644 --- a/code/game/objects/items/weapons/storage/stickersheets.dm +++ b/code/game/objects/items/weapons/storage/stickersheets.dm @@ -44,6 +44,12 @@ var/list/stickersheet_stickers_ = typesof(/obj/item/sticker) /obj/item/sticker/generic/googly_eye = 12 ) +/obj/item/storage/stickersheet/domadice + name = "domadice sticker sheet" + starts_with = list( + /obj/item/sticker/generic/domadice = 12 + ) + /obj/item/storage/stickersheet/generic name = "generic sticker sheet" starts_with = list( diff --git a/code/modules/client/preference_setup/loadout/items/toy.dm b/code/modules/client/preference_setup/loadout/items/toy.dm index 83556c6b344..5abd4ac7cd0 100644 --- a/code/modules/client/preference_setup/loadout/items/toy.dm +++ b/code/modules/client/preference_setup/loadout/items/toy.dm @@ -132,6 +132,7 @@ var/list/stickersheet = list() stickersheet["Generic sticker sheet"] = /obj/item/storage/stickersheet/generic stickersheet["Religious sticker sheet"] = /obj/item/storage/stickersheet/religion + stickersheet["Domadice sticker sheet"] = /obj/item/storage/stickersheet/domadice stickersheet["Republic of Biesel sticker sheet"] = /obj/item/storage/stickersheet/biesel stickersheet["Republic of Elyra sticker sheet"] = /obj/item/storage/stickersheet/elyra stickersheet["Solarian Alliance sticker sheet"] = /obj/item/storage/stickersheet/sol diff --git a/html/changelogs/Ben10083 - Custom_SSheets.yml b/html/changelogs/Ben10083 - Custom_SSheets.yml index 6ea1c3fb94f..9baa5cee5a3 100644 --- a/html/changelogs/Ben10083 - Custom_SSheets.yml +++ b/html/changelogs/Ben10083 - Custom_SSheets.yml @@ -56,5 +56,4 @@ delete-after: True # Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. changes: - rscadd: "Custom stickersheets added to loadout. Select 4 stickers which is put into the sheet (each selection provides 3)." - - rscdel: "Removed Domadice stickersheet." - qol: "Random and None options now appear first in content lists (like lunchboxes)"