Jump to content

[MOD] [OOSP]out of sector Production


Laserzwei

Recommended Posts

With the current version of Avorion having "keep-alive" enabled on Sectors while the player is not inside them, is this mod still required to have Out-Of-Sector production?

Are NPC stations loaded?- No, so this mod still has its purpose.

 

Is production exempt from the "keep-alive" functionality(?)

There is a config option:

config.includePlayerProperty = false 

Default false; it will ignore all sectors with player property in it.

It has a slight disadvantage: When the server allows less loaded sectors/player than they utilize, then some sectors won't get updated (by neither oosp, nor vanilla)

Sadly there is no better way to indicate loaded player-sectors than looking for playerproperty.

 

(...) is OOSP now functionality that is incorporated into the base game itself?

Not at all.

Link to comment
Share on other sites

  • Replies 174
  • Created
  • Last Reply

Top Posters In This Topic

It has a slight disadvantage: When the server allows less loaded sectors/player than they utilize, then some sectors won't get updated (by neither oosp, nor vanilla)

Sadly there is no better way to indicate loaded player-sectors than looking for playerproperty.

 

Koonschi, please give us onSectorActivate() and onSectorDeactivate() callbacks  ;D

Link to comment
Share on other sites

  • 2 weeks later...

Hey. Have you read the most recent Beta patch notes? What parts of this mod are still missing from vanilla? At this point? Is it "safe" to run this mod together with the new Beta patch? Will there be duplicated/buggy behaviour?

 

Basically: should I not install this when running Beta 0.15.8?

I've seen the patch notes, worked through the changes and most of the oosp-mod is implemented in Vanilla (0.15.8+) now. 3 things are missing:

1)  update for enqueued ships in a shipyard (if you have a ship that takes 2h and leave the sector for ingame-days, you will still end up having to wait those 2 hours[except if you own other property in that sector])

2)  OOSP currently (<0.15.7) has resource-trader refilling included, vanilla has nothing alike

3)  Player stations don't get proper trade events while they are unloaded (Goods are exchanged, but no money)

Link to comment
Share on other sites

Hm. Do you have any tips on how to modify this mod's code to supplement what's been added in the Beta patch? I'd like to still have access to those three points you mention, but would hate to unbalance or even break the game by "simply adding" it back in.

 

Or were you working on an update yourself?

Link to comment
Share on other sites

commenting out some of the lines in /mods/oosp/scripts/player/oosproduction.lua

257 onward:

if (oospConfig.includeFactories and station:hasScript("factory.lua")) then                      --normal factory
            if (station:hasScript("turretfactory.lua")) then            --factory is a substring of turretfactory, but a turretfactory doesn't produce anything
            else
                countF = countF + 1
                --calculateOOSProductionForFactory(station, timestamp)
            end
        end
        if (oospConfig.includeConsumers and station:hasScript("consumer.lua")) then --biotope, casino, equip.dock, habitat, militaryoutpost, repairdock, researchstation, resistance outpost, scrapyard, shipyard-trading
            --consumption(station, timestamp)
        end
        if (oospConfig.includeTradingPosts and station:hasScript("planetarytradingpost.lua")) then
            --calculateOOSProductionForTradingPost(station, timestamp, "scripts/entity/merchants/planetarytradingpost.lua")
        end
        if (oospConfig.includeTradingPosts and station:hasScript("tradingpost.lua")) then
           -- calculateOOSProductionForTradingPost(station, timestamp, "scripts/entity/merchants/tradingpost.lua")
        end
        if (oospConfig.includeResourceDepots and station:hasScript("resourcetrader.lua")) then
            calculateOOSProductionForResourcetrader(station, timestamp)
        end
        if (oospConfig.includeShipyards and station:hasScript("shipyard.lua")) then                      --shipyard-ships
            debugPrint(3, "update shipyard: "..station.name)
            calculateOOSProductionForShipyard(station,timestamp)
        end

Link to comment
Share on other sites

updated for 0.15.8 (0.99_5)

- removed oosp not installed detection

- removed oosp for all consumers

- reworked code for resourcetraders update

- removed playerscript handling the (Un-)Loading event

- removed the timesystem for accurate out-of-sector calculations

- removed oosProdLib since it's not required anymore

- remove shipyard oosp update; now here

 

