mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-07-13 06:22:53 +08:00
Merge remote-tracking branch 'upstream/master' into issue115
Conflicts: script/outside.js script/path.js
This commit is contained in:
+31
-7
@@ -74,7 +74,8 @@
|
||||
state: null,
|
||||
debug: false,
|
||||
log: false,
|
||||
dropbox: false
|
||||
dropbox: false,
|
||||
doubleTime: false
|
||||
},
|
||||
|
||||
init: function(options) {
|
||||
@@ -114,11 +115,11 @@
|
||||
.addClass('customSelect')
|
||||
.addClass('menuBtn')
|
||||
.appendTo(menu);
|
||||
var options = $('<span>')
|
||||
var selectOptions = $('<span>')
|
||||
.addClass('customSelectOptions')
|
||||
.appendTo(customSelect);
|
||||
var optionsList = $('<ul>')
|
||||
.appendTo(options);
|
||||
.appendTo(selectOptions);
|
||||
$('<li>')
|
||||
.text("language.")
|
||||
.appendTo(optionsList);
|
||||
@@ -137,7 +138,19 @@
|
||||
.text(_('lights off.'))
|
||||
.click(Engine.turnLightsOff)
|
||||
.appendTo(menu);
|
||||
|
||||
|
||||
$('<span>')
|
||||
.addClass('menuBtn')
|
||||
.text(_('hyper.'))
|
||||
.click(function(){
|
||||
Engine.options.doubleTime = !Engine.options.doubleTime;
|
||||
if(Engine.options.doubleTime)
|
||||
$(this).text(_('classic.'));
|
||||
else
|
||||
$(this).text(_('hyper.'));
|
||||
})
|
||||
.appendTo(menu);
|
||||
|
||||
$('<span>')
|
||||
.addClass('menuBtn')
|
||||
.text(_('restart.'))
|
||||
@@ -339,7 +352,7 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
Engine.autoSelect('#description textarea')
|
||||
Engine.autoSelect('#description textarea');
|
||||
},
|
||||
|
||||
import64: function(string64) {
|
||||
@@ -462,7 +475,6 @@
|
||||
var darkCss = Engine.findStylesheet('darkenLights');
|
||||
if (darkCss == null) {
|
||||
$('head').append('<link rel="stylesheet" href="css/dark.css" type="text/css" title="darkenLights" />');
|
||||
Engine.turnLightsOff;
|
||||
$('.lightsOff').text(_('lights on.'));
|
||||
} else if (darkCss.disabled) {
|
||||
darkCss.disabled = false;
|
||||
@@ -496,7 +508,7 @@
|
||||
var diff = Math.abs(panelIndex - currentIndex);
|
||||
slider.animate({left: -(panelIndex * 700) + 'px'}, 300 * diff);
|
||||
|
||||
if($SM.get('stores.wood') != undefined) {
|
||||
if($SM.get('stores.wood') !== undefined) {
|
||||
// FIXME Why does this work if there's an animation queue...?
|
||||
stores.animate({right: -(panelIndex * 700) + 'px'}, 300 * diff);
|
||||
}
|
||||
@@ -693,7 +705,19 @@
|
||||
if(lang && typeof Storage != 'undefined' && localStorage) {
|
||||
localStorage.lang = lang;
|
||||
}
|
||||
},
|
||||
|
||||
setTimeout: function(callback, timeout, skipDouble){
|
||||
|
||||
if( Engine.options.doubleTime && !skipDouble ){
|
||||
Engine.log('Double time, cutting timeout in half');
|
||||
timeout /= 2;
|
||||
}
|
||||
|
||||
return setTimeout(callback, timeout);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function eventNullifier(e) {
|
||||
|
||||
+20
-22
@@ -19,7 +19,7 @@ var Events = {
|
||||
);
|
||||
|
||||
// Build the Event Pool
|
||||
Events.EventPool = new Array().concat(
|
||||
Events.EventPool = [].concat(
|
||||
Events.Global,
|
||||
Events.Room,
|
||||
Events.Outside
|
||||
@@ -35,9 +35,7 @@ var Events = {
|
||||
|
||||
options: {}, // Nothing for now
|
||||
|
||||
activeEvent: null,
|
||||
activeScene: null,
|
||||
eventPanel: null,
|
||||
|
||||
loadScene: function(name) {
|
||||
Engine.log('loading scene: ' + name);
|
||||
@@ -88,7 +86,7 @@ var Events = {
|
||||
for(var k in World.Weapons) {
|
||||
var weapon = World.Weapons[k];
|
||||
if(typeof Path.outfit[k] == 'number' && Path.outfit[k] > 0) {
|
||||
if(typeof weapon.damage != 'number' || weapon.damage == 0) {
|
||||
if(typeof weapon.damage != 'number' || weapon.damage === 0) {
|
||||
// Weapons that deal no damage don't count
|
||||
numWeapons--;
|
||||
} else if(weapon.cost){
|
||||
@@ -104,18 +102,18 @@ var Events = {
|
||||
Events.createAttackButton(k).appendTo(btns);
|
||||
}
|
||||
}
|
||||
if(numWeapons == 0) {
|
||||
if(numWeapons === 0) {
|
||||
// No weapons? You can punch stuff!
|
||||
Events.createAttackButton('fists').prependTo(btns);
|
||||
}
|
||||
|
||||
Events.createEatMeatButton().appendTo(btns);
|
||||
if((Path.outfit['medicine'] || 0) != 0) {
|
||||
if((Path.outfit['medicine'] || 0) !== 0) {
|
||||
Events.createUseMedsButton().appendTo(btns);
|
||||
}
|
||||
|
||||
// Set up the enemy attack timer
|
||||
Events._enemyAttackTimer = setTimeout(Events.enemyAttack, scene.attackDelay * 1000);
|
||||
Events._enemyAttackTimer = Engine.setTimeout(Events.enemyAttack, scene.attackDelay * 1000);
|
||||
},
|
||||
|
||||
createEatMeatButton: function(cooldown) {
|
||||
@@ -131,7 +129,7 @@ var Events = {
|
||||
cost: { 'cured meat': 1 }
|
||||
});
|
||||
|
||||
if(Path.outfit['cured meat'] == 0) {
|
||||
if(Path.outfit['cured meat'] === 0) {
|
||||
Button.setDisabled(btn, true);
|
||||
}
|
||||
|
||||
@@ -151,7 +149,7 @@ var Events = {
|
||||
cost: { 'medicine': 1 }
|
||||
});
|
||||
|
||||
if((Path.outfit['medicine'] || 0) == 0) {
|
||||
if((Path.outfit['medicine'] || 0) === 0) {
|
||||
Button.setDisabled(btn, true);
|
||||
}
|
||||
|
||||
@@ -203,7 +201,7 @@ var Events = {
|
||||
if(Path.outfit['cured meat'] > 0) {
|
||||
Path.outfit['cured meat']--;
|
||||
World.updateSupplies();
|
||||
if(Path.outfit['cured meat'] == 0) {
|
||||
if(Path.outfit['cured meat'] === 0) {
|
||||
Button.setDisabled($('#eat'), true);
|
||||
}
|
||||
|
||||
@@ -225,7 +223,7 @@ var Events = {
|
||||
if(Path.outfit['medicine'] > 0) {
|
||||
Path.outfit['medicine']--;
|
||||
World.updateSupplies();
|
||||
if(Path.outfit['medicine'] == 0) {
|
||||
if(Path.outfit['medicine'] === 0) {
|
||||
Button.setDisabled($('#meds'), true);
|
||||
}
|
||||
|
||||
@@ -286,7 +284,7 @@ var Events = {
|
||||
if(!validWeapons) {
|
||||
// enable or create the punch button
|
||||
var fists = $('#attack_fists');
|
||||
if(fists.length == 0) {
|
||||
if(fists.length === 0) {
|
||||
Events.createAttackButton('fists').prependTo('#buttons', Events.eventPanel());
|
||||
} else {
|
||||
Button.setDisabled(fists, false);
|
||||
@@ -356,7 +354,7 @@ var Events = {
|
||||
if(dmg == 'stun') {
|
||||
msg = _('stunned');
|
||||
enemy.data('stunned', true);
|
||||
setTimeout(function() {
|
||||
Engine.setTimeout(function() {
|
||||
enemy.data('stunned', false);
|
||||
}, Events.STUN_DURATION);
|
||||
}
|
||||
@@ -401,7 +399,7 @@ var Events = {
|
||||
if(dmg == 'stun') {
|
||||
msg = _('stunned');
|
||||
enemy.data('stunned', true);
|
||||
setTimeout(function() {
|
||||
Engine.setTimeout(function() {
|
||||
enemy.data('stunned', false);
|
||||
}, Events.STUN_DURATION);
|
||||
}
|
||||
@@ -440,14 +438,14 @@ var Events = {
|
||||
});
|
||||
}
|
||||
|
||||
Events._enemyAttackTimer = setTimeout(Events.enemyAttack, scene.attackDelay * 1000);
|
||||
Events._enemyAttackTimer = Engine.setTimeout(Events.enemyAttack, scene.attackDelay * 1000);
|
||||
},
|
||||
|
||||
winFight: function() {
|
||||
Events.won = true;
|
||||
clearTimeout(Events._enemyAttackTimer);
|
||||
$('#enemy').animate({opacity: 0}, 300, 'linear', function() {
|
||||
setTimeout(function() {
|
||||
Engine.setTimeout(function() {
|
||||
try {
|
||||
var scene = Events.activeEvent().scenes[Events.activeScene];
|
||||
var desc = $('#description', Events.eventPanel());
|
||||
@@ -477,14 +475,14 @@ var Events = {
|
||||
}).appendTo(btns));
|
||||
|
||||
Events.createEatMeatButton(0).appendTo(btns);
|
||||
if((Path.outfit['medicine'] || 0) != 0) {
|
||||
if((Path.outfit['medicine'] || 0) !== 0) {
|
||||
Events.createUseMedsButton(0).appendTo(btns);
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
// It is possible to die and win if the timing is perfect. Just let it fail.
|
||||
}
|
||||
}, 1000);
|
||||
}, 1000, true);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -542,7 +540,7 @@ var Events = {
|
||||
var num = btn.data('numLeft');
|
||||
num--;
|
||||
btn.data('numLeft', num);
|
||||
if(num == 0) {
|
||||
if(num === 0) {
|
||||
Button.setDisabled(btn);
|
||||
btn.animate({'opacity':0}, 300, 'linear', function() {
|
||||
$(this).remove();
|
||||
@@ -744,7 +742,7 @@ var Events = {
|
||||
// every 3 seconds change title to '*** EVENT ***', then 1.5 seconds later, change it back to the original title.
|
||||
Events.BLINK_INTERVAL = setInterval(function() {
|
||||
document.title = _('*** EVENT ***');
|
||||
setTimeout(function() {document.title = title;}, 1500);
|
||||
Engine.setTimeout(function() {document.title = title;}, 1500, true);
|
||||
}, 3000);
|
||||
},
|
||||
|
||||
@@ -764,7 +762,7 @@ var Events = {
|
||||
}
|
||||
}
|
||||
|
||||
if(possibleEvents.length == 0) {
|
||||
if(possibleEvents.length === 0) {
|
||||
Events.scheduleNextEvent(0.5);
|
||||
return;
|
||||
} else {
|
||||
@@ -826,7 +824,7 @@ var Events = {
|
||||
var nextEvent = Math.floor(Math.random()*(Events._EVENT_TIME_RANGE[1] - Events._EVENT_TIME_RANGE[0])) + Events._EVENT_TIME_RANGE[0];
|
||||
if(scale > 0) { nextEvent *= scale; }
|
||||
Engine.log('next event scheduled in ' + nextEvent + ' minutes');
|
||||
Events._eventTimeout = setTimeout(Events.triggerEvent, nextEvent * 60 * 1000);
|
||||
Events._eventTimeout = Engine.setTimeout(Events.triggerEvent, nextEvent * 60 * 1000);
|
||||
},
|
||||
|
||||
endEvent: function() {
|
||||
|
||||
@@ -63,7 +63,35 @@ Events.Outside = [
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
title: _('Fire'),
|
||||
isAvailable: function() {
|
||||
return Engine.activeModule == Outside && $SM.get('game.buildings["hut"]', true) > 0 && $SM.get('game.population', true) > 5;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
text: [
|
||||
_('a fire rampages through one of the huts, destroying it.'),
|
||||
_('all residents in the hut perished in the fire.')
|
||||
],
|
||||
notification: _('a fire has started'),
|
||||
blink: true,
|
||||
onLoad: function() {
|
||||
var population = $SM.get('game.population', true);
|
||||
var huts = $SM.get('game.buildings["hut"]', true);
|
||||
$SM.set('game.buildings["hut"]', (huts - 1));
|
||||
$SM.set('game.population', (population - 4));
|
||||
},
|
||||
buttons: {
|
||||
'mourn': {
|
||||
text: _('mourn'),
|
||||
notification: _('some villagers have died'),
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ /* Sickness */
|
||||
title: _('Sickness'),
|
||||
isAvailable: function() {
|
||||
@@ -223,7 +251,7 @@ Events.Outside = [
|
||||
{ /* Soldier attack */
|
||||
title: _('A Military Raid'),
|
||||
isAvailable: function() {
|
||||
return Engine.activeModule == Outside && $SM.get('game.population', true) > 0 && $SM.get('game.cityCleared');;
|
||||
return Engine.activeModule == Outside && $SM.get('game.population', true) > 0 && $SM.get('game.cityCleared');
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
|
||||
+12
-11
@@ -49,7 +49,8 @@ Events.Room = [
|
||||
}
|
||||
}
|
||||
}
|
||||
}, { /* Noises Outside -- gain wood/fur */
|
||||
},
|
||||
{ /* Noises Outside -- gain wood/fur */
|
||||
title: _('Noises'),
|
||||
isAvailable: function() {
|
||||
return Engine.activeModule == Room && $SM.get('stores.wood');
|
||||
@@ -132,9 +133,9 @@ Events.Room = [
|
||||
onLoad: function() {
|
||||
var numWood = $SM.get('stores.wood', true);
|
||||
numWood = Math.floor(numWood * 0.1);
|
||||
if(numWood == 0) numWood = 1;
|
||||
if(numWood === 0) numWood = 1;
|
||||
var numScales = Math.floor(numWood / 5);
|
||||
if(numScales == 0) numScales = 1;
|
||||
if(numScales === 0) numScales = 1;
|
||||
$SM.addM('stores', {'wood': -numWood, 'scales': numScales});
|
||||
},
|
||||
buttons: {
|
||||
@@ -152,9 +153,9 @@ Events.Room = [
|
||||
onLoad: function() {
|
||||
var numWood = $SM.get('stores.wood', true);
|
||||
numWood = Math.floor(numWood * 0.1);
|
||||
if(numWood == 0) numWood = 1;
|
||||
if(numWood === 0) numWood = 1;
|
||||
var numTeeth = Math.floor(numWood / 5);
|
||||
if(numTeeth == 0) numTeeth = 1;
|
||||
if(numTeeth === 0) numTeeth = 1;
|
||||
$SM.addM('stores', {'wood': -numWood, 'teeth': numTeeth});
|
||||
},
|
||||
buttons: {
|
||||
@@ -172,9 +173,9 @@ Events.Room = [
|
||||
onLoad: function() {
|
||||
var numWood = $SM.get('stores.wood', true);
|
||||
numWood = Math.floor(numWood * 0.1);
|
||||
if(numWood == 0) numWood = 1;
|
||||
if(numWood === 0) numWood = 1;
|
||||
var numCloth = Math.floor(numWood / 5);
|
||||
if(numCloth == 0) numCloth = 1;
|
||||
if(numCloth === 0) numCloth = 1;
|
||||
$SM.addM('stores', {'wood': -numWood, 'cloth': numCloth});
|
||||
},
|
||||
buttons: {
|
||||
@@ -294,7 +295,7 @@ Events.Room = [
|
||||
],
|
||||
onLoad: function() {
|
||||
if(Math.random() < 0.5) {
|
||||
setTimeout(function() {
|
||||
Engine.setTimeout(function() {
|
||||
$SM.add('stores.wood', 300);
|
||||
Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with wood.'));
|
||||
}, 60 * 1000);
|
||||
@@ -313,7 +314,7 @@ Events.Room = [
|
||||
],
|
||||
onLoad: function() {
|
||||
if(Math.random() < 0.3) {
|
||||
setTimeout(function() {
|
||||
Engine.setTimeout(function() {
|
||||
$SM.add('stores.wood', 1500);
|
||||
Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with wood.'));
|
||||
}, 60 * 1000);
|
||||
@@ -365,7 +366,7 @@ Events.Room = [
|
||||
],
|
||||
onLoad: function() {
|
||||
if(Math.random() < 0.5) {
|
||||
setTimeout(function() {
|
||||
Engine.setTimeout(function() {
|
||||
$SM.add('stores.fur', 300);
|
||||
Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with furs.'));
|
||||
}, 60 * 1000);
|
||||
@@ -384,7 +385,7 @@ Events.Room = [
|
||||
],
|
||||
onLoad: function() {
|
||||
if(Math.random() < 0.3) {
|
||||
setTimeout(function() {
|
||||
Engine.setTimeout(function() {
|
||||
$SM.add('stores.fur', 1500);
|
||||
Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with furs.'));
|
||||
}, 60 * 1000);
|
||||
|
||||
@@ -33,7 +33,7 @@ var Notifications = {
|
||||
if(module != null && Engine.activeModule != module) {
|
||||
if(!noQueue) {
|
||||
if(typeof this.notifyQueue[module] == 'undefined') {
|
||||
this.notifyQueue[module] = new Array();
|
||||
this.notifyQueue[module] = [];
|
||||
}
|
||||
this.notifyQueue[module].push(text);
|
||||
}
|
||||
|
||||
+19
-19
@@ -179,7 +179,7 @@ var Outside = {
|
||||
var space = Outside.getMaxPopulation() - $SM.get('game.population');
|
||||
if(space > 0) {
|
||||
var num = Math.floor(Math.random()*(space/2) + space/2);
|
||||
if(num == 0) num = 1;
|
||||
if(num === 0) num = 1;
|
||||
if(num == 1) {
|
||||
Notifications.notify(null, _('a stranger arrives in the night'));
|
||||
} else if(num < 5) {
|
||||
@@ -206,9 +206,9 @@ var Outside = {
|
||||
if(remaining < 0) {
|
||||
var gap = -remaining;
|
||||
for(var k in $SM.get('game.workers')) {
|
||||
var num = $SM.get('game.workers["'+k+'"]');
|
||||
if(num < gap) {
|
||||
gap -= num;
|
||||
var numWorkers = $SM.get('game.workers["'+k+'"]');
|
||||
if(numWorkers < gap) {
|
||||
gap -= numWorkers;
|
||||
$SM.set('game.workers["'+k+'"]', 0);
|
||||
} else {
|
||||
$SM.add('game.workers["'+k+'"]', gap * -1);
|
||||
@@ -221,7 +221,7 @@ var Outside = {
|
||||
schedulePopIncrease: function() {
|
||||
var nextIncrease = Math.floor(Math.random()*(Outside._POP_DELAY[1] - Outside._POP_DELAY[0])) + Outside._POP_DELAY[0];
|
||||
Engine.log('next population increase scheduled in ' + nextIncrease + ' minutes');
|
||||
Outside._popTimeout = setTimeout(Outside.increasePopulation, nextIncrease * 60 * 1000);
|
||||
Outside._popTimeout = Engine.setTimeout(Outside.increasePopulation, nextIncrease * 60 * 1000);
|
||||
},
|
||||
|
||||
updateWorkersView: function() {
|
||||
@@ -229,10 +229,10 @@ var Outside = {
|
||||
|
||||
// If our population is 0 and we don't already have a workers view,
|
||||
// there's nothing to do here.
|
||||
if(!workers.length && $SM.get('game.population') == 0) return;
|
||||
if(!workers.length && $SM.get('game.population') === 0) return;
|
||||
|
||||
var needsAppend = false;
|
||||
if(workers.length == 0) {
|
||||
if(workers.length === 0) {
|
||||
needsAppend = true;
|
||||
workers = $('<div>').attr('id', 'workers').css('opacity', 0);
|
||||
}
|
||||
@@ -243,7 +243,7 @@ var Outside = {
|
||||
for(var k in $SM.get('game.workers')) {
|
||||
var workerCount = $SM.get('game.workers["'+k+'"]');
|
||||
var row = $('div#workers_row_' + k.replace(' ', '-'), workers);
|
||||
if(row.length == 0) {
|
||||
if(row.length === 0) {
|
||||
row = Outside.makeWorkerRow(k, workerCount);
|
||||
|
||||
var curPrev = null;
|
||||
@@ -256,7 +256,7 @@ var Outside = {
|
||||
}
|
||||
}
|
||||
});
|
||||
if(curPrev == null && gatherer.length == 0) {
|
||||
if(curPrev == null && gatherer.length === 0) {
|
||||
row.prependTo(workers);
|
||||
}
|
||||
else if(curPrev == null)
|
||||
@@ -272,7 +272,7 @@ var Outside = {
|
||||
$('div#' + row.attr('id') + ' > div.row_val > span', workers).text(workerCount);
|
||||
}
|
||||
numGatherers -= workerCount;
|
||||
if(workerCount == 0) {
|
||||
if(workerCount === 0) {
|
||||
$('.dnBtn', row).addClass('disabled');
|
||||
$('.dnManyBtn', row).addClass('disabled');
|
||||
} else {
|
||||
@@ -281,14 +281,14 @@ var Outside = {
|
||||
}
|
||||
}
|
||||
|
||||
if(gatherer.length == 0) {
|
||||
if(gatherer.length === 0) {
|
||||
gatherer = Outside.makeWorkerRow('gatherer', numGatherers);
|
||||
gatherer.prependTo(workers);
|
||||
} else {
|
||||
$('div#workers_row_gatherer > div.row_val > span', workers).text(numGatherers);
|
||||
}
|
||||
|
||||
if(numGatherers == 0) {
|
||||
if(numGatherers === 0) {
|
||||
$('.upBtn', '#workers').addClass('disabled');
|
||||
$('.upManyBtn', '#workers').addClass('disabled');
|
||||
} else {
|
||||
@@ -364,7 +364,7 @@ var Outside = {
|
||||
updateVillageRow: function(name, num, village) {
|
||||
var id = 'building_row_' + name.replace(' ', '-');
|
||||
var row = $('div#' + id, village);
|
||||
if(row.length == 0 && num > 0) {
|
||||
if(row.length === 0 && num > 0) {
|
||||
row = $('<div>').attr('id', id).addClass('storeRow');
|
||||
$('<div>').addClass('row_key').text(_(name)).appendTo(row);
|
||||
$('<div>').addClass('row_val').text(num).appendTo(row);
|
||||
@@ -386,7 +386,7 @@ var Outside = {
|
||||
}
|
||||
} else if(num > 0) {
|
||||
$('div#' + row.attr('id') + ' > div.row_val', village).text(num);
|
||||
} else if(num == 0) {
|
||||
} else if(num === 0) {
|
||||
row.remove();
|
||||
}
|
||||
},
|
||||
@@ -395,7 +395,7 @@ var Outside = {
|
||||
var village = $('div#village');
|
||||
var population = $('div#population');
|
||||
var needsAppend = false;
|
||||
if(village.length == 0) {
|
||||
if(village.length === 0) {
|
||||
needsAppend = true;
|
||||
village = $('<div>').attr('id', 'village').css('opacity', 0);
|
||||
population = $('<div>').attr('id', 'population').appendTo(village);
|
||||
@@ -420,7 +420,7 @@ var Outside = {
|
||||
population.text(_('pop ') + $SM.get('game.population') + '/' + this.getMaxPopulation());
|
||||
|
||||
var hasPeeps;
|
||||
if($SM.get('game.buildings["hut"]', true) == 0) {
|
||||
if($SM.get('game.buildings["hut"]', true) === 0) {
|
||||
hasPeeps = false;
|
||||
village.addClass('noHuts');
|
||||
} else {
|
||||
@@ -505,7 +505,7 @@ var Outside = {
|
||||
updateTrapButton: function() {
|
||||
var btn = $('div#trapsButton');
|
||||
if($SM.get('game.buildings["trap"]', true) > 0) {
|
||||
if(btn.length == 0) {
|
||||
if(btn.length === 0) {
|
||||
new Button.Button({
|
||||
id: 'trapsButton',
|
||||
text: _("check traps"),
|
||||
@@ -526,7 +526,7 @@ var Outside = {
|
||||
setTitle: function() {
|
||||
var numHuts = $SM.get('game.buildings["hut"]', true);
|
||||
var title;
|
||||
if(numHuts == 0) {
|
||||
if(numHuts === 0) {
|
||||
title = _("A Silent Forest");
|
||||
} else if(numHuts == 1) {
|
||||
title = _("A Lonely Hut");
|
||||
@@ -607,7 +607,7 @@ var Outside = {
|
||||
handleStateUpdates: function(e){
|
||||
if(e.category == 'stores'){
|
||||
Outside.updateVillage();
|
||||
} else if(e.stateName.indexOf('game.workers') == 0 || e.stateName.indexOf('game.population') == 0){
|
||||
} else if(e.stateName.indexOf('game.workers') === 0 || e.stateName.indexOf('game.population') === 0){
|
||||
Outside.updateVillage();
|
||||
Outside.updateWorkersView();
|
||||
Outside.updateVillageIncome();
|
||||
|
||||
+11
-11
@@ -97,14 +97,14 @@ var Path = {
|
||||
if($SM.get('character.perks')) {
|
||||
var perks = $('#perks');
|
||||
var needsAppend = false;
|
||||
if(perks.length == 0) {
|
||||
if(perks.length === 0) {
|
||||
needsAppend = true;
|
||||
perks = $('<div>').attr('id', 'perks');
|
||||
}
|
||||
for(var k in $SM.get('character.perks')) {
|
||||
var id = 'perk_' + k.replace(' ', '-');
|
||||
var r = $('#' + id);
|
||||
if($SM.get('character.perks["'+k+'"]') && r.length == 0) {
|
||||
if($SM.get('character.perks["'+k+'"]') && r.length === 0) {
|
||||
r = $('<div>').attr('id', id).addClass('perkRow').appendTo(perks);
|
||||
$('<div>').addClass('row_key').text(_(k)).appendTo(r);
|
||||
$('<div>').addClass('tooltip bottom right').text(Engine.Perks[k].desc).appendTo(r);
|
||||
@@ -137,7 +137,7 @@ var Path = {
|
||||
else if($SM.get('stores["l armour"]', true) > 0)
|
||||
armour = _("leather");
|
||||
var aRow = $('#armourRow');
|
||||
if(aRow.length == 0) {
|
||||
if(aRow.length === 0) {
|
||||
aRow = $('<div>').attr('id', 'armourRow').addClass('outfitRow').prependTo(outfit);
|
||||
$('<div>').addClass('row_key').text(_('armour')).appendTo(aRow);
|
||||
$('<div>').addClass('row_val').text(armour).appendTo(aRow);
|
||||
@@ -148,7 +148,7 @@ var Path = {
|
||||
|
||||
// Add the water row
|
||||
var wRow = $('#waterRow');
|
||||
if(wRow.length == 0) {
|
||||
if(wRow.length === 0) {
|
||||
wRow = $('<div>').attr('id', 'waterRow').addClass('outfitRow').insertAfter(aRow);
|
||||
$('<div>').addClass('row_key').text(_('water')).appendTo(wRow);
|
||||
$('<div>').addClass('row_val').text(World.getMaxWater()).appendTo(wRow);
|
||||
@@ -183,13 +183,13 @@ var Path = {
|
||||
var row = $('div#outfit_row_' + k.replace(' ', '-'), outfit);
|
||||
if((store.type == 'tool' || store.type == 'weapon') && have > 0) {
|
||||
total += num * Path.getWeight(k);
|
||||
if(row.length == 0) {
|
||||
if(row.length === 0) {
|
||||
row = Path.createOutfittingRow(k, num, store.name);
|
||||
|
||||
var curPrev = null;
|
||||
outfit.children().each(function(i) {
|
||||
var child = $(this);
|
||||
if(child.attr('id').indexOf('outfit_row_') == 0) {
|
||||
if(child.attr('id').indexOf('outfit_row_') === 0) {
|
||||
var cName = child.attr('id').substring(11).replace('-', ' ');
|
||||
if(cName < k && (curPrev == null || cName > curPrev)) {
|
||||
curPrev = cName;
|
||||
@@ -207,7 +207,7 @@ var Path = {
|
||||
$('div#' + row.attr('id') + ' > div.row_val > span', outfit).text(num);
|
||||
$('div#' + row.attr('id') + ' .tooltip .numAvailable', outfit).text(numAvailable - num);
|
||||
}
|
||||
if(num == 0) {
|
||||
if(num === 0) {
|
||||
$('.dnBtn', row).addClass('disabled');
|
||||
$('.dnManyBtn', row).addClass('disabled');
|
||||
} else {
|
||||
@@ -221,7 +221,7 @@ var Path = {
|
||||
$('.upBtn', row).removeClass('disabled');
|
||||
$('.upManyBtn', row).removeClass('disabled');
|
||||
}
|
||||
} else if(have == 0 && row.length > 0) {
|
||||
} else if(have === 0 && row.length > 0) {
|
||||
row.remove();
|
||||
}
|
||||
}
|
||||
@@ -269,7 +269,7 @@ var Path = {
|
||||
var maxExtraByStore = $SM.get('stores["'+supply+'"]', true) - cur;
|
||||
var maxExtraByBtn = btn.data;
|
||||
Path.outfit[supply] = cur + Math.min(maxExtraByBtn, Math.min(maxExtraByWeight, maxExtraByStore));
|
||||
$SM.set('outfit['+supply+']', Path.outfit[supply])
|
||||
$SM.set('outfit['+supply+']', Path.outfit[supply]);
|
||||
Path.updateOutfitting();
|
||||
}
|
||||
},
|
||||
@@ -281,7 +281,7 @@ var Path = {
|
||||
cur = typeof cur == 'number' ? cur : 0;
|
||||
if(cur > 0) {
|
||||
Path.outfit[supply] = Math.max(0, cur - btn.data);
|
||||
$SM.set('outfit['+supply+']', Path.outfit[supply])
|
||||
$SM.set('outfit['+supply+']', Path.outfit[supply]);
|
||||
Path.updateOutfitting();
|
||||
}
|
||||
},
|
||||
@@ -310,7 +310,7 @@ var Path = {
|
||||
},
|
||||
|
||||
handleStateUpdates: function(e){
|
||||
if(e.category == 'character' && e.stateName.indexOf('character.perks') == 0 && Engine.activeModule == Path){
|
||||
if(e.category == 'character' && e.stateName.indexOf('character.perks') === 0 && Engine.activeModule == Path){
|
||||
Path.updatePerks();
|
||||
};
|
||||
},
|
||||
|
||||
+24
-24
@@ -476,8 +476,8 @@ var Room = {
|
||||
|
||||
// If this is the first time playing, the fire is dead and it's freezing.
|
||||
// Otherwise grab past save state temp and fire level.
|
||||
$SM.set('game.temperature', $SM.get('game.temperature.value')==undefined?this.TempEnum.Freezing:$SM.get('game.temperature'));
|
||||
$SM.set('game.fire', $SM.get('game.fire.value')==undefined?this.FireEnum.Dead:$SM.get('game.fire'));
|
||||
$SM.set('game.temperature', $SM.get('game.temperature.value')===undefined?this.TempEnum.Freezing:$SM.get('game.temperature'));
|
||||
$SM.set('game.fire', $SM.get('game.fire.value')===undefined?this.FireEnum.Dead:$SM.get('game.fire'));
|
||||
|
||||
// Create the room tab
|
||||
this.tab = Header.addLocation(_("A Dark Room"), "room", Room);
|
||||
@@ -521,8 +521,8 @@ var Room = {
|
||||
Room.updateIncomeView();
|
||||
Room.updateBuildButtons();
|
||||
|
||||
Room._fireTimer = setTimeout(Room.coolFire, Room._FIRE_COOL_DELAY);
|
||||
Room._tempTimer = setTimeout(Room.adjustTemp, Room._ROOM_WARM_DELAY);
|
||||
Room._fireTimer = Engine.setTimeout(Room.coolFire, Room._FIRE_COOL_DELAY);
|
||||
Room._tempTimer = Engine.setTimeout(Room.adjustTemp, Room._ROOM_WARM_DELAY);
|
||||
|
||||
/*
|
||||
* Builder states:
|
||||
@@ -533,12 +533,12 @@ var Room = {
|
||||
* 4 - Helping
|
||||
*/
|
||||
if($SM.get('game.builder.level') >= 0 && $SM.get('game.builder.level') < 3) {
|
||||
Room._builderTimer = setTimeout(Room.updateBuilderState, Room._BUILDER_STATE_DELAY);
|
||||
Room._builderTimer = Engine.setTimeout(Room.updateBuilderState, Room._BUILDER_STATE_DELAY);
|
||||
}
|
||||
if($SM.get('game.builder.level') == 1 && $SM.get('stores.wood', true) < 0) {
|
||||
setTimeout(Room.unlockForest, Room._NEED_WOOD_DELAY);
|
||||
Engine.setTimeout(Room.unlockForest, Room._NEED_WOOD_DELAY);
|
||||
}
|
||||
setTimeout($SM.collectIncome, 1000);
|
||||
Engine.setTimeout($SM.collectIncome, 1000);
|
||||
|
||||
Notifications.notify(Room, _("the room is {0}", Room.TempEnum.fromInt($SM.get('game.temperature.value')).text));
|
||||
Notifications.notify(Room, _("the fire is {0}", Room.FireEnum.fromInt($SM.get('game.fire.value')).text));
|
||||
@@ -671,10 +671,10 @@ var Room = {
|
||||
if($SM.get('game.fire.value') > 1 && $SM.get('game.builder.level') < 0) {
|
||||
$SM.set('game.builder.level', 0);
|
||||
Notifications.notify(Room, _("the light from the fire spills from the windows, out into the dark"));
|
||||
setTimeout(Room.updateBuilderState, Room._BUILDER_STATE_DELAY);
|
||||
Engine.setTimeout(Room.updateBuilderState, Room._BUILDER_STATE_DELAY);
|
||||
}
|
||||
window.clearTimeout(Room._fireTimer);
|
||||
Room._fireTimer = setTimeout(Room.coolFire, Room._FIRE_COOL_DELAY);
|
||||
Room._fireTimer = Engine.setTimeout(Room.coolFire, Room._FIRE_COOL_DELAY);
|
||||
Room.updateButton();
|
||||
Room.setTitle();
|
||||
},
|
||||
@@ -689,7 +689,7 @@ var Room = {
|
||||
}
|
||||
if($SM.get('game.fire.value') > 0) {
|
||||
$SM.set('game.fire',Room.FireEnum.fromInt($SM.get('game.fire.value') - 1));
|
||||
Room._fireTimer = setTimeout(Room.coolFire, Room._FIRE_COOL_DELAY);
|
||||
Room._fireTimer = Engine.setTimeout(Room.coolFire, Room._FIRE_COOL_DELAY);
|
||||
Room.onFireChange();
|
||||
}
|
||||
},
|
||||
@@ -707,7 +707,7 @@ var Room = {
|
||||
if($SM.get('game.temperature.value') != old) {
|
||||
Room.changed = true;
|
||||
}
|
||||
Room._tempTimer = setTimeout(Room.adjustTemp, Room._ROOM_WARM_DELAY);
|
||||
Room._tempTimer = Engine.setTimeout(Room.adjustTemp, Room._ROOM_WARM_DELAY);
|
||||
},
|
||||
|
||||
unlockForest: function() {
|
||||
@@ -720,10 +720,10 @@ var Room = {
|
||||
|
||||
updateBuilderState: function() {
|
||||
var lBuilder = $SM.get('game.builder.level');
|
||||
if(lBuilder == 0) {
|
||||
if(lBuilder === 0) {
|
||||
Notifications.notify(Room, _("a ragged stranger stumbles through the door and collapses in the corner"));
|
||||
lBuilder = $SM.setget('game.builder.level', 1);
|
||||
setTimeout(Room.unlockForest, Room._NEED_WOOD_DELAY);
|
||||
Engine.setTimeout(Room.unlockForest, Room._NEED_WOOD_DELAY);
|
||||
}
|
||||
else if(lBuilder < 3 && $SM.get('game.temperature.value') >= Room.TempEnum.Warm.value) {
|
||||
var msg = "";
|
||||
@@ -741,7 +741,7 @@ var Room = {
|
||||
}
|
||||
}
|
||||
if(lBuilder < 3) {
|
||||
setTimeout(Room.updateBuilderState, Room._BUILDER_STATE_DELAY);
|
||||
Engine.setTimeout(Room.updateBuilderState, Room._BUILDER_STATE_DELAY);
|
||||
}
|
||||
Engine.saveGame();
|
||||
},
|
||||
@@ -750,13 +750,13 @@ var Room = {
|
||||
var stores = $('div#stores');
|
||||
var weapons = $('div#weapons');
|
||||
var needsAppend = false, wNeedsAppend = false, newRow = false;
|
||||
if(stores.length == 0) {
|
||||
if(stores.length === 0) {
|
||||
stores = $('<div>').attr({
|
||||
id: 'stores'
|
||||
}).css('opacity', 0);
|
||||
needsAppend = true;
|
||||
}
|
||||
if(weapons.length == 0) {
|
||||
if(weapons.length === 0) {
|
||||
weapons = $('<div>').attr({
|
||||
id: 'weapons'
|
||||
}).css('opacity', 0);
|
||||
@@ -803,7 +803,7 @@ var Room = {
|
||||
$SM.startThieves();
|
||||
}
|
||||
|
||||
if(row.length == 0 && num > 0) {
|
||||
if(row.length === 0 && num > 0) {
|
||||
row = $('<div>').attr('id', id).addClass('storeRow');
|
||||
$('<div>').addClass('row_key').text(_(k)).appendTo(row);
|
||||
$('<div>').addClass('row_val').text(Math.floor(num)).appendTo(row);
|
||||
@@ -848,7 +848,7 @@ var Room = {
|
||||
|
||||
updateIncomeView: function() {
|
||||
var stores = $('div#stores');
|
||||
if(stores.length == 0 || typeof $SM.get('income') == 'undefined') return;
|
||||
if(stores.length === 0 || typeof $SM.get('income') == 'undefined') return;
|
||||
$('div.storeRow', stores).each(function(index, el) {
|
||||
el = $(el);
|
||||
$('div.tooltip', el).remove();
|
||||
@@ -857,7 +857,7 @@ var Room = {
|
||||
for(var incomeSource in $SM.get('income')) {
|
||||
var income = $SM.get('income["'+incomeSource+'"]');
|
||||
for(var store in income.stores) {
|
||||
if(store == storeName && income.stores[store] != 0) {
|
||||
if(store == storeName && income.stores[store] !== 0) {
|
||||
$('<div>').addClass('row_key').text(_(incomeSource)).appendTo(tt);
|
||||
$('<div>')
|
||||
.addClass('row_val')
|
||||
@@ -967,7 +967,7 @@ var Room = {
|
||||
}
|
||||
if($SM.get('game.builder.level') < 4) return false;
|
||||
var craftable = Room.Craftables[thing];
|
||||
if(Room.needsWorkshop(craftable.type) && $SM.get('game.buildings["'+'workshop'+'"]', true) == 0) return false;
|
||||
if(Room.needsWorkshop(craftable.type) && $SM.get('game.buildings["'+'workshop'+'"]', true) === 0) return false;
|
||||
var cost = craftable.cost();
|
||||
|
||||
//show button if one has already been built
|
||||
@@ -1008,21 +1008,21 @@ var Room = {
|
||||
updateBuildButtons: function() {
|
||||
var buildSection = $('#buildBtns');
|
||||
var needsAppend = false;
|
||||
if(buildSection.length == 0) {
|
||||
if(buildSection.length === 0) {
|
||||
buildSection = $('<div>').attr('id', 'buildBtns').css('opacity', 0);
|
||||
needsAppend = true;
|
||||
}
|
||||
|
||||
var craftSection = $('#craftBtns');
|
||||
var cNeedsAppend = false;
|
||||
if(craftSection.length == 0 && $SM.get('game.buildings["workshop"]', true) > 0) {
|
||||
if(craftSection.length === 0 && $SM.get('game.buildings["workshop"]', true) > 0) {
|
||||
craftSection = $('<div>').attr('id', 'craftBtns').css('opacity', 0);
|
||||
cNeedsAppend = true;
|
||||
}
|
||||
|
||||
var buySection = $('#buyBtns');
|
||||
var bNeedsAppend = false;
|
||||
if(buySection.length == 0 && $SM.get('game.buildings["trading post"]', true) > 0) {
|
||||
if(buySection.length === 0 && $SM.get('game.buildings["trading post"]', true) > 0) {
|
||||
buySection = $('<div>').attr('id', 'buyBtns').css('opacity', 0);
|
||||
bNeedsAppend = true;
|
||||
}
|
||||
@@ -1113,7 +1113,7 @@ var Room = {
|
||||
} else if(e.category == 'income'){
|
||||
Room.updateStoresView();
|
||||
Room.updateIncomeView();
|
||||
} else if(e.stateName.indexOf('game.buildings') == 0){
|
||||
} else if(e.stateName.indexOf('game.buildings') === 0){
|
||||
Room.updateBuildButtons();
|
||||
}
|
||||
}
|
||||
|
||||
+20
-16
@@ -136,7 +136,7 @@ var Space = {
|
||||
t.remove();
|
||||
Space.hull--;
|
||||
Space.updateHull();
|
||||
if(Space.hull == 0) {
|
||||
if(Space.hull === 0) {
|
||||
Space.crash();
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,7 @@ var Space = {
|
||||
}
|
||||
|
||||
if(!Space.done) {
|
||||
setTimeout(Space.createAsteroid, 1000 - (Space.altitude * 10));
|
||||
Engine.setTimeout(Space.createAsteroid, 1000 - (Space.altitude * 10));
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -190,7 +190,7 @@ var Space = {
|
||||
dx += Space.getSpeed();
|
||||
}
|
||||
|
||||
if(dx != 0 && dy != 0) {
|
||||
if(dx !== 0 && dy !== 0) {
|
||||
dx = dx / Math.sqrt(2);
|
||||
dy = dy / Math.sqrt(2);
|
||||
}
|
||||
@@ -226,13 +226,15 @@ var Space = {
|
||||
},
|
||||
|
||||
startAscent: function() {
|
||||
var body_color;
|
||||
var to_color;
|
||||
if (Engine.isLightsOff()) {
|
||||
var body_color = '#272823';
|
||||
var to_color = '#EEEEEE';
|
||||
body_color = '#272823';
|
||||
to_color = '#EEEEEE';
|
||||
}
|
||||
else {
|
||||
var body_color = '#FFFFFF';
|
||||
var to_color = '#000000';
|
||||
body_color = '#FFFFFF';
|
||||
to_color = '#000000';
|
||||
}
|
||||
|
||||
$('body').addClass('noMask').css({backgroundColor: body_color}).animate({
|
||||
@@ -251,7 +253,7 @@ var Space = {
|
||||
Space.drawStars();
|
||||
Space._timer = setInterval(function() {
|
||||
Space.altitude += 1;
|
||||
if(Space.altitude % 10 == 0) {
|
||||
if(Space.altitude % 10 === 0) {
|
||||
Space.setTitle();
|
||||
}
|
||||
if(Space.altitude > 60) {
|
||||
@@ -259,7 +261,7 @@ var Space = {
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
Space._panelTimeout = setTimeout(function() {
|
||||
Space._panelTimeout = Engine.setTimeout(function() {
|
||||
if (Engine.isLightsOff())
|
||||
$('#spacePanel, .menu, select.menuBtn').animate({color: '#272823'}, 500, 'linear');
|
||||
else
|
||||
@@ -313,7 +315,7 @@ var Space = {
|
||||
left: left
|
||||
}).appendTo(el2);
|
||||
if(num < Space.NUM_STARS) {
|
||||
setTimeout(function() { Space.drawStarAsync(el, el2, num + 1); }, 100);
|
||||
Engine.setTimeout(function() { Space.drawStarAsync(el, el2, num + 1); }, 100);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -324,10 +326,11 @@ var Space = {
|
||||
clearInterval(Space._timer);
|
||||
clearInterval(Space._shipTimer);
|
||||
clearTimeout(Space._panelTimeout);
|
||||
var body_color;
|
||||
if (Engine.isLightsOff())
|
||||
var body_color = '#272823';
|
||||
body_color = '#272823';
|
||||
else
|
||||
var body_color = '#FFFFFF';
|
||||
body_color = '#FFFFFF';
|
||||
// Craaaaash!
|
||||
$('body').removeClass('noMask').stop().animate({
|
||||
backgroundColor: body_color
|
||||
@@ -382,7 +385,7 @@ var Space = {
|
||||
top: '350px',
|
||||
left: '240px'
|
||||
}, 3000, 'linear', function() {
|
||||
setTimeout(function() {
|
||||
Engine.setTimeout(function() {
|
||||
Space.ship.animate({
|
||||
top: '-100px'
|
||||
}, 200, 'linear', function() {
|
||||
@@ -390,12 +393,13 @@ var Space = {
|
||||
$('#outerSlider').css({'left': '0px', 'top': '0px'});
|
||||
$('#locationSlider, #worldPanel, #spacePanel, #notifications').remove();
|
||||
$('#header').empty();
|
||||
setTimeout(function() {
|
||||
Engine.setTimeout(function() {
|
||||
$('body').stop();
|
||||
var container_color;
|
||||
if (Engine.isLightsOff())
|
||||
var container_color = '#EEE';
|
||||
container_color = '#EEE';
|
||||
else
|
||||
var container_color = '#000';
|
||||
container_color = '#000';
|
||||
$('#starsContainer').animate({
|
||||
opacity: 0,
|
||||
'background-color': container_color
|
||||
|
||||
+22
-22
@@ -41,7 +41,7 @@ var StateManager = {
|
||||
|
||||
for(var which in cats) {
|
||||
if(!$SM.get(cats[which])) $SM.set(cats[which], {});
|
||||
};
|
||||
}
|
||||
|
||||
//subscribe to stateUpdates
|
||||
$.Dispatch('stateUpdate').subscribe($SM.handleStateUpdates);
|
||||
@@ -52,11 +52,11 @@ var StateManager = {
|
||||
var words = stateName.split(/[.\[\]'"]+/);
|
||||
//for some reason there are sometimes empty strings
|
||||
for (var i = 0; i < words.length; i++) {
|
||||
if (words[i] == '') {
|
||||
if (words[i] === '') {
|
||||
words.splice(i, 1);
|
||||
i--;
|
||||
}
|
||||
};
|
||||
}
|
||||
var obj = State;
|
||||
var w = null;
|
||||
for(var i=0, len=words.length-1;i<len;i++){
|
||||
@@ -84,7 +84,7 @@ var StateManager = {
|
||||
}
|
||||
|
||||
//stores values can not be negative
|
||||
if(stateName.indexOf('stores') == 0 && $SM.get(stateName, true) < 0) {
|
||||
if(stateName.indexOf('stores') === 0 && $SM.get(stateName, true) < 0) {
|
||||
eval('('+fullPath+') = 0');
|
||||
Engine.log('WARNING: state:' + stateName + ' can not be a negative value. Set to 0 instead.');
|
||||
}
|
||||
@@ -100,7 +100,7 @@ var StateManager = {
|
||||
$SM.buildPath(parentName);
|
||||
|
||||
//make sure the state exists to avoid errors,
|
||||
if($SM.get(parentName) == undefined) $SM.set(parentName, {}, true);
|
||||
if($SM.get(parentName) === undefined) $SM.set(parentName, {}, true);
|
||||
|
||||
for(var k in list){
|
||||
$SM.set(parentName+'["'+k+'"]', list[k], true);
|
||||
@@ -140,7 +140,7 @@ var StateManager = {
|
||||
var err = 0;
|
||||
|
||||
//make sure the parent exists to avoid errors
|
||||
if($SM.get(parentName) == undefined) $SM.set(parentName, {}, true);
|
||||
if($SM.get(parentName) === undefined) $SM.set(parentName, {}, true);
|
||||
|
||||
for(var k in list){
|
||||
if($SM.add(parentName+'["'+k+'"]', list[k], true)) err++;
|
||||
@@ -188,7 +188,7 @@ var StateManager = {
|
||||
if(!noEvent){
|
||||
Engine.saveGame();
|
||||
$SM.fireUpdate(stateName);
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
//creates full reference from input
|
||||
@@ -231,7 +231,7 @@ var StateManager = {
|
||||
$SM.remove('income.hunter', true);
|
||||
Engine.log('upgraded save to v1.1');
|
||||
version = 1.1;
|
||||
};
|
||||
}
|
||||
if(version == 1.1) {
|
||||
//v1.2 added the Swamp to the map, so add it to already generated maps
|
||||
if($SM.get('world')) {
|
||||
@@ -239,7 +239,7 @@ var StateManager = {
|
||||
}
|
||||
Engine.log('upgraded save to v1.2');
|
||||
version = 1.2;
|
||||
};
|
||||
}
|
||||
if(version == 1.2) {
|
||||
//StateManager added, so move data to new locations
|
||||
$SM.remove('room.fire');
|
||||
@@ -249,7 +249,7 @@ var StateManager = {
|
||||
$SM.set('features.location.room', true);
|
||||
$SM.set('game.builder.level', $SM.get('room.builder'));
|
||||
$SM.remove('room');
|
||||
};
|
||||
}
|
||||
if($SM.get('outside')){
|
||||
$SM.set('features.location.outside', true);
|
||||
$SM.set('game.population', $SM.get('outside.population'));
|
||||
@@ -257,7 +257,7 @@ var StateManager = {
|
||||
$SM.set('game.workers', $SM.get('outside.workers'));
|
||||
$SM.set('game.outside.seenForest', $SM.get('outside.seenForest'));
|
||||
$SM.remove('outside');
|
||||
};
|
||||
}
|
||||
if($SM.get('world')){
|
||||
$SM.set('features.location.world', true);
|
||||
$SM.set('game.world.map', $SM.get('world.map'));
|
||||
@@ -267,7 +267,7 @@ var StateManager = {
|
||||
$SM.remove('world');
|
||||
$SM.remove('starved');
|
||||
$SM.remove('dehydrated');
|
||||
};
|
||||
}
|
||||
if($SM.get('ship')){
|
||||
$SM.set('features.location.spaceShip', true);
|
||||
$SM.set('game.spaceShip.hull', $SM.get('ship.hull', true));
|
||||
@@ -275,29 +275,29 @@ var StateManager = {
|
||||
$SM.set('game.spaceShip.seenWarning', $SM.get('ship.seenWarning'));
|
||||
$SM.set('game.spaceShip.seenShip', $SM.get('ship.seenShip'));
|
||||
$SM.remove('ship');
|
||||
};
|
||||
}
|
||||
if($SM.get('punches')){
|
||||
$SM.set('character.punches', $SM.get('punches'));
|
||||
$SM.remove('punches');
|
||||
};
|
||||
}
|
||||
if($SM.get('perks')){
|
||||
$SM.set('character.perks', $SM.get('perks'));
|
||||
$SM.remove('perks');
|
||||
};
|
||||
}
|
||||
if($SM.get('thieves')){
|
||||
$SM.set('game.thieves', $SM.get('thieves'));
|
||||
$SM.remove('thieves');
|
||||
};
|
||||
}
|
||||
if($SM.get('stolen')){
|
||||
$SM.set('game.stolen', $SM.get('stolen'));
|
||||
$SM.remove('stolen');
|
||||
};
|
||||
}
|
||||
if($SM.get('cityCleared')){
|
||||
$SM.set('character.cityCleared', $SM.get('cityCleared'));
|
||||
$SM.remove('cityCleared');
|
||||
};
|
||||
}
|
||||
$SM.set('version', 1.3);
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
/******************************************************************
|
||||
@@ -356,7 +356,7 @@ var StateManager = {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(ok){
|
||||
$SM.addM('stores', income.stores, true);
|
||||
}
|
||||
@@ -369,7 +369,7 @@ var StateManager = {
|
||||
}
|
||||
if(changed){
|
||||
$SM.fireUpdate('income', true);
|
||||
};
|
||||
}
|
||||
Engine._incomeTimeout = setTimeout($SM.collectIncome, 1000);
|
||||
},
|
||||
|
||||
@@ -384,7 +384,7 @@ var StateManager = {
|
||||
} else {
|
||||
$SM.add('game.stolen["'+k+'"]', stores[k] * -1);
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
startThieves: function() {
|
||||
|
||||
+15
-15
@@ -243,7 +243,7 @@ var World = {
|
||||
|
||||
// Add water
|
||||
var water = $('div#supply_water');
|
||||
if(World.water > 0 && water.length == 0) {
|
||||
if(World.water > 0 && water.length === 0) {
|
||||
water = World.createItemDiv('water', World.water);
|
||||
water.prependTo(supplies);
|
||||
} else if(World.water > 0) {
|
||||
@@ -257,7 +257,7 @@ var World = {
|
||||
var item = $('div#supply_' + k.replace(' ', '-'), supplies);
|
||||
var num = Path.outfit[k];
|
||||
total += num * Path.getWeight(k);
|
||||
if(num > 0 && item.length == 0) {
|
||||
if(num > 0 && item.length === 0) {
|
||||
item = World.createItemDiv(k, num);
|
||||
if(k == 'cured meat' && World.water > 0) {
|
||||
item.insertAfter(water);
|
||||
@@ -410,11 +410,11 @@ var World = {
|
||||
checkDanger: function() {
|
||||
World.danger = typeof World.danger == 'undefined' ? false: World.danger;
|
||||
if(!World.danger) {
|
||||
if(!$SM.get('stores["i armour"]', true) > 0 && World.getDistance() >= 8) {
|
||||
if($SM.get('stores["i armour"]', true) === 0 && World.getDistance() >= 8) {
|
||||
World.danger = true;
|
||||
return true;
|
||||
}
|
||||
if(!$SM.get('stores["s armour"]', true) > 0 && World.getDistance() >= 18) {
|
||||
if($SM.get('stores["s armour"]', true) === 0 && World.getDistance() >= 18) {
|
||||
World.danger = true;
|
||||
return true;
|
||||
}
|
||||
@@ -441,7 +441,7 @@ var World = {
|
||||
World.foodMove = 0;
|
||||
var num = Path.outfit['cured meat'];
|
||||
num--;
|
||||
if(num == 0) {
|
||||
if(num === 0) {
|
||||
Notifications.notify(World, _('the meat has run out'));
|
||||
} else if(num < 0) {
|
||||
// Starvation! Hooray!
|
||||
@@ -471,7 +471,7 @@ var World = {
|
||||
World.waterMove = 0;
|
||||
var water = World.water;
|
||||
water--;
|
||||
if(water == 0) {
|
||||
if(water === 0) {
|
||||
Notifications.notify(World, _('there is no more water'));
|
||||
} else if(water < 0) {
|
||||
water = 0;
|
||||
@@ -754,7 +754,7 @@ var World = {
|
||||
|
||||
drawMap: function() {
|
||||
var map = $('#map');
|
||||
if(map.length == 0) {
|
||||
if(map.length === 0) {
|
||||
map = new $('<div>').attr('id', 'map').appendTo('#worldOuter');
|
||||
// register click handler
|
||||
map.click(World.click);
|
||||
@@ -818,12 +818,12 @@ var World = {
|
||||
Engine.activeModule = Room;
|
||||
$('div.headerButton').removeClass('selected');
|
||||
Room.tab.addClass('selected');
|
||||
setTimeout(function(){
|
||||
Engine.setTimeout(function(){
|
||||
Room.onArrival();
|
||||
$('#outerSlider').animate({opacity:'1'}, 600, 'linear');
|
||||
Button.cooldown($('#embarkButton'));
|
||||
Engine.keyLock = false;
|
||||
}, 2000);
|
||||
}, 2000, true);
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -831,15 +831,15 @@ var World = {
|
||||
goHome: function() {
|
||||
// Home safe! Commit the changes.
|
||||
$SM.setM('game.world', World.state);
|
||||
if(World.state.sulphurmine && $SM.get('game.buildings["sulphur mine"]', true) == 0) {
|
||||
if(World.state.sulphurmine && $SM.get('game.buildings["sulphur mine"]', true) === 0) {
|
||||
$SM.add('game.buildings["sulphur mine"]', 1);
|
||||
Engine.event('progress', 'sulphur mine');
|
||||
}
|
||||
if(World.state.ironmine && $SM.get('game.buildings["iron mine"]', true) == 0) {
|
||||
if(World.state.ironmine && $SM.get('game.buildings["iron mine"]', true) === 0) {
|
||||
$SM.add('game.buildings["iron mine"]', 1);
|
||||
Engine.event('progress', 'iron mine');
|
||||
}
|
||||
if(World.state.coalmine && $SM.get('game.buildings["coal mine"]', true) == 0) {
|
||||
if(World.state.coalmine && $SM.get('game.buildings["coal mine"]', true) === 0) {
|
||||
$SM.add('game.buildings["coal mine"]', 1);
|
||||
Engine.event('progress', 'coal mine');
|
||||
}
|
||||
@@ -868,8 +868,8 @@ var World = {
|
||||
},
|
||||
|
||||
leaveItAtHome: function(thing) {
|
||||
return thing != 'cured meat' && thing != 'bullets' && thing != 'energy cell' && thing != 'charm' && thing != 'medicine'
|
||||
&& typeof World.Weapons[thing] == 'undefined' && typeof Room.Craftables[thing] == 'undefined';
|
||||
return thing != 'cured meat' && thing != 'bullets' && thing != 'energy cell' && thing != 'charm' && thing != 'medicine' &&
|
||||
typeof World.Weapons[thing] == 'undefined' && typeof Room.Craftables[thing] == 'undefined';
|
||||
},
|
||||
|
||||
getMaxHealth: function() {
|
||||
@@ -905,7 +905,7 @@ var World = {
|
||||
x = typeof x == 'number' ? x : World.curPos[0];
|
||||
y = typeof y == 'number' ? y : World.curPos[1];
|
||||
var used = World.usedOutposts[x + ',' + y];
|
||||
return typeof used != 'undefined' && used == true;
|
||||
return typeof used != 'undefined' && used === true;
|
||||
},
|
||||
|
||||
useOutpost: function() {
|
||||
|
||||
Reference in New Issue
Block a user