Jump to content

Welcome to the Forum!

The best place to exchange builds and ideas! Vote for the best ideas and suggestions here.

Join the Avorion Discord!

Connect with other passionate players and talk about the latest news.
Discord

DLC Avorion Into the Rift Out Now!

Now available on Steam!
Steam

[MOD][outdated] Permissions Extender - Give more control of your craft


Rinart73
 Share

Recommended Posts

Attention: This mod was developed before Alliance Update. Now we have the ability to share ships, fighters, trade e.t.c in vanilla. Also the Collaboration tab is gone now.

So this mod is outdated, will not be continued.

Thanks to everyone that used my mod.

 

Version 0.1.0 is out! Bugfix, new UI and fighters support.

 

This mod adds 4 permissions: "Give Crew", "Take Crew", "Give Cargo", "Take Cargo", which can be managed through the original Collaboration/Permissions window. It works for ships and stations that are controlled by players.

 

Also, starting with version 0.1.0 it changes UI of the Permissions window. Now there is a 2 lists in each tab: "Denied users"(left) and "Allowed users"(right). UI change was mostly done because the old UI doesn't support big amount of people (combo box isn't scrollable).

 

These permissions are useful if you want to:

  • Share your cargo space in some of your factories and ships with your friends
  • Leave some cargo/crew gifts for someone following your path
  • Help your teammates to reach nearest station as quickly as possible (by giving the some of you crew to them)
  • Get some benefits of your space-vassals
  • Trade and exchange cargo with other players

 

Installation

 

[*]Make a backup of the following files:

  • data/scripts/entity/collaboration.lua
  • data/scripts/entity/transfercrewgoods.lua
  • data/scripts/sector/sector.lua

[*]Unpack contents of the folder "Install" in the mod archive in your Avorion installation folder

 

Uninstallation

 

 

Debugging

 

Mod produces a fair amount of debug logs especially when you're constantly giving or taking away the new permissions. You can turn off most of it in the "data/scripts/mods/PermissionsExtender/Config.lua" file.

But in case of errors mod will log them even if you're disabled logging.

 

Localization

 

You can change the mod language in the "data/scripts/mods/PermissionsExtender/Config.lua" file. If the mod can't find translations in its "LocalizationClient.lua" and "LocalizationServer.lua" files, it will try to look in the "data/localization/yourlanguage.po" file.

 

You can help me to adjust English in my mod or provide translations to other languages. You can also translate the mod by yourself. Edit the "scripts/mods/PermissionsExtender/LocalizationClient.lua" and "scripts/mods/PermissionsExtender/LocalizationServer.lua" files.

 

Compatibility Notes (2)

 

If you're making mod that may change faction for ships and stations from NPC to player, use following script on the converted ship/station to allow the new permissions to work:

package.path = package.path .. ";data/scripts/entity/?.lua"
entity:addScriptOnce("permissionsExt.lua")

If you will not use this code, entity will not allow you to give/take crew/goods until its reload (you will need to allow sector with the entity to unload and load again)


This mod will require compatibility patches for all mods that change following files:

  • data/scripts/entity/collaboration.lua
  • data/scripts/entity/transfercrewgoods.lua
  • data/scripts/sector/sector.lua

I separated all my code in these files by this comments:



-- [PermissionsExtender]
mycode
-- [end PermissionsExtender]

 

Also the next example shows how it looks when I replace some original code with my own.



-- [PermissionsExtender]
--player:sendChatMessage("Server"%_t, 1, "You don't own this craft."%_t)
player:sendChatMessage("Server"%_t, 1, PermissionsExtender:translate("You don't have permission to take cargo from this craft."))
-- [end PermissionsExtender]

 

Compatibility patches (2)

 

BetterTransfer (updated for 0.1.0)

Just install patch after Permissions Extender mod. You don't need to install original BetterTransfer.

 

Integration (Modders resource) - Coming soon

 

Coming soon

 

