Advertisement
Chronos_Ouroboros

SetInventoryMax?

Apr 23rd, 2015
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. case ACSF_SetInventoryMax:
  2. if (activator != NULL)
  3. {
  4. const char *type = FBehavior::StaticLookupString(args[0]);
  5. int amount = argCount >= 2? args[1] : -1;
  6. const PClass *cls = PClass::FindClass(type);
  7. AInventory *item;
  8.  
  9. if (cls != NULL && cls->IsDescendantOf (RUNTIME_CLASS(AInventory)))
  10. {
  11. item = activator->FindInventory (cls);
  12. if (item != NULL)
  13. {
  14. item->ItemFlags &= IF_KEEPDEPLETED;
  15. item->MaxAmount = amount;
  16. }
  17. else
  18. {
  19. item = activator->GiveInventoryType (cls);
  20. item->ItemFlags &= IF_KEEPDEPLETED;
  21. item->MaxAmount = amount;
  22. item->Amount = 0;
  23. }
  24. }
  25. }
  26. break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement