It appears to be impossible to set a backer name for any entity other than a roboport, radar, lab, locomotive, or train stop. The base entity class that these inherit from has methods for setting/reading the backer names but these only throw away the strings passed to it. The classes that do support backer names all have a dedicated field for a string. My understanding is that this is to implement the bare minimum for vanilla backer names without shackling every other entity with an extra eight bytes to point to a string.
If it matters at all, I need to be able to assign names to turrets that players can see when they hover over them. The idea is so I can create a turret leaderboard in a server. From what I understand, the vanilla entity hover GUI cannot be manipulated in any way so I can't store the custom names in some other way if I still want them to be shown when hovering over the "renamed" entity. If this is planned to be done at any point in the future, this would be preferable as it opens up more options.
Set backer_name for other entities
Re: Set backer_name for other entities
It's not just 8 bytes per entity with a backer name. A C++ std::string takes up 32 bytes or more depending on how large the stored string is. In addition to runtime memory usage it also increases the save file size because in order to include anything in the save file it has to *always* exist at least partially in the save file so when loading the game knows what it should load.
Adding backer name support to turrets isn't likely to happen. Every worm on the map + every laser/ammo/electric turret would incur increased RAM usage and increased save file size for something completely un-used by the base game.
Adding backer name support to turrets isn't likely to happen. Every worm on the map + every laser/ammo/electric turret would incur increased RAM usage and increased save file size for something completely un-used by the base game.
If you want to get ahold of me I'm almost always on Discord.
Re: Set backer_name for other entities
Yes but a null pointer is still just eight bytes. It's also possible to implement this with a static hash table or other table structure which sidesteps the memory problem but that has other costs associated with it if it ever has a name for a nonstandard entity. Is there any plan to allow manipulation of the hover GUI? That will also allow me to accomplish what I'm trying to do.
It's just a little frustrating that the entities the backer_names are given to are completely arbitrary outside the train stop.
It's just a little frustrating that the entities the backer_names are given to are completely arbitrary outside the train stop.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Set backer_name for other entities
What exactly is a "turret leaderboard"? Would it be sufficient to just place flying-text on the turrets?
Re: Set backer_name for other entities
The idea is I have some code the randomly generates names that would be assigned to turrets. The turret list looks like this where each piece of text in braces is a reference to a random entry of another list.
and will randomly generate something like
It's a small silly mod that I'm making to add a little more spirit to the death rail world my friends and I are playing on. So the turret in first place might have a crown or something visible on a map or you might give "good job" medals to turrets that are doing a lot of work. I'm still working on it so not everything is set in stone yet. One of my buddies suggested having an obituary for turrets that had fallen in the line of duty. The leaderboard would probably look something like this but with buttons next to these to snap to their position on the map.
I can approximate what I want to do now but I would like proper support for something like names when actual entities in the game have them rather than hacky workarounds if possible.
Code: Select all
#Gun Turret Name
GunTurretName
{
"{GloryAdjective} {AlienNoun} {KillerNoun}",
"{AlienNoun} {KillerNoun}",
"{OffspringNoun} of {GloryNoun}",
"{SearcherNoun} of {GloryNoun}",
"{GloryNoun} {SearcherNoun}",
"{TurretBarrelNoun} of {PainNoun}",
"{TurretBarrelNoun} of {DeathNoun}",
"{BattleNoun} {WeaponPersonNoun}",
"{CountryAdjective} {BattleNoun} {WeaponPersonNoun}",
"{CountryAdjective} {LiberatorNoun}",
"{GloryAdjective} {WeaponPersonNoun}",
"{GloryAdjective} {BattleNoun} {WeaponPersonNoun}",
}
Code: Select all
Name 1: "Grandiose Biter Ender"
Name 2: "Battle Hero"
Name 3: "Renowned Sergeant"
Name 4: "Descendant of Exaltation"
Name 5: "Six Glorious Barrels of Extinction"
Name 6: "Biter Death Dealer"
Name 7: "Six Glorious Barrels of Agony"
Name 8: "Six Turning Drums of Death"
Name 9: "Battle Champion"
Name 10: "Grand Gnat Ender"
Name 11: "Six Magnificent Cylinders of Erasure"
Name 12: "Grandiose War Veteran"
Name 13: "Descendant of Triumph"
Name 14: "Chinese Redeemer"
Name 15: "Grand Battle Chief"
Name 16: "Aspirant of Glory"
Name 17: "Dignity Aspirant"
Name 18: "Glorious Beetle Executioner"
Name 19: "Aspirant of Bravery"
Name 20: "Exalted Veteran"
Code: Select all
Rank, Name[Type], Kills, Owner
1 --- Insect Crucible [FlamethrowerTurretIcon] --- 1423 kills --- ExileLord
2 --- Toasty Arachnid Slayer [FlamethrowerTurretIcon] --- 1121 kills --- ExileLord
3 --- Pest Eraser [LaserTurretIcon] --- 634 kills --- ExileLord
4 --- Exalted Veteran [LaserTurretIcon] --- 511 kills --- Miaumon