Space Engineers

Space Engineers

Control Module - basically key binding for ships
Djelle 16 Sep, 2023 @ 3:18pm
Reading inputs in a unaccessable ProgBlock through an accessable Cockpit/Remote
I am using this fabulous mod with a scenario I am making. It is a racing game. And I don't want players to be able to fidle with the ProgBlock in the cars. But when the PB is not owned (accessable) by the driver, the PB can not get any values with Me.GetValue. Which does not make sense, as a not-owned PB can read the users inputs with MoveIndicator/RotateIndicator/RollIndicator from a IMyShipController in this case.

I have tried to read a secondary (accessable) PB or TimerBlock with something like: ProgBlock2.GetValue<Dictionary<string, object>>("ControlModule.Inputs"). But that is apparently not posible either.

I'm only using one key (Shift), Which should activate booster when held down.

Any suggestions are welcome.
< >
Showing 1-7 of 7 comments
Digi  [developer] 16 Sep, 2023 @ 5:11pm 
Hmm, I think the issue is that I'm checking pilot relation to the PB so it refuses to see it as a valid cockpit.
I can change that to check if PB has access to the cockpit (same check that GridTerminalSystem uses) instead.

Or do you mean you can't get the input dictionary in the first place? is it always empty (it has to have the analog ones at least)? is it throwing an error?

Also, you shouldn't use nobody-owned because players can take ownership of those so kinda defeats the point. I think you need to make PB and cockpit owned by an NPC (or something enemey to the players) and have the cockpit be shared with all.
Last edited by Digi; 16 Sep, 2023 @ 5:11pm
Djelle 16 Sep, 2023 @ 5:59pm 
Thx for the answer. I can get the input directory fine. Your mod is working wonders for me. Except when the PB is not accessable by the one sitting in the cockpit. You do also mention that in your discription. I was just trying to find a work-around. I have not checked if anything get's through at all. But at least the one key I am using does not.

I do think the sollution you mention in your first paragraph would be a good one. But I am only one person. And you (as the programmer) have to find this a good solution too, of course. I think it would fit the syntax of SE though.

Both the PB and the Cockpit is owned by an NPC (same faction as the player). The PB is shared with none. And the Cockpit is shared with faction. You are correct there.
Digi  [developer] 16 Sep, 2023 @ 8:57pm 
I've made a separate upload with that change + saving settings to customdata, I've briefly tested them but ofc that might mean I break other stuff =)

Can you use it while doing that scenario and let me know if you find any issues (it's unlisted):
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3036873243

I'll replace this version with that if no issues are found... when are you planning on finishing the scenario? Is it like hours, days, weeks+, whenever it's ready? :P As I wouldn't recommend publishing it with the test mod.
Last edited by Digi; 16 Sep, 2023 @ 8:58pm
Djelle 17 Sep, 2023 @ 4:59am 
Good morning from me :) I tested you test build. And it seems to work like intended. I did only test it the way I use it in my pressent scenario. So not a thorough test.

Only think I noticed is, that you made it transfere existing settings from the block name to Custom Data. Very nifty :) Though it didn't do this when my PB was unaccessable.Very minor thing though.

Of course I would not release anything with a test mod :) The only think I need to do with my scenario, is to transfere ownership to my NPC. Make blocks that need it, unaccessable. And do a final multiplayer test. My scenario has been dormant for around a year. As i could not figure out how to make it run on a dedicated server. But this time I managed to make it run :steamhappy:
Digi  [developer] 17 Sep, 2023 @ 5:01am 
Originally posted by Djelle:
Though it didn't do this when my PB was unaccessable.Very minor thing though.
Uhh you mean with this test version there was a block that didn't get its settings transferred? That's not minor at all, can you post the blueprint of the ship that has that?
Djelle 17 Sep, 2023 @ 5:30am 
Here it is:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3037041055
To use: you need to enter the cockpit and hit [1] to access the remote.

Many things in the script in this car won't make sense, as it is dependent on the scenarios script-part to work. But it is fully drivable as is.

I forgot to mention that when I initially tried out your mod; Without using the Seat Name Filter, it would activate the thrusters without any modifications to my script. When I added "remote" to the filter it stopped doing that. I didn't chace this weird behaviour further. As I was just exited to have a functional Shift key :)
Djelle 17 Sep, 2023 @ 5:33am 
Should mention that the scrip in this car is modified to read the Shift key. Before that I used to read MoveIndicator from the remote to have S-key (reverse) activate the thrusters.

I could probably dig up the old script from a backup, if interested.
Last edited by Djelle; 17 Sep, 2023 @ 5:36am
< >
Showing 1-7 of 7 comments
Per page: 1530 50