begin-cargo-pickup.js 691 B

12345678910111213141516171819202122232425
  1. states.push({
  2. id: "begin-cargo-pickup",
  3. button: "Pickup Cargo",
  4. action: "Gathering",
  5. duration: () => selectedItems.length * 600,
  6. step: () => selectedItems.length,
  7. requires: () => {
  8. if(selectedItems.length < 3 && isFlagEnabled('begin-cargo-requested')) {
  9. receiveMessage({name: "[mysterious signal]", id: -1, style: "dark"}, "Don't waste my time. Get all 3.");
  10. }
  11. return selectedItems.length == 3;
  12. },
  13. start: () => {
  14. play('begin-pickup-cargo-tractor');
  15. },
  16. run: () => {
  17. selectedItems.forEach(item => {
  18. userData.inCargoHold.push(item);
  19. userData.energy--;
  20. });
  21. selectedItems = [];
  22. setFlag('begin-cargo-aboard');
  23. userData.position = "begin-pickup-travel";
  24. },
  25. });