-
Notifications
You must be signed in to change notification settings - Fork 87
Updates the character preview box #1013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
1f5ba81
9a123c2
43b79c0
54b6d96
97b0be9
b6ba96f
b98876d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -279,7 +279,9 @@ GLOBAL_LIST_EMPTY(preferences_datums) | |||||
| preview_pref = params["updated_preview"] | ||||||
| character_preview_view.update_body() | ||||||
| return TRUE | ||||||
|
|
||||||
| if("update_background") | ||||||
| update_preference(GLOB.preference_entries[/datum/preference/choiced/background_state], params["new_background"]) | ||||||
| return TRUE | ||||||
| if ("set_tricolor_preference") | ||||||
| var/requested_preference_key = params["preference"] | ||||||
| var/index_key = params["value"] | ||||||
|
|
@@ -391,12 +393,21 @@ GLOBAL_LIST_EMPTY(preferences_datums) | |||||
| var/datum/preferences/preferences | ||||||
| /// Whether we show current job clothes or nude/loadout only | ||||||
| var/show_job_clothes = TRUE | ||||||
| // DOPPLER SHIFT ADDITION START: Better character preview | ||||||
| var/image/canvas | ||||||
| var/last_canvas_size | ||||||
| var/last_canvas_state | ||||||
| // DOPPLER SHIFT ADDITION END | ||||||
|
|
||||||
| /atom/movable/screen/map_view/char_preview/Initialize(mapload, datum/preferences/preferences) | ||||||
| . = ..() | ||||||
| src.preferences = preferences | ||||||
|
|
||||||
| /atom/movable/screen/map_view/char_preview/Destroy() | ||||||
| // DOPPLER SHIFT ADDITION START | ||||||
| canvas?.cut_overlays() | ||||||
| canvas = null | ||||||
| // DOPPLER SHIFT ADDITION END | ||||||
| QDEL_NULL(body) | ||||||
| preferences?.character_preview_view = null | ||||||
| preferences = null | ||||||
|
|
@@ -411,6 +422,50 @@ GLOBAL_LIST_EMPTY(preferences_datums) | |||||
|
|
||||||
| appearance = preferences.render_new_preview_appearance(body, show_job_clothes) | ||||||
|
|
||||||
| // DOPPLER SHIFT ADDITION BEGIN: Better character preview | ||||||
| var/canvas_state = preferences.read_preference(/datum/preference/choiced/background_state) | ||||||
| var/canvas_size = 0 | ||||||
| if ((body.dna.features[FEATURE_TAUR] != /datum/sprite_accessory/taur/none::name)) | ||||||
|
desertmote marked this conversation as resolved.
|
||||||
| canvas_size = 1 | ||||||
| if (body.mob_height > 12) | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. define for the |
||||||
| canvas_size = 1 | ||||||
| if (("Oversized" in preferences.all_quirks)) | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. probably should At Least refer to the quirk's actual name ala |
||||||
| canvas_size = 2 | ||||||
| if(canvas_size == 0) | ||||||
| var/obj/item/organ/ears/ears = body.get_organ_slot(ORGAN_SLOT_EARS) | ||||||
| if(ears && ears?.bodypart_overlay?.sprite_datum?.zooms_out_character_preview) | ||||||
| canvas_size = 1 | ||||||
| LAZYNULL(ears) | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why are we using DopplerShift/code/__HELPERS/_lists.dm Lines 75 to 76 in 4ecf316
|
||||||
| var/obj/item/organ/tail/tail = body.get_organ_slot(ORGAN_SLOT_EXTERNAL_TAIL) | ||||||
| if(tail && tail?.bodypart_overlay?.sprite_datum?.zooms_out_character_preview) | ||||||
| canvas_size = 1 | ||||||
| LAZYNULL(tail) | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto on |
||||||
| var/obj/item/organ/horns/horns = body.get_organ_slot(ORGAN_SLOT_EXTERNAL_HORNS) | ||||||
| if(horns && horns?.bodypart_overlay?.sprite_datum?.zooms_out_character_preview) | ||||||
| canvas_size = 1 | ||||||
| LAZYNULL(horns) | ||||||
|
Comment on lines
+427
to
+446
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this may all be best handled as a separate
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto on |
||||||
| body.pixel_x = canvas_size * 16 | ||||||
|
|
||||||
| if (isnull(canvas) || last_canvas_size != canvas_size || last_canvas_state != canvas_state) | ||||||
| switch (canvas_size) | ||||||
| if (0) | ||||||
| canvas = image('modular_doppler/character_preview_background/icons/background_32x32.dmi', icon_state = canvas_state) | ||||||
| if (1) | ||||||
| canvas = image('modular_doppler/character_preview_background/icons/background_64x64.dmi', icon_state = canvas_state) | ||||||
| if (2) | ||||||
|
Comment on lines
+451
to
+455
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all these canvas size bits should probably be defines that clarify what they actually mean, like |
||||||
| canvas = image('modular_doppler/character_preview_background/icons/background_96x96.dmi', icon_state = canvas_state) | ||||||
|
|
||||||
| // Update the map view bounds when canvas size changes to properly display the scaled preview | ||||||
| set_position(1, 1) | ||||||
| last_canvas_size = canvas_size | ||||||
| last_canvas_state = canvas_state | ||||||
|
|
||||||
| canvas.cut_overlays() | ||||||
| canvas.add_overlay(body.appearance) | ||||||
|
|
||||||
| appearance = canvas.appearance | ||||||
| // DOPPLER SHIFT ADDITION END | ||||||
|
|
||||||
| /atom/movable/screen/map_view/char_preview/proc/create_body() | ||||||
| QDEL_NULL(body) | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /// 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( | ||
| "Black", | ||
| "Grey", | ||
| "White", | ||
| "Dark Tiles", | ||
| "Grey Tiles", | ||
| "White Tiles", | ||
| "Plating", | ||
| "Reinforced Floor", | ||
| "Grass", | ||
| "4CA", | ||
| )) | ||
|
|
||
| /datum/preference/choiced/background_state/create_default_value() | ||
| return GLOB.background_state_options["Grey"] | ||
|
|
||
| /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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,3 +10,4 @@ | |
| icon_state = "bigring_large" | ||
| dimension_x = 64 | ||
| center = TRUE | ||
| zooms_out_character_preview = TRUE | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -621,6 +621,19 @@ export function MainPage(props: MainPageProps) { | |
| }) | ||
| } | ||
| /> | ||
| </Stack.Item> | ||
| {/* DOPPLER ADDITION START */} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. already in a doppler edit a few lines up? |
||
| <Stack.Item position="relative"> | ||
| <Dropdown | ||
| width="100%" | ||
| selected={data.character_preferences.misc.background_state} | ||
| options={serverData?.background_state.choices || []} | ||
| onSelected={(value) => | ||
| act('update_background', { | ||
| new_background: value, | ||
| }) | ||
| } | ||
| /> | ||
| </Stack.Item> | ||
| {/* DOPPLER ADDITION END */} | ||
| <Stack.Item position="relative"> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ import { | |
| Tooltip, | ||
| } from 'tgui-core/components'; | ||
| import { createSearch } from 'tgui-core/string'; | ||
| import { CharacterPreview } from '../../common/CharacterPreview'; // DOPPLER EDIT ADDITION | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto, comment for why |
||
|
|
||
| import { | ||
| type PreferencesMenuData, | ||
|
|
@@ -95,6 +96,7 @@ function QuirkDisplay(props: QuirkDisplayProps) { | |
| const { icon, value, name, description, customizable, failTooltip } = quirk; | ||
|
|
||
| const [customizationExpanded, setCustomizationExpanded] = useState(false); | ||
| const { data } = useBackend<PreferencesMenuData>(); // DOPPLER EDIT ADDITION | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto, comment for why |
||
|
|
||
| const className = 'PreferencesMenu__Quirks__QuirkList__quirk'; | ||
|
|
||
|
|
@@ -455,7 +457,27 @@ function QuirkPage() { | |
| </Stack.Item> | ||
|
|
||
| <Stack.Item align="center"> | ||
| <Icon name="exchange-alt" size={1.5} ml={2} mr={2} /> | ||
| {/* <Icon name="exchange-alt" size={1.5} ml={2} mr={2} /> // DOPPLER EDIT REMOVAL - moved down */} | ||
| {/* DOPPLER EDIT ADDITION START */} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto, comment for why |
||
| <Stack vertical fill align="center"> | ||
| {/* Keep the CharacterPreview alive but "hidden", so that traits that affect appearance (e.g. Oversized) refresh rendering calculations immediately. */} | ||
| <Stack.Item | ||
| style={{ | ||
| padding: '-1px', | ||
| width: 1, | ||
| height: 1, | ||
| opacity: 0.0, | ||
| }} | ||
| > | ||
| <CharacterPreview | ||
| id={data.character_preview_view} | ||
| height="1px" | ||
| width="1px" | ||
| /> | ||
| </Stack.Item> | ||
| <Icon name="exchange-alt" size={1.5} ml={2} mr={2} /> | ||
| </Stack> | ||
| {/* DOPPLER EDIT ADDITION END */} | ||
| </Stack.Item> | ||
|
|
||
| <Stack.Item basis="50%"> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -343,6 +343,7 @@ function SpeciesPageInner(props: SpeciesPageInnerProps) { | |
| <CharacterPreview | ||
| id={data.character_preview_view} | ||
| height="100%" | ||
| width="179px" // DOPPLER SHIFT ADDITION | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto, comment for why width="179px" // DOPPLER EDIT ADDITION - comment for why |
||
| /> | ||
| </Stack.Item> | ||
| </Stack> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -299,7 +299,7 @@ function LoadoutPreviewSection() { | |
| > | ||
| <Stack vertical fill> | ||
| <Stack.Item grow align="center"> | ||
| <CharacterPreview height="100%" id={data.character_preview_view} /> | ||
| <CharacterPreview height="100%" width="240px" id={data.character_preview_view} /> {/* DOPPLER SHIFT CHANGE - ORIGINAL: <CharacterPreview height="100%" id={data.character_preview_view} /> */} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. <CharacterPreview height="100%" width="240px" id={data.character_preview_view} /> {/* DOPPLER EDIT CHANGE - ORIGINAL: <CharacterPreview height="100%" id={data.character_preview_view} /> */} |
||
| </Stack.Item> | ||
| <Stack.Divider /> | ||
| <Stack.Item align="center"> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import type { FeatureChoiced } from '../../base'; | ||
| import { FeatureDropdownInput } from '../../dropdowns'; | ||
|
|
||
| export const bgstate: FeatureChoiced = { | ||
| name: 'Character Preview Background', | ||
| description: | ||
| 'What would you like the background for the character preview in the character creator to be?', | ||
| component: FeatureDropdownInput, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -193,6 +193,7 @@ export type PreferencesMenuData = { | |
| species: string; | ||
| loadout_list: LoadoutList; | ||
| job_clothes: BooleanLike; | ||
| background_state: string; // DOPPLER SHIFT ADDITION: Swappable character editor backgrounds | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. background_state: string; // DOPPLER EDIT ADDITION - Swappable character editor backgrounds |
||
| }; | ||
|
|
||
| randomization: Record<string, RandomSetting>; | ||
|
|
@@ -270,5 +271,6 @@ export type ServerData = { | |
| loadout_tabs: LoadoutCategory[]; | ||
| }; | ||
| species: Record<string, Species>; | ||
| background_state: { choices: string[] }; // DOPPLER SHIFT ADDITION | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto, comment for why background_state: { choices: string[] }; // DOPPLER EDIT ADDITION - comment for why |
||
| [otherKey: string]: unknown; | ||
| }; | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,6 +27,11 @@ export const ServerPrefs = createContext<ServerData | undefined>({ | |||||||||||||||||||||
| loadout_tabs: [], | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| species: {}, | ||||||||||||||||||||||
| // DOPPLER SHIFT ADDITION START - Background Selection | ||||||||||||||||||||||
| background_state: { | ||||||||||||||||||||||
| choices: [], | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| // DOPPLER SHIFT ADDITION END | ||||||||||||||||||||||
|
Comment on lines
+30
to
+34
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
| }); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| export function useServerPrefs() { | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,16 @@ | ||
| import { ByondUi } from 'tgui-core/components'; | ||
|
|
||
| export const CharacterPreview = (props: { height: string; id: string }) => { | ||
| export const CharacterPreview = (props: { | ||
| width?: string; // DOPPLER SHIFT EDIT | ||
| height: string; | ||
| id: string; | ||
| }) => { | ||
|
Comment on lines
-3
to
+7
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. turning this from a single line to a multiline sounds like it's gonna be awkward when pulling parity changes to this file or the other way around, for that matter |
||
| // DOPPLER SHIFT ADDITION START | ||
| const { width = '300px' } = props; | ||
| // DOPPLER SHIFT ADDITION END | ||
|
Comment on lines
+8
to
+10
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. // DOPPLER EDIT ADDITION START - why we make this change
const { width = '300px' } = props;
// DOPPLER EDIT ADDITION ENDalternatively: single line edit, cause it's a single line const { width = '300px' } = props; // DOPPLER EDIT ADDITION START - why we make this change |
||
| return ( | ||
| <ByondUi | ||
| width="220px" | ||
| width={width} // DOPPLER SHIFT EDIT | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. width={width} // DOPPLER EDIT ADDITION - why we make this change - Original: width="220px" |
||
| height={props.height} | ||
| params={{ | ||
| id: props.id, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should have /// autodocs