Skip to content

Commit

Permalink
MORPHIC Sizing (#76560)
Browse files Browse the repository at this point in the history
Update flag.cpp

Flag fix

Fixed
  • Loading branch information
Maleclypse authored Sep 21, 2024
1 parent 1a9f5ac commit 0376347
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
5 changes: 5 additions & 0 deletions data/json/flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,11 @@
"type": "json_flag",
"info": "This is <info>integrated into the body</info>."
},
{
"id": "MORPHIC",
"type": "json_flag",
"info": "This is <info>naturally sized to the body</info>."
},
{
"id": "IR_EFFECT",
"type": "json_flag"
Expand Down
12 changes: 6 additions & 6 deletions data/mods/Xedra_Evolved/items/armor/armor.json
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@
"material_thickness": 1.4,
"environmental_protection": 2,
"techniques": [ "WBLOCK_1" ],
"flags": [ "VARSIZE", "WATERPROOF", "STURDY", "PADDED" ]
"flags": [ "WATERPROOF", "STURDY", "PADDED", "MORPHIC" ]
},
{
"id": "dreamforged_helmet",
Expand All @@ -887,7 +887,7 @@
"warmth": 10,
"material_thickness": 1.4,
"techniques": [ "WBLOCK_1" ],
"flags": [ "VARSIZE", "WATERPROOF", "STURDY", "PADDED" ],
"flags": [ "MORPHIC", "WATERPROOF", "STURDY", "PADDED" ],
"armor": [ { "encumbrance_modifiers": [ "NONE" ], "coverage": 85, "covers": [ "head" ] } ]
},
{
Expand All @@ -907,7 +907,7 @@
"longest_side": "60 cm",
"material_thickness": 2,
"use_action": [ { "type": "attach_molle", "size": 4 }, { "type": "detach_molle" } ],
"flags": [ "OUTER", "STURDY", "ONLY_ONE", "BLOCK_WHILE_WORN", "PADDED" ],
"flags": [ "OUTER", "STURDY", "ONLY_ONE", "BLOCK_WHILE_WORN", "PADDED", "MORPHIC" ],
"armor": [
{
"material": [ { "type": "forged_dreamstuff", "covered_by_mat": 100, "thickness": 2 } ],
Expand Down Expand Up @@ -944,7 +944,7 @@
"color": "dark_gray",
"warmth": 10,
"material_thickness": 1.2,
"flags": [ "VARSIZE", "OUTER", "STURDY", "BLOCK_WHILE_WORN", "PADDED" ],
"flags": [ "MORPHIC", "OUTER", "STURDY", "BLOCK_WHILE_WORN", "PADDED" ],
"armor": [
{
"covers": [ "arm_l", "arm_r" ],
Expand Down Expand Up @@ -972,7 +972,7 @@
"warmth": 10,
"material_thickness": 1.5,
"environmental_protection": 1,
"flags": [ "VARSIZE", "WATERPROOF", "STURDY", "PADDED" ],
"flags": [ "MORPHIC", "WATERPROOF", "STURDY", "PADDED" ],
"armor": [
{
"covers": [ "foot_l", "foot_r" ],
Expand Down Expand Up @@ -1065,7 +1065,7 @@
"warmth": 5,
"material_thickness": 0.7,
"techniques": [ "WBLOCK_1" ],
"flags": [ "VARSIZE", "WATERPROOF", "STURDY", "PADDED" ]
"flags": [ "MORPHIC", "WATERPROOF", "STURDY", "PADDED" ]
},
{
"id": "dreamforged_armguard_plate_gunslinger",
Expand Down
2 changes: 1 addition & 1 deletion src/character_attire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ ret_val<void> Character::can_wear( const item &it, bool with_equip_change ) cons
}

if( !it.has_flag( flag_OVERSIZE ) && !it.has_flag( flag_INTEGRATED ) &&
!it.has_flag( flag_SEMITANGIBLE ) &&
!it.has_flag( flag_SEMITANGIBLE ) && !it.has_flag( flag_MORPHIC ) &&
!it.has_flag( flag_UNRESTRICTED ) ) {
for( const trait_id &mut : get_mutations() ) {
const mutation_branch &branch = mut.obj();
Expand Down
1 change: 1 addition & 0 deletions src/flag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ const flag_id flag_MELTS( "MELTS" );
const flag_id flag_MESSY( "MESSY" );
const flag_id flag_MISSION_ITEM( "MISSION_ITEM" );
const flag_id flag_MODULE_HOLDER( "MODULE_HOLDER" );
const flag_id flag_MORPHIC( "MORPHIC" );
const flag_id flag_MOUNTED_GUN( "MOUNTED_GUN" );
const flag_id flag_MOUSE( "MOUSE" );
const flag_id flag_MUNDANE( "MUNDANE" );
Expand Down
1 change: 1 addition & 0 deletions src/flag.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ extern const flag_id flag_MELTS;
extern const flag_id flag_MESSY;
extern const flag_id flag_MISSION_ITEM;
extern const flag_id flag_MODULE_HOLDER;
extern const flag_id flag_MORPHIC;
extern const flag_id flag_MOUNTED_GUN;
extern const flag_id flag_MOUSE;
extern const flag_id flag_MUNDANE;
Expand Down
10 changes: 10 additions & 0 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2061,6 +2061,16 @@ item::sizing item::get_sizing( const Character &p ) const
}
}

if( has_flag( flag_MORPHIC ) ) {
if( big ) {
return sizing::big_sized_big_char;
} else if( small ) {
return sizing::small_sized_small_char;
} else {
return sizing::human_sized_human_char;
}
}

// due to the iterative nature of these features, something can fit and be undersized/oversized
// but that is fine because we have separate logic to adjust encumbrance per each. One day we
// may want to have fit be a flag that only applies if a piece of clothing is sized for you as there
Expand Down

0 comments on commit 0376347

Please sign in to comment.