Jump to content
  • 0

Expose Sector().name to Be Writable Instead of Read-Only


Shrooblord

Suggestion

Hi devs,

 

One of the nicest things of building civilisations, empires or cities in other "building games" is to be able to name your assets and later look back on them and go "Oh, yeah, that's the Mr. Fancypants Partyhouse. Muggers like to patrol the scene there."

There's just something fun about naming things the way you want to.

 

To that end, could you please lift the Read-Only attribute on the name property of Sector()? That way we could make a mod ourselves that sets the name using

if onServer() then
    sector = Sector()
    print(sector.name)
    sector.name = "My New Sector Name"
    print(sector.name)
end

, a script that currently fails due to Sector.name not being writable.

 

I hope this should prove an easy-ish feature to implement. I'm not asking for a renaming function or a UI that does this for us, nor anything fancy. If you only lift the Read-Only property of Sector.name, I'll do the heavy lifting. ;)

 

Thank you for reading,

 

 

Shrooblord

Link to comment
Share on other sites

5 answers to this suggestion

Recommended Posts

  • 0

It would be nice if ships and stations could be renamed as well.

Actually, I went and checked for you, and this is actually very easily done!

 

I just wrote the simplest script imaginable:

package.path = package.path .. ";data/scripts/lib/?.lua"
require ("defaultscripts")
require ("stringutility")

function initialize()
    print(Entity().name)
    Entity().name = "New Name"
    print(Entity().name)
end

and added it to my ship using the Entity Debugger. Instant success! My ship is renamed. :D

 

I'll hack together a little UI similar to the one that is triggered when you found a ship, and make it accessible to the player in some way. Probably a button in Build Mode makes sense. Or the Ship Menu. I'll have a check which one is easier to implement as a quick rough-cut-and-dry solution. ;)

 

EDIT:

I've been experimenting, and it turns out that the above method is client-side only!! Not all is bad news though; by simply invoking the above functionality as a function executed by the server, the name change sticks when you log out and in again. ^^

invokeServerFunction("renameShip", "This Is the New Name")

function renameShip(newName)
    Entity().name = newName
end

 

I'm currently wrapping up work, making it nice and easy-to-use, and possibly make it so it becomes an interaction in the Interaction Dialog for a ship you own. Currently, you have to be piloting the ship for it to work, which is a nice first step, but long-range renaming would be optimal, no?

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