Known bugs (0)

 


 

Screenshots

 

Preview.jpgcbn8iH.jpg

 

Changelog

 

 

0.1.0:

  • Bug fixed 'faction is nil'
  • Collaboration/Permissions window interface redone (inspired by NexusNull's mod NexGenUI).
    Currently supports:
    • Scrolling of lists in the tab.
    • Nearly unlimited amount of tabs-permissions. When tabs count will reach 11, buttons to change page will appear.

    [*]BetterTransfer patches now add 2 more permissions: 'Give Fighters' and 'Take Fighters'

0.0.9:

  • First public release

 

Planned features

 

  • "Free Buy" permission that will allow players to get from your station only cargo that this station produces
  • "Free Sell" permission that will allow players to give your station only cargo that can be used by this station (this excludes ability to "spam" factory with some junk cargo that will prevent it from running)
  • Visually show when player can't do something by hiding some transfer buttons or the entire tab

 

The mod must be installed on both Client and Server.

 

Thanks to w00zla, infal, Dirtyredz, Splutty, Aki  for valuable information that helped me in process of creating this mod.

PermissionsExtender_0.1.0.zip

Uninstall.zip

[*]Restore 3 files that you backed up before

[*]Delete these files/folders:

  • data/scripts/entity/permissionsExt.lua
  • data/mods/PermissionsExtender/

 

If you want to uninstall mod from Server, after that you have 2 options:

  • Unpack contents of the folder "Uninstall/Default" in the mod archive in your Avorion installation folder
  • You can delete "data/scripts/entity/permissionsExt.lua" file only when you're totally sure that sectors with all player ships and stations were loaded at least once after mod uninstallation

Or

  • Unpack contents of the folder "Uninstall/Utility" in the "%appdata%/Roaming/Avorion/galaxies/yourGalaxyName/" folder. You will see a new file called "uninstallPermissionsExtender.json"
  • Place the Sector Cleaner utility near uninstall file
  • Drag the .json file on program. If you'll see any red text, restore affected files in your "sectors" folder from the backup folder that utility will create
  • If some sectors will change/re-generate, restore sectors files

Link to comment
Share on other sites

Nice work, looks promising :)

 

One thing that really bugs me about the permission screen is that the list is not scrollable, so anyone who registered later is not visible on the list.

Do you think you could find a solution for that?

Link to comment
Share on other sites

Nice work, looks promising :)

 

One thing that really bugs me about the permission screen is that the list is not scrollable, so anyone who registered later is not visible on the list.

Do you think you could find a solution for that?

Do you mean horizontal scroll for other mods that will add their own permissions? Thanks, I'll look what I can do.

 

As for now compatibility patches added for the both versions of the mod "BetterTransfer : UI upgrade & Transfer cargo/crew/fighters 1.12" - "vanilla" and "convenient".

 

Also, since BetterTransfer adds fighters transfer and it's the only UI transfer mod that updates now, maybe I should add permissions for fighters transfer too..

Link to comment
Share on other sites

Nice work, looks promising :)

 

One thing that really bugs me about the permission screen is that the list is not scrollable, so anyone who registered later is not visible on the list.

Do you think you could find a solution for that?

Do you mean horizontal scroll for other mods that will add their own permissions? Thanks, I'll look what I can do.

 

As for now compatibility patches added for the both versions of the mod "BetterTransfer : UI upgrade & Transfer cargo/crew/fighters 1.12" - "vanilla" and "convenient".

 

Also, since BetterTransfer adds fighters transfer and it's the only UI transfer mod that updates now, maybe I should add permissions for fighters transfer too..

 

What I mean is that the list only shows the first registered players, anyone registered after that is not visable.

Here is a screenshot, anyone below the player "Roy Mustang" is not visable or selectable.

http://prntscr.com/euh0bm

 

And yeah fighter permissions could be useful indeed as they can't be transferred in any other way yet.

Link to comment
Share on other sites

