Skip to content

Commit

Permalink
Added default 'take' rejection
Browse files Browse the repository at this point in the history
  • Loading branch information
rabdill committed Mar 7, 2015
1 parent feea1b5 commit ae4ac68
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bishops_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ function checkBuiltIns(command) {
}
break;
case "take":
//if the item exists, you can take it, and you can take it from the state that it's in
if (command[1] in current["items"] && "take" in current["items"][command[1]] && current["items"][command[1]]["status"] in current["items"][command[1]]["take"]) {
// we need to save the transition message before we add the item
// to the inventory because then we'll end up losing the message before
Expand All @@ -132,7 +133,14 @@ function checkBuiltIns(command) {
inventory_add(command[1], current["items"][command[1]], 1);
message(transMessage);
return false;
} else if ("take" in current["items"][command[1]]["messages"]) {
message(current["items"][command[1]]["messages"]["take"]);
return false;
} else {
message("You can't take that.");
return false;
}
break;
case "drop":
if (command[1] in player["carrying"]) {
inventory_remove(player["carrying"][command[1]]["name"], 1);
Expand Down

0 comments on commit ae4ac68

Please sign in to comment.