Skip to content

Commit

Permalink
Merge pull request Monkestation#971 from Absolucy/heights
Browse files Browse the repository at this point in the history
Customizable character height!
  • Loading branch information
dwasint committed Jan 26, 2024
2 parents 51fab1a + b802677 commit 836f4b1
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 1 deletion.
3 changes: 2 additions & 1 deletion code/__DEFINES/DNA.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#define DNA_UNI_IDENTITY_BLOCKS 7

/// This number needs to equal the total number of DNA blocks
#define DNA_FEATURE_BLOCKS 16
#define DNA_FEATURE_BLOCKS 17 // monke - height block

#define DNA_MUTANT_COLOR_BLOCK 1
#define DNA_ETHEREAL_COLOR_BLOCK 2
Expand All @@ -58,6 +58,7 @@
#define DNA_MUSHROOM_CAPS_BLOCK 14
#define DNA_POD_HAIR_BLOCK 15
#define DNA_MUTANT_COLOR_SECONDARY 16
#define DNA_BODY_HEIGHT_BLOCK 17 // monke - height block

#define DNA_SEQUENCE_LENGTH 4
#define DNA_MUTATION_BLOCKS 8
Expand Down
8 changes: 8 additions & 0 deletions code/_globalvars/~monkestation/lists/flavor_misc.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// Body sizes. The names (keys) are what is actually stored in the database. Don't get crazy with changing them.
GLOBAL_LIST_INIT(body_heights, list(
"Shortest" = HUMAN_HEIGHT_SHORTEST,
"Short" = HUMAN_HEIGHT_SHORT,
"Normal" = HUMAN_HEIGHT_MEDIUM,
"Tall" = HUMAN_HEIGHT_TALL,
"Tallest" = HUMAN_HEIGHT_TALLEST
))
7 changes: 7 additions & 0 deletions code/datums/dna.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ GLOBAL_LIST_INIT(total_uf_len_by_block, populate_total_uf_len_by_block())
else
new_dna.species = new species.type
new_dna.real_name = real_name
new_dna.update_body_height() // monke edit: body height
// Mutations aren't gc managed, but they still aren't templates
// Let's do a proper copy
for(var/datum/mutation/human/mutation in mutations)
Expand Down Expand Up @@ -360,6 +361,10 @@ GLOBAL_LIST_INIT(total_uf_len_by_block, populate_total_uf_len_by_block())
set_uni_feature_block(blocknumber, construct_block(GLOB.caps_list.Find(features["caps"]), GLOB.caps_list.len))
if(DNA_POD_HAIR_BLOCK)
set_uni_feature_block(blocknumber, construct_block(GLOB.pod_hair_list.Find(features["pod_hair"]), GLOB.pod_hair_list.len))
// monke start: body height
if(DNA_BODY_HEIGHT_BLOCK)
set_uni_feature_block(blocknumber, construct_block(GLOB.body_heights.Find(features["body_height"]), GLOB.body_heights.len))
// monke end

//Please use add_mutation or activate_mutation instead
/datum/dna/proc/force_give(datum/mutation/human/HM)
Expand Down Expand Up @@ -634,6 +639,8 @@ GLOBAL_LIST_INIT(total_uf_len_by_block, populate_total_uf_len_by_block())
dna.features["caps"] = GLOB.caps_list[deconstruct_block(get_uni_feature_block(features, DNA_MUSHROOM_CAPS_BLOCK), GLOB.caps_list.len)]
if(dna.features["pod_hair"])
dna.features["pod_hair"] = GLOB.pod_hair_list[deconstruct_block(get_uni_feature_block(features, DNA_POD_HAIR_BLOCK), GLOB.pod_hair_list.len)]
if(dna.features["body_height"])
dna.features["body_height"] = GLOB.body_heights[deconstruct_block(get_uni_feature_block(features, DNA_BODY_HEIGHT_BLOCK), GLOB.body_heights.len)]

for(var/obj/item/organ/external/external_organ in organs)
external_organ.mutate_feature(features, src)
Expand Down
8 changes: 8 additions & 0 deletions monkestation/code/datums/dna.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/datum/dna/proc/update_body_height()
var/mob/living/carbon/human/human_holder = holder
if(!istype(holder) || !features["body_height"])
return
var/height = GLOB.body_heights[features["body_height"]]
if(isnull(height))
return
human_holder.set_mob_height(height)
13 changes: 13 additions & 0 deletions monkestation/code/modules/client/preferences/body.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/datum/preference/choiced/body_height
savefile_key = "body_height"
savefile_identifier = PREFERENCE_CHARACTER
category = PREFERENCE_CATEGORY_SECONDARY_FEATURES

/datum/preference/choiced/body_height/init_possible_values()
return assoc_to_keys(GLOB.body_heights)

/datum/preference/choiced/body_height/create_default_value()
return "Normal"

/datum/preference/choiced/body_height/apply_to_human(mob/living/carbon/human/target, value)
target.dna.features["body_height"] = value
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/mob/living/carbon/update_body(is_creating = FALSE)
. = ..()
dna?.update_body_height()
4 changes: 4 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@
#include "code\_globalvars\lists\typecache.dm"
#include "code\_globalvars\lists\wiremod.dm"
#include "code\_globalvars\lists\xenobiology.dm"
#include "code\_globalvars\~monkestation\lists\flavor_misc.dm"
#include "code\_globalvars\~monkestation\lists\mobs.dm"
#include "code\_js\byjax.dm"
#include "code\_js\menus.dm"
Expand Down Expand Up @@ -5626,6 +5627,7 @@
#include "monkestation\code\area\areas\station.dm"
#include "monkestation\code\controllers\subsystem\job.dm"
#include "monkestation\code\datums\action.dm"
#include "monkestation\code\datums\dna.dm"
#include "monkestation\code\datums\emotes.dm"
#include "monkestation\code\datums\interaction_particle.dm"
#include "monkestation\code\datums\meta_tokens.dm"
Expand Down Expand Up @@ -6047,6 +6049,7 @@
#include "monkestation\code\modules\client\preferences\admin.dm"
#include "monkestation\code\modules\client\preferences\anime_implant.dm"
#include "monkestation\code\modules\client\preferences\bloom.dm"
#include "monkestation\code\modules\client\preferences\body.dm"
#include "monkestation\code\modules\client\preferences\context_menu_requires_shift.dm"
#include "monkestation\code\modules\client\preferences\face_cursor_combat_mode.dm"
#include "monkestation\code\modules\client\preferences\interaction_mode.dm"
Expand Down Expand Up @@ -6304,6 +6307,7 @@
#include "monkestation\code\modules\mob\living\basic\vermin\mouse.dm"
#include "monkestation\code\modules\mob\living\carbon\carbon_defense.dm"
#include "monkestation\code\modules\mob\living\carbon\carbon_defines.dm"
#include "monkestation\code\modules\mob\living\carbon\carbon_update_icons.dm"
#include "monkestation\code\modules\mob\living\carbon\human\accessory_helpers.dm"
#include "monkestation\code\modules\mob\living\carbon\human\carbon.dm"
#include "monkestation\code\modules\mob\living\carbon\human\custom_bodytype.dm"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { FeatureChoiced, FeatureDropdownInput } from '../../base';

export const body_height: FeatureChoiced = {
name: 'Body Height',
component: FeatureDropdownInput,
};

0 comments on commit 836f4b1

Please sign in to comment.