What I mean is that the list only shows the first registered players, anyone registered after that is not visable.

Here is a screenshot, anyone below the player "Roy Mustang" is not visable or selectable.

http://prntscr.com/euh0bm

 

And yeah fighter permissions could be useful indeed as they can't be transferred in any other way yet.

Oh.. that thing, the ComboBox. I'll see what I can do. If scrolling will not work for that UI element, possible I will just redesign the whole permissions tab like in this mod

 

PermissionsUi.1.1.png

 

 

This looks like pure dark magic!

 

Amazing work, thank you!

Thanks, yeah, that was some dark magic involved in a process.

 

I'll do fighters and I think I'll explain how to use the main module as a modding resource. Maybe this will help somebody.

Link to comment
Share on other sites

habs problem das wenn man bei schmuggler ware reinwaschen will, das man nicht mehr scrollen kann, wenn man mehr ware hat und somit geht auch das reinwaschen nicht mehr. vorher konnte man scrollen jetzt ist es wie vor dem avorionupdate

Google Translate: "I have problem that if you want to clean with smugglers ware, which you can no longer scroll, if you have more ware and thus does not wash. Before you could scroll now it is like before the avorion update"

 

My mod has nothing to do with the smugglers trading.

 

Google Translate: "Mein mod hat nichts mit dem Schmuggler-Handel zu tun."

Link to comment
Share on other sites

Just installed the mod, when I tested it on singleplayer it seemed to work fine but on the server I get the following error:

could not execute function 'initialize' in '"data/scripts/sector/sector.lua"':
data/scripts/sector/sector.lua:32: attempt to index local 'faction' (a nil value)
stack traceback:
        data/scripts/sector/sector.lua:32: in function <data/scripts/sector/sector.lua:10>

Setting script "data/scripts/sector/sector.lua" to invalid.

Link to comment
Share on other sites

Just installed the mod, when I tested it on singleplayer it seemed to work fine but on the server I get the following error:

could not execute function 'initialize' in '"data/scripts/sector/sector.lua"':
data/scripts/sector/sector.lua:32: attempt to index local 'faction' (a nil value)
stack traceback:
        data/scripts/sector/sector.lua:32: in function <data/scripts/sector/sector.lua:10>

Setting script "data/scripts/sector/sector.lua" to invalid.

 

Have self Problem:

 

 

12:11:42:429 could not execute function 'initialize' in '"data/scripts/sector/sector.lua"':

12:11:42:432 data/scripts/sector/sector.lua:32: attempt to index local 'faction' (a nil value)

12:11:42:434 stack traceback:

12:11:42:436    data/scripts/sector/sector.lua:32: in function <data/scripts/sector/sector.lua:10>

 

Link to comment
Share on other sites

Just installed the mod, when I tested it on singleplayer it seemed to work fine but on the server I get the following error:

could not execute function 'initialize' in '"data/scripts/sector/sector.lua"':
data/scripts/sector/sector.lua:32: attempt to index local 'faction' (a nil value)
stack traceback:
        data/scripts/sector/sector.lua:32: in function <data/scripts/sector/sector.lua:10>

Setting script "data/scripts/sector/sector.lua" to invalid.

Do you have any other mods?

We have this mod installed on server where we're playing with friends. It works just fine.

I'll re-check it.

Also it would be good to see the full logs.

Link to comment
Share on other sites

ja, aber kein mod wo in die sector.lua geschrieben wird

 

 

-- [PermissionsExtender]

package.path = package.path .. ";data/scripts/mods/PermissionsExtender/?.lua"

package.path = package.path .. ";data/scripts/entity/?.lua"

 

local PermissionsExtender = require("PermissionsExtender")

 

-- [end PermissionsExtender]

if onServer() then

 

