mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-05-30 01:02:00 +08:00
create and configure callback handlers for state updates
add $.Dispatch to handle object events add subscribe calls to files update SM fireUpdate to use new Dispatch There are some NaN issues right now, no time to bug hunt right now, it does kind of function though
This commit is contained in:
+7
-7
@@ -129,7 +129,7 @@ var World = {
|
||||
World.LANDMARKS[World.TILE.SWAMP] = {num: 1, minRadius: 15, maxRadius: World.RADIUS * 1.5, scene: 'swamp', label: 'A Murky Swamp'};
|
||||
|
||||
if(typeof $SM.get('features.location.world') == 'undefined') {
|
||||
$SM.set('features.location.world', true);
|
||||
$SM.set('features.location.world');
|
||||
$SM.setM('game.world', {
|
||||
map: World.generateMap(),
|
||||
mask: World.newMask()
|
||||
@@ -149,6 +149,9 @@ var World = {
|
||||
$('<div>').attr('id', 'healthCounter').appendTo(outer);
|
||||
|
||||
Engine.updateOuterSlider();
|
||||
|
||||
//subscribe to stateUpdates
|
||||
$.Dispatch('stateUpdate').subscribe(World.handleStateUpdates);
|
||||
},
|
||||
|
||||
clearDungeon: function() {
|
||||
@@ -870,7 +873,7 @@ var World = {
|
||||
return World.BASE_HEALTH + 35;
|
||||
} else if($SM.get('stores[\'i armour\']', true) > 0) {
|
||||
return World.BASE_HEALTH + 15;
|
||||
} else if($SM.get('stores[\'l armour']', true) > 0) {
|
||||
} else if($SM.get('stores[\'l armour\']', true) > 0) {
|
||||
return World.BASE_HEALTH + 5;
|
||||
}
|
||||
return World.BASE_HEALTH;
|
||||
@@ -940,8 +943,5 @@ var World = {
|
||||
|
||||
handleStateUpdates: function(e){
|
||||
|
||||
},
|
||||
};
|
||||
|
||||
//listener for StateManager update events
|
||||
$(World).on('stateUpdate', World.handleStateUpdates);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user