File tree 2 files changed +21
-2
lines changed
src/mercury_engine_data_structures/formats
2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -569,10 +569,21 @@ def raw(self) -> Container:
569
569
return self ._raw
570
570
571
571
def get_component_type (self ) -> str :
572
+ return find_charclass_for_type (self .type )
573
+
574
+ @property
575
+ def type (self ) -> str :
576
+ if self .target_game == Game .SAMUS_RETURNS :
577
+ raise AttributeError (name = "type" , obj = self )
578
+ if self .target_game == Game .DREAD :
579
+ return self .raw .type
580
+
581
+ @type .setter
582
+ def type (self , value : str ):
572
583
if self .target_game == Game .SAMUS_RETURNS :
573
- raise AttributeError (name = "_get_component_type " , obj = self )
584
+ raise AttributeError (name = "type " , obj = self )
574
585
if self .target_game == Game .DREAD :
575
- return find_charclass_for_type ( self .raw .type )
586
+ self .raw .type = value
576
587
577
588
def get_component_type_class (self ) -> type_lib .StructType :
578
589
return get_type_lib_for_game (self .target_game ).get_type (self .get_component_type ())
Original file line number Diff line number Diff line change @@ -114,6 +114,14 @@ def test_api_dread_charclass(dread_file_tree: FileTreeEditor):
114
114
115
115
navmesh = bmsad .components ["NAVMESHITEM" ]
116
116
117
+ # type
118
+ assert navmesh .type == "CNavMeshItemComponent"
119
+ assert navmesh .get_component_type () == "CCharClassNavMeshItemComponent"
120
+ navmesh .type = "CPowerBombBlockLifeComponent"
121
+ assert navmesh .type == "CPowerBombBlockLifeComponent"
122
+ assert navmesh .get_component_type () == "CCharClassLifeComponent"
123
+ navmesh .type = "CNavMeshItemComponent"
124
+
117
125
# extra_fields
118
126
assert navmesh .fields .sInitialStage == "closed"
119
127
navmesh .fields .sInitialStage = "opened"
You can’t perform that action at this time.
0 commit comments