Space Engineers

Space Engineers

[OBSOLETE] Smart Turrets
Zelious  [developer] Dec 17, 2017 @ 1:22am
Bugs/Crashes
Shove any Bugs or Crashes you experience here and I'll fix them as soon as I can!

Make sure to be descriptive, I can't resolve a problem I can't duplicate!
Last edited by Zelious; Dec 17, 2017 @ 1:22am
< >
Showing 1-15 of 53 comments
Butter Dec 18, 2017 @ 5:48pm 
Whenever I click the "enable smart turret" button, my game instantly crashes. I disabled all my mods, limited the world size, deactivated oxygen, random encounters, ect, and loaded up an empty world with a grid that was three blocks: light armor, a reactor, and a turret. still crashed when I went to enable smart turret. I'm also dumb and don't know how to put a crash log here.
Zelious  [developer] Dec 18, 2017 @ 6:10pm 
Go to your file explorer and navigate to %appdata%\SpaceEngineers. Then look in SpaceEngineers.log and grab the chunk at the end that is a mess, that's the crash bit I need. There is also a view log button you can click from the crash screen.
🅂🄸🅂🄺 Dec 19, 2017 @ 1:54pm 
Same here with a vanila small grid gatling turret.


Exception occured: System.NullReferenceException: Object reference not set to an instance of an object.
at Zkillerproxy.TurretMinTargetMod.smartTargetingSwitchSetter(IMyTerminalBlock turret, Boolean newValue)
at Sandbox.Game.Screens.Terminal.Controls.MyTerminalValueControl`2.SetValue(TBlock block, TValue value)
at Sandbox.Game.Gui.MyTerminalControlOnOffSwitch`1.OnValueChanged(MyGuiControlOnOffSwitch obj)
at Sandbox.Game.Screens.Helpers.MyGuiControlOnOffSwitch.set_Value(Boolean value)
at Sandbox.Game.Screens.Helpers.MyGuiControlOnOffSwitch.HandleInput()
at Sandbox.Graphics.GUI.MyGuiControlBase.HandleInputElements()
at Sandbox.Graphics.GUI.MyGuiControlBlockProperty.HandleInput()
at Sandbox.Graphics.GUI.MyGuiControlParent.HandleInput()
at Sandbox.Graphics.GUI.MyGuiControlList.HandleInput()
at Sandbox.Graphics.GUI.MyGuiControlBase.HandleInputElements()
at Sandbox.Graphics.GUI.MyGuiControlParent.HandleInput()
at Sandbox.Graphics.GUI.MyGuiControlParent.HandleInput()
at Sandbox.Graphics.GUI.MyGuiScreenBase.HandleControlsInput(Boolean receivedFocusInThisUpdate)
at Sandbox.Graphics.GUI.MyGuiScreenBase.HandleInput(Boolean receivedFocusInThisUpdate)
at Sandbox.Graphics.GUI.MyScreenManager.HandleInput()
at Sandbox.Graphics.GUI.MyDX9Gui.HandleInput()
at Sandbox.MySandboxGame.Update()
at Sandbox.Engine.Platform.Game.UpdateInternal()
at Sandbox.Engine.Platform.Game.RunSingleFrame()
at Sandbox.Engine.Platform.FixedLoop.<>c__DisplayClass1.<Run>b__0()
at Sandbox.Engine.Platform.GenericLoop.Run(VoidAction tickCallback)
at Sandbox.Engine.Platform.Game.RunLoop()
at Sandbox.MySandboxGame.Run(Boolean customRenderLoop, Action disposeSplashScreen)
at SpaceEngineers.MyProgram.Main(String[] args)
Zelious  [developer] Dec 19, 2017 @ 4:27pm 
Having a look at the "smartTargetingSwitchSetter" function, the one where your crash is occurring, I can't see any reason for there to be a NullReferenceException unless the turret or the value being set are nonexistent. Going into a new empty world with nothing but Smart Turrets and testing with a small grid gatling I have no problems (All my initial testing was with large grids so I thought I should check). If everyone had the same problem your having than the mod would be completely broken and I haven't gotten any reports of that, so I think there still must be a problem on your end, try verifying your game files to make sure SE isn't missing something.
🅂🄸🅂🄺 Dec 19, 2017 @ 5:58pm 
Ok i tested a bit more.
Empty World with default settings and only Smart Turret Mod.
Tested Survival and Creative modes

