Space Engineers

Space Engineers

786 个评价
TCES | Turret Controller Enhancement Script
29
6
7
3
5
2
3
3
2
2
   
奖励
收藏
已收藏
取消收藏
标签: other_script
文件大小
发表于
更新日期
642.447 KB
2022 年 2 月 14 日 下午 12:01
1 月 1 日 上午 5:42
29 项改动说明 ( 查看 )

订阅以下载
TCES | Turret Controller Enhancement Script

在 Whiplash141 的 1 个合集中
Whip's Scripts
22 件物品
描述
TCES | Turret Controller Enhancement Script


  Description
Howdy!

TCES enhances the functionality of the Custom Turret Controller block (CTC) in a few ways:
  • NEW! Enables mouse aimed turret stabilization when manually aimed! TCES will try to automatically cancel the effect that ship rotation has on your aim so that rough terrain or evasive maneuvers don't mess up your gunner's aim.
  • Automatically configures Custom Turret Controller blocks using block groups. This helps fix a very annoying bug[support.keenswh.com] and means you don't need to manually configure the Custom Turret Controller.
  • Allows you to use more than two rotors/hinges for each CTC. This means you could have turrets with multiple elevation rotors for example.
  • Rest angle support. Turrets will automatically return to configured rest angles after a set amount of idle time.

Additionally, you only need one script to manage all of your custom turret controllers.





  Instructions
Script Setup
  1. Group each Custom Turret Controller block with all the blocks that it will control with a group named TCES <Unique Name Tag> (See below section for more info).
  2. Open a programmable block and load this script from the "Edit" menu.
  3. Configure rotor/hinge custom data if you want rest angles.
  4. Run TCES with the argument setup to process any new groups or custom data changes.

TCES Groups
TCES groups should be named like the following:
TCES <Unique Name>
where <Unique Name> is... well... a unique name.

Each Custom Turret Controller should have its own, unique group with all of the blocks that it controls (including itself!). You need one TCES group per custom turret.

TCES will automatically configure the custom turret controller in each group with:
  • A Rotor/hinge named "Azimuth" will be used as the azimuth rotor
  • A Rotors/hinge named "Elevation" will be used as the elevation rotor
  • Cameras, weapons, and tools in the group
  • Any extra rotors are automatically controlled by TCES. This allows you to create custom turrets with multiple elevation rotors for example. (See the "Extra Rotors" section below for more details)

At minimum, a TCES group should have the following blocks:
  • The custom turret controller that it should manage.
  • At least one rotor with name tag "Azimuth" OR one rotor with name tag "Elevation".
    • You do not need both an azimuth and an elevation, you only need one
  • At least one camera, weapon, or tool.

Extra Rotors
If you want TCES to control extra rotors/hinges in addition to your Azimuth and/or Elevation, the following conditions must be met.
  1. A camera, weapon, or tool must reside on the same grid as the rotor/hinge head of the Azimuth or the Elevation
  2. Each extra rotor must have a camera, weapon, or tool on the same grid as it's rotor/hinge head.

If these two constraints are satisfied, the extra rotors will point their cameras/weapons/tools in the same direction as the Azimuth and Elevation are pointing theirs. The script will also synchronize weapon firing and tool activation across these extra rotors.

Note: Due to limitations of the API, in order for you to be able to manually fire the weapons/tools on extra rotors, you need at least one weapon or tool (a camera alone is not enough) for constraint (1) above. This is because the script tries to read the state of weapons on the main rotors and sync them across the extra rotors. Cameras do not change state when the turret is manually fired, but weapons and tools (like drills/welders) do.

SYNC Groups
SYNC groups allow you to synchronize the aiming of a custom rotor turret to a particular custom turret controller. The custom turret controller does not need to be in a TCES group, but if it is, the SYNC group will inherit the configured turret stabilization, rest angles, and weapon deadzones from the TCES group.

SYNC groups should be named like the following:
SYNC <Unique Name>
The <Unique Name> does not need to correspond to a TCES name to function.

A SYNC group should have the following blocks:
  • The custom turret controller that it should synchronize to.
  • At least one rotor (name does not matter)
  • At least one camera, weapon, or tool.

