Space Engineers

Space Engineers

25 次評價
ShipsMainProgram Mk2
由 Elfi Wolfe 發表
Guide for how to set up ships and use the Orbital Industrial Services Ships Main Program

Does airpressure, airlocks, hangerbay, power readings, orbital holding, autolevel, landing, take offs, hover, solar arrays, solar tracking. ect
   
獎勵
加入最愛
已加入最愛
移除最愛
General Purpose
Hello,
This is a general purpose program. It covers:
Airlocks
Airpressure
Holding airtanks between two states of fill, giving space for depressurization.
Filling H2 tanks. if this runs it will fill the o2 tanks as well.
Hanger Bays
Giving a basic power reading
Locking landing gear if a connector is locked
Turns lights yellow if connector is ready to lock.
Turns lights green or white if a landing gear is locked
Auto level in gravity field.
Orbit holding code (can be used to launch from surface of planet)
Hover from surface of land
Can use GravDrive in orbit.
Sun chaser (can be use in orbit to get under sun)
(can be use to align toward sun in orbit)
(can be used to align a ship front/side/top towards sun in space)


Example ship
http://steamproxy.net/sharedfiles/filedetails/?id=1101414276
Customization Options
This section deals with the various sub programs that can be turned off or off.
As well as the default states of each.
Place options in CustomData of the programing block.
On block initilzation or recomple the data will be read.

autolevelon //autolevel is default off , this will turn it on
gravdriveon //this will turn on gravdrive
sunchaseron //sunchaser is default off, this will turn it on

**orbital modes**
orbitaloff //Default, this will turn off orbital code
gravity //this turns the orbital code into gravity mode. Best used for high in gravity well.
altitude // this turns the orbital code into altitude in meter mode.
hover // this turns the orbital code into hover from terrian and objects below

**change names**
timerName string //this changes the timer that the code starts up on game load
shipStatusLCDName string //this sets the name of the LCD to write normal status to
orbitalStatusLCDName string //this sets the name of orbital (can be the same as ship)
EmergencyThrusterName string //this set the name of emergency thrusters

o2TankLow ## //sets where to turn on o2Generators when the o2tanks gets below this
o2TankHigh ## //sets where to turn off o2Generators when the o2Tanks fill to this.
h2TankLow ## //sets where to turn on h2Generators when the h2tanks gets below this
h2TankHigh ## //sets where to turn off h2Generators when the h2Tanks fill to this.
stopShipIfNotPiloted bool //sets true to have code turn on dampener when no one is in shipController.
rocketGyro bool //set true to have autolevel use back of remotecontroll or Ship controller for autolevel

**orbital settings**
targetaltitude ### // set desired altitude
targetgravity ### // set desired gravity to orbit at.
targethover ### // set desired hover altitude
heightoffset ### //sets an offset, used to adjust landings. default 100m
LCD, TextPanels, Cockpit Panels.
Default tag
[ShipStatus]

Old System: (still works)
To add a LCD or TextPanel just add the [tag] to the name of the LCD or TextPanel.

New system:
In CustomData of the LCD, TextPanel, CockPits.
use one of the following 2 ways

;[tag] 0
---

or

---
//[tag] 0

Where the number is the Text surface to use.
tag is the phase set. default is ShipStatus
Blocks with one text surface use 0
Where ask multi text surfaces start with the first item in list at 0

Arguments
Arugments to change the operation of the program.
All the options from Customization Options also work.

autolevel //turns on/off autolevel
autolevelon //turns on autolevel
rebuild //tells program to rebuild the airzone, airlocks, hangers objects.
rebuildlcd //tells program to rebuild the LCD lists
sunchaser //turns on/off sunchaser mode
sunchaseron //turns on sunchaser mode

**orbital arugments**
altitude //go to altitude mode
changealtitude ### //changes altitude by ###
changehover ### //changes hover by ###
changegravity ### //changes gravity by ###
currentaltitude //go to altitude mode at current altitude
currentgravity //go to gravity mode at current gravity
currenthover //go to hover mode at current height from ground
godeepspace //goes to 0 gravity and stops
gohover //changes to hover mode and goes to target hover height
goland // land
gravdrive //turns on/off gravDrive option
gravdriveon //turns on gravDrive option
orbitaloff //turns off orbital code
orbitalrebuild //rebuilds all the thrusters and items for orbital code
targetaltitude ### //sets target altitude
targetgravity ### //sets target gravity
targethover ### //sets targethover
velocitylimit ### //sets velocity limit of orbital


Air Locks
This is example of sensor to trip airlock change.
Airlocks:

Airlocks must have at least:
1 vent
1 light
2 doors

