mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-05-28 08:11:54 +08:00
Merge pull request #39 from toofarapart/improved_item_dropping
events.js: Item dropping improvements
This commit is contained in:
+9
-2
@@ -526,7 +526,6 @@ var Events = {
|
|||||||
Path.outfit[thing] -= num;
|
Path.outfit[thing] -= num;
|
||||||
Events.getLoot(btn.closest('.button'));
|
Events.getLoot(btn.closest('.button'));
|
||||||
World.updateSupplies();
|
World.updateSupplies();
|
||||||
$('#dropMenu').remove();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getLoot: function(btn) {
|
getLoot: function(btn) {
|
||||||
@@ -548,6 +547,7 @@ var Events = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
// #dropMenu gets removed by this.
|
||||||
btn.text(name + ' [' + num + ']');
|
btn.text(name + ' [' + num + ']');
|
||||||
}
|
}
|
||||||
var curNum = Path.outfit[name];
|
var curNum = Path.outfit[name];
|
||||||
@@ -555,7 +555,14 @@ var Events = {
|
|||||||
curNum++;
|
curNum++;
|
||||||
Path.outfit[name] = curNum;
|
Path.outfit[name] = curNum;
|
||||||
World.updateSupplies();
|
World.updateSupplies();
|
||||||
} else {
|
|
||||||
|
// Update weight and free space variables so we can decide
|
||||||
|
// whether or not to bring up/update the drop menu.
|
||||||
|
weight = Path.getWeight(name);
|
||||||
|
freeSpace = Path.getFreeSpace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(weight > freeSpace && btn.data('numLeft') > 0) {
|
||||||
// Draw the drop menu
|
// Draw the drop menu
|
||||||
Engine.log('drop menu');
|
Engine.log('drop menu');
|
||||||
$('#dropMenu').remove();
|
$('#dropMenu').remove();
|
||||||
|
|||||||
Reference in New Issue
Block a user