Author Topic: [MOD] AutoDock -- v1.2.2  (Read 5044 times)

Shrooblord

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    578
    • View Profile
on: July 23, 2018, 10:00:15 PM
AutoDock
Do you find docking tedious? Do you wish you could just press a button when close to a Station, and get docked, like those lazy AI traders do? Do you want to fly at a dock at 2000 m/s and still dock perfectly fine without ever having to hit the brakes?

Then AutoDock is for you!


Usage
This mod adds the Interaction "Auto-Dock to Station" to all Stations, which allows you to easily dock to them by flying up to a Docking Beacon that gets created when the Interaction is used. You'll get pulled into the Station dock by tractor beams like AI traders get too, and like so easily dock without having to try and manoeuvre yourself correctly or lose enough speed while approaching the dock. What's more, you can fly at the Docking Beacon at great speed (up to 2000 m/s due to, probably, engine limitations) and it will still instantly start the docking procedure for you, so you don't even have to make sure you slow down to dock anymore! Sound great? Install the mod now!

See the following video for an explanation:



Prerequisites
This mod requires an external resource: ShipScriptLoader
Please follow the installation instructions of ShipScriptLoader before you install AutoDock.


Installation Instructions (Client-Side)
- Download the mod ShipScriptLoader by Dirtyredz and follow its installation instructions. This is required to load AutoDock. If you are already using it you may skip this step.

- Open the file Avorion/mods/ShipScriptLoader/config/ShipScriptLoader.lua
- Before the last line containing return Config add this:
Code: [Select]
Config.Add("mods/AutoDock/data/scripts/player/autoDockMigrator.lua")- Modify defaultscripts.lua in Avorion/data/scripts/lib/: in the function AddDefaultStationScripts(station) (line 14) add the following code:
Code: [Select]
station:addScriptOnce("mods/AutoDock/data/scripts/entity/autoDockInteraction.lua")For example, add it on line 28 such that the block of code becomes:
Code: [Select]
function AddDefaultStationScripts(station)
    station:addScriptOnce("data/scripts/entity/startbuilding.lua")
    station:addScriptOnce("data/scripts/entity/entercraft.lua")
    station:addScriptOnce("data/scripts/entity/exitcraft.lua")

    station:addScriptOnce("data/scripts/entity/crewboard.lua")
    station:addScriptOnce("data/scripts/entity/backup.lua")
    station:addScriptOnce("data/scripts/entity/bulletinboard.lua")
    station:addScriptOnce("data/scripts/entity/story/bulletins.lua")
    station:addScriptOnce("data/scripts/entity/regrowdocks.lua")

    station:addScriptOnce("data/scripts/entity/craftorders.lua")
    station:addScriptOnce("data/scripts/entity/transfercrewgoods.lua")

station:addScriptOnce("mods/AutoDock/data/scripts/entity/autoDockInteraction.lua")
end
- Copy the directory mods contained in the AutoDock .zip file directly into the Steam installation directory folder for Avorion.

Multiplayer (Server Owners)
NOTE: This mod needs to be installed both client-side and server-side in order to work. To install on the server, copy these same instructions, but use the server's root directory folder in place of the Avorion Steam Installation folder.

For example: when installing for the server, if the installation instructions tell you to drop a file in the Steam installation directory for Avorion, drop it in the server's top-level folder instead.

Addtionally, an instruction like
- Modify defaultscripts.lua in Avorion/data/scripts/lib/

becomes

- Modify defaultscripts.lua in SERVER-TOP-LEVEL-FOLDER/data/scripts/lib/


For Modders
If you want to disable AutoDocks for a Station of yours, add the following code near the top of one of its scripts:

Code: [Select]
local noAutoDock = require ("mods/AutoDock/data/scripts/lib/noAutoDock")
if noAutoDock then
    noAutoDock.initialize()
end

This local variable is never used, but simply including it will execute the code inside the script, causing your station to be given a noAutoDock = true Entity Value which the AutoDock Migrator now checks for.
If this value is found, and its value is true, the AutoDock Migrator will skip that station and not add any AutoDocks to it.

If AutoDock is not installed, this value is nil, but because you're not using the value anywhere in your script, that doesn't matter. So it works with AutoDock installed, and with AutoDock not installed.


Known Issues
Spoiler: show

  • Detected an issue where AutoDock Beacons will fail to spawn if something is in the way of the Station's "light line", i.e. Asteroids, another Ship, etc.



Changelog
==MOST RECENT VERSION: 1.2.2==