Example simple airlock:
Door Outer [Fore Under Airlock]
Door Inner [Fore Under Airlock]
Panel Outer [Fore Under Airlock]
Panel Inner [Fore Under Airlock]
Air Vent [Fore Under Airlock]
Light [Fore Under Airlock] Control
Sensor [Fore Under Airlock]
This is an airlock between space (planet) and the living areas of the ship.
The airlock knows it is doing something when the light with Control in its name is turned off. This can be turned off by the button panel outside, the button panel inside the ship or by a sensor in the airlock, (can use a button panel in airlock instead or in addition).

Example 2 zone airlock:
Example airlock between Hanger bay and Living quarters:
Door [Fore Under Airlock] [Hanger5]
Door [Fore Under Airlock] [PassageZone1]
Panel Hanger [Fore Under Airlock]
Panel Inner [Fore Under Airlock]
Air Vent [Fore Under Airlock]
Light [Fore Under Airlock] Control
Sensor [Fore Under Airlock]
This is an airlock between the hanger bay and the living areas. When the bay is pressurized both doors will open when light control is turned off. If the hanger is depressurized then it operates as an airlock. If the [Hanger5] is told to depressurize, then it will close all doors with [Hanger5] in their names.

Example airlock between Hanger bay and space (planet):
Door [Hanger5] [Fore Under Airlock]
Door Outer [Fore Under Airlock]
Panel Outer [Fore Under Airlock]
Panel Inner [Fore Under Airlock]
Air Vent [Fore Under Airlock]
Light [Fore Under Airlock] Control
Sensor [Fore Under Airlock]
This is an airlock between the hanger bay and space. When the bay is depressurized both doors will open when light control is turned off. If the hanger is pressurized then it operates as an airlock. If the hanger is told to pressurize, then it will close all doors with hanger in their names.
Air Pressurization
Air Pressurization:
Ship is divided up into zones. A zone is defined with [zone].

Pressurization Zone must have:
Vent[LivingRoom1]

Example zone:
Vent[Bridge]
Light[Bridge]
Door1[Bridge][Hall1]
Door2[Bridge][Airlock2] Inner
This example has the vent; a light that turns red if pressure is lost or O2 is too low, turns white when pressure is good; 2 doors, one is between bridge and hall 1 and either zone could close the door on a pressure loss, other door is an inner airlock door.
Hangar Bays

Hangar Bay:

Hangar bays have to have at least one of the following setups

[name] // in all blocks name for the hangar bay
light [name] Pressurize
light [name] Depressurize
vent [name]
doors [name]
sensor [name]
sound [name]

[name] // in all blocks name for the hangar bay
light [name] Pressurize
light [name] Depressurize
vent [name]
doors [name]
sensor [name]

[name] // in all blocks name for the hangar bay
light [name] Pressurize
light [name] Depressurize
vent [name]
doors [name]
vent outsideVent //used to tell O2 outside ship

[name] // in all blocks name for the hangar bay
light [name] Pressurize
light [name] Depressurize
vent [name]
doors [name]

Example:
HangerVent 1 [HangerBlue]
Sound block [HangerBlue]
Light 1 Door Warning [HangerBlue]
Light Depressurize [HangerBlue]
Light Pressurrize [HangerBlue]
AirTightDoor 1[HangerBlue]
AirTightDoor 2 [HangerBlue]
Sensor [HangerBlue]
The Vents pressurize and depressurize, the vent with [HangerFloor] is the one the airpressurization method talks to; soundlblock plays what ever is programmed into it when the bay starts to depressurize; the light turns on when the bay starts to depressurize; the lights baydepressure and baypressure start the depressurization and pressurization, Note: if both are turned on the program will reset back to pressurized, can be used to stop a depressurization; the airtightdoor are the outside doors that are opened by the sensor once the bay is depressurized.

Orbital
Orbital:
This maintains the ship/satellite at a target g +- 0.005g. Handles the LCD with orbital information as well as turn on the emergency thrusters if the altitude (measured in g) gets below gravityLimit (defaulted to 0.3g).

Requires:
Some thruster pointing down OR
GravityGenerator and an artifical Mass (only works at gravity 0.5 to 0.05g)

Emergency Thruster example.
Small Hydrogen Thruster [EmergencyThrust]
Altitude mode
Altitude mode
This maintains the ship/satellite at a target altitude above sealevel +-5m. Handles the LCD with orbital information.

Arguments can be passed in with g-menu running the programing block, timers, ect

goland \\lands
altitude \\turns on altitude mode and goes to target altitude
currentaltitude \\turns on altitude mode and sets current altitude as target
targetaltitude ### \\sets target altitude
changealtitude ### \\goes up or down ### meters
Gravity Mode
Gravity mode
This maintains the ship/satellite at a target local gravity +- 0.001g. Handles the LCD with orbital information.

Arguments can be passed in with g-menu running the programing block, timers, ect

