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 */
title: 'An Underground Cache',
title: 'A Destroyed Village',
scenes: {
'start': {
text: [
'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.',
buttons: {
@@ -3415,7 +3415,7 @@ Events.Setpieces = {
},
'underground': {
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.'
],
buttons: {
@@ -3432,6 +3432,7 @@ Events.Setpieces = {
],
onLoad: function() {
World.markVisited(World.curPos[0], World.curPos[1]);
Prestige.load();
},
buttons: {
'leave': {
+7 -1
View File
@@ -11,7 +11,7 @@ var Prestige = {
},
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["fur"]'), // randGen('g'),
$SM.get('stores["meat"]'), // randGen('g'),
@@ -37,9 +37,15 @@ var Prestige = {
$SM.get('stores["grenade"]'), // randGen('a'),
$SM.get('stores["bolas"]') // randGen('a')
];
$SM.set('previous.stores', prevStores);
return prevStores;
},
load: function() {
var prevStores = $SM.get('previous.stores');
return prevStores;
}
/*randGen: function(storeType) {
if (storeType == 'g') {
divisor = Math.floor(Math.random()*10)
+2
View File
@@ -387,10 +387,12 @@ var Space = {
},
complete: function() {
Prestige.save();
backup = $SM.get('previous.stores');
$('#starsContainer').remove();
if(typeof Storage != 'undefined' && localStorage) {
localStorage.clear();
}
$SM.set('previous.stores',backup);
delete window.State;
Engine.options = {};
}