Skip to content

Commit

Permalink
Support maze bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
rrrobo committed May 25, 2024
1 parent 14a8b15 commit 499e7a6
Show file tree
Hide file tree
Showing 22 changed files with 592 additions and 348 deletions.
212 changes: 107 additions & 105 deletions helper/scoreSheetPDFMazeRules/2024.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function drawRun(doc, config, scoringRun) {
);

// System version
pdf.drawText(doc, 742, 573, `RoboCupJunior CMS v${process.env.cms_version}`, 6, 'black');
pdf.drawText(doc, 20, 580, `This score sheet is generated by RCJ CMS v${process.env.cms_version}`, 6, 'black');

const cells = [];
for (const cell of scoringRun.map.cells) {
Expand Down Expand Up @@ -214,110 +214,112 @@ function drawRun(doc, config, scoringRun) {
};
for (let j = 1, l = scoringRun.map.length * 2 + 1; j < l; j += 2) {
for (let i = 1, m = scoringRun.map.width * 2 + 1; i < m; i += 2) {
if (!cells[`${i},${j},0`]) continue
const victimLF = cells[`${i},${j},0`].isLinear ? 'linear' : 'floating';
const { victims } = cells[`${i},${j},0`].tile;
const { tile } = cells[`${i},${j},0`];
let victimType = 'None';

victimType = victims.top;
if (victimType != 'None') {
let name;
if (victimLF == 'linear')
name = big[itemList[victimType][victimLF].length];
else name = small[itemList[victimType][victimLF].length];
const tmp = {
x: i,
y: j,
z: 0,
name,
};
itemList[victimType][victimLF].push(tmp);
}

victimType = victims.left;
if (victimType != 'None') {
let name;
if (victimLF == 'linear')
name = big[itemList[victimType][victimLF].length];
else name = small[itemList[victimType][victimLF].length];
const tmp = {
x: i,
y: j,
z: 0,
name,
};
itemList[victimType][victimLF].push(tmp);
}

victimType = victims.right;
if (victimType != 'None') {
let name;
if (victimLF == 'linear')
name = big[itemList[victimType][victimLF].length];
else name = small[itemList[victimType][victimLF].length];
const tmp = {
x: i,
y: j,
z: 0,
name,
};
itemList[victimType][victimLF].push(tmp);
}

victimType = victims.bottom;
if (victimType != 'None') {
let name;
if (victimLF == 'linear')
name = big[itemList[victimType][victimLF].length];
else name = small[itemList[victimType][victimLF].length];
const tmp = {
x: i,
y: j,
z: 0,
name,
};
itemList[victimType][victimLF].push(tmp);
}

if (tile.checkpoint) {
const tmp = {
x: i,
y: j,
z: 0,
name: itemList.checkpoint.length + 1,
};
itemList.checkpoint.push(tmp);
}

if (tile.speedbump) {
const tmp = {
x: i,
y: j,
z: 0,
name: itemList.speedbump.length + 1,
};
itemList.speedbump.push(tmp);
}

if (tile.ramp) {
const tmp = {
x: i,
y: j,
z: 0,
name: itemList.ramp.length + 1,
};
itemList.ramp.push(tmp);
}

if (tile.steps) {
const tmp = {
x: i,
y: j,
z: 0,
name: itemList.steps.length + 1,
};
itemList.steps.push(tmp);
for (let k = 0; k < scoringRun.map.height; k++) {
if (!cells[`${i},${j},${k}`]) continue
const victimLF = cells[`${i},${j},${k}`].isLinear ? 'linear' : 'floating';
const { victims } = cells[`${i},${j},${k}`].tile;
const { tile } = cells[`${i},${j},${k}`];
let victimType = 'None';

victimType = victims.top;
if (victimType != 'None') {
let name;
if (victimLF == 'linear')
name = big[itemList[victimType][victimLF].length];
else name = small[itemList[victimType][victimLF].length];
const tmp = {
x: i,
y: j,
z: k,
name,
};
itemList[victimType][victimLF].push(tmp);
}

victimType = victims.left;
if (victimType != 'None') {
let name;
if (victimLF == 'linear')
name = big[itemList[victimType][victimLF].length];
else name = small[itemList[victimType][victimLF].length];
const tmp = {
x: i,
y: j,
z: k,
name,
};
itemList[victimType][victimLF].push(tmp);
}

victimType = victims.right;
if (victimType != 'None') {
let name;
if (victimLF == 'linear')
name = big[itemList[victimType][victimLF].length];
else name = small[itemList[victimType][victimLF].length];
const tmp = {
x: i,
y: j,
z: k,
name,
};
itemList[victimType][victimLF].push(tmp);
}

victimType = victims.bottom;
if (victimType != 'None') {
let name;
if (victimLF == 'linear')
name = big[itemList[victimType][victimLF].length];
else name = small[itemList[victimType][victimLF].length];
const tmp = {
x: i,
y: j,
z: k,
name,
};
itemList[victimType][victimLF].push(tmp);
}

if (tile.checkpoint) {
const tmp = {
x: i,
y: j,
z: k,
name: itemList.checkpoint.length + 1,
};
itemList.checkpoint.push(tmp);
}

if (tile.speedbump) {
const tmp = {
x: i,
y: j,
z: k,
name: itemList.speedbump.length + 1,
};
itemList.speedbump.push(tmp);
}

if (tile.ramp) {
const tmp = {
x: i,
y: j,
z: k,
name: itemList.ramp.length + 1,
};
itemList.ramp.push(tmp);
}

if (tile.steps) {
const tmp = {
x: i,
y: j,
z: k,
name: itemList.steps.length + 1,
};
itemList.steps.push(tmp);
}
}
}
}
Expand Down
Loading

0 comments on commit 499e7a6

Please sign in to comment.