Open reaperrr opened 7 years ago
introducing an
AlwaysUseWeapon
boolean that does just what it implies
IMO an even better solution would be to have Armament
grant a ReloadingCondition
that mods can use to switch between different Explodes
, and then remove EmptyWeapon
completely.
I like that, it opens a possibility to fix the V2 issue as well by using the empty artwork when that ReloadingCondition is enabled and dropping the "aim" artwork altogether. (We could go RA2 way with it and creating a delayed launch if that turns out visually not good enough.)
I'm just not sure how to replicate the "LoadedChance" behavior then (probability X that large explosion will be used instead of small explo).
I see two obvious possibilities for this:
AlternativeWeapon
/ AlternativeChance
fields that are decoupled from reloading.GrantConditionWithProbability
trait that has a % chance of granting a condition when the unit is built. The random option is chosen when the unit is built rather than when it is killed, but that won't change anything in practice. This trait could then be used for other interesting things like picking a random artwork variant for the actor.Artwork won't work with that, because artwork variants require adjusting for turret/weapon offsets and whatnot.
There's no reason why they couldn't be adjusted using conditions.
Explodes' current setup is rather unintuitive:
Weapon
has FieldLoader.Require, but still an internal (useless) default #13342LoadedChance
andChance
are hard to tell apart, unless you look at the code. They should be renamed toWeaponProbability
(because it's the probability thatWeapon
will be used instead ofEmptyWeapon
) andExplosionProbability
(becauseChance
defines the probability the actor will explode at all) or something along those lines, respectively.EmptyWeapon
is currently required to matchWeapon
if you want the actor to explode the same way all the time (i.e. regardless of whether the actor currently has ammo/payload or not). As this is the most common case (in our official mods and likely most external ones, too), we could save a bunch of yaml lines and make the trait a bit more intuitive by introducing anAlwaysUseWeapon
boolean that does just what it implies, completely ignoringEmptyWeapon
and payload state. This would allow us to set it totrue
on actor defaults and then only set it to false in special cases like harvesters, artillery, Grenadiers etc.