Rinart73 Posted September 6, 2018 Share Posted September 6, 2018 Starting from game version 0.23 mod is moved to the Steam Workshop. Currently the biggest problem in the Avorion economy balance is the exploit that allows to construct turrets that cost billions and trillions. I'm totally not against the idea of making turrets for profit, but this profit should be reasonable. And while devs are working on the global balance (which is a hard work), I came up with a local solution of this problem. This mod allows the game to 'remember' a cost of all ingredients of a player-made turret and assembly price, so selling price will be based on that instead of vanilla price. It will only affect turrets that were created after this mod was installed. Should be compatible with 0.17.1-0.18.3. By default mod has settings that result in non-profitable turrets that cost 25% of their production price at maximum. If you want to adjust settings, look at "Configuration" section. Installation Unpack mod archive into "Avorion" folder Add following line in the end of the file "data/scripts/entity/merchants/equipmentdock.lua": if not pcall(require, "mods.TurretSellingFix.scripts.entity.merchants.equipmentdock") then print("[ERROR][TurretSellingFix]: Failed to extend equipmentdock.lua!") end Add this line in the end of the file "data/scripts/entity/merchants/turretfactory.lua": if not pcall(require, "mods.TurretSellingFix.scripts.entity.merchants.turretfactory") then print("[ERROR][TurretSellingFix]: Failed to extend turretfactory.lua!") end And this line in the end of the file "data/scripts/entity/merchants/researchstation.lua": if not pcall(require, "mods.TurretSellingFix.scripts.entity.merchants.researchstation") then print("[ERROR][TurretSellingFix]: Failed to extend researchstation.lua!") end Uninstallation Remove the lines that you added during the installation Delete "TurretSellingFix" folder from the "mods" folder Known issues (Minor UI) Empty line will appear in the turret descriptions. There is no way to hide it or fixate it's position Compatibility (2, new info as of 16.09.18) Extended Turret Factory - should be compatible if Turret Selling Fix will be installed after it. If you're using version 0.1.1, you'll need to install a patch from this post. Auto Research - should be compatible if Turret Selling Fix will be installed after it. Incompatible with any mod that allows to change turrets after they were built (Weapon Engineering for example). Please message me if you're dev of the mod. Mod overrides following functions: data/scripts/entity/merchants/turretfactory.lua buildTurret data/scripts/entity/merchants/equipmentdock.lua EquipmentDock.shop:updateBuyGui EquipmentDock.shop:updateBuybackGui EquipmentDock.shop:buyFromPlayer EquipmentDock.shop:buyTrashFromPlayer EquipmentDock.shop:sellBackToPlayer data/scripts/entity/merchants/researchstation.lua transform Mod extends following functions: data/scripts/entity/merchants/turretfactory.lua makeTurret data/scripts/entity/merchants/equipmentdock.lua EquipmentDock.initialize - client only Configuration Ingredient price is how much all plasma cells and steel tubes that were used to create a turret cost. Assembly price is additional credit cost that players pay when they build a turret. Production price = (Ingredient price + Assembly price) mod Selling Price = (Ingredient price * ingredientPriceMultiplier) + (Assembly price * assemblyPriceMultiplier) Profit is possible if the resulting Selling price is greater than Production price. File "mods/TurretSellingFix/config/TurretSellingFix.lua" has a few parameters that will let you adjust how the mod works: config.useMinimalValue = true/false — Determines which price mod will use. If true, mod will choose minimal value between (Vanilla price * 0.25) and Selling price If false, mod Selling price will always be used config.ingredientPriceMultiplier = float (0.25, 1.02..) — A multiplier for Ingredient price.Multiplier 0.25 will result in a vanilla-like behavior - it will be completely non-profitable to make money via turrets.Multiplier 1.0+ will allow people to make money with turrets (it also depends on assemblyPriceMultiplier) config.assemblyPriceMultiplier = float (0.25, 1.02..) — A multiplier for Assembly price.Multiplier 0.25 will result in a vanilla-like behavior - it will be completely non-profitable to make money via turrets.Multiplier 1.0+ will allow people to make money with turrets (it also depends on ingredientPriceMultiplier) config.maxProfit = -1/number — Allows to limit maximal profit that player can get from selling a turret.Example: Ingredient price = 500 000, Assembly price = 200 000 => Production price = 700 000 ingredientPriceMultiplier = 1.4, assemblyPriceMultiplier = 1.3; maxProfit is 100 000 Selling price will be 100 000 instead of 260 000-1 means no limit Changelog 1.1.1 Fixed: Vanilla exploit that allowed to build high-rarity turrets (thanks to Hammelpilaw) 1.1.0 Fixed: Vanilla exploit that allowed to build turrets with any (but usually 0) amount of ingredients Added: Now when research of player-made turrets produces a turret, mod will ensure that this turret is following the same rules as a player-made turret. The resulting turret "ingredientPrice" will be the sum of researched player-made turrets "ingredientPrice"-s. And "assemblyPrice" will consist of researched player-made turrets "assemblyPrice"-s + other turrets/upgrades prices. 1.0.1 Fixed: It appears that players always have to pay credits to build a turret - so now the resulting Selling price is based on Ingredient Price and Assembly price (credit cost) Added: 'assemblyPriceMultiplier' config option Changed: Renamed config parameter 'priceMultiplier' to 'ingredientPriceMultiplier' 1.0.0 Initial release Credits Devious - for reporting component amount 0 exploit Hammelpilaw - for reporting high-rarity exploit TurretSellingFix-1.0.0_0.17.1-0.18.2.zip TurretSellingFix-1.0.1_0.17.1-0.18.2.zip TurretSellingFix-1.1.0_0.17.1-0.18.3.zip TurretSellingFix-1.1.1_0.17.1-0.18.3.zip Link to comment Share on other sites More sharing options...
Hammelpilaw Posted September 7, 2018 Share Posted September 7, 2018 Good idea to fix it that way. Isnt it possible to calculate before creating the turret at turret factory to change the cration price? Link to comment Share on other sites More sharing options...
Rinart73 Posted September 7, 2018 Author Share Posted September 7, 2018 Hammelpilaw, Hi. Can you explain please? Do you mean: To calculate production price with modifiers, compare it with vanilla price and just save final price? Or to change turret creation price somehow? Link to comment Share on other sites More sharing options...
Rinart73 Posted September 7, 2018 Author Share Posted September 7, 2018 1.0.1 Fixed: It appears that players always have to pay credits to build a turret - so now the resulting Selling price is based on Ingredient Price and Assembly price (credit cost) Added: 'assemblyPriceMultiplier' config option Changed: Renamed config parameter 'priceMultiplier' to 'ingredientPriceMultiplier' Link to comment Share on other sites More sharing options...
Rinart73 Posted September 16, 2018 Author Share Posted September 16, 2018 1.1.0 Fixed: Vanilla exploit that allowed to build turrets with any (but usually 0) amount of ingredients Added: Now when research process of player-made turrets produces a turret, mod will ensure that this turret will follow the same rules as a player-made turret (so people couldn't research several player-made turrets into something that costs billions). The resulting turret "ingredientPrice" will be the sum of researched player-made turrets "ingredientPrice"-s. And "assemblyPrice" will consist of researched player-made turrets "assemblyPrice"-s + other turrets/upgrades prices. Also, if you're using Extended Turret Factory version 0.1.1, here is the patch for it. Future versions of that mod should already include this patch. You still need to install both Extended Turret Factory and this mod. ExtTurretFactory-0.1.1_turretExploitPatch.zip Link to comment Share on other sites More sharing options...
Devious Posted September 16, 2018 Share Posted September 16, 2018 1.1.0 Fixed: Vanilla exploit that allowed to build turrets with any (but usually 0) amount of ingredients Added: Now when research process of player-made turrets produces a turret, mod will ensure that this turret will follow the same rules as a player-made turret (so people couldn't research several player-made turrets into something that costs billions). The resulting turret "ingredientPrice" will be the sum of researched player-made turrets "ingredientPrice"-s. And "assemblyPrice" will consist of researched player-made turrets "assemblyPrice"-s + other turrets/upgrades prices. Boxelware should hire you! I mentioned the component exploit to you yesterday, and you have a good fix already, again awesome work :) Also, if you're using Extended Turret Factory version 0.1.1, here is the patch for it. Future versions of that mod should already include this patch. You still need to install both Extended Turret Factory and this mod. Link to comment Share on other sites More sharing options...
Rinart73 Posted September 16, 2018 Author Share Posted September 16, 2018 Devious, thank you for reporting this exploit so I could fix it. Well I'm still bad at C/C++ so they can't hire me :) 1.1.1 Fixed: Vanilla exploit that allowed to build high-rarity turrets (thanks to Hammelpilaw) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now