Skip to content

Commit

Permalink
Merge pull request doublespeakgames#230 from anubisthejackle/issue229
Browse files Browse the repository at this point in the history
Fix negative gatherers
  • Loading branch information
groteworld committed Feb 12, 2015
2 parents 7c978f4 + 7333d03 commit 5fcd897
Show file tree
Hide file tree
Showing 10 changed files with 6,063 additions and 6,063 deletions.
1,480 changes: 740 additions & 740 deletions script/engine.js

Large diffs are not rendered by default.

1,700 changes: 850 additions & 850 deletions script/events.js

Large diffs are not rendered by default.

564 changes: 282 additions & 282 deletions script/events/outside.js

Large diffs are not rendered by default.

1,206 changes: 603 additions & 603 deletions script/events/room.js

Large diffs are not rendered by default.

156 changes: 78 additions & 78 deletions script/notifications.js
Original file line number Diff line number Diff line change
@@ -1,78 +1,78 @@
/**
* Module that registers the notification box and handles messages
*/
var Notifications = {

init: function(options) {
this.options = $.extend(
this.options,
options
);

// Create the notifications box
elem = $('<div>').attr({
id: 'notifications',
className: 'notifications'
});
// Create the transparency gradient
$('<div>').attr('id', 'notifyGradient').appendTo(elem);

elem.appendTo('div#wrapper');
},

options: {}, // Nothing for now

elem: null,

notifyQueue: {},

// Allow notification to the player
notify: function(module, text, noQueue) {
if(typeof text == 'undefined') return;
if(text.slice(-1) != ".") text += ".";
if(module != null && Engine.activeModule != module) {
if(!noQueue) {
if(typeof this.notifyQueue[module] == 'undefined') {
this.notifyQueue[module] = [];
}
this.notifyQueue[module].push(text);
}
} else {
Notifications.printMessage(text);
}
Engine.saveGame();
},

clearHidden: function() {

// To fix some memory usage issues, we clear notifications that have been hidden.

// We use position().top here, because we know that the parent will be the same, so the position will be the same.
var bottom = $('#notifyGradient').position().top + $('#notifyGradient').outerHeight(true);

$('.notification').each(function() {

if($(this).position().top > bottom){
$(this).remove();
}

});

},

printMessage: function(t) {
var text = $('<div>').addClass('notification').css('opacity', '0').text(t).prependTo('div#notifications');
text.animate({opacity: 1}, 500, 'linear', function() {
// Do this every time we add a new message, this way we never have a large backlog to iterate through. Keeps things faster.
Notifications.clearHidden();
});
},

printQueue: function(module) {
if(typeof this.notifyQueue[module] != 'undefined') {
while(this.notifyQueue[module].length > 0) {
Notifications.printMessage(this.notifyQueue[module].shift());
}
}
}
};
/**
* Module that registers the notification box and handles messages
*/
var Notifications = {

init: function(options) {
this.options = $.extend(
this.options,
options
);

// Create the notifications box
elem = $('<div>').attr({
id: 'notifications',
className: 'notifications'
});
// Create the transparency gradient
$('<div>').attr('id', 'notifyGradient').appendTo(elem);

elem.appendTo('div#wrapper');
},

options: {}, // Nothing for now

elem: null,

notifyQueue: {},

// Allow notification to the player
notify: function(module, text, noQueue) {
if(typeof text == 'undefined') return;
if(text.slice(-1) != ".") text += ".";
if(module != null && Engine.activeModule != module) {
if(!noQueue) {
if(typeof this.notifyQueue[module] == 'undefined') {
this.notifyQueue[module] = [];
}
this.notifyQueue[module].push(text);
}
} else {
Notifications.printMessage(text);
}
Engine.saveGame();
},

clearHidden: function() {

// To fix some memory usage issues, we clear notifications that have been hidden.

// We use position().top here, because we know that the parent will be the same, so the position will be the same.
var bottom = $('#notifyGradient').position().top + $('#notifyGradient').outerHeight(true);

$('.notification').each(function() {

if($(this).position().top > bottom){
$(this).remove();
}

});

},

printMessage: function(t) {
var text = $('<div>').addClass('notification').css('opacity', '0').text(t).prependTo('div#notifications');
text.animate({opacity: 1}, 500, 'linear', function() {
// Do this every time we add a new message, this way we never have a large backlog to iterate through. Keeps things faster.
Notifications.clearHidden();
});
},

printQueue: function(module) {
if(typeof this.notifyQueue[module] != 'undefined') {
while(this.notifyQueue[module].length > 0) {
Notifications.printMessage(this.notifyQueue[module].shift());
}
}
}
};
Loading

0 comments on commit 5fcd897

Please sign in to comment.