fix(Predator): add bulletSpawnDistance for concentric bullet spawn#195
Open
sandbushman wants to merge 1 commit into
Open
fix(Predator): add bulletSpawnDistance for concentric bullet spawn#195sandbushman wants to merge 1 commit into
sandbushman wants to merge 1 commit into
Conversation
Predator's 3 barrels have different visual sizes (110, 95, 80) which was causing their bullets to spawn at different distances from tank center — small bullet ahead, big bullet behind. In diep.io all 3 spawn concentrically. Added optional bulletSpawnDistance field to BarrelDefinition. When set, it overrides barrel visual size for bullet spawn distance calculation. Set to 110 on all 3 Predator barrels for concentric spawn. Also fixed: barrel.distance in Bullet.ts was not scaled by scaleFactor, inconsistent with Barrel.ts where it is. Signed-off-by: linuxdev
Collaborator
|
This is probably not the right way to do this - Bullet spawn logic needs to be reworked eventually |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Problem: Predator's 3 barrels have different visual sizes (110, 95, 80), and bullet spawn position was computed from
barrel.physicsData.values.size. This caused the small bullet to spawn ahead of the mid bullet, which spawned ahead of the big bullet — all at different distances from tank center. In diep.io all 3 spawn concentrically.Fix: Added optional
bulletSpawnDistancefield toBarrelDefinition. When set, it overrides the barrel's visualsizefor bullet spawn distance calculation. Set to110on all 3 Predator barrels so they all spawn at the same radius.Bonus fix: The
barrel.distancefield inBullet.tswas not being multiplied byscaleFactor, inconsistent withBarrel.ts. Fixed.Files changed
src/Const/TankDefinitions.tsbulletSpawnDistance?: numbertoBarrelDefinitioninterfacesrc/Entity/Tank/Projectile/Bullet.ts(bulletSpawnDistance ?? size) * scaleFactorfor spawn position + fixdistancescalingsrc/Const/TankDefinitions.jsonbulletSpawnDistance: 110to all 3 Predator barrelsNo regression risk:
bulletSpawnDistanceis optional — defaults tosizefor all other tanks.