I build always the same blocks:
1. Fighter Cockpit
2. Gatling Turret

Every time i try to enable the smart turret function my game crash.
If i save the game and reload before i hit the button it doesn't crash.

In the first case the default controls of the turret are missing.
I don't looked into your code but i think the bug is somewhere in the terminal controls initialisation.

EDIT: Sorry my bad, the default controls are not missing, they just are not at the top. Only the "Toggle Block" switch is missing.
But after saving and reloading all controls are where they should be
Last edited by 🅂🄸🅂🄺; Dec 19, 2017 @ 6:21pm
Zelious  [developer] Dec 20, 2017 @ 12:42am 
It's odd that the default controls are at the bottom, that does sound like a problem with the terminal controls initialization, but it's still strange that only a few people have this issue, makes me think it's some problem with your SE but I have no idea what it could be. Try entering and exiting the terminal multiple times and saving/reloading without touching any of the controls just to observe how the terminal controls are behaving, might shed some light on the cause.
Zelious  [developer] Dec 20, 2017 @ 4:00am 
A friend of mine happened to experience this crash and was able help me track it down, it should now be fixed. It turns out that some peoples space engineers installs, for some unknown reason, have there vanilla turret targeting options disappear when Smart Turrets is running. This was quite a problem as when enabled Smart Turrets attempts to turn off these settings. This was causing a NullReferenceException as the settings simply didn't exist to disable. The mod now checks if the settings exist before changing them, resolving the crash. If you have the disappearing vanilla targeting options problem and want to use vanilla targeting, simply save and reload as 🆂🅸🆂🅺 found out, they should reappear :)
🅂🄸🅂🄺 Dec 20, 2017 @ 7:10am 
Ok the crash is fixed but i think there is still something wrong.
Is there a reason why you use a MySessionComponentBase instead of a MyGameLogicComponent for your turret logic?
This might be the problem with the crash and missing or unordered controls.
Zelious  [developer] Dec 20, 2017 @ 3:06pm 
Still something wrong? Are you just referring to the missing terminal controls or is there some major problem? I used MySessionComponentBase because that's what the modding tutorials and other mods I looked at used, switching to MyGameLogicComponent in my test version and the terminal controls are not added, I would assume the script isn't running at all. I have a bit of a suspicion that this terminal control mess is down to whether you have an Intel or AMD processor, after all SE used to have some big problems on AMD hardware so there is likely inconsistencies in how the game runs between the two. It would explain why so many people have no issues and so many others have the exact same issues.
🅂🄸🅂🄺 Dec 20, 2017 @ 3:32pm 
Look at mods like Automated Beam Drill or Nanobot Build and Repair System how they implement their block logic and add their terminal controls.

I use an intel i5 processor.

For the MyGameLogicComponent you have to add an MyEntityComponentDescriptor. I think [MyEntityComponentDescriptor(typeof(MyObjectBuilder_TurretBase), true)] is the correct one.
Zelious  [developer] Dec 20, 2017 @ 3:40pm 
Well I guess it's not because of AMD hardware. I'll have a go at what you've said and actually read up on it a bit this time :)
Zelious  [developer] Dec 20, 2017 @ 4:01pm 
Ok, what you've put there is correct but it still doesn't work because that is for assigning classes to blocks that are ran every time the blocks updates. MySessionComponentBase is for running classes globally. I also don't think you can add terminal controls in MyGameLogicComponent so It unfortunately won't help with the missing controls problem. Thanks for telling me about it anyway, quite useful to know I can directly tie classes to blocks (I'm relatively new to SE modding).
🅂🄸🅂🄺 Dec 20, 2017 @ 4:50pm 
https://pastebin.com/qh5ZP13n

This is your script as GameLogicComponent without targeting stuff :D

This should initialize the TerminalControl correctly.
Only tested with vanilla turrets.
Zelious  [developer] Dec 20, 2017 @ 4:55pm 
Oh, I forgot to remove [MySessionComponentDescriptor(MyUpdateOrder.BeforeSimulation)] when I tried, no wonder it didn't work! XD
Zelious  [developer] Dec 20, 2017 @ 4:59pm 
Well I don't have the missing terminal controls bug so would you be able to test with modded turrets to be sure that it initializes the terminal controls correctly? If so I might be able to make this work!
< >
Showing 1-15 of 53 comments
Per page: 1530 50