Space Engineers

Space Engineers

76 人が評価
Solar Alignment for Fixed Solar Panels
   
アワード
お気に入り
お気に入り
お気に入りから削除
タグ: other_script
ファイルサイズ
投稿日
更新日
404.258 KB
2015年7月21日 22時38分
2023年7月13日 14時12分
15 項目の変更履歴 ( 表示 )

サブスクライブしてダウンロード
Solar Alignment for Fixed Solar Panels

解説
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.

This script keeps your ship's (fixed) solar panels aligned with the sun by manipulating its gyros.

Main Features
  • Works with any number of axes. By default, operates on pitch and roll.

  • Adapts to any number of gyros installed in any orientation. Only touches gyros on the same grid as its programmable block though, so it won't touch gyros on ships connected via connector. (But ships connected via merge blocks are considered the same ship, so keep that in mind...)

  • Can easily be paused & resumed by running the programmable block with an argument. This allows you to take full control of your ship again.
This script is a cut-down version of that which I normally run on my satellites, mobile platforms, jump rings/sleds, etc. so it's had a lot of use & testing (as much as a single person can :P). I also use it on my 3200 tonne survival ship, though with just a single axis (roll).

Setup
Just load it into a programmable block. It will start running right away (no timer block required).

The Reference Point
The script by default operates on pitch and roll. But this is "pitch" and "roll" relative to the ship's grid pivot. If the axes are wrong on your ship (this can happen easily if you're in survival and build from a wrongly-aligned projector), then you can do one of two things: edit the code and change the axes to your liking, or create a group named SolarGyroReference that contains exactly 1 block. It can be any kind of block, but the "front" and "up" sides of this block will be used as your ship's "front" and "up." So the best block to use as reference is a remote control or other ship controller block, like a cockpit or flight seat.

If you add or change the reference group, be sure to re-compile the script so it picks up the new reference block.

Commands
You can optionally send the script's programmable block one of two arguments (e.g. from your cockpit toolbar or a button panel or a sensor):
  • pause - This will pause the script and allow you to rotate your ship normally using the mouse/keyboard etc.

  • resume - This will resume the script's behavior.

  • togglesolar - This will toggle the script's state between active & paused.

3-Axis Alignment
Unfortunately, there's no one-stop option for this, but you can make the script align all 3 axes by looking for the following:
private readonly SolarGyroController solarGyroController = new SolarGyroController( GyroControl.Pitch, GyroControl.Roll );

and adding "GyroControl.Yaw," like so (don't forget the comma):

private readonly SolarGyroController solarGyroController = new SolarGyroController( GyroControl.Yaw, GyroControl.Pitch, GyroControl.Roll );

LCD Output

See this post.
101 件のコメント
Mike ={JcC}= 2023年8月5日 12時10分 
What happened to the linked mods in the description? All i get is an error from steam when clicking the links.
ZerothAngel  [作成者] 2023年7月13日 14時18分 
@perahansen80
Script updated, see the July 13 entry: Change Notes
perahansen80 2023年7月13日 2時51分 
Is there a way to make this work for sub-grid panels? I would like to use this script for my unfold-able but otherwise fixed panels.
DrBossWatson 2022年8月11日 16時11分 
This works great for vanilla solar panels but it does not seem to work for Advanced power 2 :/
YTunz 2022年1月5日 11時54分 
Im getting an error thats saying "Caught exceptions during executions of script: An item with the same key has already been added. at" then it goes on to list a bunch of lines. For example the first one is "System.ThrowHelper.ThrowArgumentException(ExceptionResourceresource)" Any help figuring out what the problem is would be great.
Typhon Plume 2021年11月16日 16時53分 
Will this pick up on the panels from the Advanced Power 2 mod? I been having a problem finding a script that will align them properly
Daywalker 2020年8月12日 23時59分 
is this usable for a Station on the Moon ?
irRegularGuy646 2020年8月12日 16時21分 
to add on to my previous comment, it occasionally forgets to check a single axis. just now it missed roll and i had to manually roll it a bit before the script kicked in. also a command to force it to start adjusting would be cool.
irRegularGuy646 2020年8月12日 14時32分 
also, i've noticed that it isn't very good at correcting pitch. frequently when i turn it on (judging from the shadows) it gets the pitch wrong. i can clearly see the shadows extending forwards when if it were full efficiency the shadow would be directly underneath.
ZerothAngel  [作成者] 2020年8月11日 13時50分 
It's easy enough to add a command instead of taking the old commands away and breaking builds. :P

Thanks for the idea, the script has been updated. A new command togglesolar has been added to simply toggle the state. (Note: I could not use the word toggle because it was already taken by one of my other scripts... which would cause problems with my "super scripts".)