Mods can set a train stop name to the empty string. Bug? Feature? Future assertion error? Not really any of those.

Bugs that are actually features.
Post Reply
slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Mods can set a train stop name to the empty string. Bug? Feature? Future assertion error? Not really any of those.

Post by slippycheeze »

I'm not sure what this counts as, but with the recent spate of train system bugs:

I was poking at a rail blueprint someone had where they described some stations used to add a routing penalty as "unnamed" stations. Indeed, they had no visible name. Turns out in practice that they were named "<space>", as in one space character.

Meanwhile the default UI forbids an empty string as a station name, but it turns out mods can set it to that - literally a zero character long string.

It doesn't assert saving or loading the map, and the "name" persists, but ... I'm not sure if this is a lurking bug for the future or something. So, do with that what you will. Meanwhile I'm going to, uh, not do that, because I'd rather not find out where the bugs *are* that it causes. :)

To reproduce: use any lua to set the backer_name field to "" in lua. I'd post a map, but it doesn't seem worth the effort. Let me know if I'm wrong. :)


Moderators: this should probably go over into the "entertaining quirks" forum, now it turns out to not really be anything but entertainingly "I hurt myself" and all.
Last edited by slippycheeze on Fri Jul 19, 2019 3:12 am, edited 1 time in total.

tehfreek
Filter Inserter
Filter Inserter
Posts: 391
Joined: Thu Mar 17, 2016 7:34 am
Contact:

Re: Mods can set a train stop name to the empty string. Bug? Feature? Future assertion error?

Post by tehfreek »

I'm reasonably sure you can do it directly in the blueprint string as well, but I have no idea if you can actually paste or even load such a blueprint.

slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: Mods can set a train stop name to the empty string. Bug? Feature? Future assertion error?

Post by slippycheeze »

tehfreek wrote:
Fri Jul 19, 2019 1:42 am
I'm reasonably sure you can do it directly in the blueprint string as well, but I have no idea if you can actually paste or even load such a blueprint.
Works perfectly, for some values of perfectly. Additional interesting facts, just for fun:
  • You can't crash the game with any valid Unicode string as a station name, even the really strange characters right at the top of the ethereal plane.
  • All unicode outside WGL4 appears to sort at the very top of the list, so you can't just whack in U+F00F and hide a station at the very bottom. I did not test extensively, mostly because once I established it didn't sort at the bottom I didn't care any longer.
  • No font fallback, so very, very few Unicode characters work compared to the whole. You won't notice unless you want hieroglyphics or runic train station names though. I'm unclear about SEA and far east text, etc, and honestly, don't care enough to try while casually messing with the game.
  • If you route a train to a station, and set the name of it to the empty string, it is as if you destroyed the rail it was moving to. (Internally, this is what a destroyed rail, or station I guess, is renamed to.)
  • If you get "empty string" into a train schedule, it shows up named "Invalid", which is what that represents internally.
  • You can wierd up all the train things, but you can't kill the game easily, which is pretty impressively robust, doing this.
  • A station with "empty string" will blueprint, and will place and name normally if you don't save station names.
  • A station with "empty string" will blueprint, and be visible in the preview, but will not actually place (in my testing, anyway) when you throw down the blueprint, if you save the names.
Also potentially useful, but quirky: a station with the name " " - a single space character - will not be visible in the list of stations in a train schedule. It will work perfectly normally otherwise, as in, acts like a station. If you get it into a schedule, for example by putting a station there, then renaming it to " "

So... not very useful in the normal station, but if you wanted to put a "prefer the other line" hint for the train pathing system, the fact it won't show up in the list when scheduling is really nice. So, they can be used as a horrible, but not very dangerous, hack to place a penalty on a bit of rail for the pathfinder. It doesn't like to go through a station it isn't scheduled at, and you don't have to ignore "ZZ - use the fast lane" at the bottom.


Credit to the Bulldog main line blueprints for the single space thing. I eventually worked out that it wasn't an *accident* they named the stations that, far, far later than I should have.

posila
Factorio Staff
Factorio Staff
Posts: 5202
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Mods can set a train stop name to the empty string. Bug? Feature? Future assertion error? Not really any of tho

Post by posila »

Thanks for the report.
Mods being able to do something that doesn't make the game unstable is generaly not a bug.

slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: Mods can set a train stop name to the empty string. Bug? Feature? Future assertion error? Not really any of tho

Post by slippycheeze »

posila wrote:
Fri Jul 19, 2019 5:58 am
Thanks for the report.
Mods being able to do something that doesn't make the game unstable is generaly not a bug.
Yeah, I posted when I thought I was going to stop trying to break your game. I didn't stop, so figured out that it wasn't really a bug at all. I left this because it seemed interesting and relevant somewhere on the forums, but I couldn't work out where. On reflection, "not a bug" sounds like a good forum choice for it, because it looked like one initially.

Post Reply

Return to “Not a bug”