Open sprunk opened 1 year ago
Does it even need the additional args? Can't everything be read from the weapon def?
The args are entirely optional but are there in case you want to modify the explosion. It's still superior to SpawnExplosion
because you don't need to apply the ones you don't modify.
User story
I am a newbie modder who wants to spawn an explosion of an existing weapon, that's it.
Deficiencies of existing interfaces
Spring.SpawnExplosion
exists but it has a bad interface for this. It defaults to 0 aoe and 0 damage and 0 edgeeffectiveness and 0 literally everything. It doesn't require to pass a weaponDefID (so you can get weird ghost explosions with no FX), but even if you do pass one, it still doesn't affect the default damage/aoe/ee/etc so you need to replicate them manually. The flat (non-table) version also has the weaponDefID as far as the 16th parameter, being considered less important than such things asgfxMod
andimpactOnly
. Using this function is tedious and error-prone.Spring.CreateProjectile
combined with eitherttl=0
orSpring.DestroyProjectile
seems to spawn an explosion with the correct damage etc but actually does more than that; it triggersgadget:ProjectileCreated/Destroyed
which may make assumptions and have side effects.Proposal
Add
Spring.SpawnWeaponExplosion(weaponDefID, x, y, z, rest of args)
. TheweaponDefID
is mandatory and affects the default damage/aoe/ee/etc. The rest of args are in a similar format asSpawnExplosion
(ie. table or flat) but the flat version has them in a more sensible order (which is a vague term and may be discussed).