function initialize()

    local dockables = {Sector():getEntitiesByComponent(ComponentType.DockingPositions)}

 

    for _, entity in pairs(dockables) do

        entity:addScriptOnce("entity/regrowdocks.lua")

    end

 

    Sector():addScriptOnce("sector/relationchanges.lua")

    -- [PermissionsExtender]

 

    for _, entity in pairs({Sector():getEntitiesByType(EntityType.Ship)}) do

        local faction = Faction(entity.factionIndex)

        if faction.isPlayer then

            if PermissionsExtender.debug then

                printlog("[PermissionsExt]", "Sector initialize()", faction.name, "ship", entity.name, entity:hasScript("permissionsExt.lua") and "hasScript" or "noScript")

            end

           

            entity:addScriptOnce("permissionsExt.lua")

        end

    end

    for _, entity in pairs({Sector():getEntitiesByType(EntityType.Station)}) do

        local faction = Faction(entity.factionIndex)

        if faction.isPlayer then

            if PermissionsExtender.debug then

                printlog("[PermissionsExt]", "Sector initialize()", faction.name, "station", entity.name, entity:hasScript("permissionsExt.lua") and "hasScript" or "noScript")

            end

           

            entity:addScriptOnce("permissionsExt.lua")

        end

    end

    -- [end PermissionsExtender]

end

 

end

 

-- [PermissionsExtender]

if onClient() then

 

function initialize()

    for _, entity in pairs({Sector():getEntitiesByType(EntityType.Ship)}) do

        local faction = Faction(entity.factionIndex)

        if faction.isPlayer then

            if PermissionsExtender.debug then

                printlog("[PermissionsExt]", "Sector initialize()", faction.name, "ship", entity.name, entity:hasScript("permissionsExt.lua") and "hasScript" or "noScript")

            end

           

            entity:addScriptOnce("permissionsExt.lua")

        end

    end

    for _, entity in pairs({Sector():getEntitiesByType(EntityType.Station)}) do

        local faction = Faction(entity.factionIndex)

        if faction.isPlayer then

            if PermissionsExtender.debug then

                printlog("[PermissionsExt]", "Sector initialize()", faction.name, "station", entity.name, entity:hasScript("permissionsExt.lua") and "hasScript" or "noScript")

            end

           

            entity:addScriptOnce("permissionsExt.lua")

        end

    end

end

 

end

-- [end PermissionsExtender]

 

Link to comment
Share on other sites

ja, aber kein mod wo in die sector.lua geschrieben wird

 

 

-- [PermissionsExtender]

package.path = package.path .. ";data/scripts/mods/PermissionsExtender/?.lua"

package.path = package.path .. ";data/scripts/entity/?.lua"

 

local PermissionsExtender = require("PermissionsExtender")

 

-- [end PermissionsExtender]

if onServer() then

 

function initialize()

    local dockables = {Sector():getEntitiesByComponent(ComponentType.DockingPositions)}

 

    for _, entity in pairs(dockables) do

        entity:addScriptOnce("entity/regrowdocks.lua")

    end

 

    Sector():addScriptOnce("sector/relationchanges.lua")

    -- [PermissionsExtender]

 

    for _, entity in pairs({Sector():getEntitiesByType(EntityType.Ship)}) do

        local faction = Faction(entity.factionIndex)

        if faction.isPlayer then

            if PermissionsExtender.debug then

                printlog("[PermissionsExt]", "Sector initialize()", faction.name, "ship", entity.name, entity:hasScript("permissionsExt.lua") and "hasScript" or "noScript")

            end

           

            entity:addScriptOnce("permissionsExt.lua")

        end

    end

    for _, entity in pairs({Sector():getEntitiesByType(EntityType.Station)}) do

        local faction = Faction(entity.factionIndex)

        if faction.isPlayer then

            if PermissionsExtender.debug then

                printlog("[PermissionsExt]", "Sector initialize()", faction.name, "station", entity.name, entity:hasScript("permissionsExt.lua") and "hasScript" or "noScript")

            end

           

            entity:addScriptOnce("permissionsExt.lua")

        end

    end

    -- [end PermissionsExtender]

