Skip to content

Commit

Permalink
Merge pull request #118 from Nerev4r/numberonemostwantedprintheunited…
Browse files Browse the repository at this point in the history
…states

job/loadout/underwear/nakey pref.
  • Loading branch information
carpotoxin authored Oct 1, 2024
2 parents d4d3839 + d69891d commit 25c0dc6
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 3 deletions.
5 changes: 5 additions & 0 deletions code/__DEFINES/~doppler_defines/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@

#define PREFERENCE_CATEGORY_DOPPLER_LORE "doppler_lore"

#define PREVIEW_PREF_JOB "Job"
#define PREVIEW_PREF_LOADOUT "Loadout"
#define PREVIEW_PREF_UNDERWEAR "Underwear"
#define PREVIEW_PREF_NAKED "Naked"

#define READ_PREFS(target, pref) (target.client?.prefs?.read_preference(/datum/preference/pref))
9 changes: 9 additions & 0 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
data["character_profiles"] = create_character_profiles()
tainted_character_profiles = FALSE

data["preview_selection"] = preview_pref // DOPPLER EDIT ADDITION

data["character_preferences"] = compile_character_preferences(user)

data["active_slot"] = default_slot
Expand All @@ -178,6 +180,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
/datum/preferences/ui_static_data(mob/user)
var/list/data = list()

data["preview_options"] = list(PREVIEW_PREF_JOB, PREVIEW_PREF_LOADOUT, PREVIEW_PREF_UNDERWEAR, PREVIEW_PREF_NAKED)

data["character_profiles"] = create_character_profiles()

data["character_preview_view"] = character_preview_view.assigned_map
Expand Down Expand Up @@ -268,6 +272,11 @@ GLOBAL_LIST_EMPTY(preferences_datums)

return TRUE
/// DOPPLER SHIFT ADDITION BEGIN
if("update_preview")
preview_pref = params["updated_preview"]
character_preview_view.update_body()
return TRUE

if ("set_tricolor_preference")
var/requested_preference_key = params["preference"]
var/index_key = params["value"]
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/dead/new_player/preferences_setup.dm
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@

return preview_job

