').attr({'id': 'dropMenu', 'data-legend': _('drop:')});
needsAppend = true;
}
for(var k in Path.outfit) {
@@ -676,9 +678,10 @@ var Events = {
}
}
lootButtons.appendTo(desc);
+ var takeET = null;
if(lootButtons.children().length > 0) {
var takeETrow = $('
').addClass('takeETrow');
- var takeET = new Button.Button({
+ takeET = new Button.Button({
id: 'loot_takeEverything',
text: '',
cooldown: Events._LEAVE_COOLDOWN,
@@ -773,10 +776,10 @@ var Events = {
World.updateSupplies();
},
- getLoot: function(btn, skipButtonSet) {
+ getLoot: function(btn, stateSkipButtonSet) {
var name = btn.attr('id').substring(5).replace('-', ' ');
if(btn.data('numLeft') > 0) {
- var skipButtonSet = skipButtonSet || false;
+ var skipButtonSet = stateSkipButtonSet || false;
var weight = Path.getWeight(name);
var freeSpace = Path.getFreeSpace();
if(weight <= freeSpace) {
@@ -857,8 +860,9 @@ var Events = {
}
// Draw any loot
+ var takeETbtn;
if(scene.loot) {
- var takeETbtn = Events.drawLoot(scene.loot);
+ takeETbtn = Events.drawLoot(scene.loot);
}
// Draw the buttons
@@ -1113,7 +1117,7 @@ var Events = {
if(typeof target[i] == 'function'){
target[i]();
} else {
- $SM.remove(stateName)
+ $SM.remove(stateName);
}
}
}
@@ -1127,7 +1131,7 @@ var Events = {
if(delay){
$SM.set(state, delay);
} else {
- var delay = $SM.get(state, true)
+ delay = $SM.get(state, true);
}
var time = Engine.setInterval(function(){
// update state every half second
diff --git a/script/events/outside.js b/script/events/outside.js
index 71d7790..1a6e763 100644
--- a/script/events/outside.js
+++ b/script/events/outside.js
@@ -148,7 +148,7 @@ Events.Outside = [
}
}
},
-
+
{ /* Plague */
title: _('Plague'),
isAvailable: function() {
@@ -275,7 +275,7 @@ Events.Outside = [
bullets: 10,
'cured meat': 50
},
-
+
blink: true,
buttons: {
'end': {
@@ -287,4 +287,5 @@ Events.Outside = [
}
}
}
+
];
diff --git a/script/events/room.js b/script/events/room.js
index 6710b25..1e70a3e 100644
--- a/script/events/room.js
+++ b/script/events/room.js
@@ -40,7 +40,7 @@ Events.Room = [
cost: { fur: 300, scales: 15, teeth: 5 },
reward: { 'compass': 1 },
notification: _('the old compass is dented and dusty, but it looks to work.')
- },
+ },
'goodbye': {
text: _('say goodbye'),
nextScene: 'end'
@@ -48,7 +48,7 @@ Events.Room = [
}
}
}
- },
+ },
{ /* Noises Outside -- gain wood/fur */
title: _('Noises'),
isAvailable: function() {
@@ -257,7 +257,63 @@ Events.Room = [
}
}
},
-
+ {/* The Shady Builder */
+ title: _('The Shady Builder'),
+ isAvailable: function() {
+ return Engine.activeModule == Room && $SM.get('game.buildings["hut"]', true) >= 5 && $SM.get('game.buildings["hut"]', true) < 20;
+ },
+ scenes: {
+ 'start':{
+ text: [
+ _('a shady builder passes through'),
+ _('says he can build you a hut for less wood')
+ ],
+ notification: _('a shady builder passes through'),
+ buttons: {
+ 'build': {
+ text: _('300 wood'),
+ cost: { 'wood' : 300 },
+ nextScene: {0.6: 'steal', 1: 'build'}
+ },
+ 'deny': {
+ text: _('say goodbye'),
+ nextScene: 'end'
+ }
+ }
+ },
+ 'steal': {
+ text:[
+ _("the shady builder has made off with your wood")
+ ],
+ notification: _('the shady builder has made off with your wood'),
+ buttons: {
+ 'end': {
+ text: _('go home'),
+ nextScene: 'end'
+ }
+ }
+ },
+ 'build': {
+ text:[
+ _("the shady builder builds a hut")
+ ],
+ notification: _('the shady builder builds a hut'),
+ onLoad: function() {
+ var n = $SM.get('game.buildings["hut"]', true);
+ if(n < 20){
+ $SM.set('game.buildings["hut"]',n+1);
+ }
+ },
+ buttons: {
+ 'end': {
+ text: _('go home'),
+ nextScene: 'end'
+ }
+ }
+ }
+ }
+ },
+
{ /* Mysterious Wanderer -- wood gambling */
title: _('The Mysterious Wanderer'),
isAvailable: function() {
@@ -292,8 +348,8 @@ Events.Room = [
text: [
_('the wanderer leaves, cart loaded with wood')
],
- action: function(delay) {
- var delay = delay || false;
+ action: function(inputDelay) {
+ var delay = inputDelay || false;
Events.saveDelay(function() {
$SM.add('stores.wood', 300);
Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with wood.'));
@@ -315,8 +371,8 @@ Events.Room = [
text: [
_('the wanderer leaves, cart loaded with wood')
],
- action: function(delay) {
- var delay = delay || false;
+ action: function(inputDelay) {
+ var delay = inputDelay || false;
Events.saveDelay(function() {
$SM.add('stores.wood', 1500);
Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with wood.'));
@@ -336,7 +392,7 @@ Events.Room = [
}
}
},
-
+
{ /* Mysterious Wanderer -- fur gambling */
title: _('The Mysterious Wanderer'),
isAvailable: function() {
@@ -371,8 +427,8 @@ Events.Room = [
text: [
_('the wanderer leaves, cart loaded with furs')
],
- action: function(delay) {
- var delay = delay || false;
+ action: function(inputDelay) {
+ var delay = inputDelay || false;
Events.saveDelay(function() {
$SM.add('stores.fur', 300);
Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with furs.'));
@@ -394,8 +450,8 @@ Events.Room = [
text: [
_('the wanderer leaves, cart loaded with furs')
],
- action: function(delay) {
- var delay = delay || false;
+ action: function(inputDelay) {
+ var delay = inputDelay || false;
Events.saveDelay(function() {
$SM.add('stores.fur', 1500);
Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with furs.'));
@@ -415,7 +471,7 @@ Events.Room = [
}
}
},
-
+
{ /* The Scout -- Map Merchant */
title: _('The Scout'),
isAvailable: function() {
@@ -457,7 +513,7 @@ Events.Room = [
}
}
},
-
+
{ /* The Wandering Master */
title: _('The Master'),
isAvailable: function() {
@@ -530,7 +586,7 @@ Events.Room = [
}
}
},
-
+
{ /* The Sick Man */
title: _('The Sick Man'),
isAvailable: function() {
diff --git a/script/localization.js b/script/localization.js
index dd1aa9d..5e9c3d4 100644
--- a/script/localization.js
+++ b/script/localization.js
@@ -65,5 +65,5 @@
_('the compass points southwest')
];
- delete keywords;
+ keywords = null;
})();
diff --git a/script/outside.js b/script/outside.js
index 4fdfa0e..881bc43 100644
--- a/script/outside.js
+++ b/script/outside.js
@@ -619,14 +619,14 @@ var Outside = {
}
/// TRANSLATORS : Mind the whitespace at the end.
var s = _('the traps contain ');
- for(var i = 0, len = msg.length; i < len; i++) {
- if(len > 1 && i > 0 && i < len - 1) {
+ for(var l = 0, len = msg.length; l < len; l++) {
+ if(len > 1 && l > 0 && l < len - 1) {
s += ", ";
- } else if(len > 1 && i == len - 1) {
+ } else if(len > 1 && l == len - 1) {
/// TRANSLATORS : Mind the whitespaces at the beginning and end.
s += _(" and ");
}
- s += msg[i];
+ s += msg[l];
}
var baitUsed = numBait < numTraps ? numBait : numTraps;
@@ -643,7 +643,7 @@ var Outside = {
Outside.updateVillage();
Outside.updateWorkersView();
Outside.updateVillageIncome();
- };
+ }
},
scrollSidebar: function(direction, reset) {
diff --git a/script/path.js b/script/path.js
index 347b880..9aa7a8e 100644
--- a/script/path.js
+++ b/script/path.js
@@ -341,7 +341,7 @@ var Path = {
var momentum = 10;
if( direction == 'up' )
- momentum = momentum * -1
+ momentum = momentum * -1;
if( direction == 'down' && inView( direction, $('#perks') ) ){
diff --git a/script/room.js b/script/room.js
index 11e807b..7705994 100644
--- a/script/room.js
+++ b/script/room.js
@@ -1093,9 +1093,9 @@ var Room = {
var costTooltip = $('.tooltip', craftable.button);
costTooltip.empty();
var cost = craftable.cost();
- for(var k in cost) {
- $("
").addClass('row_key').text(_(k)).appendTo(costTooltip);
- $("
").addClass('row_val').text(cost[k]).appendTo(costTooltip);
+ for(var c in cost) {
+ $("
").addClass('row_key').text(_(c)).appendTo(costTooltip);
+ $("
").addClass('row_val').text(cost[c]).appendTo(costTooltip);
}
if(max && !craftable.button.hasClass('disabled')) {
Notifications.notify(Room, craftable.maxMsg);
@@ -1108,34 +1108,34 @@ var Room = {
}
}
- for(var k in Room.TradeGoods) {
- good = Room.TradeGoods[k];
- var max = $SM.num(k, good) + 1 > good.maximum;
+ for(var g in Room.TradeGoods) {
+ good = Room.TradeGoods[g];
+ var goodsMax = $SM.num(g, good) + 1 > good.maximum;
if(good.button == null) {
- if(Room.buyUnlocked(k)) {
+ if(Room.buyUnlocked(g)) {
good.button = new Button.Button({
- id: 'build_' + k,
+ id: 'build_' + g,
cost: good.cost(),
- text: _(k),
+ text: _(g),
click: Room.buy,
width: '80px',
ttPos: buySection.children().length > 10 ? 'top right' : 'bottom right'
- }).css('opacity', 0).attr('buildThing', k).appendTo(buySection).animate({opacity:1}, 300, 'linear');
+ }).css('opacity', 0).attr('buildThing', g).appendTo(buySection).animate({opacity:1}, 300, 'linear');
}
} else {
// refresh the tooltip
- var costTooltip = $('.tooltip', good.button);
- costTooltip.empty();
- var cost = good.cost();
- for(var k in cost) {
- $("
").addClass('row_key').text(_(k)).appendTo(costTooltip);
- $("
").addClass('row_val').text(cost[k]).appendTo(costTooltip);
+ var goodsCostTooltip = $('.tooltip', good.button);
+ goodsCostTooltip.empty();
+ var goodCost = good.cost();
+ for(var gc in goodCost) {
+ $("
").addClass('row_key').text(_(gc)).appendTo(goodsCostTooltip);
+ $("
").addClass('row_val').text(goodCost[gc]).appendTo(goodsCostTooltip);
}
- if(max && !good.button.hasClass('disabled')) {
+ if(goodsMax && !good.button.hasClass('disabled')) {
Notifications.notify(Room, good.maxMsg);
}
}
- if(max) {
+ if(goodsMax) {
Button.setDisabled(good.button, true);
} else {
Button.setDisabled(good.button, false);
diff --git a/script/scoring.js b/script/scoring.js
index e9f957d..1e50ba9 100644
--- a/script/scoring.js
+++ b/script/scoring.js
@@ -13,7 +13,7 @@ var Score = {
var fullScore = 0;
var factor = [1, 1.5, 1, 2, 2, 3, 3, 2, 2, 2, 2, 1.5, 1,
- 1, 10, 30, 50, 100, 150, 150, 3, 3, 5, 4]
+ 1, 10, 30, 50, 100, 150, 150, 3, 3, 5, 4];
for(var i = 0; i< factor.length; i++){
fullScore += scoreUnadded[i] * factor[i];
}
diff --git a/script/space.js b/script/space.js
index 8cdd178..0c4c235 100644
--- a/script/space.js
+++ b/script/space.js
@@ -166,7 +166,7 @@ var Space = {
}
if(!Space.done) {
- Engine.setTimeout(Space.createAsteroid, 1000 - (Space.altitude * 10));
+ Engine.setTimeout(Space.createAsteroid, 1000 - (Space.altitude * 10), true);
}
}
},
@@ -266,7 +266,7 @@ var Space = {
$('#spacePanel, .menu, select.menuBtn').animate({color: '#272823'}, 500, 'linear');
else
$('#spacePanel, .menu, select.menuBtn').animate({color: 'white'}, 500, 'linear');
- }, Space.FTB_SPEED / 2);
+ }, Space.FTB_SPEED / 2, true);
Space.createAsteroid();
},
@@ -372,8 +372,8 @@ var Space = {
clearTimeout(Events._eventTimeout);
clearTimeout(Room._fireTimer);
clearTimeout(Room._tempTimer);
- for(var k in Room.Craftables) {
- Room.Craftables[k].button = null;
+ for(var j in Room.Craftables) {
+ Room.Craftables[j].button = null;
}
for(var k in Room.TradeGoods) {
Room.TradeGoods[k].button = null;
diff --git a/script/state_manager.js b/script/state_manager.js
index 6d31aac..94624ae 100644
--- a/script/state_manager.js
+++ b/script/state_manager.js
@@ -54,10 +54,10 @@ var StateManager = {
createState: function(stateName, value) {
var words = stateName.split(/[.\[\]'"]+/);
//for some reason there are sometimes empty strings
- for (var i = 0; i < words.length; i++) {
- if (words[i] === '') {
- words.splice(i, 1);
- i--;
+ for (var j = 0; j < words.length; j++) {
+ if (words[j] === '') {
+ words.splice(j, 1);
+ j--;
}
}
var obj = State;
@@ -218,7 +218,7 @@ var StateManager = {
fireUpdate: function(stateName, save){
var category = $SM.getCategory(stateName);
- if(stateName == undefined) stateName = category = 'all'; //best if this doesn't happen as it will trigger more stuff
+ if(stateName === undefined) stateName = category = 'all'; //best if this doesn't happen as it will trigger more stuff
$.Dispatch('stateUpdate').publish({'category': category, 'stateName':stateName});
if(save) Engine.saveGame();
},
diff --git a/script/world.js b/script/world.js
index d40e629..f89e151 100644
--- a/script/world.js
+++ b/script/world.js
@@ -685,7 +685,7 @@ var World = {
// Place landmarks
for(var k in World.LANDMARKS) {
var landmark = World.LANDMARKS[k];
- for(var i = 0; i < landmark.num; i++) {
+ for(var l = 0; l < landmark.num; l++) {
var pos = World.placeLandmark(landmark.minRadius, landmark.maxRadius, k, map);
}
}
@@ -713,7 +713,7 @@ var World = {
targets[index] = {
x : i - World.RADIUS,
y : j - World.RADIUS,
- }
+ };
index++;
if(index === max){
// optimisation: stop the research if maximum number of items has been reached
@@ -774,12 +774,13 @@ var World = {
var chances = {};
var nonSticky = 1;
+ var cur;
for(var i in adjacent) {
if(adjacent[i] == World.TILE.VILLAGE) {
// Village must be in a forest to maintain thematic consistency, yo.
return World.TILE.FOREST;
} else if(typeof adjacent[i] == 'string') {
- var cur = chances[adjacent[i]];
+ cur = chances[adjacent[i]];
cur = typeof cur == 'number' ? cur : 0;
chances[adjacent[i]] = cur + World.STICKINESS;
nonSticky -= World.STICKINESS;
@@ -788,7 +789,7 @@ var World = {
for(var t in World.TILE) {
var tile = World.TILE[t];
if(World.isTerrain(tile)) {
- var cur = chances[tile];
+ cur = chances[tile];
cur = typeof cur == 'number' ? cur : 0;
cur += World.TILE_PROBS[tile] * nonSticky;
chances[tile] = cur;
@@ -796,8 +797,8 @@ var World = {
}
var list = [];
- for(var t in chances) {
- list.push(chances[t] + '' + t);
+ for(var j in chances) {
+ list.push(chances[j] + '' + j);
}
list.sort(function(a, b) {
var n1 = parseFloat(a.substring(0, a.length - 1));
@@ -807,8 +808,8 @@ var World = {
var c = 0;
var r = Math.random();
- for(var i in list) {
- var prob = list[i];
+ for(var l in list) {
+ var prob = list[l];
c += parseFloat(prob.substring(0,prob.length - 1));
if(r < c) {
return prob.charAt(prob.length - 1);