end

 

end

 

-- [PermissionsExtender]

if onClient() then

 

function initialize()

    for _, entity in pairs({Sector():getEntitiesByType(EntityType.Ship)}) do

        local faction = Faction(entity.factionIndex)

        if faction.isPlayer then

            if PermissionsExtender.debug then

                printlog("[PermissionsExt]", "Sector initialize()", faction.name, "ship", entity.name, entity:hasScript("permissionsExt.lua") and "hasScript" or "noScript")

            end

           

            entity:addScriptOnce("permissionsExt.lua")

        end

    end

    for _, entity in pairs({Sector():getEntitiesByType(EntityType.Station)}) do

        local faction = Faction(entity.factionIndex)

        if faction.isPlayer then

            if PermissionsExtender.debug then

                printlog("[PermissionsExt]", "Sector initialize()", faction.name, "station", entity.name, entity:hasScript("permissionsExt.lua") and "hasScript" or "noScript")

            end

           

            entity:addScriptOnce("permissionsExt.lua")

        end

    end

end

 

end

-- [end PermissionsExtender]

 

 

Can you give full logs please?

Können Sie bitte volle Logs geben?

 

And I actually need list of your mods. Just names. Is there any mods that add or change stations?

Und ich brauche eigentlich eine Liste deiner Mods. Nur Namen. Gibt es irgendwelche Mods, die Stationen hinzufügen oder wechseln?

Link to comment
Share on other sites

kommen um 0 uhr, dann starte ich den server neu log mich ein und hänge hier die logs dran

 

Mods findest du hier: http://lost-survivors.com/index.php?thread/130-modpack-1-5/

 

Minecorb1.4 fügt hinzu und infinionigta und infinion

 

kannst auch ins Teamspeak kommen. gaming-network.ddnss.de

dann können wir mit teamviewer aufen root schauen

 

Desktop.zip

Link to comment
Share on other sites

