MART | Whip's Mouse Aimed Rotor Turret Script для Space Engineers
UPDATE: This script triggers itself automatically. No timers needed!
NOTE: MAJOR LIMITATION
There is a major limitation. Only ONE person can control things on a ship and its subgrids. This game limitation has existed ever since control seats have. There is nothing I can do to fix this without using mods. I was holding off releasing this code for ages hoping that Keen would fix this, but it seems that it wont be fixed any time soon.
Also, it seems that if your control seat is on a station, your inputs can not be read unless you are the host of the game. To get around this, put your control seat/remote control on a rotor, and it should work.
[img=http://i.imgur.com/e0pytVG.gif]
You can get the tank shown above HERE!
[img=https://i.imgur.com/86zb7Bb.png?1]
- Added optional gyro assistance. Simply place a gyro on the azimuth or elevation grid and group it to use it.
- Added main elevation rotor specification. Add the word "Main" to the name of the rotor you want to be considered the parent elevation rotor that all other rotors mimic.
- Added independent stabilization terms for azimuth and elevation.
- Turrets return to rest position when not being controlled
- Automatic turret stabilization feature :D
[img=https://i.imgur.com/ZT0CCCH.gif]
- This code can now support unlimited elevation rotors per turret group!
[img=https://i.imgur.com/Vw0h1Xy.png]
Howdy!
This script allows the user to control player made rotor using direct mouse inputs from a cockpit or control seat. No gyroscope or remote control is needed to do this since the code reads the user's mouse movement and directly converts it to rotor velocity. Rotor turrets using this code will emulate the movement of a manually controlled AI turret :)
Mouse aimed rotor turrets (MARTs) can have one or more Elevation rotors per turret group and the angles of each elevation rotor will be synced; however, only one Azimuth rotor can be used per MART group. You can fire the weapons in a turret group by pressing the default button for "crouch" [C].
Since the program can read mouse inputs directly from a cockpit or control seat, you are able to make land-based tanks using MARTs that can be fully crewed by just one person! You can also control multiple MARTs with only one code!
[img=https://i.imgur.com/A6KkMfe.png]
Watch the Setup Video for a visual walkthrough!
It is recommended that you read all the instructions before attempting
to use this code! This will make troubleshooting any issues much easier <3
Script Setup
[olist]
- Place this script in a program block
- Set up mouse aimed rotor turret groups (see below sections)
- Set ownership on EVERYTHING to yourself
- DON'T FORGET TO SET YOUR ROTOR LIMITS!
[/olist]
Turret Group Setup
[img=http://i.imgur.com/17CsVQi.png]
[img=http://i.imgur.com/iP3Rao1.png]
Mouse aimed rotor turret groups must be named like the following:
"MART <ID Tag>"
Where <ID Tag> is the unique identification tag of the rotor turret.
Example Turret Group Names:
- MART 1
- MART WhiplashIsAwesome
- MART Tank Turret
Turret Group Components
EACH turret group must have:
- One cockpit, control seat, or remote control (passenger seats wont work!)
- One azimuth (horizontal) rotor with "Azimuth" in its name
- One or more elevation (vertical) rotor(s) with "Elevation" in its name
[list]- Place the word "Main" in the name of the elevation rotor that you want to be used as the parent rotor that all other elevation rotors follow. The code will pick this automatically if you do not specify :)
- One or more weapons or tools on* each elevation rotor
(rocket launchers, gatling guns, welders, grinders, drills, cameras, and spotlights supported)
* "On" means on the same grid as the elevation rotor head
[/list]
Optional components:
- Gyros for rotor movement assistance: Gyros placed on elevation and azimuth grids will be used to help turn the turret if they are in the MART group.
Names of blocks don't matter beyond what is required.
Example: "Advanced Rotor - Azimuth"
Changing Variable Values
Open the programmable block's Custom Data to change variables without needing to mess with the code!
[olist]- Open the program's Custom Data
- Change the variables you want
- Run the script with the argument "setup"
[/olist]
[img=http://i.imgur.com/rLvBCrG.png]
Setting Turret Rest Position
By default, turrets will return to rest position when not being controlled. To set your own rest angle for a specified MART rotor, simply type the desire rest angle (in degrees) inside the rotor's custom data.
Example:
30
This would set the rest angle for the rotor to be 30 degrees
[img=https://i.imgur.com/twuIaF6.png]
I had initially envisioned this code to make multi crewed vessels possible, but bugs have smashed that dream. If they ever fix the bug where multiple seats can't be controlled, this code will still work without modification. Here's hoping!
Post any questions, suggestions, or issues you have in the comments! <3
Also, I'd love to see what y'all make with my scripts so feel free to post your turret creations in the discussions section!
Turret design in the picture was based off a design by 5URG3 :)
As always, I will be continuing to improve and support this code as time goes on :). My next plan is to make this code interface with my Turret Slaving Script To allow a MART to control other rotor turret's angles :)
- Whiplash141