Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $$<modular.inputs.min.txt>
- LOG("§e'§3Service sensors§e' §6started §7%&inputs_[1]% §7%&inputs_[2]% §7%&inputs_[3]% §7%&inputs_[4]% §7%&inputs_[5]% §7%&inputs_[6]% §7%&inputs_[7]% §7%&inputs_[8]%");
- ¤t_="sensors.init";
- //12 lines of horizontal sensors. Each line has 7 sensors.
- //0-2: back positions. 3: current position. 4-6 front positions
- //4 groups of sensor lines: floor(f){y=-1}, surface(s){y=0}, head(h){y=1}, roof(r){y=2}
- //3 horizontal lines of sensor lines: left(l), center(c), right(r)
- //Pattern example variable name: sensorls[3] (left surface at the current block)
- $$<modular.initial.min.txt>
- //§
- ELSEIF(¤t_=="sensors.init");
- SET(@service_sensors);
- &next_="sensors.monitor";
- ELSEIF(¤t_=="sensors.monitor");
- UNSAFE(350);
- DO;
- IF(%DIRECTION%=="N");
- #x=0;#z=-1;
- //left: -x, right:+x
- ELSEIF(%DIRECTION%=="S");
- #x=0;#z=1;
- //left: +x, right:-x
- ELSEIF(%DIRECTION%=="E");
- #x=1;#z=0;
- //left: -z, right:+z
- ELSEIF(%DIRECTION%=="W");
- #x=-1;#z=0;
- //left: +z, right:-z
- ENDIF;
- #leftx=%#z%*1;#rightx=%#z%*-1;
- #leftz=%#x%*-1;#rightz=%#x%*1;
- FOR(#n,-3,3);
- #nx=%#x%*%#n%;#nz=%#z%*%#n%;#apos=3+%#n%;
- #nleftx=%#nx%+%#leftx%;#nleftz=%#nz%+%#leftz%;
- #nrightx=%#nx%+%#rightx%;#nrightz=%#nz%+%#rightz%;
- ///////////////////////////////////
- // FLOOR
- ///////////////////////////////////
- #gy=-1;
- GETIDREL(%#nx%,%#gy%,%#nz%,"&idc","&datac");
- GETIDREL(%#nleftx%,%#gy%,%#nleftz%,"&idl","&datal");
- GETIDREL(%#nrightx%,%#gy%,%#nrightz%,"&idr","&datar");
- MATCH("%&idc%¢%&idl%¢%&idr%","([^¢]+)¢([^¢]+)¢([^¢]+)",&id[]);
- MATCH("%&datac%¢%&datal%¢%&datar%","([^¢]+)¢([^¢]+)¢([^¢]+)",&data[]);
- SET(@&sensorcf[%#apos%],"%&id[1]%:%&data[1]%");
- SET(@&sensorlf[%#apos%],"%&id[2]%:%&data[2]%");
- SET(@&sensorrf[%#apos%],"%&id[3]%:%&data[3]%");
- ///////////////////////////////////
- // SURFACE
- ///////////////////////////////////
- #gy=0;
- GETIDREL(%#nx%,%#gy%,%#nz%,"&idc","&datac");
- GETIDREL(%#nleftx%,%#gy%,%#nleftz%,"&idl","&datal");
- GETIDREL(%#nrightx%,%#gy%,%#nrightz%,"&idr","&datar");
- MATCH("%&idc%¢%&idl%¢%&idr%","([^¢]+)¢([^¢]+)¢([^¢]+)",&id[]);
- MATCH("%&datac%¢%&datal%¢%&datar%","([^¢]+)¢([^¢]+)¢([^¢]+)",&data[]);
- SET(@&sensorcs[%#apos%],"%&id[1]%:%&data[1]%");
- SET(@&sensorls[%#apos%],"%&id[2]%:%&data[2]%");
- SET(@&sensorrs[%#apos%],"%&id[3]%:%&data[3]%");
- ///////////////////////////////////
- // HEAD
- ///////////////////////////////////
- #gy=1;
- GETIDREL(%#nx%,%#gy%,%#nz%,"&idc","&datac");
- GETIDREL(%#nleftx%,%#gy%,%#nleftz%,"&idl","&datal");
- GETIDREL(%#nrightx%,%#gy%,%#nrightz%,"&idr","&datar");
- MATCH("%&idc%¢%&idl%¢%&idr%","([^¢]+)¢([^¢]+)¢([^¢]+)",&id[]);
- MATCH("%&datac%¢%&datal%¢%&datar%","([^¢]+)¢([^¢]+)¢([^¢]+)",&data[]);
- SET(@&sensorch[%#apos%],"%&id[1]%:%&data[1]%");
- SET(@&sensorlh[%#apos%],"%&id[2]%:%&data[2]%");
- SET(@&sensorrh[%#apos%],"%&id[3]%:%&data[3]%");
- ///////////////////////////////////
- // ROOF
- ///////////////////////////////////
- #gy=2;
- GETIDREL(%#nx%,%#gy%,%#nz%,"&idc","&datac");
- GETIDREL(%#nleftx%,%#gy%,%#nleftz%,"&idl","&datal");
- GETIDREL(%#nrightx%,%#gy%,%#nrightz%,"&idr","&datar");
- MATCH("%&idc%¢%&idl%¢%&idr%","([^¢]+)¢([^¢]+)¢([^¢]+)",&id[]);
- MATCH("%&datac%¢%&datal%¢%&datar%","([^¢]+)¢([^¢]+)¢([^¢]+)",&data[]);
- SET(@&sensorcr[%#apos%],"%&id[1]%:%&data[1]%");
- SET(@&sensorlr[%#apos%],"%&id[2]%:%&data[2]%");
- SET(@&sensorrr[%#apos%],"%&id[3]%:%&data[3]%");
- NEXT;
- $$<modular.loop.min.txt>
- WHILE(1);
- UNSET(@service_sensors);
- UNSET(%&socket_%);
- ARRAYSIZE(@&sensorcf,#s);
- IF(#s>0);
- DO(%#s%);
- POP(@&sensorcf,&o);
- POP(@&sensorlf,&o);
- POP(@&sensorrf,&o);
- POP(@&sensorcs,&o);
- POP(@&sensorls,&o);
- POP(@&sensorrs,&o);
- POP(@&sensorch,&o);
- POP(@&sensorlh,&o);
- POP(@&sensorrh,&o);
- POP(@&sensorcr,&o);
- POP(@&sensorlr,&o);
- POP(@&sensorrr,&o);
- LOOP;
- ENDIF;
- ENDUNSAFE;
- &next_="exit";
- $$<modular.parser.min.txt>
- LOG("§e'§3Service Sensors§e' §cScript stopped!");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement