Space Engineers

Space Engineers

[OBSOLETE] Smart Turrets
191 Comments
Zelious  [author] Jun 14, 2019 @ 1:35am 
NOTICE TO EVERYONE:

SMART TURRETS 2 IS OUT

As such this mod is now obsolete. Smart Turrets 2 can be found here:

https://steamcommunity.com/sharedfiles/filedetails/?id=1769486689
Zelious  [author] Jun 10, 2019 @ 12:09am 
Just a little announcement to anyone interested:

I've just updated ST Experimental Version to the latest iteration of version 2, it's nearly ready to release bar a single bug, that is provided no other issues arise, but I've had to disable targeting players/characters due to an issue I can’t really fix (a problem with SE).
Ace Jun 8, 2019 @ 3:29pm 
Seems to have been broken. The option for smart targeting has vanished. However, my turrets are still acting as if they are following the script.
Loki Jun 6, 2019 @ 9:53am 
What I might add, but can't confirm if it's got to do with turret's of over 800m range, that the mod has a slight issue getting along with weapons that have higher reload times?
I tried it with the MexPex-Energyweapons, where Smart Turrets just let's them fire around every 2.5 loading cycles (even up close)
Krzemyk May 25, 2019 @ 11:41am 
Is there an option to enable targeting hostile NPCs like spiders or wolves for example with smart targeting enabled?
Kill3rCat [1st FORECON] May 17, 2019 @ 5:47pm 
Would it be possible to create a version where firing through grids is forced off? For servers, particularly with some modded weapons, it would be totally unbalanced for a railgun with high pen to just psychically know where a ship's reactor, FTL, etc. is and knock out a ship in one or two shots.
Mask of Humble May 10, 2019 @ 1:17pm 
Thank you for your hard work, I am greatful.
Zelious  [author] May 10, 2019 @ 12:46am 
So I decided to put in a bit of effort for once and finish version 2, and by finish I mean get to a point that it works, but not really test it at all (so I didn’t really put that much effort in :D ).

It's currently available as a sort of semi-public beta under "ST Experimental Version" so that all those people who really want version 2 can do all that boring testing for me, so fair warning, it WILL be full of bugs.

If you're fine with said bugs, here is a link to the mod:
https://steamcommunity.com/sharedfiles/filedetails/?id=1237178882

I'm not advertising this beta anywhere but here, not even on the mods page, so keep that in mind when you see the bold warning telling you not to use that mod ;)



And @The One Percent, Version 2 does support any range the turret is capable of :)
Mask of Humble May 9, 2019 @ 5:59pm 
I wish it would work with turrets that have more then 800m range Y-Y
troubled_offspring Apr 30, 2019 @ 5:02pm 
a new version of this would be awesome, the vanilla turrets seem are starting to get odd targeting bugs. Framework to bypass keens targeting would be a must have for weapons modders!
TeNNeX15 Apr 20, 2019 @ 6:11pm 
How is version 2 coming along? I hope we can get our hands on it as soon as possible, very underrated mod in my opinion
drmskr Apr 15, 2019 @ 11:33pm 
Ahh Man.. I was hoping this was updated by now..

@Zkillerproxy Could you possibly colaborate with the author of NanobotBuildAndRepair? As that can target specific things, and the controls work with host and clients... Just a hopeful suggestion.
Rekalty Apr 11, 2019 @ 8:10pm 
Really looking forward to an update for this, or a similar mod, turrets are just too damn stupid, keep targeting and destroying stuff I would like to salvage...
ETHREAL1 Mar 30, 2019 @ 7:48pm 
GitHub it so others can help with the V2? I’m not much of a coder but I know some that are and they may take a crack at it and github would be the easiest way, also this all should just be in vanilla SE..... looking at you KEEN....
Caelaran Mar 21, 2019 @ 6:20am 
Zkillerproxy, if you're burned out on SE right now any chance of releasing the updated code for others to hack at?
Zelious  [author] Mar 20, 2019 @ 6:18pm 
+Takamiki Another known bug, Ammo Management Controls will cause smart targeting options to disappear, and many weapon mods list Ammo Management Controls as a dependency as a solution to their ridiculous ammo names, which makes this mod unfortunately incompatible with all those weapon mods.
Takamiki Mar 20, 2019 @ 2:05am 
wonder if this conflicts with Lucas' Ammo Management Controls mod since i can see his mod in turret's terminal and not your controls anymore.
The Erubian Warlord Mar 19, 2019 @ 10:03am 
looking forward to the new version here
CryogenicCloud Mar 19, 2019 @ 8:18am 
Ah ok thanks
Zelious  [author] Mar 18, 2019 @ 10:09pm 
+Ginge Version 2 is almost done, but it’s been almost done for a month and a half, sort of went off Space engineers a bit. It will probably get finished whenever something else gets me playing SE again.

