Jump to content

[MOD] Rename Ships - 1.1.3


Shrooblord

Recommended Posts

Rename Ships

Have you ever made a mistake during ship creation and given it the wrong name? Has a kooky name grown old? Have you given a ship a name for a specific purpose, only to discover you wanted to reassign it a different purpose, but now the name is all wrong?

 

In other words: do you want to rename your ships? Then look no further! This mod is for you.

 

 

Usage

This mod adds a Holy Grail icon to the UI. Use this icon to modify the name of the ship you are currently piloting.

To modify the name of another ship you own, which you are currently not piloting, bring up the Interaction Window with F and choose "Rename Ship".

This can also be done on the ship you're currently piloting yourself, of course.

Either way, a dialog comes up within which you can type your new ship's name. The name is limited to 35 characters, as all ship names in Avorion are. Press OK and the new name is applied. Press the X button to close the dialog afterwards.

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

 

 

Installation Instructions

- Download the mod ShipScriptLoader by Dirtyredz and follow its installation instructions. This is required to load Rename Ships. If you are already using it you may skip this step.

Note

There is an issue in the installation instructions of ShipScriptLoader. These are the lines you should add to Avorion/data/scripts/server/server.lua:

local s, b = pcall(require, 'Avorion/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

 

- Open the file Avorion/mods/ShipScriptLoader/config/ShipScriptLoader.lua

- Before the last line containing return Config add this:

Config.Add("mods/RenameShips/scripts/entity/shipRename.lua")
Config.Add("mods/RenameShips/scripts/player/shipRenameMigrator.lua")

- Copy the directory mods contained in the RenameShips .zip file directly into the Steam installation directory folder for Avorion.

 

NOTE: This mod needs to be installed both client-side and server-side in order to work. Client-side integration is important for the UI to work, while server-side integration ensures the change is registered and saved to the galaxy's data.

 

 

Changelog

==MOST RECENT VERSION: 1.1.3==

NOTE: A new file, mods/RenameShips/scripts/player/shipRenameMigrator.lua was added in this version, which needs to be added to the config of ShipScriptLoader.lua. See the updated installation instructions in this forum post or README file included in the download.

 

1.1.3

  • BUGFIX: shipRenameMigrator now prints the correct amount of ships into Console when entering a new Sector.

 

1.1.2

  • BUGFIX: You can now rename ships at long range. If you own the craft or have the appropriate Alliance permissions to modify a ship,
    you can now Interact with any ship in the Sector and use the item Rename Ship.

 

==OLDER VERSIONS==

 

 

  • 1.1.1
    • BUGFIX: The UI window now closes when you press OK.

     

    [*]1.1

    • Added Alliance recognition: players in Alliance craft will now have the ability to rename those craft if they have the appropriate Alliance permissions to fly ships.
    • Added a README.txt to the modpack for bundled installation instructions.

     

    [*]1.0

    • Initial Release

 

 

 

Credits

- Dirtyredz for the ShipScriptLoader.

- Laserzwei's post for CarrierCommander, whose structure (and, partly, words) I shamelessly copy-pasta'd because it is very effective at getting the point across succinctly.

RenameShips-1.1.3.zip

Link to comment
Share on other sites

BUG REPORT

Noticed unexpected behaviour due to the implementation of Ship Script Loader as the only hook for entities into using this mod: you cannot long-distance rename ships you own. This is confusing since once you've piloted these ships, the script has been added to them, and then, you can long-distance rename them.

This is intentional to how Ship Script Loader works, but an oversight on my end.

 

I will work out a solution soon / today that incorporates the ease-of-use of using Ship Script Loader to install the mod, but allows long-distance renaming of ships you own / in your Alliance (given the proper privileges etc. etc.) without having to pilot them first. Stay tuned.

Link to comment
Share on other sites

Update 1.1.2

  • BUGFIX: You can now rename ships at long range. If you own the craft or have the appropriate Alliance permissions to modify a ship,
    you can now Interact with any ship in the Sector and use the item Rename Ship.

 

/!\

NOTE: A new file, mods/RenameShips/scripts/player/shipRenameMigrator.lua was added in this version, which needs to be added to the config of ShipScriptLoader.lua. See the updated installation instructions in this forum thread or README file included in the download.

 

EDIT:

Immediately noticed a mistake I'd left in the code. Fixed.

 

Update 1.1.3

  • BUGFIX: shipRenameMigrator now prints the correct amount of ships into Console when entering a new Sector.

Link to comment
Share on other sites

  • 3 weeks later...

error constructing Player: no player found in script context at 	[C]:-1: in function Player
mods/RenameShips/scripts/player/shipRenameMigrator.lua:32: in function ?
could not execute function 'onSectorChanged' in '"mods/RenameShips/scripts/player/shipRenameMigrator.lua"':
mods/RenameShips/scripts/player/shipRenameMigrator.lua:34: attempt to index global 'player' (a nil value)
stack traceback:
mods/RenameShips/scripts/player/shipRenameMigrator.lua:34: in function <mods/RenameShips/scripts/player/shipRenameMigrator.lua:26>

 

 

maybe a Problem with Alliance ships ? but it´s still working

Link to comment
Share on other sites

function onSectorChanged()
    if onServer() then
        local stations = {Sector():getEntitiesByType(EntityType.Station)}
        local ships = {Sector():getEntitiesByType(EntityType.Ship)}
        
        playerShip = Entity()
        player = Player()
        
        if playerShip.factionIndex == player.index then
            addRenameScriptToEntities(stations)
            addRenameScriptToEntities(ships)
            
            if touched then
                print("***================================***")
                if craftTouched == 1 then
                    print("RenameShips Migrator: Added ShipRename to 1 craft in this Sector.\n")
                else
                    print("RenameShips Migrator: Added ShipRename to "..tostring(craftTouched).." craft in this Sector.\n")
				local craftTouched = 0
                end
            end
        end
    end
end

 

 

someone knows how to change this

 

        if playerShip.factionIndex == player.index then

 

for Alliance ships ? if this is the matter ?

Link to comment
Share on other sites

  • 4 months later...
  • 5 weeks later...

RenameShips does it's job perfectly, I can rename any ship in my fleet, no problem. However...I don't have a holy grail icon and my insurance icon now renames ships instead of lets me purchase insurance. It's even changed names. I'm running a good number of mods, but the only other one that affects that bar is moveUI. Or it could be any of them...Could someone give me a place to start poking around, maybe the location of the file that affects that bar?  I'm guessing I've fudged up an install by overwriting something I should have handled in the text editor.

Link to comment
Share on other sites

  • 2 months later...
  • 3 months later...

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