Skip to content

Commit

Permalink
Make the players unkillable by their own bullets
Browse files Browse the repository at this point in the history
Tracked by #57

Bump version to 0.1.2
  • Loading branch information
nabijaczleweli committed Apr 23, 2016
1 parent 1df4b65 commit ed89b5a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/src/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Game {
return; // if the bullet just went OOB, no point checking for player hits... right?
}
this.game.state.alivePlayers.forEach((player: Entity): void => {
if (this.bulletHitPlayer(bullet, player)) {
if (this.game.bullet_ownership[bullet.id] != player.id && this.bulletHitPlayer(bullet, player)) {
destroyedBullets.push(bullet.id);
killedPlayers.push(player.id);
}
Expand Down
2 changes: 1 addition & 1 deletion server/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repository = "https://github.com/LoungeCPP/Tatsoryk/tree/master/server"
readme = "README.md"
keywords = ["game", "lounge", "server"]
license = "MIT"
version = "0.1.1"
version = "0.1.2"
# Remember to also modify options.rs authors
authors = ["nabijaczleweli <[email protected]>",
"Cat Plus Plus <[email protected]>",
Expand Down
3 changes: 2 additions & 1 deletion server/src/server/gamestate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ impl GameState {
// Check for collisions
for (_, bullet) in &self.bullets {
for (_, player) in &self.players {
if distance_between(bullet.bullet.x, bullet.bullet.y, player.x, player.y) <
if bullet.owner_id != player.id &&
distance_between(bullet.bullet.x, bullet.bullet.y, player.x, player.y) <
BULLET_RADIUS + PLAYER_RADIUS {
destroyed_bullets.push(bullet.bullet.id);
destroyed_players.push((player.id, bullet.bullet.id));
Expand Down

0 comments on commit ed89b5a

Please sign in to comment.