Skip to content

Commit

Permalink
Move bullet rate validation to server to prevent cheating
Browse files Browse the repository at this point in the history
  • Loading branch information
halftheopposite committed Oct 23, 2019
1 parent 19a2515 commit 3b951fb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
4 changes: 0 additions & 4 deletions packages/client/src/managers/GameManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ export default class GameManager {

this.onActionSend({
type: 'move',
ts: Date.now(),
value: {
x: dir.x,
y: dir.y,
Expand Down Expand Up @@ -291,7 +290,6 @@ export default class GameManager {
this.me.rotation = rotation;
this.onActionSend({
type: 'rotate',
ts: Date.now(),
value: {
rotation,
},
Expand All @@ -303,7 +301,6 @@ export default class GameManager {
this.me.rotation = this.forcedRotation;
this.onActionSend({
type: 'rotate',
ts: Date.now(),
value: {
rotation: this.forcedRotation,
},
Expand Down Expand Up @@ -332,7 +329,6 @@ export default class GameManager {
);
this.onActionSend({
type: 'shoot',
ts: Date.now(),
value: {
angle: this.me.rotation,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type MapNameType = 'small' | 'long' | 'big';

export interface IAction {
playerId?: string;
ts: number;
ts?: number;
type: ActionType;
value: any;
}
Expand Down
1 change: 1 addition & 0 deletions packages/server/src/rooms/DMRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export class DMRoom extends Room<DMState> {
this.state.playerAddAction({
playerId,
...data,
ts: Date.now(),
});
break;
default:
Expand Down

0 comments on commit 3b951fb

Please sign in to comment.