Jump to content

[Mod] StationCargoExtension


Hammelpilaw

Recommended Posts

When you fly threw the galaxy and look for some npc stations for trading or to buy goods to feed your own stations, you often find stations with a cargo bay of 100 or even less. This is making the whole station absolutely senseless. Especially mines are often very low on cargo. This mod can fix it.

 

Incompatible to current Avorion version. We use an updated version of this on the Galaxy-Gamers server, but since this does not seem to be used very much at all I do not publish current versions. If you are interested to get this mod please let me know, maybe Ill create a current mod package.

 

What does it do?

When entering a sector it recreates plans of the stations in this sector, wich got less then 10,000 pieces of each good to sell (may vary a little cause of rounded numbers in calculations). This also works for stations/sectors, that were already created before. While doing this it keeps the own style of the faction, so the custom look is not gone.

Right now, this only work for mines, I do not know yet if support for other factories will be added.

 

Because it changes the stations plans, it will do irreversible changes to the affected stations in your galaxy. That does not hurt though if everything is working fine. It is a beta version... so I can not guarantee, but also installed it on our live server and it works great.

Player stations are excluded of course, it only modifies stations with a valid npc faction.

 

 

Known issues

  • Performance - it takes too much time to process all mines in a sector, depending on how many mines needs to be upgraded. That could cause lags on the server, but did not test it yet. This can happen only once per sector.
  • Setting the plan size does not work, I just don't know yet how the plan size for stations works (only of interest for modders)

Roadmap

  • Improve performance
  • Add other factories then mines to this mod (maybe)
  • Make plan size working
  • Add an option to exclude already existing stations

Settings

local minGoods = 10000         -- The minimum amount of goods wich should be sold at a station. If the station is smaller, regenerate its plan (possible values: any number > 1)

--Note: It seems that increasing the size value doesn't increase the cargo bay, will have to check out how the plan sizes work. So default is set to {1}
local sizes = {1}      -- Plan sizes (Possible values: 1-5)(when small plans result in too little cargo the mod tries the next higher one)
local AttemptsPerSize = 9      -- Max attempts per size to get a plan with the required cargo (possible values: 1-12)(Total attempts per station are limited to 12)

 

minGoods: sets the minimum amout that should be sold of each good.

sizes: This option is not fully implemented yet, you should not change.

 

AttemptsPerSize: decrease this to improve performance.

When trying to generate a plan with bigger cargo, the mod uses the vanilla functions to create the new plan. This means, that there is a chance to get a cargo bay wich is big enaugh, but it could also be smaller. So it generates plans until it created a plan wich got enaugh cargo. AttemptsPerSize is the maximum amount of attempts, then it chooses the best plan (with fallback to the original plan if this is the best).

 

 

Compatibility with other mods

This mod modifies the file "data/scripts/server/server.lua". If you got another mod wich also modified this, you need to add this line...

 

player:addScriptOnce("lib/StationCargoExtender.lua")                  --StationCargoExtender

 

...to the player scripts:

 

function onPlayerLogIn(playerIndex)
    local player = Player(playerIndex)
    Server():broadcastChatMessage("Server", 0, "Player %s joined the galaxy"%_t, player.name)

    player:addScriptOnce("headhunter.lua")
    player:addScriptOnce("eventscheduler.lua")
    player:addScriptOnce("story/spawnswoks.lua")
    player:addScriptOnce("story/spawnai.lua")
    player:addScriptOnce("story/spawnguardian.lua")
    player:addScriptOnce("story/spawnadventurer.lua")
   player:addScriptOnce("lib/StationCargoExtender.lua")                  --StationCargoExtender
    matchResources(player)
end

 

 

Uninstall

To uninstall this mod you just need to delete file "data/scripts/lib/StationCargoExtender.lua" and remove the following line from "data/scripts/server/server.lua":

 

player:addScriptOnce("lib/StationCargoExtender.lua")                  --StationCargoExtender

Link to comment
Share on other sites

Why not just add cargo to the mine/station instead of randomly creating plans?

 

Because you would need to add huge cargos to small stations. I want to keep the factions custom style. This way it is compatible with every faction seed and does not destroy its custom look.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...