1.2.2
  • Fixed .zip directory structure so that it actually contains what it displays on the tin. Thanks to Amriel for notifying me of this problem!

1.2.1
  • Fixed a bug where the opt-out functionality would not correctly remove AutoDock functionality. Opt-out functionality should behave as expected now. See updated installation instructions.

1.2
  • Added functionality to opt-out your Station for AutoDocks. See the For Modders section for information.

1.1.1
  • Removed erroneously included developer content from release zip.

==OLDER VERSIONS==
Spoiler: show

1.1
  • Namespaced all scripts where applicable.
  • Added compatibility with 0.20.2 Beta Branch Security update.

1.0
  • Initial Release


Credits
- Dirtyredz for the ShipScriptLoader.
« Last Edit: February 27, 2019, 12:07:39 PM by Shrooblord »
Shrooblord



Rilgar

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    6
    • View Profile
on: July 24, 2018, 09:49:12 AM
Love It!

Thanks.

Docking was such a chore... esp. with bigger ships...

This works wonderfully :)



Scapoose

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    3
    • View Profile
on: July 27, 2018, 05:28:49 AM
Ive been looking for Auto Docking with the AI Tractor beams HOW Ever i Cannot get the Mod to work for me. Ive done what you said.

Ive added the script to ShipScriptLoader, I've Modified DefaultScripts
Ive done it to where instead of being on line 28 i put it on line 15 and still does the same thing. Am i missing something ?

Im not getting any Errors what so ever when in game.. so i havent a clue.
Code: [Select]
function AddDefaultStationScripts(station)
    station:addScriptOnce("data/scripts/entity/startbuilding.lua")
    station:addScriptOnce("data/scripts/entity/entercraft.lua")
    station:addScriptOnce("data/scripts/entity/exitcraft.lua")

    station:addScriptOnce("data/scripts/entity/crewboard.lua")
    station:addScriptOnce("data/scripts/entity/backup.lua")
    station:addScriptOnce("data/scripts/entity/bulletinboard.lua")
    station:addScriptOnce("data/scripts/entity/story/bulletins.lua")
    station:addScriptOnce("data/scripts/entity/regrowdocks.lua")

    station:addScriptOnce("data/scripts/entity/craftorders.lua")
    station:addScriptOnce("data/scripts/entity/transfercrewgoods.lua")

station:addScriptOnce("mods/AutoDock/scripts/entity/autoDockInteraction.lua")
end

Code: [Select]
-- Example use to add a script to a players ship
-- Config.Add("mods/YourMod/scripts/entity/YourMod.lua")
Config.Add("mods/CarrierCommander/scripts/entity/CarrierCommander.lua")
Config.Add("mods/RenameShips/scripts/entity/shipRename.lua")
Config.Add("mods/RenameShips/scripts/player/shipRenameMigrator.lua")
Config.Add("mods/AutoDock/scripts/player/autoDockMigrator.lua")

return Config

Says its registered that i modified the DefaultScripts.lua on loading the server
Sorry in advance just showing all the modified files ive done. along with the defaultscripts

Code: [Select]
Detected Modified Files:
"data/scripts\sectorspecifics.lua"
"data/scripts\commands\agoods.lua"
"data/scripts\commands\consolelevel.lua"
"data/scripts\commands\crew.lua"
"data/scripts\commands\disttocore.lua"
"data/scripts\commands\fighter.lua"
"data/scripts\commands\gate.lua"
"data/scripts\commands\inv.lua"
"data/scripts\commands\inventory.lua"
"data/scripts\commands\list.lua"
"data/scripts\commands\loglevel.lua"
"data/scripts\commands\price.lua"
"data/scripts\commands\regen.lua"
"data/scripts\commands\sethome.lua"
"data/scripts\commands\tmod.lua"
"data/scripts\commands\whereis.lua"
"data/scripts\lib\defaultscripts.lua"
"data/scripts\lib\shipgenerator.lua"
"data/scripts\lib\upgradegenerator.lua"
"data/scripts\systems\universalsystem.lua"
"data/scripts\entity\merchants\turretfactory.lua"
"data/scripts\lib\cmd\common.lua"
"data/scripts\lib\cmd\materials.lua"
"data/scripts\lib\cmd\professions.lua"
"data/scripts\lib\cmd\ranks.lua"
"data/scripts\lib\cmd\rarities.lua"
"data/scripts\lib\cmd\upgrades.lua"
"data/scripts\lib\cmd\weapons.lua"
"data/scripts\player\cmd\agoods.lua"
"data/scripts\player\cmd\crew.lua"
"data/scripts\player\cmd\disttocore.lua"
"data/scripts\player\cmd\fighter.lua"
"data/scripts\player\cmd\gate.lua"
"data/scripts\player\cmd\price.lua"
"data/scripts\player\cmd\sethome.lua"
"data/scripts\player\cmd\tellposition.lua"
"data/scripts\player\cmd\whereis.lua"