/* DOPPLER EDIT REMOVAL - MOVED TO MASTER FILES
/datum/preferences/proc/render_new_preview_appearance(mob/living/carbon/human/dummy/mannequin, show_job_clothes = TRUE)
var/datum/job/no_job = SSjob.get_job_type(/datum/job/unassigned)
var/datum/job/preview_job = get_highest_priority_job() || no_job
Expand Down Expand Up @@ -127,3 +128,4 @@
mannequin.add_quirk(quirk_type, parent)
return mannequin.appearance
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

/datum/preferences
/// Preference of how the preview should show the character.
var/preview_pref = PREVIEW_PREF_JOB
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/datum/preferences/proc/render_new_preview_appearance(mob/living/carbon/human/dummy/mannequin, show_job_clothes = TRUE)
var/datum/job/no_job = SSjob.get_job_type(/datum/job/unassigned)
var/datum/job/preview_job = get_highest_priority_job() || no_job

// Set up the dummy for its photoshoot
apply_prefs_to(mannequin, TRUE)

switch(preview_pref)
if(PREVIEW_PREF_JOB)
mannequin.underwear_visibility = NONE
// Silicons only need a very basic preview since there is no customization for them.
if (istype(preview_job, /datum/job/ai))
return image('icons/mob/silicon/ai.dmi', icon_state = resolve_ai_icon(read_preference(/datum/preference/choiced/ai_core_display)), dir = SOUTH)
if (istype(preview_job, /datum/job/cyborg))
return image('icons/mob/silicon/robots.dmi', icon_state = "robot", dir = SOUTH)

mannequin.job = preview_job.title
mannequin.dress_up_as_job(
equipping = show_job_clothes ? preview_job : no_job,
visual_only = TRUE,
player_client = parent,
consistent = TRUE,
)

if(PREVIEW_PREF_LOADOUT)
mannequin.underwear_visibility = NONE
var/default_outfit = new /datum/outfit()
mannequin.equip_outfit_and_loadout(default_outfit, src, TRUE)

if(PREVIEW_PREF_UNDERWEAR)
mannequin.underwear_visibility = NONE

if(PREVIEW_PREF_NAKED)
mannequin.underwear_visibility = UNDERWEAR_HIDE_UNDIES | UNDERWEAR_HIDE_SHIRT | UNDERWEAR_HIDE_SOCKS | UNDERWEAR_HIDE_BRA

// Apply visual quirks
// Yes we do it every time because it needs to be done after job gear
if(SSquirks?.initialized)
// And yes we need to clean all the quirk datums every time
mannequin.cleanse_quirk_datums()
for(var/quirk_name as anything in all_quirks)
var/datum/quirk/quirk_type = SSquirks.quirks[quirk_name]
if(!(initial(quirk_type.quirk_flags) & QUIRK_CHANGES_APPEARANCE))
continue
mannequin.add_quirk(quirk_type, parent)

mannequin.update_body()
return mannequin.appearance
2 changes: 2 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -6771,6 +6771,8 @@
#include "modular_doppler\modular_customization\preferences\fluff.dm"
#include "modular_doppler\modular_customization\preferences\frills.dm"
#include "modular_doppler\modular_customization\preferences\horns.dm"
#include "modular_doppler\modular_customization\preferences\preferences.dm"
#include "modular_doppler\modular_customization\preferences\preferences_setup.dm"
#include "modular_doppler\modular_customization\preferences\snout.dm"
#include "modular_doppler\modular_customization\preferences\species_traits.dm"
#include "modular_doppler\modular_customization\preferences\tail.dm"
Expand Down
20 changes: 17 additions & 3 deletions tgui/packages/tgui/interfaces/PreferencesMenu/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Autofocus,
Box,
Button,
Dropdown, // DOPPLER EDIT ADDITION
Flex,
Input,
LabeledList,
Expand All @@ -34,7 +35,7 @@ import { ServerPreferencesFetcher } from './ServerPreferencesFetcher';
import { useRandomToggleState } from './useRandomToggleState';

const CLOTHING_CELL_SIZE = 48;
const CLOTHING_SIDEBAR_ROWS = 9;
const CLOTHING_SIDEBAR_ROWS = 13.4; // NOVA EDIT CHANGE - ORIGINAL: 9

const CLOTHING_SELECTION_CELL_SIZE = 48;
const CLOTHING_SELECTION_WIDTH = 5.4;
Expand Down Expand Up @@ -578,13 +579,26 @@ export const MainPage = (props: { openSpecies: () => void }) => {
/>
</Stack.Item>

<Stack.Item grow>
<Stack.Item grow maxHeight="300px">
<CharacterPreview
height="100%"
id={data.character_preview_view}
/>
</Stack.Item>

{/* DOPPLER ADDITION START */}
<Stack.Item position="relative">
<Dropdown
width="100%"
selected={data.preview_selection}
options={data.preview_options}
onSelected={(value) =>
act('update_preview', {
updated_preview: value,
})
}
/>
</Stack.Item>
{/* DOPPLER ADDITION END */}
<Stack.Item position="relative">
<NameInput
name={data.character_preferences.names[data.name_to_use]}
Expand Down
3 changes: 3 additions & 0 deletions tgui/packages/tgui/interfaces/PreferencesMenu/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ export type PreferencesMenuData = {
character_preview_view: string;
character_profiles: (string | null)[];

preview_options: string[]; // DOPPLER EDIT ADDITION
preview_selection: string; // DOPPLER EDIT ADDITION

character_preferences: {
clothing: Record<string, string>;
features: Record<string, string>;
Expand Down

0 comments on commit 25c0dc6

Please sign in to comment.