We found solution that should be implemented into Avorion game. what we suggesting is to increase traders in the sector so if u have 5 docks on your station all 5 of them will be used. how code works? it allows traders to use all free docks on your station by default if u have more then 1 dock only 1 trader will come to your station buy and will leave and other docks wont be used. our script allows 5 traders at the same time to dock because it searches for free docks on station and it tells trader go to that free dock if other one is being used. its best idea yet because currently if you running water factory it fills up really quick and by having this in your game it balances everything by letting you decide how many traders u want and that depends on how many docks you have. currently we set maximum limit to 5 per station so there could be not to many traders in the sectors to prevent any bugs or heavy traffic. i hope you will add this to the game ❤️
Code + Attached files with code: data/scripts/sector/traders.lua
functionTraders.isSpawnCandidate(station local docks = DockingPositions(station) ifnot docks thenreturnend
if docks.numDockingPositions == 0ornot docks.docksEnabled thenreturnend
Suggestion
Endo
Hello,
We found solution that should be implemented into Avorion game. what we suggesting is to increase traders in the sector so if u have 5 docks on your station all 5 of them will be used. how code works? it allows traders to use all free docks on your station by default if u have more then 1 dock only 1 trader will come to your station buy and will leave and other docks wont be used. our script allows 5 traders at the same time to dock because it searches for free docks on station and it tells trader go to that free dock if other one is being used. its best idea yet because currently if you running water factory it fills up really quick and by having this in your game it balances everything by letting you decide how many traders u want and that depends on how many docks you have. currently we set maximum limit to 5 per station so there could be not to many traders in the sectors to prevent any bugs or heavy traffic. i hope you will add this to the game ❤️
Code + Attached files with code:
data/scripts/sector/traders.lua
function Traders.isSpawnCandidate(station
local docks = DockingPositions(station)
if not docks then return end
if docks.numDockingPositions == 0 or not docks.docksEnabled then return end
if not TradingUtility.hasEmptyDocks(station) then return end
if station:getValue("minimum_population_fulfilled") == false then -- explicitly check for 'false'
return
end
return true
end
data/scripts/lib/tradingutility.lua
function TradingUtility.hasEmptyDocks(station)
-- check if there are traders flying to this station
local traders = {Sector():getEntitiesByScript("merchants/tradeship.lua")}
local docks = DockingPositions(station)
local emptyDocks = math.min(5, docks.numDockingPositions)
for _, trader in pairs(traders) do
local partner = trader:getValue("trade_partner")
if partner and station.index.string == partner then
emptyDocks = emptyDocks - 1
if emptyDocks == 0 then
return false
end
end
end
return true
end
traders.lua tradingutility.lua
Edited by EndoLink to comment
Share on other sites
0 answers to this suggestion
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