Link to comment
Share on other sites

Error while adding file "mods/oosp/scripts/player/oosproduction.lua":

mods/oosp/scripts/player/oosproduction.lua:15: bad argument #1 to 'max' (number expected, got nil)

 

With the new version (0.99_5)

You updated from oosp <0.99_5 right?

You need to fully reinstall the mod:

1) replace /data/scripts/server/server.lua with the VANILLA file

2) delete /mods/oosp/*

3) continue with the standard installation

 

I updated the installation guide accordingly

Link to comment
Share on other sites

I have performed the installation steps you mention, but I run into a different problem. Whenever I boot the game, and periodically through playing, I'll get error messages in Console that table.insert is being used wrong, all to do with the resourcetrader.lua.

 

See this bug report I made for the vanilla code. Your code is triggering this same behaviour four times per execution. Basically, table.insert expects two arguments. You can pass it three, but then it expects the second to be a number, which it's not, so the code freaks out. Please read the original bug report. There's a link to a question on StackOverflow and everything where this is explained in further detail.

Link to comment
Share on other sites

I have performed the installation steps you mention, but I run into a different problem. Whenever I boot the game, and periodically through playing, I'll get error messages in Console that table.insert is being used wrong, all to do with the resourcetrader.lua.

 

See this bug report I made for the vanilla code. Your code is triggering this same behaviour four times per execution. Basically, table.insert expects two arguments. You can pass it three, but then it expects the second to be a number, which it's not, so the code freaks out. Please read the original bug report. There's a link to a question on StackOverflow and everything where this is explained in further detail.

This bug is inherited from vanilla and I can't reproduce it. So I can't fix it either

Link to comment
Share on other sites

Strange. By adding your mod, the bug has quadrupled in frequency as opposed to before. I guess I can try and compare the old version against the new and see what was changed, in order to try and pinpoint the source of the problem.

 

Maybe I've done something silly to my own resourcetrader.lua anyhow that is causing the table.insert to fail. I'll investigate and report back.

Link to comment
Share on other sites

I installed the latest version, but it does not seem to add any resource to resource depot. Also I couldnt find anything in code where adding resources is done. Function ResourceDepot.onRestoredFromDisk set a few variables, prints out the result, but does not add anything? Or am I blind?

Link to comment
Share on other sites

I installed the latest version, but it does not seem to add any resource to resource depot. Also I couldnt find anything in code where adding resources is done. Function ResourceDepot.onRestoredFromDisk set a few variables, prints out the result, but does not add anything? Or am I blind?

I accidentally only changed a test-variable instead of the actual one. See 0.99_5b

Link to comment
Share on other sites

Error while adding file "mods/oosp/scripts/player/oosproduction.lua":

mods/oosp/scripts/player/oosproduction.lua:15: bad argument #1 to 'max' (number expected, got nil)

 

Did Steps as you said. Help Pls

 

 

 

Maybe oospConfig.consumptionTime is not available or nil...

 

Avorion 0.15.7 or 0.15.8?

On 0.15.7: See if "mods/oosp/config/oosp.lua" exists. And if "config.consumptionTime = 86400" is set within.

On 0.15.8: Properly install oosp_0.99_5b.zip

Link to comment
Share on other sites

Perhaps there is one more feature you could make.  With your knowledge, could you make a mod that would restock the Trade Equipment after certain amount of time?

Somewhere out there is a mod that restocks EQ-Dock equipment every time a sector gets loaded

 

I'll look it up, but I'm not crazy about it changing every time the sector is reloaded.  It's not an exploit, but it is a way to refresh the listing more often than it should.  I'd prefer a delay of a few hours.  Do you think adding a table value to the station to control the station refresh times would work?

Link to comment
Share on other sites

What are you looking at? This mod is:

Deprecated

As of 0.16.1 ALL features of oosp are included in vanilla. Therefore no update for 0.16 or later will occur.

 

 

 

 

(...) I'd prefer a delay of a few hours.  Do you think adding a table value to the station to control the station refresh times would work?

Since equipment docks don't keep track of their operation-time (/scripts/entity/merchants/equipmentdock.lua), one would require to combinate

updateServer(timestep)

and the callback

onRestoredFromDisk(timeSinceLastSimulation)

A table would most likely not be needed. Always depends on the actual implementation though...

 

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...