Quantcast

Added recipe methods SetRequiredFaction() and RequiredFaction()

James D. Callahan III [03-11-11 - 08:20]
Added recipe methods SetRequiredFaction() and RequiredFaction()
Filename
Recipe.lua
diff --git a/Recipe.lua b/Recipe.lua
index aae55ab..698d75b 100644
--- a/Recipe.lua
+++ b/Recipe.lua
@@ -145,6 +145,22 @@ function recipe_prototype:Specialty()
 	return self.specialty
 end

+function recipe_prototype:SetRequiredFaction(faction_name)
+	self.required_faction = faction_name
+
+	if faction_name and private.Player.faction ~= BFAC[faction_name] then
+		self.is_ignored = true
+	end
+
+	if self.is_ignored then
+		private.num_recipes[self.profession] = (private.num_recipes[self.profession] or 0) - 1
+	end
+end
+
+function recipe_prototype:RequiredFaction()
+	return self.required_faction
+end
+
 function recipe_prototype:HasState(state_name)
 	return self.state and (bit.band(self.state, SF[state_name]) == SF[state_name]) or false
 end