Author Topic: [MOD] Rename Ships - 1.1.3  (Read 5197 times)

Shrooblord

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    578
    • View Profile
on: January 27, 2018, 04:44:31 AM
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:
Code: [Select]
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:
Code: [Select]
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==
Spoiler: show

  • 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.
« Last Edit: February 05, 2018, 12:52:52 AM by Shrooblord »
Shrooblord



Ravien

  • Sr. Member
  • ****
  • Status:
    Offline
    Posts:
    253
    • View Profile
on: January 27, 2018, 09:02:03 AM
Oh that's amazing. Thank you!

I hope they make that baseline soon so we don't need a mod for it.



Shrooblord

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    578
    • View Profile
on: January 28, 2018, 06:31:56 PM
Update 1.1
  • Added Alliance recognition: players are now able to rename Alliance ships, as long as they have the proper Alliance permissions to fly ships.
  • Added a README.txt to the modpack for bundled installation instructions.
Shrooblord



Shrooblord

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    578
    • View Profile
on: January 30, 2018, 11:19:53 PM
Update 1.1.1
  • BUGFIX: The UI window now closes when you press OK.
Shrooblord



Shrooblord

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    578
    • View Profile
on: February 02, 2018, 12:57:58 PM
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.
Shrooblord



Shrooblord

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    578
    • View Profile
on: February 02, 2018, 04:09:31 PM
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.
« Last Edit: February 02, 2018, 04:24:11 PM by Shrooblord »
Shrooblord



Ravien

  • Sr. Member
  • ****
  • Status:
    Offline
    Posts:
    253
    • View Profile
on: February 03, 2018, 06:52:51 AM
This will be a must have mod for me.



T4Ken

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    18
    • View Profile
on: February 24, 2018, 12:48:30 AM
Code: [Select]
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



T4Ken

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    18
    • View Profile
on: February 26, 2018, 08:59:43 PM
Code: [Select]
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 ?



Shrooblord

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    578
    • View Profile
on: July 13, 2018, 11:45:14 AM
Hey. Late reply, I know. I've looked into the error. Silly things were happening. Here's a hotfix; I'll look into how to properly solve it later.

Shrooblord



Malkeus

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    1
    • View Profile
on: August 12, 2018, 04:18:38 AM
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.



TheCreepyGinger

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    2
    • View Profile
on: October 15, 2018, 01:33:14 AM
Hey so great mod, but uh... how do ya download the actual rename ship mod? I couldn't find a link.



TheCreepyGinger

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    2
    • View Profile
on: October 15, 2018, 01:35:05 AM
Nevermind. Turns out one needs to be registered with the forum to actually see the link. Good thing I made an account.



kirknay

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    5
    • View Profile
on: February 13, 2019, 05:05:51 AM
Mod has been broken by the latest patch. Please fix for 0.20.x update.



unbekannt1984

  • Full Member
  • ***
  • Status:
    Offline
    Posts:
    164
    • View Profile
on: February 13, 2019, 08:11:08 AM
Hi,

I think there won't be a fix. Shrooblord put this Mod into the Deprected-Section of Topic: [Mod Info] Which Mods Are Supported This Patch?.