jpcsupplies / Economy_mod

Basic Economy System for Space Engineers
13 stars 12 forks source link

Find way to use worth command from another server mod/plugin. #191

Closed foogs closed 3 years ago

foogs commented 5 years ago

Find way to use worth command from another server mod/plugin. How? need something

jpcsupplies commented 5 years ago

Hmm.. you could try duplicating the worth code in another mod of your own, ie Have it read the pricing data from the data file. Have it scan in the blocks and inventory of an item, to tally up the components used/stored Have it add up the value of those components based on the pricing data you previously loaded.

Only downside to this approach is price changes to components since last server restart might not be current.

If this mod of your own also needs to generate transactions and payments, you can interact directly with economy to pay/bill players directly via our API here (you include the api code in your mod): https://github.com/jpcsupplies/Economy_mod/tree/master/EconomyAPI

Another approach used by another modder was to read the price table direct from a pricing LCD and use that to calculate values in their own script.