Space Engineers

Space Engineers

评价数不足
Cargo Utilization Light
   
奖励
收藏
已收藏
取消收藏
文件大小
发表于
2.221 KB
2015 年 2 月 6 日 上午 10:46
1 项改动说明 ( 查看 )

订阅以下载
Cargo Utilization Light

描述
Use a light to indicate Cargo Utilization

Given 2 colors one for 0 % and one for 100%
Calculate the percentage of cargo space utilized
interpolate the colors with percent to determine
indicator light color.

Blocks Required:
Timer Block set to run the programmable block on interval and set to start timer (i use 5 seconds)
Programmable block
a light block or blocks (spotlight or interior light)
a cargo container or containers

Test Ship blueprint: http://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=387942067

Args:
zeroPercent: Color to indicate 0% utilization
hundredPercent: Color to indicate 100% utilization
lightName: Name of Light to change color for
blinkOnEmpty: (Optional) Defaults to True
If utilization = 0% will blink starting color
blinkOnFull: (Optional) Defaults to True
if utilization = 100% will blink ending color
blinkInterval: Interval to blink in seconds
blinkLength: Percent of Interval where light is on
50% is 50.0F NOT 0.5F

Returns: Void

Raises: Void

Notes:
Reference Color by RGB:
new VRageMath.Color(int R, int G, int B)
There are 9 other options for creating a color based on different values
see mod documentation for more

Colors with names as of 2/6/2015:
A, AliceBlue, AntiqueWhite, Aqua, Aquamarine, Azure, B, Beige, Bisque
Black, BlanchedAlmond, Blue, BlueViolet, Brown, BurlyWood, CadetBlue
Chartreuse, Chocolate, Coral, CornflowerBlue, Cornsilk, Crimson, Cyan
DarkBlue, DarkCyan, DarkGoldenrod, DarkGray, DarkGreen, DarkKhaki
DarkMagenta, DarkOliveGreen, DarkOrange, DarkOrchid, DarkRed
DarkSalmon, DarkSeaGreen, DarkSlateBlue, DarkSlateGray, DarkTurquoise
DarkViolet, DeepPink, DeepSkyBlue, DimGray, DodgerBlue, Firebrick
FloralWhite, ForestGreen, Fuchsia, G, Gainsboro, GhostWhite, Gold
Goldenrod, Gray, Green, GreenYellow, Honeydew, HotPink, IndianRed
Indigo, Ivory, Khaki, Lavender, LavenderBlush, LawnGreen, LemonChiffon
LightBlue, LightCoral, LightCyan, LightGoldenrodYellow, LightGray
LightGreen, LightPink, LightSalmon, LightSeaGreen, LightSkyBlue
LightSlateGray, LightSteelBlue, LightYellow, Lime, LimeGreen, Linen
Magenta, Maroon, MediumAquamarine, MediumBlue, MediumOrchid
MediumPurple, MediumSeaGreen, MediumSlateBlue, MediumSpringGreen
MediumTurquoise, MediumVioletRed, MidnightBlue, MintCream, MistyRose
Moccasin, NavajoWhite, Navy, OldLace, Olive, OliveDrab, Orange
OrangeRed, Orchid, PackedValue, PaleGoldenrod, PaleGreen
PaleTurquoise, PaleVioletRed, PapayaWhip, PeachPuff, Peru, Pink, Plum
PowderBlue, Purple, R, Red, RosyBrown, RoyalBlue, SaddleBrown, Salmon
SandyBrown, SeaGreen, SeaShell, Sienna, Silver, SkyBlue, SlateBlue
SlateGray, Snow, SpringGreen, SteelBlue, Tan, Teal, Thistle, Tomato
Transparent, Turquoise, Violet, Wheat, White, WhiteSmoke, Yellow
YellowGreen
11 条留言
Ibigpapa  [作者] 2019 年 6 月 6 日 下午 2:47 
Jared_T Glad to hear someone took up the reigns and improved it. Wish i had put the code on github way back when, So you get to take the title :D
Jared_T 2019 年 5 月 27 日 下午 11:23 
Actually, you may have already have noticed, but the script that W4stedspace used was this one, https://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=1405630071 .
Granted, I used your script as a base / inspiration for the script, it is quite different from yours although does the same thing. I do apologize for not asking you if I could take your script and overhaul it. However, the last time your script was updated was back in 2015, and while I have used your script for a long time it has become a bit outdated. Therefore, I thought it would fair game to do my own support for the script. My current version of the script has quite a few more features than the original, such as including and balancing drill inventory.
Ibigpapa  [作者] 2019 年 5 月 24 日 下午 1:10 
Thats awesome
xar582 2019 年 5 月 12 日 下午 10:18 
W4stedspace used this script dack in december 2018 in the episode called, Space Engineers: The Danger Zone - Uncooperative Survival #61 at about the 2hrs 30min point and he had I think 6 lights on this small ship. it also showed him setting the script up to work.
Ibigpapa  [作者] 2019 年 5 月 12 日 下午 4:57 
I don't even think i have the code for this any longer. Been since 2015 for me. Sorry it's only using 2 lights
John the Don 2019 年 5 月 12 日 上午 5:20 
right now the script is only using 2 lights how do i get it to use more
Haram Bae 2015 年 5 月 31 日 上午 12:50 
Late to party, but can you force it to only read only certain containers?
jarhead 2015 年 2 月 26 日 下午 6:57 
not bad
15 2015 年 2 月 7 日 下午 2:08 
Cool idea!
Ibigpapa  [作者] 2015 年 2 月 6 日 下午 1:40 
Buzzed Bear,

This script generates a color value between the starting color and ending color using interpolation function built into the vrage library.

It technically handles every percent between 0 and 100. I believe there is an exception to that is if you choose 2 colors very close to each other.

an example though not correctly calculated

starting R: 0; G: 255; B: 0
ending R:255; G:0; B:0
currently at 55%

ending color will look something like R: 140.25; G: 140.25; B:0;

for the actual math behind it look at interpolation(LERP) http://en.wikipedia.org/wiki/Linear_interpolation