Skip to content

Commit

Permalink
Merge pull request #967 from NecroticPhantom/main
Browse files Browse the repository at this point in the history
Update V2.1.0 (Phasing Drills)
  • Loading branch information
slweeb authored Jan 29, 2025
2 parents 5914ea9 + 2403a6c commit e9cdc12
Showing 1 changed file with 165 additions and 0 deletions.
165 changes: 165 additions & 0 deletions mods/drills.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
~ Fixed all drills not drilling
~ Slight change to drill missile function (no functional difference)
~ Fixed reverse drills not creating pixels while drilling sometimes and when moving vertically
Version 2.1.0 (Phasing Drills)
@NecroticPhantom
+ steel phasing drill
+ diamond phasing drill
+ void phasing drill
*/


Expand Down Expand Up @@ -117,6 +123,39 @@ reverse_drill_function = function(pixel, dif_x, dif_y, drill_element) {
};
};

phasing_drill_function = function(pixel, dif_x, dif_y, current_element, current_color, non_phase_elements) {
held_element = undefined;
held_color = undefined;
if (!outOfBounds(pixel.x + dif_x, pixel.y + dif_y)) {
if (!isEmpty(pixel.x + dif_x, pixel.y + dif_y)) {
pxl = pixelMap[pixel.x + dif_x][pixel.y + dif_y];
if (elements[pxl.element].hardness <= elements[pixel.element].hardness || elements[pxl.element].hardness == undefined) {
held_element = pxl.element;
held_color = pxl.color;
deletePixel(pxl.x, pxl.y);
};
};
tryMove(pixel, pixel.x + dif_x, pixel.y + dif_y);
};
phase = true;
if (isEmpty(pixel.x - dif_x, pixel.y - dif_y)) {
if (current_element != undefined) {
for (let i = 0; i < non_phase_elements.length; i++) {
if (current_element == non_phase_elements[i]) {
phase = false;
break
};
};
if (phase == true) {
createPixel(current_element, pixel.x - dif_x, pixel.y - dif_y);
phase_pxl = pixelMap[pixel.x - dif_x][pixel.y - dif_y];
phase_pxl.color = current_color;
};
};
};
return [held_element, held_color];
};



// elements
Expand Down Expand Up @@ -367,4 +406,130 @@ elements.void_reverse_drill = {
conduct: 0.01,
state: "solid",
maxSize: 1,
};

elements.steel_phasing_drill = {
color: ["#71797e", "#cdeedc"],
properties: {
x_direction: 0,
y_direction: 0,
stored_element: undefined,
stored_color: undefined,
non_phase_elements: [0],
},
tick: function(pixel) {
if (pixel.x_direction == 0 && pixel.y_direction == 0) {
pixel.x_direction = Number(prompt("Move left, right or neither (Type: -1, 1 or 0 respectively)? "));
if (pixel.x_direction == 0) {
pixel.y_direction = Number(prompt("Move up or down (Type: -1 or 1 respectively)? "));
};
};
if (pixel.non_phase_elements[0] == 0) {
for (let i = 0; i > -1; i++) {
pixel.non_phase_elements[i] = prompt("Enter element name to not phase through (Type: -1 when done): ");
if (pixel.non_phase_elements[i] == "-1") {
if (pixel.non_phase_elements[i] == "-1") {
pixel.non_phase_elements == undefined;
};
break
};
};
};
stored_properties = phasing_drill_function(pixel, pixel.x_direction, pixel.y_direction, pixel.stored_element, pixel.stored_color, pixel.non_phase_elements);
pixel.stored_element = stored_properties[0];
pixel.stored_color = stored_properties[1];
},
category: "Drills",
breakInto: ["metal_scrap", "steel", "iron", "tin"],
tempHigh: 1455.5,
stateHigh: ["molten_aluminium", "molten_steel", "molten_iron", "molten_tin"],
density: 7850,
hardness: 0.8,
conduct: 0.42,
state: "solid",
maxSize: 1,
};

elements.diamond_phasing_drill = {
color: ["#03fcec", "#cdeedc"],
properties: {
x_direction: 0,
y_direction: 0,
stored_element: undefined,
stored_color: undefined,
non_phase_elements: [0],
},
tick: function(pixel) {
if (pixel.x_direction == 0 && pixel.y_direction == 0) {
pixel.x_direction = Number(prompt("Move left, right or neither (Type: -1, 1 or 0 respectively)? "));
if (pixel.x_direction == 0) {
pixel.y_direction = Number(prompt("Move up or down (Type: -1 or 1 respectively)? "));
};
};
if (pixel.non_phase_elements[0] == 0) {
for (let i = 0; i > -1; i++) {
pixel.non_phase_elements[i] = prompt("Enter element name to not phase through (Type: -1 when done): ");
if (pixel.non_phase_elements[i] == "-1") {
if (pixel.non_phase_elements[i] == "-1") {
pixel.non_phase_elements == undefined;
};
break
};
};
};
stored_properties = phasing_drill_function(pixel, pixel.x_direction, pixel.y_direction, pixel.stored_element, pixel.stored_color, pixel.non_phase_elements);
pixel.stored_element = stored_properties[0];
pixel.stored_color = stored_properties[1];
},
category: "Drills",
breakInto: ["metal_scrap", "diamond", "iron", "tin"],
tempHigh: 1455.5,
stateHigh: ["molten_aluminium", "diamond", "molten_iron", "molten_tin"],
density: 3515,
hardness: 0.99,
conduct: 0.01,
state: "solid",
maxSize: 1,
};

elements.void_phasing_drill = {
color: ["#262626", "#cdeedc"],
properties: {
x_direction: 0,
y_direction: 0,
stored_element: undefined,
stored_color: undefined,
non_phase_elements: [0],
},
tick: function(pixel) {
if (pixel.x_direction == 0 && pixel.y_direction == 0) {
pixel.x_direction = Number(prompt("Move left, right or neither (Type: -1, 1 or 0 respectively)? "));
if (pixel.x_direction == 0) {
pixel.y_direction = Number(prompt("Move up or down (Type: -1 or 1 respectively)? "));
};
};
if (pixel.non_phase_elements[0] == 0) {
for (let i = 0; i > -1; i++) {
pixel.non_phase_elements[i] = prompt("Enter element name to not phase through (Type: -1 when done): ");
if (pixel.non_phase_elements[i] == "-1") {
if (pixel.non_phase_elements[i] == "-1") {
pixel.non_phase_elements == undefined;
};
break
};
};
};
stored_properties = phasing_drill_function(pixel, pixel.x_direction, pixel.y_direction, pixel.stored_element, pixel.stored_color, pixel.non_phase_elements);
pixel.stored_element = stored_properties[0];
pixel.stored_color = stored_properties[1];
},
category: "Drills",
breakInto: ["metal_scrap", "void", "iron", "tin"],
tempHigh: 1455.5,
stateHigh: ["molten_aluminium", "void", "molten_iron", "molten_tin"],
density: 7850,
hardness: 1,
conduct: 0.01,
state: "solid",
maxSize: 1,
};

0 comments on commit e9cdc12

Please sign in to comment.