Skip to content

Commit

Permalink
set down framework, storage/map gen/etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vermilingua committed Oct 16, 2013
1 parent 36b9cf2 commit acc04d0
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 7 deletions.
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<meta itemprop="name" property="og:title" content="A Dark Room" />
<link rel="shortcut icon" href="favicon.ico" />
<link rel="image_src" href="img/adr.png" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<!-- <script src="lib/jquery.min.js"></script> -->
<!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> -->
<script src="lib/jquery.min.js"></script>
<script src="lib/jquery.color-2.1.2.min.js"></script>
<script src="lib/jquery.event.move.js"></script>
<script src="lib/jquery.event.swipe.js"></script>
Expand All @@ -32,6 +32,7 @@
<script src="script/path.js"></script>
<script src="script/ship.js"></script>
<script src="script/space.js"></script>
<script src="script/prestige.js"></script>
<!-- Event modules -->
<script src="script/events/global.js"></script>
<script src="script/events/room.js"></script>
Expand Down
6 changes: 6 additions & 0 deletions lib/jquery.min.js

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions script/events/setpieces.js
Original file line number Diff line number Diff line change
Expand Up @@ -3392,5 +3392,54 @@ Events.Setpieces = {
}
}
}
},
"cache": { /* Cache - contains some of supplies from previous game */
title: 'An Underground Cache',
scenes: {
'start': {
text: [
'a destroyed village stands before you',
'with bodies littering the ground.'
],
notification: 'you smell the metallic tang of a wanderer afterburner.',
buttons: {
'enter': {
text: 'enter',
nextScene: {1: 'underground'}
},
'leave': {
text: 'leave',
nextScene: 'end'
}
}
},
'underground': {
text: [
'a small shack stands at the center of the village.',
'there are still supplies inside.'
],
buttons: {
'take': {
text: 'take',
nextScene: {1: 'exit'}
}
}
},
'exit': {
text: [
'all the work of a previous generation is here.',
'ripe for the picking.'
],
onLoad: function() {
World.markVisited(World.curPos[0], World.curPos[1]);
},
buttons: {
'leave': {
text: 'leave',
nextScene: 'end'
}
}
}
}
}
};
60 changes: 60 additions & 0 deletions script/prestige.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
var Prestige = {
name: 'Prestige',

options: {},

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

save: function() {
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'),
$SM.get('stores["iron"]'), // randGen('g'),
$SM.get('stores["coal"]'), // randGen('g'),
$SM.get('stores["sulphur"]'), // randGen('g'),
$SM.get('stores["steel"]'), // randGen('g'),
$SM.get('stores["cured meat"]'), // randGen('g'),
$SM.get('stores["scales"]'), // randGen('g'),
$SM.get('stores["teeth"]'), // randGen('g'),
$SM.get('stores["leather"]'), // randGen('g'),
$SM.get('stores["bait"]'), // randGen('g'),
$SM.get('stores["torch"]'), // randGen('g'),
$SM.get('stores["cloth"]'), // randGen('g'),
$SM.get('stores["bone spear"]'), // randGen('w'),
$SM.get('stores["iron sword"]'), // randGen('w'),
$SM.get('stores["steel sword"]'), // randGen('w'),
$SM.get('stores["bayonet"]'), // randGen('w'),
$SM.get('stores["rifle"]'), // randGen('w'),
$SM.get('stores["laser rifle"]'), // randGen('w'),
$SM.get('stores["bullets"]'), // randGen('a'),
$SM.get('stores["energy cell"]'), // randGen('a'),
$SM.get('stores["grenade"]'), // randGen('a'),
$SM.get('stores["bolas"]') // randGen('a')
];
return prevStores;
},

/*randGen: function(storeType) {
if (storeType == 'g') {
divisor = Math.floor(Math.random()*10)
}
else if (storeType == 'w') {
divisor = Math.floor(Math.floor(Math.random()*10)/2)
}
else if (storeType == 'a') {
divisor = Math.floor(Math.random()*10*Math.floor(Math.random()*10/5))
}
else { divisor = 1 };
if (divisor === 0) {
divisor = 1
};
return divisor;
}*/

}
1 change: 1 addition & 0 deletions script/space.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ var Space = {
$('#notifyGradient').attr('style', 'background-color:'+cur+';background:-webkit-' + s + ';background:' + s);
},
complete: function() {
Prestige.save();
$('#starsContainer').remove();
if(typeof Storage != 'undefined' && localStorage) {
localStorage.clear();
Expand Down
12 changes: 7 additions & 5 deletions script/world.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ var World = {
SHIP: 'W',
BOREHOLE: 'B',
BATTLEFIELD: 'F',
SWAMP: 'M'
SWAMP: 'M',
CACHE: 'U'
},
TILE_PROBS: {},
LANDMARKS: {},
Expand Down Expand Up @@ -123,10 +124,11 @@ var World = {
World.LANDMARKS[World.TILE.CAVE] = { num: 5, minRadius: 3, maxRadius: 10, scene: 'cave', label: 'A&nbsp;Damp&nbsp;Cave' };
World.LANDMARKS[World.TILE.TOWN] = { num: 10, minRadius: 10, maxRadius: 20, scene: 'town', label: 'An&nbsp;Abandoned&nbsp;Town' };
World.LANDMARKS[World.TILE.CITY] = { num: 20, minRadius: 20, maxRadius: World.RADIUS * 1.5, scene: 'city', label: 'A&nbsp;Ruined&nbsp;City' };
World.LANDMARKS[World.TILE.SHIP] = {num: 1, minRadius: 28, maxRadius: 28, scene: 'ship', label: 'A&nbsp;Crashed&nbsp;Starship'};
World.LANDMARKS[World.TILE.BOREHOLE] = {num: 10, minRadius: 15, maxRadius: World.RADIUS * 1.5, scene: 'borehole', label: 'A&nbsp;Borehole'};
World.LANDMARKS[World.TILE.BATTLEFIELD] = {num: 5, minRadius: 18, maxRadius: World.RADIUS * 1.5, scene: 'battlefield', label: 'A&nbsp;Battlefield'};
World.LANDMARKS[World.TILE.SWAMP] = {num: 1, minRadius: 15, maxRadius: World.RADIUS * 1.5, scene: 'swamp', label: 'A&nbsp;Murky&nbsp;Swamp'};
World.LANDMARKS[World.TILE.SHIP] = { num: 1, minRadius: 28, maxRadius: 28, scene: 'ship', label: 'A&nbsp;Crashed&nbsp;Starship'};
World.LANDMARKS[World.TILE.BOREHOLE] = { num: 10, minRadius: 15, maxRadius: World.RADIUS * 1.5, scene: 'borehole', label: 'A&nbsp;Borehole'};
World.LANDMARKS[World.TILE.BATTLEFIELD] = { num: 5, minRadius: 18, maxRadius: World.RADIUS * 1.5, scene: 'battlefield', label: 'A&nbsp;Battlefield'};
World.LANDMARKS[World.TILE.SWAMP] = { num: 1, minRadius: 15, maxRadius: World.RADIUS * 1.5, scene: 'swamp', label: 'A&nbsp;Murky&nbsp;Swamp'};
World.LANDMARKS[World.TILE.CACHE] = { num: 1, minRadius: 10, maxRadius: World.RADIUS * 1.5, scene: 'cache', label: 'An&nbsp;Underground&nbsp;Cache'};

if(typeof $SM.get('features.location.world') == 'undefined') {
$SM.set('features.location.world', true);
Expand Down

0 comments on commit acc04d0

Please sign in to comment.