+CryogenicGamer A known bug, typically only the host can see the controls but sometimes it’s the opposite and only the clients can see them. It won’t ever be fixed in this mod, but it will be in version 2 if I ever finish it.
CryogenicCloud Mar 18, 2019 @ 7:05pm 
So here is a question @Zkillerproxy my friend can see the option on the world but i cant why is that?
Ginge Mar 16, 2019 @ 8:24am 
hey @Zkillerproxy any news on version 2, hope its coming along the way you want it to. cant wait for this mod
Wolffie Mar 14, 2019 @ 7:18pm 
okay. thank you.
Zelious  [author] Mar 14, 2019 @ 6:29pm 
+Wolf Heart That's intentional. I didn’t know how to disable idle movement properly when I wrote this mod, and having it on caused problems, so I had to settle for just turning it off whenever it comes on (which it does by itself for some reason).
Wolffie Mar 14, 2019 @ 12:54pm 
I'm experiencing an issue where the turrets rapidly enable and disable idle movements. Is this intentional or am I experiencing a bug?
Raaknaar Losbroek Mar 11, 2019 @ 6:00am 
I just came back to rate this mod. When my missile turrets take out drones, all the valuables are left intact for me to salvage. Works great. Thanks.
Silverbane Feb 28, 2019 @ 5:24pm 
Zkillerproxy I sent you a friend request in steam. MisFit Studios is working with the community to create Protocol 51 https://www.youtube.com/watch?v=qaNyww4WJc4 and I would like to chat with you when you have some time. Thanks!
Zelious  [author] Feb 26, 2019 @ 3:11am 
Wow that one took too parts to fit!
Zelious  [author] Feb 26, 2019 @ 3:11am 
+Silverbane First of all don't trust anything in this mods code, I made it back when I had no idea what I was doing ;)

Secondly the easiest way to disable the AI is to use this mess of code to get the bool for AiEnabled:

(MyDefinitionManager.Static.GetCubeBlockDefinition((TURRET AS IMYTERMINALBLOCK HERE).BlockDefinition) as MyLargeTurretBaseDefinition).AiEnabled

You can set that to true or false as you please to disable or enable AI on a turret, although it still seems to target things, like with the little red target indicator, it just won’t shoot anything. If you want that gone too you will have to turn everything off like I do.

If you want to make the controls disappear or be blanked out, then you can use this to get the controls:
Zelious  [author] Feb 26, 2019 @ 3:11am 
MyAPIGateway.TerminalControls.CustomControlGetter += ControlModifier;

Where “ControlModifier” is a method that return void and accepts an IMyTerminalBlock and a List<IMyTerminalControl>. The terminal block is the block, so you can check if it had the id your looking for, and the list is all the controls.

Then just find the controls you want and enable or disable them (which is whether they are greyed out or not) or just change their visibility to make them disappear. If you want to turn them on or off the way I do it in this mod will work just fine, although there are other ways.

Hope all that helped :)
Silverbane Feb 25, 2019 @ 7:44am 
@Zkillerproxy I was hoping you could help a fellow modder. I am creating a scenario in which I need to disable AI Targeting on certain turrets all together using SubtypeId. I looked at your code and I think I understand how to do it but wanted to ask the expert first! Would there be a simple way to force TargetSmallShips, TargetLargeShips, TargetCharacters, TargetStations to off or simply removed them from the GUI Control Panel all together for a specific SubtypeId turret? Thank you and if you do this I am willing to donate to your project.
MrFox Feb 4, 2019 @ 12:57pm 
some minor issues with targing. it will shtill shit things its told not to like T5 reactors :P
Also this wont work with higher Tired gats
MrFox Feb 3, 2019 @ 3:25pm 
OH lets see how this works :DD
Hopefully one can not use eveything and only select what they want to get shot at
Carl Jan 29, 2019 @ 7:44am 
Is there a way I can change the default Target Priories from the default 4 (Turrets, Fixed Weapons, Warheads, and Control Blocks)? Also have smart targeting enabled by default on all weapons when they are built?
Slashgamer27 Jan 19, 2019 @ 5:30am 
does shoot through grid mean shoot ememy or friendly players
Dalten Jan 6, 2019 @ 6:17am 
this mod was beautiful during the short time I was able to use it in SP, worthy of graduating to vanilla feature. I wish you the best of luck rewriting it, and really look forward to seeing the results :D
Zelious  [author] Jan 3, 2019 @ 3:42am 
+ПЕРЕЖИВАНИЕ I don’t use github or anything like it, all local files, and you don’t want to see it, the code for this mod is a hot mess worthy of r/techgore, hence why version 2 requires a complete rewrite.
Echolocator Jan 3, 2019 @ 1:51am 
Why don't you pin your github repo link? I'm sure many would like to read / contribute. (I would really like to look at it)
requiemfang Nov 17, 2018 @ 10:11pm 
yeap gonna fav this for future when version 2 gets released.
Dots Nov 12, 2018 @ 12:27am 
Yep .. can confirm that is has performance issues with this mod enabled. followed author to see the ST 2 and when it comes out. Love this mod even if i used it briefly!
Scooby Doo Oct 23, 2018 @ 7:03am 
Workshop so needs version 2 can not believe this is not something that has many options. With all the inventory management crap why is no one concerned with their turrets being stupid? LOL. Can not wait for version 2.0. How close are you to releasing even a very basice version?
mookie1590 Oct 12, 2018 @ 12:51pm 
I understand, I do thank you for the information.
Do you have en ETA on version 2?
I don't want you to throw out a guess. I klnow what its like to say this job will take me 5 weeks, then 8 weeks later I'm still not done. So if you don't want to toss out a date, I complelty understand why.

