Skip to content

Commit

Permalink
Starting on docks
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmaddock committed Oct 6, 2012
1 parent 09da70c commit ebe14ed
Show file tree
Hide file tree
Showing 11 changed files with 361 additions and 334 deletions.
4 changes: 4 additions & 0 deletions client/js/catan.js
Expand Up @@ -56,6 +56,10 @@ CATAN.getState = function() {
return this.state;
}

CATAN.getBoard = function() {
return this.board;
}

CATAN.getSchema = function() {
return this.Schemas.get("Classic"); // static for now
}
Expand Down
6 changes: 6 additions & 0 deletions client/js/controls.js
Expand Up @@ -149,6 +149,12 @@ THREE.CatanControls = function ( object, domElement ) {
* Math.cos( this.theta * Math.PI / 360 )
* Math.cos( this.phi * Math.PI / 360 );

/*if(CATAN.board) {
this.target = CATAN.board.getWorldHexOffset();
this.object.position.x += this.target.x;
this.object.position.z += this.target.z;
}*/

this.object.lookAt( this.target );
this.object.updateMatrix();

Expand Down
7 changes: 7 additions & 0 deletions client/js/main.js
Expand Up @@ -20,6 +20,13 @@ CATAN._init = function() {
this.socket.on( 'CServerList', this.Lobby.loadServerList );
}

// Request desktop notification permissions
document.addEventListener("mousedown", function(event) {
if(webkitNotifications.checkPermission() > 0) {
webkitNotifications.requestPermission();
}
}, false);

};

CATAN.createServer = function() {
Expand Down
16 changes: 14 additions & 2 deletions server/game.js
Expand Up @@ -559,9 +559,21 @@ CATAN.Game.prototype = {
}

// Send tiles
var docks = [];
for(var i in this.getBoard().getDocks()) {
var dock = this.getBoard().getDocks()[i];
docks.push({
id: dock.getEntId(),
dock: true,
dockTo: dock.dockTo.getEntId()
});
};
ply.emit('CBoardEntities', { ents: docks });

// Send docks
var tiles = [];
for(var i=0; i < board.hexTiles.length; i++) {
var tile = board.hexTiles[i];
for(var i=0; i < this.getBoard().getTiles().length; i++) {
var tile = this.getBoard().getTiles()[i];
tiles.push({
id: tile.getEntId(),
resource: tile.getResource(),
Expand Down

0 comments on commit ebe14ed

Please sign in to comment.