Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
which is a bit confusing as the key is actually a hash/dictionary that points to an array/list
The ones I meant to ask about are:
getStationTerminalForVehicleNode(nodeId)
getStationTerminalsForPersonEdge(edgeId)
getStationTerminalsForPersonNode(nodeId)
Edit: They all have similar ref info to this:
6707 is a station:
So, I'm looking at entity 7566, to figure out what that might be (in the debug window):
Going back to your original question, I figured out so far:
getStationTerminalForVehicleNode(nodeId) the nodeId needs to be userdata, so it can be made with:
(6547 is a station entity)
The EdgeId works in a similar fashion:
One thing to remember here, that despite the way the debug window presents these values they are NOT Lua tables, but userdata. Which means that some things (like iterators) don't always behave the way you'd expect. One very important thing to remember is to never directly refer to the sub-fields of the returned userdata like this:
but instead use this:
The first notation can result in random crashes when the underlying userdata object gets garbage-collected (on the game side) but the Lua library has no way of determining this.
Instead of print(a) I can use debugPrint(a) to expand the userdata stuff. (Seems to do the same thing as print(table.toString(a)), except the latter doesn't seem to work in this context.)
But I don't want to examine it anyhow because I already know what the entity is -- it's a vehicleNode, personNode, or personEdge that I get from the station info, like this:
So for
On that particular function to "create" a new nodeId - you're not really creating anything - that nodeId is existing (taken from the map before, I just trimmed too much of the output). You're building a lua 'userdata' object here that can be passed as a parameter to the api.engine.system.stationSystem.getStationTerminalForVehicleNode() function.
so there are two steps here: build the userdata object and provide it to the API call to get the data back:
It takes a bit of experimentation and guessing to figure out what links to what and how.
So I tried it but the results weren't very helpful. In my station entity 33711, terminal [1] has vehicleNode 33681. So I made the type.new "copy" of 33681, and then stuffed it into the getStationTerminalForVehicleNode function. The result was 33711 (plus a nil if I table/debug print), which is the station entity, but no terminal number. The ref doc suggests the function is supposed to return the terminal number, so still seem to be missing something if the function is supposed to live up to its label 🤔
Edit: the console...
Emailed UG for some guidance...
Edit: I mean we shouldn't have to guess how to use it, so it seems to be a "hole" in the ref doc.
Many thanks for the help, learned a bunch today! 🙏
For every terminal in the station it lists every personNode, personEdge, and vehicleNode. So the 3 getStationTerminalFor- functions are simply doing the lookup in the other direction. At least that's what the API ref indicates.