v0.1.0 is out

  • Bug fixed 'faction is nil'
  • Collaboration/Permissions window interface redone (inspired by NexusNull's mod NexGenUI).
    Currently supports:
    • Scrolling of lists in the tab.
    • Nearly unlimited amount of tabs-permissions. When tabs count will reach 11, buttons to change page will appear.

    [*]BetterTransfer patches now add 2 more permissions: 'Give Fighters' and 'Take Fighters'

 

Screenshot of the new UI:

 

Preview.jpg

 

Link to comment
Share on other sites

hmm hab ich was falsch gemacht?

 

https://steamuserimages-a.akamaihd.net/ugc/80345569856271611/A62E00E3D94F423F10B11C794C4BAFFB6F07D591/

 

https://steamuserimages-a.akamaihd.net/ugc/80345569856271834/177E678976DB8C6EC9BC0C9E9648B3487193B793/

 

Modpack for client:

http://lost-survivors.com/index.php?attachment/67-modpack-1-6-zip/

 

kannst du bitte transfer convenient version nicht vanilla version reinmachen bitte?

weil bei transfer convenient version eingabefelder sind und bei vanilla nicht

Link to comment
Share on other sites

hmm hab ich was falsch gemacht?

 

https://steamuserimages-a.akamaihd.net/ugc/80345569856271611/A62E00E3D94F423F10B11C794C4BAFFB6F07D591/

 

https://steamuserimages-a.akamaihd.net/ugc/80345569856271834/177E678976DB8C6EC9BC0C9E9648B3487193B793/

 

Modpack for client:

http://lost-survivors.com/index.php?attachment/67-modpack-1-6-zip/

 

kannst du bitte transfer convenient version nicht vanilla version reinmachen bitte?

weil bei transfer convenient version eingabefelder sind und bei vanilla nicht

 

You can find patches for both versions of BetterTransfer in the "Compatibility patches" section.

Sie finden Patches für beide Versionen von BetterTransfer im Abschnitt "Compatibility patches".

Link to comment
Share on other sites

Danke, hat geklappt. hatte ich wohl übersehen

 

Normalerweisse kann man ja beim Schmuggler, wenn man mehr als 13 geklaute ware hat seit dem letzten update nach unten scrollen, das geht bei uns nicht mehr, möglich das ich es bei einem mod überscdhrieben habe? weißt du wo in welcher datei das ist?

Link to comment
Share on other sites

Normalerweisse kann man ja beim Schmuggler, wenn man mehr als 13 geklaute ware hat seit dem letzten update nach unten scrollen, das geht bei uns nicht mehr, möglich das ich es bei einem mod überscdhrieben habe? weißt du wo in welcher datei das ist?

 

"Normally you can at the smuggler, if you have more than 13 stolen items since the last update scroll down, which is with us no more, possible that I have it with a mod overdrubbed? Do you know where in which file?"

I think I know which file contains smuggler's trading, but it's not related to this mod. Probably you should create a mod request thread or ask about fixing it in the "Troubleshooting".

 

"Ich glaube, ich weiß, welche Datei Smuggler's Trading enthält, aber es steht nicht im Zusammenhang mit diesem Mod. Wahrscheinlich solltest du einen Mod-Anforderungs-Thread erstellen oder nach der Feststellung in der "Troubleshooting" fragen."

Link to comment
Share on other sites

  • 2 weeks later...

03:34:55:760 [OOSP][0.9_7c] no timestamp - no production!

03:34:55:761 [OOSP][0.9_7c] Sector: -437:127 needed 0ms for Production catch-up

03:37:12:526 [OOSP][0.9_7c] Sector get first timestamp: 44185676 | -437:127

03:37:12:537 [OOSP][0.9_7c] Player: Natsu Dragneel entered sector with: 0 more player(s)

03:37:12:538 [OOSP][0.9_7c] timestamp aquired: 43864117

03:37:12:538 [OOSP][0.9_7c] 0/1 Factories/Stations

03:37:12:539 [OOSP][0.9_7c] Sector: -438:126 needed 0ms for Production catch-up

03:39:09:022 could not execute function 'onDestroyed' in '"data/scripts/sector/relationchanges.lua"':

03:39:09:023 data/scripts/sector/relationchanges.lua:50: attempt to index local 'faction' (a nil value)

03:39:09:023 stack traceback:

03:39:09:024 data/scripts/sector/relationchanges.lua:50: in function <data/scripts/sector/relationchanges.lua:13>

03:39:09:024

03:39:09:025 Setting script "data/scripts/sector/relationchanges.lua" to invalid.

 

Link to comment
Share on other sites

03:34:55:760 [OOSP][0.9_7c] no timestamp - no production!

03:34:55:761 [OOSP][0.9_7c] Sector: -437:127 needed 0ms for Production catch-up

03:37:12:526 [OOSP][0.9_7c] Sector get first timestamp: 44185676 | -437:127

03:37:12:537 [OOSP][0.9_7c] Player: Natsu Dragneel entered sector with: 0 more player(s)

03:37:12:538 [OOSP][0.9_7c] timestamp aquired: 43864117

03:37:12:538 [OOSP][0.9_7c] 0/1 Factories/Stations

03:37:12:539 [OOSP][0.9_7c] Sector: -438:126 needed 0ms for Production catch-up

03:39:09:022 could not execute function 'onDestroyed' in '"data/scripts/sector/relationchanges.lua"':

03:39:09:023 data/scripts/sector/relationchanges.lua:50: attempt to index local 'faction' (a nil value)

03:39:09:023 stack traceback:

03:39:09:024 data/scripts/sector/relationchanges.lua:50: in function <data/scripts/sector/relationchanges.lua:13>

03:39:09:024

03:39:09:025 Setting script "data/scripts/sector/relationchanges.lua" to invalid.

 

My mod has nothing to do with "data/scripts/sector/relationchanges.lua"

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
 Share

×
×
  • Create New...