Ore Refinery (https://drive.google.com/uc?export=download&id=1AvYmv5-WHw0no0xiNhsCeLRzjCmSvJ02)
A cargo space compression utility mod that adds 5 new toggle abilities (Ore Refinery (https://i.imgur.com/6wVOkEZ.jpg) Rare Ore Refinery (https://i.imgur.com/mjv3pH9.png) Bio Refinery (https://i.imgur.com/Z0BVaz8.png) Volatiles Refinery(https://i.imgur.com/IO3a4ps.png)
And Food Compression (https://i.imgur.com/6Ek9VY1.png)) that refine resources found in mining stations, orbital habitats or from the Nexerelin mod mining feature by using heavy machinery and forges them into custom manufactured commodities that take up less space.
For example: To activate the Ore Refinery, manually assign the ability by right-clicking the ability toolbar on an empty space and select the icon from the drop down menu that appears.
Once activated, it refines 185 ore and 1 heavy machinery in you inventory per day and in return gives 1 custom commodity (Platinum) until the inventory is out of source materials. That shrinks 186 inventory space down to 1 space used at base level. The ability is increased by 10% for every salvage gantry in your fleet and also gets a 10% bump if you have a corrupted nanoforge or 20% for pristine in you inventory (multiple nanoforges do not stack).
The conversion image below is for the Ore Refinery ability in the above example. The math charts are for the four remaining abilities.
(https://i.imgur.com/Lodkbhc.png)
I enjoy the mining function added by NEX but always hated having to toss away low value commodities in my inventory to make room. What this does is "refine" the mined commodity in your inventory and produces these custom resources:
(https://i.imgur.com/9da7YKG.png)Platinum (base value of 2000) (https://i.imgur.com/FzqPxYu.png) Palladium (base value to 4800) (https://i.imgur.com/JTFZwFg.png) Biophotovoltaics (base value of 3000) (https://i.imgur.com/Ldrv3II.png) CompV (base value of 6250)
and (https://i.imgur.com/uC9VDeg.png) Famine Wafer Crate (base value of 2000)
The first three are equal to the base values of the mined commodity and heavy machinery used to make them as seen in the math charts above. Due to fractional integers Volatiles Refinery rounds up for a slight gain and Famine Wafer Crate rounds down for a slight loss (see chart)
I envision this mod as a space saver and the conversion ratio stays the same with the bonuses applied from gantries and nanoforges, only the amount used and made is increased not the overall value. I have balanced the output to be as near to the input in value and all new custom commodities are effected by market demand valuation using their base commodity demand.
I am always open to suggestions and respond as I see them.
If you enjoy my content, please consider buying me a coffee to keep me going! :) on Ko-Fi (https://ko-fi.com/dazs825110)!
(https://i.imgur.com/nYXN58D.png) (https://ko-fi.com/dazs825110)
Credits
Spoiler
A special thank you to Timid, the modder formerly known as Techpriest :), for allowing me to modify code from Supply Forge
Testers: IonDragonX, 6chad.noirlee9, mkire, slowpersun, Uhlang, Jaghaimo, cardgame and 5ColouredWalker- Thank you all for your input and patience as I learn to code Java
Alex for his hard work making this game and keeping it up to date all these years
Icons used are royalty free from Vectorstock.com
Current Changelog
v0.8 -Save game compatible
-Added a new ability, Food Compression, which compresses food into a new commodity Famine Wafer Crate - Lore wise, makes sense with the constant wars and invasions - TY GoldenGlory for the idea
-Updated the forum OP with the new icons and food values added to the conversion chart
-Note: with food being an even number and machinery being an odd number and having to use round numbers for food consumption, I have the conversion round down resulting in a slight loss (see chart)
-I set it to a 10 credit loss per conversion to prevent exploit but as a whole it is a gain to not have to dump food into space
-To instead round up for a 20 credit gain per conversion you can open data\config\settings.json with notepad++, or w/e java editor you prefer, navigate to "MF_FOODCost": 93, and change it to 92
Past Changelog
Spoiler
v0.7.1 -Save game compatible with v0.7
-Updated to 0.97a
V0.7 - Save game compatible with v0.65
-Darkened the icon for biophotovoltaics and gave it some depth - Player request that it was too shiny and out of place compared to the other icons
-Added a direct download link to the Version file that mod managers can use to auto-update - Ty Timid for showing me how
-Added a direct download link to the forum and discord d/l links that bypasses the google drive preview - one less step to get to the good stuff :)
-Adjusted the code to work with 0.96a
v0.65
-Added version checker support
-Replaced the cargo icons for Palladium and Compressed Volatile - TY Yunru for the donation
-Replaced the cargo icons for Biophotovoltaics and Platinum - Bashed newer hi-rez versions
v0.6
-Added compatibility with the latest version of Starsector
v0.55
-Added a new toggle ability that condenses Volatiles into a new custom commodity, Compressed Volatiles Canister or CompV for short
-Added new altered versions of royalty free icons for above from Vectorstock.com
-Tidied up all the tool tips and floating text to now show all commodities in proper lower case
v0.5
-Changed some calculations in the files so that the custom commodities show up correctly on the market tool tip -TY Jaghaimo for pointing me in the correct direction!
v0.4
-As requested, I finally figured out how to have more than one toggle ability per mod - cheer! -mkire ask and ye shall receive! :)
-Created two new commodities Palladium and Biophotovoltaics
-Added new royalty free icons for above from Vectorstock.com
-Scripted a new toggle ability for Rare Ore that converts it into Palladium
-Scripted a new toggle ability for Organics that converts them into Biophotovoltaics
-Changed the commodity valuation of Platinum to be more in line with ore -Ty slowpersun for pointing that out
v0.3
-Cleaned up the code, deleting several references and graphics for compressing other commodities.
-I tired oh I tried to get more than one toggle ability in the same mod but this is my release version and I am happy with it. :)
v0.2
-Added an all new conversion chart to the forum
-Adjusted the ratios in the formula to increase the compression for a base savings of 186 to 1
-Increased the price of Platinum to 2000 and set it's demand closer to the combination of ore and heavy machinery
v0.1
-Ready for test release
-Separated the ability from the mod Junk Yard Dogs to form it's own utility mod.
-Ore forged to Platinum a success!
-Rare Ore turned to Palladium a failure :( Keeping the resource and it's icon in the mod for future use.
-Added Platinum as a resource
-Added Palladium as a resource
-Added royalty free icons for above from Vectorstock.com
-Obtained permission from Techpriest to modify code from Supply Forge
Something is wrong with the valuations in my game - the refined rare material, palladium, is only valued at 2k on the market tabs (F1). Interestingly, despite the most expensive market listing it for 2200, I was able to sell it on Cruor for 3k. Still, though, a far cry off from the value of the combined ores listed in the OP.
Platinum is working just fine. Love the concept and am having actual fun as a miner now.
I am so glad you like the overall concept and it really makes me happy to bring joy to another mining enthusiast! :)
I did some quick testing on two stations in different parts of the sector and found the valuation much higher than what that market tooltip (F1) shows. I have found the market to be a rough guide for single pricing and not really accurate because it bases it's value as if you were selling 300 units of a commodity.
This is Palladium out in the wild: Spoiler
(https://i.imgur.com/ttaDzz6.png)
Palladium at station 1: Spoiler
(https://i.imgur.com/mzsy69R.png)
Palladium at station 2: Spoiler
(https://i.imgur.com/N45hQjP.png)
So in my game Palladium is at a base value of 4800 (pic1 top left) But you can see that in Pic 2 & 3 that price ("Sells for" price on the top left of the tooltip) does differ between the two stations from different star systems. The market values in all three pic are way off which goes to my point of it not being all that useful as a guide.
I have all three of the custom recourses set to mimic the market price of the ore used. It does lower the valuation a little because I also factor in the cost of the heavy machinery. The following is the math behind my calculations for Palladium which is representative of all three custom commodities.
A bit of a peek under the hood but I put it in spoilers because I know how popular a subject math calculations can be :)
Spoiler
The first three lines are from Starsector's core files Commodities.CSV. The last three lines are from the mod's Commodities.CSV:
(https://i.imgur.com/3WFJm0a.png)
This taken from the mod's configurations settings at data/config
"MF_OreConversionRate": 10,
"MF_OreCost": 185,
"MF_RARE_OREConversionRate": 10,
"MF_RARE_ORECost": 62,
"MF_ORGANICSConversionRate": 10,
"MF_ORGANICSCost": 95,
"MF_HeavyMachineryCost":1,
Now referring to the charts found on the OP, you can see the breakdowns of each commodity that matches the above conversion numbers.
So that being said, let's take the Palladium conversion as an example: Rare_Ore is set by starsector at 75. I have Palladium set at a base price of 75. Now multiply that by the Utility of 64 which gives it a conversion price of 4800. Now this does effect market demand because the game sees this 1 product as 64 rare ore. I originally had the custom commodities set as their own demand class non-econ commodity but as was pointed out by slowpersun it did not convert properly so I changed the conversion to use the demand class of the originating ore. This replicates the bulk value (which is always lower) of the rare ore sold at a station versus a 1 v 1.
[key HM=Heavy Machinery]
Now back to the OP charts vs the mod's configurations settings I have the RARE_ORECOST set to use 62 versus the the above UTILITY of 64 from the Commodities.CSV. The 2 difference accounts for the HM cost (HM cost 150 vs Rare ore cost 75 x2 =150). The downside of this is that HM has it's own demand and market fluctuations. I can not factor that in because I cannot do split demand classes so that fraction of the overall that represents HM does account for some loss in overall value of the Palladium.
Now the only factor I can see maybe effecting the price is that I lowered the price variability by 1 in the mod's CSV vs the game's CSV. The variability affects how price fluctuates with demand. I don't remember the exact formula, but it factors into an exponent somewhere. Variability 0 means no price variation at all. Variability 10 is something like 16x the price when no demand is met, and a comparably sharper dropoff after all demand is met. So by lowering the variability I lowered the variance fluctuation but that my not be working as intended because math is hard and I suffer from dumb brain.
Now if you read the above spoiler, OMG I give you props for your inquisitive brain! Bottom line: I do my best to take the game's algorithms and smash them with my inexperience and do my best to line them up. I am currently working on another new mod but I will pause that and look into this further and get back to you.
As always, thank you for helping me make this mod the best it can be!
Wanted to ask something.
I noticed that refining keeps using up raw resources till it runs out.
What happens when insufficient amount gets used up?
Are those resources gone or does mod remembers unfinished refining progress from previous time and resumes?
Basically if (numbers pulled out of my rear) platinum needs 100 ore, you have 140, refining gives 1 platinum but uses 140 ore, if I acquire 60 more ore and refine that, will one more platinum be made or initial 40 and later 60 ore are gone?
Conversion happens frame-by-frame using applyEffect(float amount, float level), and each frame a tiny fraction of the full day's input is subtracted and a tiny fraction of the full day's output is added. The fraction part here is important - cargo is a float value mechanically, so what you see as 5 platinum in cargo screen might be actually 5.42 platinum. So in some sense yes, I would imagine that "progress" on the refining is saved, so long as you do not sell the output before a new unit is produced, since game does not account for price of anything left over after the integer.
That said, I do have a bit of the input on code:
float supply = fleet.getCargo().getCommodityQuantity(jydr_Items.PLATINUM);
} else if(supply >= fleet.getCargo().getMaxCapacity()) {
fleet.addFloatingText("Full of Platinum", Misc.setAlpha(entity.getIndicatorColor(), 255), 0.5f);
deactivate();
}
What this part does is restricts conversion if there is more units of platinum in the cargo holds than the fleet cargo capacity itself; Not only you'll never have a situation where this happens in normal ingame conditions, the restriction itself is counterproductive since conversion process is a net shrink of cargo, so you want it running even when cargo holds are full.
So a problem I ran into was that mining stations often have 15000 to 50000 in ore, but I only had 600 cargo space, hence it took so many loads to get it done.
Would it be possible to add a to the skills the following:
if(skillOn = true && cargo>maxCargo)
{
setMaxBurn = 0
setSupplyPenalityMultiplier = 1 // or just suppInf = true
}
So I could just load the 30k and let my fleet essentially be a temporary stationary factory, instead of all the micro management.
A second thing is, I know there is a mod somewhere that has a skill which transforms metal+heavy_machine into supplies at a 0.8 cost factor. Could you please add someting like this for food and metal? Or just converting food into organics and metal into anything else.