cmdrmcdonald / EliteDangerousDataProvider

Apache License 2.0
133 stars 31 forks source link

Enhancement: FuelScoop #155

Closed mikelimtw closed 7 years ago

mikelimtw commented 7 years ago

Hi CmdrMcDonald,

The player journal has a FuelScoop even which calculates the amount of fuel scooped from a star and the total fuel after the scoop disengages. Can you add this information and associated variables for use in EDDI? This is useful for general traveling around the galaxy. Thanks!

Darkcyde13 commented 7 years ago

This functionality is already in EDDI. Here's the event script I use for the 'Ship refuelled' event:-

{_ Context}
{SetState('eddi_context_last_subject', 'refuelling')}
{SetState('eddi_context_last_action', 'complete')}
{SetState('eddi_context_fuel_remaining', event.total)}

{set fueltotal to ship.fueltanktotalcapacity}

{if event.source = "Market":
   {Occasionally(2,"{OneOf('{ShipName()}','Ship')}")}
   {OneOf("re-fuelled","fuel tanks topped up","tanks re-filled")}
   {Occasionally(3,"by {Humanise(event.amount)} tonnes")}
|else:
   {set total to (100/fueltotal)*event.total}
   {set amount to round((100/fueltotal)*event.amount,1)}
   {OneOf("{amount}% refuelled",
          "Refuelled by {OneOf('{amount}%','{Humanise(event.amount)} tonnes')}",
          "{OneOf('{amount}%','{Humanise(event.amount)} tonnes')} taken on board")}.
   {if total = 100:
      {Occasionally(2,"Main")}
      {Occasionally(2,"Fuel")}
      tanks at {OneOf("Maximum","100%")}
      {Occasionally(2,"capacity")}
   |else: {F("JumpFuel")}
   }
   {Occasionally(3,"{F('Honorific')}")}
}
.

Note: JumpFuel is a function I use to calculate the number of max range jumps available at the current fuel level.

In this, if you didn't buy the fuel from the market (so scooped it instead) then it tells you by how much, either as a percentage or as a tonnage amount.

mikelimtw commented 7 years ago

Hi Darkcyde13,

Thank you for your quick response! I understand what your code does, even though I don't understand the proper format for scripting in Cottle. However, I can use this to adapt some VA code to the Ship refulled event which will do essentially the same thing. Thanks for pointing out the Ship refuelled event to me. I don't know how I missed that. Thanks again!