Advertisement
Forecaster

railcraft functions

Feb 22nd, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. function fuelUsage($maxHeat, $heatLevel, $numTanks, $type)
  2. {
  3.   $temp = $heatLevel / $maxHeat;
  4.  
  5.   $base = ((6.4 - $numTanks * 0.08) / $type) * $numTanks;
  6.  
  7.   $fuelUsage = $base + $base * (8 - 8 * $temp);
  8.  
  9.   return $fuelUsage;
  10. }
  11.  
  12. function increaseHeat($heatLevel, $numTanks, $maxHeat, $heatStep)
  13. {
  14.   $change = $heatStep;
  15.   if ($heatLevel < 0.25)
  16.   {
  17.     $change += $heatStep;
  18.   }
  19.   if ($heatLevel < 0.5)
  20.   {
  21.     $change += $heatStep;
  22.   }
  23.   if ($heatLevel < 0.75)
  24.   {
  25.     $change += $heatStep;
  26.   }
  27.   $change /= $numTanks;
  28.   $heatLevel += $change;
  29.   $heatLevel = min($heatLevel, $maxHeat);
  30.  
  31.   return $heatLevel;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement