Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2021
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function get_payment(cargo, ticks, amount, distance, cargo_aging_period) {
  2.     const transit_days = Math.min((ticks / cargo_aging_period) | 0, 255);
  3.     const days_over_days1 = Math.max(transit_days - cargo.transit_days_1, 0)
  4.     const days_over_days2 = Math.max(days_over_days1 - cargo.transit_days_2, 0)
  5.     const time_factor = Math.max(255 - days_over_days1 - days_over_days2, 31)
  6.     return (distance * amount * time_factor * cargo.initial_payment) / (1 << 21)
  7.     // return (Math.sqrt(distance) * 20 * amount * time_factor * cargo.initial_payment) / (1 << 21)
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement