apetavern / grubs

A worms-inspired artillery game for s&box with randomly generated levels.
MIT License
34 stars 7 forks source link

Concrete Garry Weapon + TargetPreview Refactor #263

Closed DrewBritt closed 1 year ago

DrewBritt commented 1 year ago

This PR adds the Concrete Garry weapon, which is a giant statue that falls from the sky and continuously explodes and bounces on contact.

To accomplish this, the weapon spawns a projectile with an AnvilPhysicsGadgetComponent, responsible for gravity and bouncing, and an ExplosiveGadgetComponent, which has been adjusted to allow explosions without outright killing the source of the explosion.

As the weapon uses the same preview as the Homing Missile, said preview has now been refactored into a TargetPreview entity, which when simulated, will display a preview that follows the Owner's MousePosition.

I also had to adjust how GadgetComponents were simulated, sorting them by a SortOrder priority set on each component to determine which ones were simulated first. This was due to a race condition between AnvilPhysics and ExplosiveGadget collision checks, where sometimes one would simulate before the other, leading to incorrect collision behavior.

ShadowBrian commented 1 year ago

https://github.com/apetavern/sbox-grubs/assets/11138884/740babb2-e07d-490e-a00e-96d9bf99d3d3

It can spawn inside the terrain, should always spawn as high as possible to prevent. Needs more explosions so it can actually make a decent dent in the terrain (usually going entirely through)

ShadowBrian commented 1 year ago

Also definitely need to test the cluster grenade before merging- it was treating all the shards like concrete garry with infinite explosions for some reason...

DrewBritt commented 1 year ago

I've fixed everything mentioned so far. Concrete Garry can be tweaked further if we like, but now it bounces 19 times (20 collisions) before deleting, which is enough to go through the tower on HighTower according to my testing.

DrewBritt commented 1 year ago

Couple of changes: