You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the issue tracker to check if the issue has already been reported.
My issue happened while using mods.
What happened?
In the current implementation it uses conditionType = Type.GetType("Barotrauma.Abilities." + type + "", false, true); to find the type of AbilityCondition. However, this is very hard coded and makes extending AbilityConditions, for example adding own new types of AbilityConditions, extremely hard. This is also not consistent with other places like AfflictionPrefab and ItemComponent, where both uses ReflectionUtils.GetDerivedNonAbstract. You may search "GetDerivedNonAbstract" to verify its usages. Given that lua for baro modifies this method to also include modded assemblies with the purposes of making the game more extendable, AbilityCondition should also be constructed using this method.
Therefore the change I propose to change the hard coded Type.GetType line to ReflectionUtils.GetDerivedNonAbstract<AbilityCondition>().First() (or smth like this). This should not change XML behaviors as all vanilla AbilityConditions are subclasses of AbilityCondition with the benefit of making creating new ones way more easier.
Reproduction steps
Problem described above.
Bug prevalence
Just once
Single player or multiplayer?
Single player
-
No response
Version
v1.2.8.0 (Winter Update hotfix 2)
-
No response
Which operating system did you encounter this bug on?
Windows
Relevant error messages and crash reports
No response
The text was updated successfully, but these errors were encountered:
Disclaimers
What happened?
In the current implementation it uses
conditionType = Type.GetType("Barotrauma.Abilities." + type + "", false, true);
to find the type of AbilityCondition. However, this is very hard coded and makes extending AbilityConditions, for example adding own new types of AbilityConditions, extremely hard. This is also not consistent with other places like AfflictionPrefab and ItemComponent, where both usesReflectionUtils.GetDerivedNonAbstract
. You may search "GetDerivedNonAbstract" to verify its usages. Given that lua for baro modifies this method to also include modded assemblies with the purposes of making the game more extendable, AbilityCondition should also be constructed using this method.Therefore the change I propose to change the hard coded
Type.GetType
line toReflectionUtils.GetDerivedNonAbstract<AbilityCondition>().First()
(or smth like this). This should not change XML behaviors as all vanilla AbilityConditions are subclasses ofAbilityCondition
with the benefit of making creating new ones way more easier.Reproduction steps
Problem described above.
Bug prevalence
Just once
Single player or multiplayer?
Single player
-
No response
Version
v1.2.8.0 (Winter Update hotfix 2)
-
No response
Which operating system did you encounter this bug on?
Windows
Relevant error messages and crash reports
No response
The text was updated successfully, but these errors were encountered: