This commit is contained in:
Zan
2024-05-09 14:05:30 -07:00
parent 93d72079dd
commit cfa8289330
2074 changed files with 21518 additions and 11 deletions

View File

@@ -0,0 +1,18 @@
# Material Scanner Script
This script automates the usage of the Material-Point-Scanner.
# Setup
1. Have a Material-Scanner attached to your ship and properly wired up. You do NOT need to change the default field-names.
2. Have a Button of type 1, with it's ButtonState-Field renamed to "Active". (Yes this isn't a really descriptive name, but this way everything can keep the default names.)
3. Have a text-panel with it's field renamed to "Materials"
# Usage
1. Press the "Active"-Button. The Scanner is now on and will continously try to scan (until you re-press the button).
2. Aim the scanner at an asteroid
3. The scanner will now scan the asteroid, print it's content on the text-panel and then shut-off.
# License
MIT
# Credits
github.com/dbaumgarten / dbaumgarten#9279

View File

@@ -0,0 +1,37 @@
include "std/logic"
// These are the default field-names for the Material-Scanner
define MATSCANNER_ACTIVE=:Active
define MATSCANNER_SCAN=:Scan
define MATSCANNER_INDEX=:Index
define MATSCANNER_RESULTS=:ScanResults
define MATSCANNER_MATERIAL=:Material
define MATSCANNER_VOLUME=:Volume
define MATSCANNER_RESET=:Reset
define MATSCANNER_OUT=:Materials
waitmsg="Scanning..."
suffix1="ium"
suffix2="ite"
suffix3=" Ore"
suffix4=" Crystal"
while 1 do
logic_wait(not MATSCANNER_ACTIVE)
while not MATSCANNER_RESULTS do
MATSCANNER_OUT=waitmsg
MATSCANNER_SCAN=1
end
MATSCANNER_OUT=""
while MATSCANNER_INDEX<MATSCANNER_RESULTS do
MATSCANNER_ACTIVE=0
// remove suffix to save space on textpanel
mat=MATSCANNER_MATERIAL-suffix1-suffix2-suffix3-suffix4
MATSCANNER_OUT+=mat+":"+MATSCANNER_VOLUME+"\n"
MATSCANNER_INDEX++
end
MATSCANNER_RESET=1
end

View File

@@ -0,0 +1,6 @@
b="Scanning..." c="ium" d="ite" e=" Ore" f=" Crystal"
ifnot :Active thengoto2end
ifnot :ScanResults then:Materials=b :Scan=1 goto3end :Materials=""
if:Index>=:ScanResults thengoto6end :Active=0 g=:Material-c-d-e-f
:Materials+=g+":"+:Volume+"\n" :Index++ goto4
:Reset=1 goto2