Difference between revisions of "CInventory::TakeRequirements"
From King Arthur's Gold Wiki
Shadlington (Talk | contribs) (Created page with "<onlyinclude> Removes the requirements specified in the given CBitStream this inventory. </onlyinclude> This essentially calls TakeRequirementsCombined just for this inv...") |
(No difference)
|
Revision as of 21:16, 19 August 2012
Removes the requirements specified in the given CBitStream this inventory.
This essentially calls TakeRequirementsCombined just for this inventory (passing null for the other inventory argument).
The requirements will only be removed if they exist in the inventory to begin with.
If the requirement's type was a blob and the quantity was 0, then all blobs of that type will be removed.
The requirements parameter is the CBitStream you're reading the requirements from.
void TakeRequirements(CBitStream@ requirements)
Example from Entities/Characters/Scripts/BuilderInventory.as:
case Builder::make_workshop: { CBitStream reqs, missing; AddRequirement( reqs, "blob", "mat_stone", "Stones", 10 ); if (this.hasRequirements( reqs, missing )) { // if server this.TakeRequirements( reqs ); CBlob @shopBlob = CreateBlob( "genericblock", "Entities/Workshops/Base/WorkshopWAR.cfg", 0, this.getBlob().getPosition() ); this.getBlob().Pickup( shopBlob, false ); } else { print("doesn't meet requirements"); } }
Object method of: CInventory