From f29facab6fab31fa9d32b955fad36935837ec4f1 Mon Sep 17 00:00:00 2001 From: Alexis Date: Mon, 17 Mar 2025 11:51:46 -0400 Subject: [PATCH] (Port) Adds changeable character creator backgrounds + character creator zooms out for big chars now (#3015) ## About The Pull Request _**SPECIAL THANKS TO ARTUR**_ TL;DR read the title. But I ported the ability to change the background of the character creator [from Virgo](https://github.com/VOREStation/VOREStation/pull/2341). They are able to be changed in the character creation menu. Also character resizing works now, so you can properly see your oversized characters. All of the possible backgrounds are: - 000 (Pure Black) - Midgrey (Grey) - FFF (Pure White) - White (White Tiles) - Plasteel (Normal Tiles) - Dark (Dark Tiles) - Plating (Maints Plating) - Reinforced (Reinforced Floor) ## Why It's Good For The Game Some people play characters that have pure black parts or are really dark, so the ability to change the background helps them better preview their character. ## Proof Of Testing It worked and I was able to update the background in game and change it to other ones.
Screenshots/Videos ![image](https://github.com/user-attachments/assets/25970ab7-167c-4e8c-8d98-0e6c1b2b84b4)
## Changelog :cl: xPokee, RimiNosha add: Added the ability to change the character creator background via the character visuals tab. fix: Fixed oversized characters and larger characters not being fully visible in the character creator image: Added additional background icons for the character creator. /:cl: --------- Co-authored-by: RimiNosha --- code/modules/client/preferences.dm | 55 +++++++++++++++++- .../character_preview_background.dm | 24 ++++++++ .../icons/customization/template.dmi | Bin 0 -> 636 bytes .../icons/customization/template_64x64.dmi | Bin 0 -> 885 bytes .../icons/customization/template_96x96.dmi | Bin 0 -> 1327 bytes tgstation.dme | 1 + .../CharacterPreferences/MainPage.tsx | 14 +++++ .../bubber/character_preview_background.tsx | 9 +++ .../tgui/interfaces/PreferencesMenu/types.ts | 4 +- .../PreferencesMenu/useServerPrefs.ts | 5 +- 10 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 modular_zubbers/code/modules/character_preview_background/character_preview_background.dm create mode 100644 modular_zubbers/icons/customization/template.dmi create mode 100644 modular_zubbers/icons/customization/template_64x64.dmi create mode 100644 modular_zubbers/icons/customization/template_96x96.dmi create mode 100644 tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/bubber/character_preview_background.tsx diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index b11315a122d..f45f14232f4 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -309,6 +309,12 @@ GLOBAL_LIST_EMPTY(preferences_datums) character_preview_view.update_body() return TRUE + //BUBBER EDIT ADDITION START: Background Selection + if("update_background") + update_preference(GLOB.preference_entries[/datum/preference/choiced/background_state], params["new_background"]) + return TRUE + //BUBBER EDIT ADDITION END: Background Selection + if ("open_food") GLOB.food_prefs_menu.ui_interact(usr) return TRUE @@ -432,11 +438,21 @@ GLOBAL_LIST_EMPTY(preferences_datums) /// Whether we show current job clothes or nude/loadout only var/show_job_clothes = TRUE + // BUBBER EDIT ADDITION START: Better character preview: Rescales between 32x32, 64x64 and 96x96. + var/image/canvas + var/last_canvas_size + var/last_canvas_state + // BUBBER EDIT END + /atom/movable/screen/map_view/char_preview/Initialize(mapload, datum/preferences/preferences) . = ..() src.preferences = preferences /atom/movable/screen/map_view/char_preview/Destroy() + // BUBBER EDIT ADDITION START: Better character preview + canvas?.cut_overlays() + QDEL_NULL(canvas) + // BUBBER EDIT END QDEL_NULL(body) preferences?.character_preview_view = null preferences = null @@ -449,7 +465,44 @@ GLOBAL_LIST_EMPTY(preferences_datums) else body.wipe_state() - appearance = preferences.render_new_preview_appearance(body, show_job_clothes) + // BUBBER STATION EDIT BEGIN: Better character preview + // appearance = preferences.render_new_preview_appearance(body, show_job_clothes) // ORIGINAL CODE + if (canvas) + canvas.cut_overlays() + + preferences.render_new_preview_appearance(body, show_job_clothes) + + var/canvas_size = 0 + var/canvas_state = preferences.read_preference(/datum/preference/choiced/background_state) + + // Being a taur, or over 1.1 scales it up + if (body.dna.mutant_bodyparts["taur"] && body.dna.mutant_bodyparts["taur"]["name"] != "None") + canvas_size = 1 + else if (!isnull(body.dna.features["body_size"]) && body.dna.features["body_size"] > 1.1) + canvas_size = 1 + // Add extra level if we're oversized + if (preferences.all_quirks.Find("Oversized")) + canvas_size += 1 + + if (last_canvas_size != canvas_size || last_canvas_state != canvas_state) + QDEL_NULL(canvas) + switch(canvas_size) + if(0) + body.pixel_x = 0 + canvas = image('modular_zubbers/icons/customization/template.dmi', icon_state = canvas_state) + if(1) + body.pixel_x = 16 + canvas = image('modular_zubbers/icons/customization/template_64x64.dmi', icon_state = canvas_state) + else + body.pixel_x = 32 + canvas = image('modular_zubbers/icons/customization/template_96x96.dmi', icon_state = canvas_state) + + last_canvas_size = canvas_size + last_canvas_state = canvas_state + + canvas.add_overlay(body.appearance) + appearance = canvas.appearance + // BUBBER EDIT END /atom/movable/screen/map_view/char_preview/proc/create_body() QDEL_NULL(body) diff --git a/modular_zubbers/code/modules/character_preview_background/character_preview_background.dm b/modular_zubbers/code/modules/character_preview_background/character_preview_background.dm new file mode 100644 index 00000000000..2b71dd7a0b8 --- /dev/null +++ b/modular_zubbers/code/modules/character_preview_background/character_preview_background.dm @@ -0,0 +1,24 @@ +/// Enables the choice of background in the character preview menu +/datum/preference/choiced/background_state + savefile_key = "background_state" + savefile_identifier = PREFERENCE_CHARACTER + +GLOBAL_LIST_INIT(background_state_options, list( + "000", + "midgrey", + "FFF", + "white", + "plasteel", + "dark" , + "plating", + "reinforced", + )) + +/datum/preference/choiced/background_state/create_default_value() + return GLOB.background_state_options[1] + +/datum/preference/choiced/background_state/init_possible_values() + return GLOB.background_state_options + +/datum/preference/choiced/background_state/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences) + return diff --git a/modular_zubbers/icons/customization/template.dmi b/modular_zubbers/icons/customization/template.dmi new file mode 100644 index 0000000000000000000000000000000000000000..95bf98a98e0c0a9d2c3d89e2f6bf8e7fb4c2f627 GIT binary patch literal 636 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD3?#3*wSy!)0(?STfpl+o_y7O@Z{EC_mX_Ag z(BR>C>l~GiUnx`WhP>D=VrS8=49UNdPsbr>DC)yDKWH z>FOF7-gs~XD8yJ2W3*2_YH_@@|m0v32d0-8itnnz`N0qNP43*T zS#bGX>MgOI)+dhKXW(~BlbG<+4s6y6<%*x*4;uEnmeouCeR{b6oT7PDpStCx$!9-m zS^U0z@ZXyW;T%3Qx_5FNE4lYp(kM=m!(PeFse?)WvE0WKuUWp=hl<$ji)Sg`?7zqB zf zZ1dy4qMpEiqq&IjKKuWB%&Dty{E1tVSGLqPBBCz)i$Zi+;m_WfJIt$>Y+>IYa8dLg U7uU6~z}RN+boFyt=akR{0JZxQ$^ZZW literal 0 HcmV?d00001 diff --git a/modular_zubbers/icons/customization/template_64x64.dmi b/modular_zubbers/icons/customization/template_64x64.dmi new file mode 100644 index 0000000000000000000000000000000000000000..0918e47a9a35bc136d90b98972e14cbdae0ce788 GIT binary patch literal 885 zcmeAS@N?(olHy`uVBq!ia0vp^2SAvE8Azrw%`pX19sxcfu0XoCyZitD|2J>mOiN2^ zXlQV7bTKoxl9raQsi_GJ3RP9r`t<43%$YNNeSM9Mjg=MEjSWqOgd~6()6>)4oZS@_ z)pT_Y3~xL*0u*8_3GxeOaCmkj4ak{W6%tY6l3JWxlvz-cnV-kNP%)?X!bYw`1_H-E zT2^*lcqg=Q$4(FFmkIY3XJi-MSoX9iqNci;)x7ie_jY;nn6-L$x5|f9zkVvL@lfb$ zq$#`Z(Y8M4zF=inhA)lZJ#r*Jt=V#IstBLvQ!6jSNplnL#~UyH%(8xw@iCFJViOjw zxOP&FZARCH$f`fZy@tOQDIc)VD`EfMeQlNWt@HEmXU|G|{z0`fpMinN$kW9!q+-t7 zn~DC-1_BL|Xp7Gx9(1-ll zhxXiRe|X=lwK7odkcM~WKKr(Z^~(*`&o+1!HOrX)#(!RzK876012zY21lT^qMGkCZ zIKzB~InjV0E|kN4z$U?lzvkTHsn6a?EzkS$!tb2tXD8|T&o`)?e{1tqx^6?=-4jcH z-;F3Qykx_?;N^Q)V}?hsFMqH6-RD}#=I~$EMOf`GL&y4ZyE`ItP0lm#_#6I7dQROu zhKXOV+>-yS)9~s%ZTdk*6l#@Ff&@*CI<_#>EK zFncw83OTfo-{$Ae3BOX#?c#Ug%V&3}0a+EpJ45!G9)JG-iOYe8ne)F;+WPJDSH^ej zXMQt$XTDb3@SE{jqbS1+ppnl$HwY!%XE$jG{lb{bd69h!!`GK4KsEjib_v`I_#^BY ze>K=PR34CWkPl$mA@8x`ui<%y2X#ObLT!HkJ;1;Ce0b^S_{eLZF!glxb6Mw<&;$UA C_G#Jx literal 0 HcmV?d00001 diff --git a/modular_zubbers/icons/customization/template_96x96.dmi b/modular_zubbers/icons/customization/template_96x96.dmi new file mode 100644 index 0000000000000000000000000000000000000000..8fc408d9aef4797aae83fa157a3ca91410da2877 GIT binary patch literal 1327 zcmeAS@N?(olHy`uVBq!ia0y~yU{nBM4rT@h2IbheO+d;cz$e5NNcVPk|NsC0=FOXF zX=x1&4GxYjX69DX((*MmHGx5)s;XL_K7E=wbEdDaud%VQvZA`Np{bCN1W;podb*pl zyP~3+uC9UMjR!}7LX0Ire!&b5&u*jvIrFMQB1&9Ri<65o3raHc^B5Q^=Ja0J$aTm- z;MhmY%B~CVgdADe#WR&<-&nI0`|{o162sS>pTFUOTH)`1A0D@@zPfa8+1{+Yxiw6x za~4~zKJ4ecana)mk4vT~G5k6Zt+I`$GA!z~7gzg~qPI&WPWWwjyME?{%BJv(lF40Z zye9%ePG<-+_qe{$vHiF6m_+SG!33GKUCqB;v#)+T`}}-wPwu*_3=GV#JzX3_ zD(1Ys6iJu}I`eh; zy|1euM=>z5a0n+a5G zPpv8sSjLX(xo3_b=sEw7%9-X%`@Z;TzV&`T<&qq#|7Ws;pla=>$p-vhzb{!Y-J-uY z*sB^fh*IQ0aLSjH{)cQdz@~tWV?+tX36&ria7o>s^Ya3*DPZHUIO^duNB`+t*WNA9 z|GLNe-^S{9yKenmRBF4Ir~Z=u?bF{19(10+&-ZE9@A3_Iv%`1qXS$H~KQOnC;qtui z^S}SJ4%iA5`FDPS+2OQ$mKon_%2%vgAN%&7mBaJ>SNYiA{NK$! zu=>ATK`GmePk;Wpe0@JJ*q(m@Tlx8w^Em_l?tXsdJhMg_UlzZJ4ZA6O*Zk%vrn5@y zrvKPZI$AFHV7cPyYPak4&kTz%l6Y~3Qv~P8tRp1MmD}SU_*n96g7G1EIAY<|^ zhHp~y6NS$UZZorAnd_+ig~N=rHjQADlfck zRC*4yWj%w4H88^NN@>*bWpSEx%Ut;Zbj{O-L(dmXTQ3#+f9CNsj^CP%Qte*|JFI=L zV3{G~!6#L%$9~eW2y95x^99cwfG!XCA(LXS!G7gKXfhkvzKmP{`u{5Y25NT8e)Z3P zoxPlT8Q&)PDU2XIsri#b?&Oj$GAVK;)eBBop0IhL&2aP_FnMif!yRxF{x0yj$^VNb z;I%c-5$uzikIg#`bOywb2bL==fx*WoV#j`y{}iKX&D9x>VEblm`=4xoq7JBe<1g+o Xi6h5mdS2uP7ElbHu6{1-oD!M {/* BUBBER EDIT ADDITION END: Preview Selection */} + {/* BUBBER EDIT ADDITION START: Background Selection */} + + + act('update_background', { + new_background: value, + }) + } + /> + + {/* BUBBER EDIT ADDITION END: Background Selection */} ; @@ -269,5 +270,6 @@ export type ServerData = { loadout_tabs: LoadoutCategory[]; }; species: Record; - [otherKey: string]: unknown; + background_state: { choices: string[] }; // BUBBER EDIT ADDITION + [otheyKey: string]: unknown; }; diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/useServerPrefs.ts b/tgui/packages/tgui/interfaces/PreferencesMenu/useServerPrefs.ts index 63731c55b37..c67f80973a6 100644 --- a/tgui/packages/tgui/interfaces/PreferencesMenu/useServerPrefs.ts +++ b/tgui/packages/tgui/interfaces/PreferencesMenu/useServerPrefs.ts @@ -23,8 +23,11 @@ export const ServerPrefs = createContext({ loadout_tabs: [], }, species: {}, + background_state: { + /* BUBBER EDIT ADDITION: Background Selection - LINES 26 - 29 */ + choices: [], + }, }); - export function useServerPrefs() { return useContext(ServerPrefs); }