Skip to content
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

Adds height scaling #134

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions modular_doppler/height_scaling/code/icons.dm
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
61 changes: 61 additions & 0 deletions modular_doppler/height_scaling/code/preferences.dm
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
26 changes: 26 additions & 0 deletions modular_doppler/height_scaling/readme.md
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
2 changes: 2 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -6611,6 +6611,8 @@
#include "modular_doppler\hearthkin\tribal_extended\code\weapons\bow.dm"
#include "modular_doppler\hearthkin\tribal_extended\code\weapons\shield.dm"
#include "modular_doppler\hearthkin\tribal_extended\code\weapons\sword.dm"
#include "modular_doppler\height_scaling\code\icons.dm"
#include "modular_doppler\height_scaling\code\preferences.dm"
#include "modular_doppler\icspawn\cconsultant_items.dm"
#include "modular_doppler\icspawn\observer_spawn.dm"
#include "modular_doppler\icspawn\spell.dm"
Expand Down
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,
};
Loading