unbekannt1984

  • Full Member
  • ***
  • Status:
    Offline
    Posts:
    164
    • View Profile
on: July 31, 2018, 10:44:58 AM
Hi,

has anybody tried this mod on 0.18.2?

The Goodshauler-Mod has problems with docking to stations now... Question is: Is it docking or the new brake-behavior of AI-controlled ships?



Devious

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    579
  • Have you seen Rusty?
    • View Profile
    • Rusty's Universe and Community
on: August 02, 2018, 07:53:44 PM
Hi,

has anybody tried this mod on 0.18.2?

The Goodshauler-Mod has problems with docking to stations now... Question is: Is it docking or the new brake-behavior of AI-controlled ships?

That's probably due to the new brake behaviour yeah.


Thank you Shroob for this mod, even with larger docking ranges it can still be very tedious and dangerous to dock bigger ships so will definately give it a try :)



Spalato

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    1
    • View Profile
on: August 13, 2018, 10:24:02 AM
NOTE: This mod needs to be installed both client-side and server-side in order to work.

Following your instructions, did I install it on the client or the server? And how do I install it on the one that it wasn't installed on? Did what you said and it's not working.



Sixcross

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    1
    • View Profile
on: August 14, 2018, 02:53:15 AM
I've followed the instructions twice now trying to get this to work. I have installed both shipscript and this without success. I am not getting any UI or additional station options. I have Turret Editor, ext Turret Factory and CCBasic Commands installed. Do you think there could be a conflict? I am running non beta current version of the game. Any help getting this to work would be greatly appreciated! This game desperately needs built in docking for players.



EyeDeck

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    3
    • View Profile
on: September 16, 2018, 10:25:19 AM
Spoiler: show
I noticed that, unsurprisingly, this does not retroactively apply the docking script to stations in existing sectors. In case anyone finds it useful, you can manually add the script to enable auto-docking by targeting a station and running:
Code: [Select]
/run Entity().selectedObject:addScriptOnce("mods/AutoDock/scripts/entity/autoDockInteraction.lua")Also, when you inevitably accidentally run that on the same station twice and end up with duplicate options, you can fix that with:
Code: [Select]
/run Entity().selectedObject:removeScript("mods/AutoDock/scripts/entity/autoDockInteraction.lua")

Disregard that; I spent the time to debug this properly and found that the note about "There is an issue in the installation instructions of ShipScriptLoader." etc is incorrect, at least for my installation, and that the correct lines to add to server.lua are the ones provided by the author of ShipScriptLoader:
Code: [Select]
local s, b = pcall(require, 'mods/ShipScriptLoader/scripts/server/server')
if s then if b.onPlayerLogIn then local a = onPlayerLogIn; onPlayerLogIn = function(c) a(c); b.onPlayerLogIn(c); end end end
With the extra "Avorion/" appended to the beginning of the argument passed to require(), the pcall fails and so ShipScriptLoader does not load, which of course means that the retroactive script loader does not run.
« Last Edit: September 19, 2018, 09:26:10 PM by EyeDeck »



Shrooblord

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    578
    • View Profile
on: January 02, 2019, 02:45:59 PM
Version 1.1 released! Now compatible with the 0.20.2 Beta Branch security update. Running smoothly with no problems detected so far.

------

Sorry folks; haven't been on the forums in a while to answer your questions. I will address them now!

I spent the time to debug this properly and found that the note about "There is an issue in the installation instructions of ShipScriptLoader." etc is incorrect, at least for my installation
Indeed. There used to be a problem with ShipScriptLoader -- at least, that was my experience --, but it seems to have been resolved at this time.

With a clean installation of the current 0.20.2 Beta Branch (uninstall Avorion > Install Avorion > Patch to Beta 0.20.2), the installation instructions now no longer require you to modify your ShipScriptLoader installation. See the first post in this thread for more information on how to install AutoDock v1.1.

I've followed the instructions twice now trying to get this to work. I have installed both shipscript and this without success. I am not getting any UI or additional station options.
I don't think you're running into a conflict. Rather, follow the updated installation instructions as I detailed in my answer to the previous question.

