states.push({ id: "begin-cargo-pickup", button: "Pickup Cargo", action: "Gathering", duration: () => selectedItems.length * 600, step: () => selectedItems.length, requires: () => { if(selectedItems.length < 3 && isFlagEnabled('begin-cargo-requested')) { receiveMessage({name: "[mysterious signal]", id: -1, style: "dark"}, "Don't waste my time. Get all 3."); } return selectedItems.length == 3; }, start: () => { play('begin-pickup-cargo-tractor'); }, run: () => { selectedItems.forEach(item => { userData.inCargoHold.push(item); userData.energy--; }); selectedItems = []; setFlag('begin-cargo-aboard'); userData.position = "begin-pickup-travel"; }, });