Permalink
Browse files

Added property existence check

  • Loading branch information...
1 parent f6e59f9 commit f830b10a4971ff1f3c919d5843e8cb39eefb2be9 @quantumstate committed Apr 18, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 worker.js
View
@@ -10,7 +10,8 @@ Worker.prototype.update = function(gameState) {
var subrole = this.ent.getMetadata("subrole");
if (subrole === "gatherer"){
- if (!(this.ent.unitAIState().split(".")[1] === "GATHER" && this.getResourceType(this.ent.unitAIOrderData().type) === this.ent.getMetadata("gather-type"))
+ if (!(this.ent.unitAIState().split(".")[1] === "GATHER" && this.ent.unitAIOrderData().type
+ && this.getResourceType(this.ent.unitAIOrderData().type) === this.ent.getMetadata("gather-type"))
&& !(this.ent.unitAIState().split(".")[1] === "RETURNRESOURCE")){
// TODO: handle combat for hunting animals
Engine.ProfileStart("Start Gathering");

0 comments on commit f830b10

Please sign in to comment.