Space Engineers

Space Engineers

Not enough ratings
Warship Manager
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
15.671 KB
6 Apr, 2016 @ 10:22am
18 Aug, 2018 @ 12:04pm
20 Change Notes ( view )

Subscribe to download
Warship Manager

Description
2017-11-17 Update: No longer needs a timer block. If you had one before, I recommend you "disconnect" it from the prog block (remove all its actions) to reduce surprises.

ZerothAngel's Warship Manager script

This is a simple script for my large grid combat ships/drones. It combines the features from a few other of my scripts along with some new ones.

(For a demo ship that takes advantage of all/most features offered by this script, see my Beluga-class Self-Repairing Multi-Gun Corvette.)

Features
  • Simple weapon sequencer that sequentially enables blocks in a block group (i.e. rocket launchers) for short intervals (by default, 20 frames or 1/3rds of a second)

  • Speed-based triggers to selectively enable or disable blocks when exceeding or falling below speed thresholds you define. Examples: automatically enabling gravity shields when you travel faster than 50 m/s; automatically disabling repair projectors when exceeding 20 m/s (because they get wonky at high speed)

  • Automatic about-face/reverse thrust manuever (since combat ships are usually about forward thrust)

  • Inventory stock manager. Can maintain a minimum number of certain items in certain blocks. I currently use this to get around game bugs that prevent my self-repairing warship from working properly in survival.

    Namely I use it to keep turrets/rocket launchers stocked with ammo (because they don't always pull from the conveyor network) and I keep a small stock of steel plates/interior plates/construction components in every welder. This helps kickstart repairs and usually gets around the problem where welders don't place new blocks in a projection.
A few select modules from my Ship Manager script:
  • Door auto-closer -- Closes open doors after a few seconds.

  • Simple airlock manager -- Allows grouping of doors into airlocks and only allows one door in a group to open at a time

  • Oxygen manager -- Shuts off oxygen production when the tanks reach a certain threshold. Saves power by not running oxygen generator(s) all the time.

  • Redundancy manager -- Ensures a certain number of blocks in a block group are enabled. Can be used for backup antennas, backup gravity generators, whatever.

  • Damage control -- Highlights (enables show-on-HUD) any block that is not at 100% HP. Only works for blocks that appear in the terminal, of course. No armor blocks or conveyors, unfortunately.
One feature from my Drone/Utility Ship Manager script:
  • Safe Mode -- Automatically engages dampeners when the ship is uncontrolled. Automatically attempts to stop the ship if it thinks it's been abandoned (default off) or if it detects there are no longer any functional ship controllers.
Finally, it also incorporates my Cruise Control script.

Setup

Requires a programmable block. Optionally, you can have a timer block named "Safe Mode" that will be triggered as described in the Safe Mode docs.
  1. Select one or more ship control blocks (cockpits, remote controls, etc.) Make sure they are all oriented the same and then create a group around them named "CruiseControlReference"

    This step is optional, but if your ship's grid axes are off, then it will end up flying in the wrong direction.

  2. Load script into programmable block

Usage

Usage for most other features are described in my other scripts. For now, I'll only document the new stuff or features that were never documented before.

As with most of my scripts, you perform an action or give a command by sending the prog block an argument. You can do this from a remote control, cockpit, flight seat, whatever. In emergencies, you can even send it directly to the prog block in the terminal.

Block sequencer

Create a block group around the blocks (most likely rocket launchers) named "Sequenced<whatever>" for example, "SequencedRockets". Note, letter case doesn't matter for the group name or the commands below.

Then send one of two commands to the prog block:
  • sequence start <whatever> -- This will shut off all the blocks in the group and begin activating each one in sequence. By default, it will sequence each block every 20 frames (frame = 1/60th of a second, assuming 1.0 sim speed). You can change this by editing SEQUENCER_FRAMES_PER_RUN.

    For rocket launchers (large grid or small), a good rule of thumb is to set the delay to 60 divided by the number of rocket launchers. This is the absolute minimum it should be set to.

    In the future, I may allow the delay to be set per group. If decoys are ever fixed, strobing them at a longer frequency might be helpful.

  • sequence stop <whatever> -- This will stop the sequencing and re-enable all the blocks in the group.
Speed-based Triggers

Create a group around blocks named "SpeedAction:<speed>:<action>"

Where <speed> is whatever speed threshold you want.

And <action> is one of:
  • on -- The blocks are enabled when current speed is above the threshold and disabled when below.

  • off -- The blocks are disabled when current speed is above the threshold and enabled when below.

  • >on -- The blocks are enabled when transitioning from below the threshold to above. They aren't touched otherwise.

  • <on -- Same, but only when going from above the threshold to below.

  • >off -- The blocks are disabled when transitioning from below the threshold to above. Not touched otherwise.

  • <off -- Same (disabled), but only when going from above to below.

For example, to disable projectors when going above 20 m/s, create a group around them named "SpeedAction:20:>off"

Note that this module only runs once per second, so you should adjust your thresholds if your ship can accelerate reasonably quickly. I may play around with sub-second polling in the future, but I don't like the idea of it running all the time using Trigger Now.

Reverse Thrust

Send the argument "cruise reverse" to the prog block. The thrusters will shut off, it will wait about a second (to measure its current velocity), then it will rotate the ship so its rear is facing the direction of motion.

Finally, it will re-enable all thrusters.

Note that it does not touch inertial dampeners, so they need to be on for you to actually brake. Keeping them off while you make an about-face has some interesting tactical uses though...

Damage Control

See this post.

Inventory Stock Manager

See this post.
17 Comments
DomDiaemus 4 Sep, 2021 @ 10:46am 
"assembly not found, please compile the script"... that is soon after recompile ... also check the script list a few errors so I suppose this script is no longer working? Thanks
SevenofThr4wn 18 Jan, 2021 @ 9:39pm 
I love this
ZerothAngel  [author] 4 Feb, 2018 @ 9:37am 
If you didn't set up any groups for it, it should ignore hangar doors already.

Otherwise you can tag the doors with "[Excluded]"

Or you can create a group around the doors you only care about.

See the auto-door-closer docs on my Ship Manager script .
[DUFF] gogeto 4 Feb, 2018 @ 9:04am 
i need your help pls!
can i use auto-door-closer only for doors except the big hangar-door?
ZerothAngel  [author] 4 Oct, 2017 @ 11:11am 
Still makes no sense to me, but ok.
ZerothAngel  [author] 4 Oct, 2017 @ 9:18am 
What, exactly, are you saying?
ZerothAngel  [author] 27 Feb, 2017 @ 7:28am 
I haven't checked the game lately, but that means you're probably using the development version of the game.

I'm not going to bother updating the workshop version of the script until those changes hit stable, but here are dev versions of my script that were good as of a few weeks ago:

https://tyrannyofheaven.org/ZerothAngel/development-se-scripts.html
hellhound 26 Feb, 2017 @ 6:57pm 
what does
cannot convert from 'VRageMath.Vector3D' to 'VRageMath.Vector3I'
mean? cause i got that error when attempting to compile this script
TheKingBEE 22 Sep, 2016 @ 6:19am 
Ignore me and keep up the good work, I've mixed your script up with another i use. Yours works great.
ZerothAngel  [author] 21 Sep, 2016 @ 8:46pm 
Wait... what changed recently? I know they added being able to read planet stuff (center, altitude). Was there anything else?