-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed airdrop glitch #341
Fixed airdrop glitch #341
Conversation
Now when an airdrop has landed it will check if its colliding with other airdrops and move.
The airdrop now checks if its colliding with any other airdrops and fixes its position.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix these issues
server/src/objects/parachute.ts
Outdated
@@ -70,6 +72,25 @@ export class Parachute extends BaseGameObject<ObjectCategory.Parachute> { | |||
amount: Infinity, | |||
source: crate | |||
}); | |||
if (object.definition.idString == "airdrop_crate_locked" && object != crate){ | |||
var xDif = crate.position.x - object.position.x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use var
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead, use const
server/src/objects/parachute.ts
Outdated
@@ -70,6 +72,25 @@ export class Parachute extends BaseGameObject<ObjectCategory.Parachute> { | |||
amount: Infinity, | |||
source: crate | |||
}); | |||
if (object.definition.idString == "airdrop_crate_locked" && object != crate){ | |||
var xDif = crate.position.x - object.position.x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need xDif and yDif as we have a vector subtraction function
server/src/objects/parachute.ts
Outdated
@@ -70,6 +72,25 @@ export class Parachute extends BaseGameObject<ObjectCategory.Parachute> { | |||
amount: Infinity, | |||
source: crate | |||
}); | |||
if (object.definition.idString == "airdrop_crate_locked" && object != crate){ | |||
var xDif = crate.position.x - object.position.x | |||
if (xDif <= 0){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please run pnpm lint
to fix inconsistent spacing
server/src/objects/parachute.ts
Outdated
@@ -70,6 +72,25 @@ export class Parachute extends BaseGameObject<ObjectCategory.Parachute> { | |||
amount: Infinity, | |||
source: crate | |||
}); | |||
if (object.definition.idString == "airdrop_crate_locked" && object != crate){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checking for idStrings is bad but this may be the only option so add a comment saying it is a hack
server/src/objects/parachute.ts
Outdated
} | ||
var position = Vec.create(xDif, yDif); | ||
crate.hitbox = object.hitbox.transform(position); | ||
crate.position = crate.hitbox.getCenter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inconsistent semicolons, run pnpm lint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linted, added comments. Does a small fix and works for me
Added |
The airdrops don't overlap anymore.