mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-06-30 00:02:29 +08:00
Merge pull request #10 from dmnd/master
Add an 'eat meat' button to the loot screen
This commit is contained in:
+23
-11
@@ -103,22 +103,32 @@ var Events = {
|
|||||||
Events.createAttackButton('fists').prependTo(btns);
|
Events.createAttackButton('fists').prependTo(btns);
|
||||||
}
|
}
|
||||||
|
|
||||||
var eat = new Button.Button({
|
Events.createEatMeatButton().appendTo(btns);
|
||||||
id: 'eat',
|
|
||||||
text: 'eat meat',
|
|
||||||
cooldown: Events._EAT_COOLDOWN,
|
|
||||||
click: Events.eatMeat,
|
|
||||||
cost: { 'cured meat': 1 }
|
|
||||||
}).appendTo(btns);
|
|
||||||
|
|
||||||
if(Path.outfit['cured meat'] == 0) {
|
|
||||||
Button.setDisabled(eat, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up the enemy attack timer
|
// Set up the enemy attack timer
|
||||||
Events._enemyAttackTimer = setTimeout(Events.enemyAttack, scene.attackDelay * 1000);
|
Events._enemyAttackTimer = setTimeout(Events.enemyAttack, scene.attackDelay * 1000);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
createEatMeatButton: function(cooldown) {
|
||||||
|
if (cooldown == null) {
|
||||||
|
cooldown = Events._EAT_COOLDOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
var btn = new Button.Button({
|
||||||
|
id: 'eat',
|
||||||
|
text: 'eat meat',
|
||||||
|
cooldown: cooldown,
|
||||||
|
click: Events.eatMeat,
|
||||||
|
cost: { 'cured meat': 1 }
|
||||||
|
});
|
||||||
|
|
||||||
|
if(Path.outfit['cured meat'] == 0) {
|
||||||
|
Button.setDisabled(btn, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return btn;
|
||||||
|
},
|
||||||
|
|
||||||
createAttackButton: function(weaponName) {
|
createAttackButton: function(weaponName) {
|
||||||
var weapon = World.Weapons[weaponName];
|
var weapon = World.Weapons[weaponName];
|
||||||
var cd = weapon.cooldown;
|
var cd = weapon.cooldown;
|
||||||
@@ -410,6 +420,8 @@ var Events = {
|
|||||||
},
|
},
|
||||||
text: 'leave'
|
text: 'leave'
|
||||||
}).appendTo(btns);
|
}).appendTo(btns);
|
||||||
|
|
||||||
|
Events.createEatMeatButton(0).appendTo(btns);
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
// It is possible to die and win if the timing is perfect. Just let it fail.
|
// It is possible to die and win if the timing is perfect. Just let it fail.
|
||||||
|
|||||||
Reference in New Issue
Block a user