This script will attempt to aim the SYNC turret in the same direction as the grouped custom turret controller and it will also synchronize weapon/tool firing state.

Rotor Configuration
To configure rotor/hinge rest angles and stabilization, you must first have the rotors in a valid TCES group. Then, once the group is recognized by the script, you should see the following in the rotor's custom data:
[TCES - Rotor] Rest angle (deg)=none Enable stabilization=False
Configure these to your desired values, then run the argument setup to process this custom data change.

General Configuration
To configure general TCES parameters, open the custom data of the programmable block and edit the settings to your liking. The custom data should look like the following:
[TCES - General] Group name tag=TCES Azimuth rotor name tag=Azimuth Elevation rotor name tag=Elevation Should auto return to rest angle=true Auto return to rest angle delay (s)=2 Draw title screen=true
After you are done making changes, run the argument setup to process any custom data changes.


  Arguments
TCES supports the following arguments:
Argument
Description
rest
Sends all inactive turrets to their rest angles.
setup
Refetches all blocks, block groups, and reprocesses custom data.


  Author's Notes
I plan to add more features to this script as the CTC API becomes more complete like:
  • Done! Mouse aimed turret stabilization
  • Better friendly fire avoidance
  • Done! Automatic return to rest angle

Also, I made the sprites for the title screen using the SESpriteBuilder tool that I developed: https://gitlab.com/whiplash141/spritebuilder/-/wikis/home. It may be of use to scripters trying to visualize and design sprites :)

I'll probably do more polish passes, but I'm pretty sure this should work for most uses. Enjoy and let me know if y'all have any issues.

Oh, and the acronym is pronounced like "tea-sis" :)

The VTOL in the first GIF is a modified version of Consty's Blackwolf that uses TCES instead of MART.

- Whiplash141
热门讨论 查看全部(2)
178
10 月 14 日 下午 11:20
置顶: Help/Questions - TCES
Whiplash141
4
2024 年 12 月 10 日 下午 7:55
Can Camera Sync With Turret?
DangerNoodle13
536 条留言
OutLook 10 月 3 日 下午 2:56 
Would it be possible to add the capability for heavy turrets to utilize gyroscopes to assist with rotation?
Whiplash141  [作者] 9 月 29 日 上午 9:17 
Inverted for the purposes of this script and the CTC means the head of the rotor is is being used as the rotation anchor instead of the base. Sounds like you just have then upside down which is not the same.

I noticed you said 2 turrets; does *each turret* have a distinct TCES group?

And is your intent to bind 2 distinct turrets to a single CTC?
ⅩⅢ 9 月 29 日 上午 3:04 
1.14.2 I have two turrets on the underside of a drone that flys in atmosphere.
I set the Azimuth and Elevation to negative in the CTC, but because the script isn't picking them up as "inverted" in the PB display, it's only trying to slave one turret to the other when it's looking at a point it's incapable of looking at.
Whiplash141  [作者] 9 月 29 日 上午 3:00 
What do you mean by inverted?

Also what script version?
ⅩⅢ 9 月 28 日 下午 11:24 
Hey @whiplash141
I'm not able to have the script recognize that the azimuth or elevation are inverted.
It's really messing up the turret slaving as the second turret only moves when trying to follow the first going an impossible direction. Please help.
Whiplash141  [作者] 9 月 26 日 下午 3:58 
That is almost 100% an ownership issue. Check ownership of *all blocks* on your ship. Grinding and then replacing sets the ownership of the block to you.
Anarsim 9 月 25 日 下午 11:48 
Something I noticed: If you build a blueprint in survival that uses this script it will not work until you grind down and replace the custom turret controller. It just simply will not recognize it no matter what until it's been replaced
Mintsplinter 9 月 22 日 下午 12:52 
Can someone please make a video of this showing how to use it? Cause i can't seem to get it working, like... at all...
Whiplash141  [作者] 9 月 21 日 下午 9:55 
Negate the azimuth and/or elevation velocity in the custom turret controller itself
DoubleRation 9 月 20 日 上午 6:00 
Hello, sorry for my silly question but how can I invert the controls of the rotor and the hinge?