forked from tgstation/tgstation
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from MortoSasye/body-height-option
Adds height scaling
- Loading branch information
Showing
5 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// To speed up the preference menu, we apply 1 filter to the entire mob | ||
/mob/living/carbon/human/dummy/regenerate_icons() | ||
. = ..() | ||
apply_height_filters(src, TRUE) | ||
|
||
/mob/living/carbon/human/dummy/apply_height_filters(mutable_appearance/appearance, only_apply_in_prefs = FALSE) | ||
if(only_apply_in_prefs) | ||
return ..() | ||
|
||
// Not necessary with above | ||
/mob/living/carbon/human/dummy/apply_height_offsets(mutable_appearance/appearance, upper_torso) | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/datum/preference/choiced/height_scaling | ||
category = PREFERENCE_CATEGORY_SECONDARY_FEATURES | ||
savefile_key = "height_scaling" | ||
savefile_identifier = PREFERENCE_CHARACTER | ||
|
||
/// Assoc list of stringified HUMAN_HEIGHT_### defines to string. Passed into CHOICED_PREFERENCE_DISPLAY_NAMES. | ||
var/static/list/height_scaling_strings = list( | ||
"[HUMAN_HEIGHT_SHORT]" = "Short", | ||
"[HUMAN_HEIGHT_MEDIUM]" = "Medium", | ||
"[HUMAN_HEIGHT_TALL]" = "Tall", | ||
) | ||
|
||
/// List of strings, representing quirk ids that prevent this from applying and being accessed. | ||
var/static/list/incompatable_quirk_ids = list( | ||
"Spacer", | ||
"Settler" | ||
) | ||
|
||
/datum/preference/choiced/height_scaling/init_possible_values() | ||
// HUMAN_HEIGHT_SHORTEST and HUMAN_HEIGHT_TALLER are left out on maintainer request unless desired later | ||
// HUMAN_HEIGHT_TALLEST is disabled because it constantly artifacts | ||
return list(HUMAN_HEIGHT_SHORT, HUMAN_HEIGHT_MEDIUM, HUMAN_HEIGHT_TALL) | ||
|
||
/datum/preference/choiced/height_scaling/create_default_value() | ||
return HUMAN_HEIGHT_MEDIUM | ||
|
||
/datum/preference/choiced/height_scaling/is_accessible(datum/preferences/preferences) | ||
. = ..() | ||
|
||
if(!.) | ||
return | ||
|
||
// if (ispath(preferences?.pref_species, /datum/species/dwarf)) // all 3 of these manually set your height | ||
// return FALSE | ||
|
||
for (var/quirk_id as anything in preferences?.all_quirks) | ||
if (quirk_id in incompatable_quirk_ids) | ||
return FALSE | ||
|
||
return TRUE | ||
|
||
/datum/preference/choiced/height_scaling/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences) | ||
if (HAS_TRAIT(target, TRAIT_DWARF)) // nuh uh. your height is set mf | ||
return FALSE | ||
|
||
for (var/quirk_id as anything in preferences?.all_quirks) | ||
if (quirk_id in incompatable_quirk_ids) | ||
return FALSE | ||
|
||
// if (isteshari(target)) | ||
// value = (max(value, HUMAN_HEIGHT_MEDIUM)) // to respect junis tesh rework i am preventing them from getting shorter | ||
|
||
target.set_mob_height(value) | ||
|
||
/datum/preference/choiced/height_scaling/compile_constant_data() | ||
var/list/data = ..() | ||
|
||
// An assoc list of values to display names so we don't show players numbers in their settings! | ||
data[CHOICED_PREFERENCE_DISPLAY_NAMES] = height_scaling_strings | ||
|
||
return data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
## Title: Height scaling | ||
|
||
MODULE ID: HEIGHT_SCALING | ||
|
||
### Description: | ||
|
||
Allows people to change their characters height using tg's height framework | ||
|
||
### TG Proc Changes: | ||
|
||
- N/A | ||
|
||
### Defines: | ||
|
||
- N/A | ||
|
||
### Master file additions | ||
|
||
- N/A | ||
|
||
### Included files that are not contained in this module: | ||
|
||
- N/A | ||
|
||
### Credits: | ||
Niko - Original code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...terfaces/PreferencesMenu/preferences/features/dopplershift_preferences/height_scaling.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// THIS IS A DOPPLER SECTOR UI FILE | ||
import { FeatureChoiced } from '../base'; | ||
import { FeatureDropdownInput } from '../dropdowns'; | ||
|
||
export const height_scaling: FeatureChoiced = { | ||
name: 'Body Height', | ||
component: FeatureDropdownInput, | ||
}; |