Open G-M-twostay opened 8 months ago
If you could make a PR with the changes and do some basic QA (make sure it doesn't break anything), it would be nice.
i will try to do some qa, but I haven't compiled baro before.
This will be addressed in the Services Refactor.
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