started backup/loading mechanic

This commit is contained in:
Vermilingua
2013-10-13 11:53:11 +11:00
parent acc04d0780
commit 1be4d5edc5
3 changed files with 13 additions and 4 deletions
+4 -3
View File
@@ -3394,12 +3394,12 @@ Events.Setpieces = {
} }
}, },
"cache": { /* Cache - contains some of supplies from previous game */ "cache": { /* Cache - contains some of supplies from previous game */
title: 'An Underground Cache', title: 'A Destroyed Village',
scenes: { scenes: {
'start': { 'start': {
text: [ text: [
'a destroyed village stands before you', 'a destroyed village stands before you',
'with bodies littering the ground.' 'charred bodies littering the ground.'
], ],
notification: 'you smell the metallic tang of a wanderer afterburner.', notification: 'you smell the metallic tang of a wanderer afterburner.',
buttons: { buttons: {
@@ -3415,7 +3415,7 @@ Events.Setpieces = {
}, },
'underground': { 'underground': {
text: [ text: [
'a small shack stands at the center of the village.', 'a shack stands at the center of the village.',
'there are still supplies inside.' 'there are still supplies inside.'
], ],
buttons: { buttons: {
@@ -3432,6 +3432,7 @@ Events.Setpieces = {
], ],
onLoad: function() { onLoad: function() {
World.markVisited(World.curPos[0], World.curPos[1]); World.markVisited(World.curPos[0], World.curPos[1]);
Prestige.load();
}, },
buttons: { buttons: {
'leave': { 'leave': {
+7 -1
View File
@@ -11,7 +11,7 @@ var Prestige = {
}, },
save: function() { save: function() {
prevStores = [ //g = goods, w = weapons, a = ammo var prevStores = [ //g = goods, w = weapons, a = ammo
$SM.get('stores["wood"]'), // randGen('g'), $SM.get('stores["wood"]'), // randGen('g'),
$SM.get('stores["fur"]'), // randGen('g'), $SM.get('stores["fur"]'), // randGen('g'),
$SM.get('stores["meat"]'), // randGen('g'), $SM.get('stores["meat"]'), // randGen('g'),
@@ -37,9 +37,15 @@ var Prestige = {
$SM.get('stores["grenade"]'), // randGen('a'), $SM.get('stores["grenade"]'), // randGen('a'),
$SM.get('stores["bolas"]') // randGen('a') $SM.get('stores["bolas"]') // randGen('a')
]; ];
$SM.set('previous.stores', prevStores);
return prevStores; return prevStores;
}, },
load: function() {
var prevStores = $SM.get('previous.stores');
return prevStores;
}
/*randGen: function(storeType) { /*randGen: function(storeType) {
if (storeType == 'g') { if (storeType == 'g') {
divisor = Math.floor(Math.random()*10) divisor = Math.floor(Math.random()*10)
+2
View File
@@ -387,10 +387,12 @@ var Space = {
}, },
complete: function() { complete: function() {
Prestige.save(); Prestige.save();
backup = $SM.get('previous.stores');
$('#starsContainer').remove(); $('#starsContainer').remove();
if(typeof Storage != 'undefined' && localStorage) { if(typeof Storage != 'undefined' && localStorage) {
localStorage.clear(); localStorage.clear();
} }
$SM.set('previous.stores',backup);
delete window.State; delete window.State;
Engine.options = {}; Engine.options = {};
} }