Yes, you can also use C.GetPlayerID() and player.entity if you are doing something where the player character needs to change ships. You can also use the player.entity with the NPCblackboard. This is useful as some things like true/false print differently if they are a Lua true vs a script true when they are printed. i.e. a table of {true, false} with print as {1LF, 0LF} for script values and {1, 0} for Lua values even though the Lua values are converted via the signal object function. This is useful for checking to make sure you have properly converted boolean values loaded from scripts into Lua boolean values.UniTrader wrote: ↑Mon, 25. Feb 19, 15:51just a hint: your event will probably fail when you change the ship because the event object is on!y set up once (when the event is set up/starts listening), but you send the signal to the current player ship rather than the one which used to be it. Either use a better suited event object like the player.entity or re-register the event whenever the player changes the ship. Former way is imo better because it doesn't have edge cases (player riding a ship without control!ling it, player walking on station with possibly no player ship docked)
Update Day 16: Continued work on the equipment menu. In hindsight, it would have been easier to start from scratch rather than mutilating the ship_configuration_menu into what I want. But then I wouldn't get to hear it scream as I rip chunks out of it, so a bit of a mixed bag either way. Lots of library functions have been created to support the equipment menu. I decided to go with searching for a nearby shipyard, instead of using the library/Encylopedia. I added a search for nearest shipyard function to the library for that. For the equipment menu, I added an option to select a specific place to resupply. For that, I added isshipyard, and canbuildships options to the select_object library. I left off working on the saving and loading, which is where the hindsight kicks in: getting it to display not a difference from the current loadout, but an absolute amount without considering the current loadout. I also spent a bit of time updating comments; muddling my way through the ship_configuration_menu reinforced the importance of having good comments.