I'll still be waiting on it patientlly. There is no other mod like this and it looks pretty great.
I did have weapons added. If you posted ssomething abotu those casueiong issue that would be my fault for not reading everything before installing.

I don't have any ammo management mods. But it could be isys inventory manager that is the issue. I think it has something for ammo.
Zelious  [author] Oct 11, 2018 @ 10:42pm 
+MOOKIE1590

Part of the reason why I'm making version 2 is because the way I added terminal controls means that they are incompatible with any mod that also adds stuff to turrets. Most often this is ammo management mods. And there does seem to be some sort of 'performance' leak where every turret gets targeting calculations, even with smart targeting disabled, destroying sim.
mookie1590 Oct 11, 2018 @ 3:31pm 
Nvm, can't even use it.
I uploaded this and put at the top of my mod list.
I could not find any options in any turrets, nothing new.
All it did was take my sim speed from a solid 1-1.02 to 0.80.
My game has 90 mods. But none should conflict this mod, I can upload my mod list in a paste bin if need be.
This is a great shame, I was looking forward to using this.

I guesds I'll have to wait till smart turrets 2. Hopefully tht'll work
mookie1590 Oct 11, 2018 @ 2:40pm 
Does this mod stop turrets from destroying my loot? I remember reading a mod that could do that and I'm not sure this is it.
I'll end up using it regardless.
How is part 2 coming along. Could you add an option to stop turrets from destrotying loot in version2?
Thanks for the hard work.
jackik Oct 10, 2018 @ 3:35am 
Is there absoloutly no way to pass it data 'behind' SE's back? Such as having a physical block which has a block data acting as a "clipboard"?
Seems terribly inefficient to not be able to do that...
Zelious  [author] Oct 3, 2018 @ 4:24am 
+jackik1410 [V-WG] I don’t think SE lets you access a running thread, you just create one and tell it what to do then, and it returns once it's done that. If I can get away with one worker thread that would be perfect. Another thing to look into! :)
jackik Oct 3, 2018 @ 3:10am 
oh, so it's a thread each? okay, that does hurt... Is there no way to condense it into one active thread that only acts when needed? I'd prefer having nonactive code on RAM instead of having to run it several times over. If that doesn't work like this entirely, then maybe you can have 1 main thread do the basic functionality and have smaller threads do the details of each turret or something like this?
Zelious  [author] Oct 3, 2018 @ 2:54am 
+ jackik1410 [V-WG] I was more suggesting not possible from a performance standpoint, every time you press some 'Next Target' button it would create a new thread and run through all of the targeting code all over again. It’s on a different thread because of its huge performance impact (for context, on the main thread a single turret getting a target drops sim to 0.01 for 2 seconds) so if I provide people with a means to spam that, even with some cooldown, it could be devastating for performance, especially on dedicated servers with lots of people doing it. Whether or not I can implement this is dependent almost entirely on how much of a performance improvement I can get by rewriting the code for Smart Turrets 2. (And its ok to be a code noob, I pretty much was when I wrote this mod, hence why it has to be rewritten XD)
jackik Oct 3, 2018 @ 2:34am 
Even if it's in another thread, all of it still is done via the actual turret there right? You had the on/off switches for the smart targeting i.e. and they were essentially connections between SE physical to your outsourced targeting task. Maybe a normal passed argument may not work, but if you implement a button that you can virtually flick via an argument, that would still work right? (code newb here)