Following your instructions, did I install it on the client or the server? And how do I install it on the one that it wasn't installed on? Did what you said and it's not working.
I'm sorry to hear that! I will update the installation instructions to make it more clear. See the first post in this thread for details.

Thank you Shroob for this mod, even with larger docking ranges it can still be very tedious and dangerous to dock bigger ships so will definately give it a try :)
Oh, indeed. And the bigger the ship, the better this works, I have found. But big and small ships alike, it feels amazingly fun to fly at a docking beacon at 2 km/s and dock no problem.

If you've tried bigger ships, you should notice the docking beacon sticks further out from the dock than with smaller ships, making the approach to the beacon (and thus, the station) safe for both.

has anybody tried this mod on 0.18.2?
I've tested on the current 0.20.2 Beta Branch and it's working without a hitch. Please tell me if you run into any further problems.

Ive been looking for Auto Docking with the AI Tractor beams HOW Ever i Cannot get the Mod to work for me. Ive done what you said.

Ive added the script to ShipScriptLoader, I've Modified DefaultScripts
Ive done it to where instead of being on line 28 i put it on line 15 and still does the same thing. Am i missing something ?
Most likely it's the ShipScriptLoader instructions that have now been updated. See the first post (same answer as to the previous two questions regarding failure of installation).

------

If you run into any problems running this on 0.20.2 Beta Branch, please let me know -- I'll try and respond quicker this time.
« Last Edit: January 02, 2019, 02:55:34 PM by Shrooblord »
Shrooblord



Shrooblord

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    578
    • View Profile
on: January 03, 2019, 05:42:31 PM
Version 1.2 released! Now includes opt-out functionality for modders.

This version update contains opt-out functionality so that modders creating custom Stations can make sure their Station doesn't get any AutoDocks added to it if they don't want AutoDocks on their Station. See the main post for more details.

=======

1.2.1
  • Fixed a bug where the opt-out functionality would not correctly remove AutoDock functionality. Opt-out functionality should behave as expected now. See updated installation instructions.
« Last Edit: January 03, 2019, 08:34:41 PM by Shrooblord »
Shrooblord



Amriel

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    5
    • View Profile
on: January 05, 2019, 01:56:50 PM
Bit of confusion with the directory structure of the 1.2.1 zip file: it unzips to /AutoDock.v1.2.1/data/*  instead of the expected /mods/Autodock/data/* ,  so it can't be directly dropped into the steamapps/Avorion folder without manually creating the path chain.



Shrooblord

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    578
    • View Profile
on: January 06, 2019, 02:47:00 PM
Oh fk I messed up the directory inside the zip folder sorry about that. I'll fix it so it's more obvious.

The top-level folder is just the container; what's inside *should* have been a clear /mods/ folder so you just drop the contents of the container folder onto your Steam installation dir.

Fixing it now. Thanks for letting me know!

EDIT:
Oh, in fact the whole zip file seems to be for an older version of the mod. Wtf. I'll have it updated properly within a couple of minutes.
Shrooblord



Aloneatwar

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    1
    • View Profile
on: January 10, 2019, 07:47:19 AM
So I had this installed along with MoveUI on my own personal server I run. It was working fine over the holidays, but now none of us on the server get the option to autodock anymore.  Any ideas on what could have broken between then and now? I have tried fully deleting and reinstalling the mods but it is still broken.  MoveUI still works fine for me though.  Note that I am not running my server on the beta branch, just the normal branch.



Shrooblord

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    578
    • View Profile
on: January 13, 2019, 09:37:52 PM
Hmmm I have MoveUI and this mod installed both on my Beta Branch 0.20.3 server and it's working fine for us. I don't expect to have broken backwards compatibility with any upates performed, but to be sure, let's make sure of a couple of things. For clarification: absolutely no AutoDocks are spawning?

You don't get the option -- does this mean the interaction is missing from the UI when you try and interact with stations? Are you flying player vessels, or Alliance vessels? When you press the quote key ( ' " ) to open the console in-game, does it display any error messages?

EDIT:
Another possibility: did you by accident only update the mod locally, and not both in the local and server installations?
« Last Edit: January 14, 2019, 05:34:07 PM by Shrooblord »
Shrooblord



Nardix

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    1
    • View Profile
on: January 28, 2019, 06:19:39 PM
I followed the instructions to the letter, yet I'm unable to see the interaction.
According to the console Autodock migrator registered, and no error messages are displayed.

Any idea what's going on?

EDIT: Nevermind, I apparently had to jump to a different sector before the interaction appeared.
It works like a charm now!
« Last Edit: January 28, 2019, 06:21:49 PM by Nardix »