Skip to content

Commit 7553bb1

Browse files
committed
Add variable work speed
1 parent 3fb7c71 commit 7553bb1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

light/main.blocks

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="q3?fLvPt4_eLlJj(a7w*">secretCode</variable></variables><block type="every_interval" id="Aa32_D{op8s}~c|=+WVy" x="1014" y="-224"><value name="interval"><shadow type="longTimePicker" id="(.gQ{/b;56mRswhxCt-_"><field name="ms">100</field></shadow></value><statement name="HANDLER"><block type="controls_if" id="4%|c|,D/y]#weV4P6n(#"><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="SpaceStationX_isPuzzleSolved" id="OG@5LPB~UqsG4tOiwu4+"></block></value><statement name="DO0"><block type="typescript_statement" id="Dz5=hL:3o-_QG!:Y13wG" editable="false"><mutation xmlns="http://www.w3.org/1999/xhtml" line0="return" numlines="1"></mutation></block></statement><next><block type="controls_if" id=",ED#-A+QqM)R_:%xX{=?"><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="ulca-r*4=z5D_XZ{TAPE"><field name="OP">GTE</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="device_get_light_level" id="[MvK:`U0BImI81!O`[#A"></block></value><value name="B"><shadow type="math_number" id="AMPgZU81nS_DOm:B?tXX"><field name="NUM">196</field></shadow></value></block></value><statement name="DO0"><block type="SpaceStationX_workOnPuzzle" id="hw8c^o^.Ev,E1$9{(Ty,"><next><block type="SpaceStationX_showWorkGraph" id="z81BsbQ);qiX60}{18P8"><field name="puzzle">SpaceStationX.Puzzles.Light</field></block></next></block></statement><next><block type="controls_if" id="K$p=;vR-g5r/e6UxX(Y."><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="=1/po(vvk}:/=?]6UyVj"><field name="OP">GTE</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="SpaceStationX_getAmountOfWorkDone" id="1I2~#3;5(!/j?Yn$W5}Z"></block></value><value name="B"><shadow type="math_number" id="g-R~o=x8Pq@K618Muo`U"><field name="NUM">250</field></shadow></value></block></value><statement name="DO0"><block type="SpaceStationX_solveLightPuzzle" id="8$x=1np5SwMV2-#ufEJB"><next><block type="music_playable_play_default_bkg" id="psu*#_r}r;JS_]@Eq6B%"><field name="playbackMode">music.PlaybackMode.InBackground</field><value name="toPlay"><shadow type="music_string_playable"></shadow><block type="device_builtin_melody_playable" id=")(5*kY6p;NJVc4Y`DXpv"><field name="melody">Melodies.PowerUp</field></block></value><next><block type="SpaceStationX_displayCodeDigit" id="x0I7^_e^^Q4rhdxTEdMp"><field name="puzzle">SpaceStationX.Puzzles.Light</field><next><block type="variables_set" id=".Y/:0~qy_5BAXK`kHUl#"><field name="VAR" id="q3?fLvPt4_eLlJj(a7w*">secretCode</field><value name="VALUE"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="SpaceStationX_getSecretCode" id="b,C?-W`F$Fffal/A?!_3"><field name="puzzle">SpaceStationX.Puzzles.Light</field></block></value></block></next></block></next></block></next></block></statement></block></next></block></next></block></statement></block><block type="pxt-on-start" id="7KZbgs5T2Pp/$D_-sPP:" x="20" y="20"><statement name="HANDLER"><block type="SpaceStationX_prepareCommunications" id="39{J=(`26I)hd1N0snP^"></block></statement></block><block type="device_button_event" id="U_`0O?`3^Aw2i_bM!8~A" x="291" y="20"><field name="NAME">Button.AB</field><statement name="HANDLER"><block type="SpaceStationX_sendSecretCode" id="_6U1EqJO5~ryoBS{V:Iq"><value name="code"><block type="variables_get" id="%Y_.Ms}!$45=Ke42#l-z"><field name="VAR" id="q3?fLvPt4_eLlJj(a7w*">secretCode</field></block></value></block></statement></block><block type="device_forever" id="H)eU!;35aRF-F53xL9I(" x="648" y="20"><statement name="HANDLER"><block type="controls_if" id="gf(j13]=O+pg11Rv{k,7"><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="SpaceStationX_isPuzzleBricked" id=";/c]DQu(R@_Y^rnrtnB^"></block></value><statement name="DO0"><block type="SpaceStationX_showExplosion" id="eKyIFP+Sv+@R:P#k~h7g"></block></statement></block></statement></block></xml>
1+
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="av(F35V_Iahptv0/|USF">secretCode</variable></variables><block type="pxt-on-start" id="40`qR-#y8q3Je,ROJ^CM" x="0" y="0"><statement name="HANDLER"><block type="SpaceStationX_prepareCommunications" id="e9e.1otDx;@Dw*+vo.?Z"></block></statement></block><block type="device_button_event" id="d[k-{T@!67ZB%.=#P8F[" x="271" y="0"><field name="NAME">Button.AB</field><statement name="HANDLER"><block type="SpaceStationX_sendSecretCode" id="%;kZI3Euf_ClsJ-KN|dc"><value name="code"><block type="variables_get" id="U8bNeaM=+X5X/m4fBjHJ"><field name="VAR" id="av(F35V_Iahptv0/|USF">secretCode</field></block></value></block></statement></block><block type="device_forever" id="dV0};ynd9f%x%$#L$l;M" x="628" y="0"><statement name="HANDLER"><block type="controls_if" id="5(?_-3*6LI6[w|WSS93B"><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="SpaceStationX_isPuzzleBricked" id="BF}3!a:p-p,fKbCWqBut"></block></value><statement name="DO0"><block type="SpaceStationX_showExplosion" id="j],$9jS7TE5;+n2Z?FQJ"></block></statement></block></statement></block><block type="every_interval" id="p{=#1kLb6_xN0(0DhMgm" x="987" y="0"><value name="interval"><shadow type="longTimePicker" id="![IyD%2/OJ6@)Xwhjo=L"><field name="ms">100</field></shadow></value><statement name="HANDLER"><block type="controls_if" id="}gOVSeSv9|=DJR}%9vgz"><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="SpaceStationX_isPuzzleSolved" id="YP9doH[6v%l*.tOeO833"></block></value><statement name="DO0"><block type="typescript_statement" id="{S3r!ni_Ao$R*Qga|D$M" editable="false"><mutation xmlns="http://www.w3.org/1999/xhtml" line0="return" numlines="1"></mutation></block></statement><next><block type="controls_repeat_ext" id=";Ci8QfuA`qfsoTuo3TiO"><value name="TIMES"><shadow type="math_whole_number"><field name="NUM">0</field></shadow><block type="math_op2" id="dv7}NL}Y@UdEKB(19[g0"><field name="op">max</field><value name="x"><shadow type="math_number" id="E:(d#c6h{GN)`+m(h9EG"><field name="NUM">0</field></shadow></value><value name="y"><block type="math_js_round" id="5PvSOV7d9L6N(Oy7s#GW"><field name="OP">round</field><value name="ARG0"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="math_map" id="/in?9Op8hrPr0$K-i@w^"><value name="value"><block type="device_get_light_level" id="M*!/R]-~zEQgT%hjwNRY"></block></value><value name="fromLow"><shadow type="math_number" id="@ojM,g)nX;sTP8V}yLnQ"><field name="NUM">128</field></shadow></value><value name="fromHigh"><shadow type="math_number" id="rCCd;k![oq0-pbnBc*Rw"><field name="NUM">255</field></shadow></value><value name="toLow"><shadow type="math_number" id="f@vEazE_B?}GM;rxCjIc"><field name="NUM">0</field></shadow></value><value name="toHigh"><shadow type="math_number" id="GU?ZzLy;8~Kx4WezUmiu"><field name="NUM">8</field></shadow></value></block></value></block></value></block></value><statement name="DO"><block type="SpaceStationX_workOnPuzzle" id="F3/-+$@W=G/u#(i/qrTB"></block></statement><next><block type="SpaceStationX_showWorkGraph" id="gIX},(aUU8B*;9[wHVqq"><field name="puzzle">SpaceStationX.Puzzles.Light</field><next><block type="controls_if" id="50#/,,4Wk$L){wX`*iT%"><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id=",5.s^u[~EFUFvAc7~e[h"><field name="OP">GTE</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="SpaceStationX_getAmountOfWorkDone" id="E[8~b_`8zi(`}ZhWxHNv"></block></value><value name="B"><shadow type="math_number" id=",(FCqf)rX~rO`Ms|aZxU"><field name="NUM">1600</field></shadow></value></block></value><statement name="DO0"><block type="SpaceStationX_solveLightPuzzle" id="mt7j@q3v~C/%`DT^?y{1"><next><block type="music_playable_play_default_bkg" id=".cX7uFlHIDx/,0xN@9PL"><field name="playbackMode">music.PlaybackMode.InBackground</field><value name="toPlay"><shadow type="music_string_playable"></shadow><block type="device_builtin_melody_playable" id="%=40FYE9uP8jge`@fuE;"><field name="melody">Melodies.PowerUp</field></block></value><next><block type="SpaceStationX_displayCodeDigit" id="ywMKJ{7hY+Q7ZA^$8sU="><field name="puzzle">SpaceStationX.Puzzles.Light</field><next><block type="variables_set" id="WEvpAs%.a$WYEwHfvH90"><field name="VAR" id="av(F35V_Iahptv0/|USF">secretCode</field><value name="VALUE"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="SpaceStationX_getSecretCode" id="m8)m:Jd$hk(GJZ`Mfq+L"><field name="puzzle">SpaceStationX.Puzzles.Light</field></block></value></block></next></block></next></block></next></block></statement></block></next></block></next></block></next></block></statement></block></xml>

light/main.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ loops.everyInterval(100, function () {
1212
if (SpaceStationX.isPuzzleSolved()) {
1313
return
1414
}
15-
if (input.lightLevel() >= 196) {
15+
for (let index = 0; index < Math.max(0, Math.round(Math.map(input.lightLevel(), 128, 255, 0, 8))); index++) {
1616
SpaceStationX.workOnPuzzle()
17-
SpaceStationX.showWorkGraph(SpaceStationX.Puzzles.Light)
1817
}
19-
if (SpaceStationX.getAmountOfWorkDone() >= 250) {
18+
SpaceStationX.showWorkGraph(SpaceStationX.Puzzles.Light)
19+
if (SpaceStationX.getAmountOfWorkDone() >= 1600) {
2020
SpaceStationX.solveLightPuzzle()
2121
music._playDefaultBackground(music.builtInPlayableMelody(Melodies.PowerUp), music.PlaybackMode.InBackground)
2222
SpaceStationX.displayCodeDigit(SpaceStationX.Puzzles.Light)

0 commit comments

Comments
 (0)