godeepspace \\goes to deep space and stops. Very slow in low gravity
gravity \\turns on gravity mode and goes to target gravity
currentgravity \\turns on gravity mode and sets current gravity as target
targetgravity ### \\sets target altitude
changegravity ### \\goes up or down ### g example -0.01 = goes up in orbit
Hover Mode
Hover mode
This maintains the ship/satellite at a target hover above the surface +-5m. Handles the LCD with orbital information.

Arguments can be passed in with g-menu running the programing block, timers, ect

gohover \\ goes to hover at 100m
hover \\turns on hover mode and goes to target altitude
currenthover \\turns on hover mode and sets current distance from surface as target
targethover ### \\sets hover altitude
changehover ### \\changes hover up or down ### meters
SunChaser
Sun Chaser:
This allows the ship to turn in yaw and pitch and to move towards the sun.
NOTE: this assume the gyro used is facing the front of the ship.
Or the gyro and all the solar panels face the direction you want the sun to be.
NOTE: this is not that easy to set up and tune.

Settings:
sunTurn (default of 0.018) : how fast to turn the ship
sunOverride (default of 10): what % of thrust override to put the thruster at
sunChaserName (default of [SunChaser]): name of the blocks used for this feature

Example design:
Solar Panel [SunChaser] Fore
Solar Panel [SunChaser] Aft
Solar Panel [SunChaser] Port
Solar Panel [SunChaser] Starboard
gyroscope [SunChaser]
Small Ion Thruster 3 [SunChaser] Fore
Small Ion Thruster 4 [SunChaser] Aft

If SunChaser is turned on the ship will turn sideways toward the sun and then move forward.
This is used in orbitals for the orbital to stay on the sunny side of the planet. Commonly used with autolevel and OrbitHolder/OrbitalGravDrive. If you turn off the fore solar panel then it will not move forward.

DeepSpace
Example design:
Solar Panel [SunChaser] Aft (May not be needed if side panels can see sun from rear)
Solar Panel [SunChaser] Port
Solar Panel [SunChaser] Starboard
Solar Panel [SunChaser] Above
Solar Panel [SunChaser] Below
gyroscope [SunChaser]

If SunChaser is turned on the ship will turn sideways and pitch to face the sun.
This is used in deep space to turn the ship to face the sun.
Solar Arrays
Solar Tracking:

This is a 1 axis solar panel tracking.
It can be used to control more than one axis with each axis/rotor being a seperate axis.

Large arrays on a small ship will torque a little when the rotar starts up. If this happens and it cause problem turn down the rotor's torque

Due to script not able to see all sub parts at the game load.
It is recommended to have in customdata the following argument. It will cause a rebuild after 10 runs (seconds) so the script can see the subgrids.
rebuild 10
Landing Pad/Lights
Landing Pad/Lights:

This set up locks the landing gear to hold the small ship when the connector is locked.
The lights will turn the light white or green if the landing gear is locked.

These can be used together or seperately.

Idea is to use the large landing gear to hold the small ship securely. No longer needed since connectors now hard lock instead of soft lock.

Example:
Landing Gear [YellowPad]
Connector [Yellowpad]
Light [Yellowpad]
8 則留言
[Λ]Farsight 2021 年 8 月 12 日 下午 9:12 
That worked. It works well enough for me, but I’ll check out the flight computer
Elfi Wolfe  [作者] 2021 年 8 月 12 日 下午 5:33 
Please try
orbitaloff
//turns off orbital code

and this orbital code is very basic vs the orbital flight computer.
[Λ]Farsight 2021 年 8 月 12 日 下午 1:06 
Love this script. I use it in every build I make. One I use I have with it though is when I set a ship to orbital or godeepspace I can't cancel that and regain control of my ship. I know I've missed something but I can't figure out what it is.
dragonsphotoworks 2021 年 4 月 6 日 下午 5:01 
Ah cool. I saw this on main screen in... was checking comments and this popup up on bottom right as a suggestion. So I had not seen the script page yet just the guide. So i didnt see version hehe

All good, this script is pretty cool. Do you have plans to add to it? Like a formation option? Not sure what else could really add as seems to have it all.
Elfi Wolfe  [作者] 2021 年 4 月 6 日 下午 4:51 
Any time I update or check functionality I post the game version on the page of the script. This is the not the best script but I use it for many of my ships.
dragonsphotoworks 2021 年 4 月 6 日 下午 4:48 
Really neat script. I dont do ships yet but id keep this in mind if still works.
Elfi Wolfe  [作者] 2017 年 9 月 9 日 下午 6:21 
Program is already made. Just have to name objects on ships and start up the program.
Insurgency Lemur 2017 年 9 月 9 日 下午 6:14 
this guide looks really helpfull i just cant program