Skip to content

Commit

Permalink
Fix neutral bombs crashing the game under certain circumstances.
Browse files Browse the repository at this point in the history
  • Loading branch information
BonsaiDen committed Oct 30, 2010
1 parent c85dae4 commit 417ebfc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions server/shooter/actors.js
Expand Up @@ -411,17 +411,17 @@ ActorBomb.onCreate = function(data) {
this.killedPlayers = [];

if (this.player) {
this.color = this.player.cid;
this.cid = this.player.cid;
this.player.client.shots++;
this.$$.launchAt(this, 4, this.r, 6, 9);
this.x = this.player.x + Math.sin(this.$$.wrapAngle(this.r)) * data.d;
this.y = this.player.y + Math.cos(this.$$.wrapAngle(this.r)) * data.d;

} else {
this.color = 0;
this.cid = 0;
this.x = data.obj.x;
this.y = data.obj.y;
}
}
};

ActorBomb.onUpdate = function() {
Expand All @@ -435,7 +435,7 @@ ActorBomb.onUpdate = function() {

ActorBomb.finishExplosion = function() {
if (this.killedPlayers.length === 1 && this.fired) {
if (this.killedPlayers[0] === this.player.cid) {
if (this.killedPlayers[0] === this.cid) {
this.$$.achievement(this.player, 'awesome');
}

Expand All @@ -456,7 +456,7 @@ ActorBomb.finishExplosion = function() {

ActorBomb.checkPlayerCollision = function(p) {
if (this.timeDiff(this.time) > 3750
&& p.cid !== this.player.cid) {
&& p.cid !== this.cid) {

this.$$.achievement(this.player, 'sharp');
}
Expand All @@ -467,7 +467,7 @@ ActorBomb.onDestroy = function() {
};

ActorBomb.onMessage = function(once) {
return once ? [this.color, this.range] : [];
return once ? [this.cid, this.range] : [];
};


Expand Down
2 changes: 1 addition & 1 deletion server/shooter/client.js
Expand Up @@ -329,7 +329,7 @@ Client.killByBomb = function(b) {
b.player.client.addScore(-5);
b.player.client.selfDestructs++;
}
this.killedBy = [this.getTime(), b.player.cid];
this.killedBy = [this.getTime(), b.cid];
this.kill();
}
};
Expand Down

0 comments on commit 417ebfc

Please sign in to comment.