2024-06-21 07:56:47 -04:00
/ * M a d e b y : N e c r o t i c P h a n t o m
2024-05-08 06:05:22 -04:00
With help from : voidapex11 * /
// For change log: "+" = addition, "-" = removal and "~" = change. L, R, U, D corresponds to LEFT, RIGHT, UP and DOWN
/ *
=== CHANGE LOG ===
2024-06-21 07:56:47 -04:00
Version : 1.0 . 0 ( Drills . js )
2024-05-08 06:05:22 -04:00
@ Necrotic _Phantom & @ voidapex11
+ steel drill L , R , U & D
+ steel drill missile L , R , U & D
+ diamond drill L , R , U & D
+ diamond drill missile L , R , U & D
+ void drill L , R , U & D
+ void drill missile L , R , U & D
+ drills . js info ( drills _info ) element to 'mods' category
~ fixed steel / diamond / void drill R & steel / diamond / void drill missile R crashing upon border collision
2025-01-21 12:16:50 -05:00
~ made steel / diamond / void drill missile L , R , U & D explode upon contact with canvas edge
2024-05-08 06:05:22 -04:00
~ committed
2024-06-21 07:56:47 -04:00
2025-01-21 12:16:50 -05:00
Version : 1.0 . 1 ( No Hardness Fix )
2024-06-21 07:56:47 -04:00
@ NecroticPhantom
~ fixed steel / diamond / void drill L , R , U & D + steel / diamond / void drill missile L , R , U & D not breaking pixels with no listed hardness
2025-01-21 12:16:50 -05:00
Version : 2.0 . 0 ( Drills Revamped ( AKA Reverse Drills ) )
@ NecroticPhantom
+ maxSize : 1 to all drills without it
~ rewrote drills and functions so no longer need L , R , U and D versions of all drills
- L , R , U and D versions of all drills
~ rewrote drills and functions so no longer need 1 function per drill material
- drill material - specific functions
- drill color variables
~ changed breakInto and stateHigh for most drills
~ changed density , tempHigh and conductivity of all drills
~ renamed 'drills.js_info' element to 'drills.js'
2025-01-24 04:07:52 -05:00
+ steel reverse drill
+ diamond reverse drill
+ void reverse drill
Version 2.0 . 1 ( Drills Not Functioning Hotfix )
@ NecroticPhantom
~ 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
2024-05-08 06:05:22 -04:00
* /
2024-06-21 07:56:47 -04:00
2025-01-21 12:16:50 -05:00
// info element
2024-05-08 06:05:22 -04:00
elements . drills _info = {
2025-01-21 12:16:50 -05:00
color : "#000000" ,
name : "drills.js" ,
2024-05-08 06:05:22 -04:00
category : "Mods" ,
behavior : behaviors . SELFDELETE ,
maxSize : 1 ,
tool : function ( pixel ) { } ,
onSelect : function ( pixel ) {
2025-01-21 12:16:50 -05:00
let mod _info = "The drills.js mod adds different kinds of drills to a new 'drills' category.\n\nMod made by: Necrotic_Phantom. \n With help from: voidapex11."
alert ( mod _info )
2024-05-08 06:05:22 -04:00
return
} ,
2025-01-21 12:16:50 -05:00
} ;
2024-05-08 06:05:22 -04:00
2025-01-21 12:16:50 -05:00
// functions
drill _function = function ( pixel , dif _x , dif _y ) {
if ( ! outOfBounds ( pixel . x + dif _x , pixel . y + dif _y ) ) {
if ( ! isEmpty ( pixel . x + dif _x , pixel . y + dif _y ) ) {
2025-01-24 04:07:52 -05:00
pxl = pixelMap [ pixel . x + dif _x ] [ pixel . y + dif _y ] ;
if ( elements [ pxl . element ] . hardness <= elements [ pixel . element ] . hardness || elements [ pxl . element ] . hardness == undefined ) {
deletePixel ( pxl . x , pxl . y ) ;
2024-06-21 07:56:47 -04:00
} ;
2024-05-08 06:05:22 -04:00
} ;
2025-01-21 12:16:50 -05:00
tryMove ( pixel , pixel . x + dif _x , pixel . y + dif _y ) ;
2024-05-08 06:05:22 -04:00
} ;
2025-01-21 12:16:50 -05:00
} ;
2024-05-08 06:05:22 -04:00
2025-01-21 12:16:50 -05:00
drill _missile _function = function ( pixel , dif _x , dif _y ) {
if ( pixel . die == 0 ) {
deletePixel ( pixel . x , pixel . y ) ;
2024-05-08 06:05:22 -04:00
explodeAt ( pixel . x , pixel . y , 15 ) ;
2025-01-21 12:16:50 -05:00
return ;
2024-05-08 06:05:22 -04:00
} ;
2025-01-21 12:16:50 -05:00
if ( ! outOfBounds ( pixel . x + dif _x , pixel . y + dif _y ) ) {
2025-01-24 04:07:52 -05:00
pxl = pixelMap [ pixel . x + dif _x ] [ pixel . y + dif _y ] ;
2025-01-21 12:16:50 -05:00
if ( ! isEmpty ( pixel . x + dif _x , pixel . y + dif _y ) ) {
pixel . primed = true ;
2025-01-24 04:07:52 -05:00
if ( elements [ pxl . element ] . hardness <= elements [ pixel . element ] . hardness || elements [ pxl . element ] . hardness == undefined ) {
deletePixel ( pxl . x , pxl . y ) ;
2024-06-21 07:56:47 -04:00
} ;
2024-05-08 06:05:22 -04:00
}
else if ( pixel . primed ) {
2025-01-21 12:16:50 -05:00
pixel . die -- ;
return ;
2024-05-08 06:05:22 -04:00
} ;
2025-01-21 12:16:50 -05:00
tryMove ( pixel , pixel . x + dif _x , pixel . y + dif _y ) ;
2024-05-08 06:05:22 -04:00
}
2025-01-21 12:16:50 -05:00
else if ( outOfBounds ( pixel . x + dif _x , pixel . y + dif _y ) ) {
deletePixel ( pixel . x , pixel . y ) ;
2024-05-08 06:05:22 -04:00
explodeAt ( pixel . x , pixel . y , 15 ) ;
} ;
2025-01-21 12:16:50 -05:00
} ;
reverse _drill _function = function ( pixel , dif _x , dif _y , drill _element ) {
if ( ! outOfBounds ( pixel . x + dif _x , pixel . y + dif _y ) ) {
if ( ! isEmpty ( pixel . x + dif _x , pixel . y + dif _y ) ) {
2025-01-24 04:07:52 -05:00
pxl = pixelMap [ pixel . x + dif _x ] [ pixel . y + dif _y ] ;
if ( elements [ pxl . element ] . hardness <= elements [ pixel . element ] . hardness || elements [ pxl . element ] . hardness == undefined ) {
deletePixel ( pxl . x , pxl . y ) ;
2025-01-21 12:16:50 -05:00
} ;
} ;
tryMove ( pixel , pixel . x + dif _x , pixel . y + dif _y ) ;
} ;
2025-01-24 04:07:52 -05:00
if ( isEmpty ( pixel . x - dif _x , pixel . y - dif _y ) ) {
2025-01-21 12:16:50 -05:00
createPixel ( drill _element , pixel . x - dif _x , pixel . y - dif _y ) ;
} ;
} ;
2024-05-08 06:05:22 -04:00
2025-01-21 12:16:50 -05:00
// elements
elements . steel _drill = {
color : "#71797e" ,
2024-05-08 06:05:22 -04:00
properties : {
2025-01-21 12:16:50 -05:00
x _direction : 0 ,
y _direction : 0 ,
2024-05-08 06:05:22 -04:00
} ,
tick : function ( pixel ) {
2025-01-21 12:16:50 -05:00
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)? " ) ) ;
} ;
} ;
drill _function ( pixel , pixel . x _direction , pixel . y _direction ) ;
2024-05-08 06:05:22 -04:00
} ,
category : "Drills" ,
2025-01-21 12:16:50 -05:00
breakInto : [ "metal_scrap" , "steel" , "iron" , "tin" ] ,
tempHigh : 1455.5 ,
stateHigh : [ "molten_aluminium" , "molten_steel" , "molten_iron" , "molten_tin" ] ,
density : 7850 ,
2024-05-08 06:05:22 -04:00
hardness : 0.8 ,
2025-01-21 12:16:50 -05:00
conduct : 0.42 ,
2024-05-08 06:05:22 -04:00
state : "solid" ,
maxSize : 1 ,
2025-01-21 12:16:50 -05:00
} ;
2024-05-08 06:05:22 -04:00
2025-01-21 12:16:50 -05:00
elements . diamond _drill = {
color : "#03fcec" ,
2024-05-08 06:05:22 -04:00
properties : {
2025-01-21 12:16:50 -05:00
x _direction : 0 ,
y _direction : 0 ,
2024-05-08 06:05:22 -04:00
} ,
tick : function ( pixel ) {
2025-01-21 12:16:50 -05:00
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)? " ) ) ;
2024-06-21 07:56:47 -04:00
} ;
2024-05-08 06:05:22 -04:00
} ;
2025-01-21 12:16:50 -05:00
drill _function ( pixel , pixel . x _direction , pixel . y _direction ) ;
2024-05-08 06:05:22 -04:00
} ,
category : "Drills" ,
breakInto : [ "metal_scrap" , "diamond" , "iron" , "tin" ] ,
2025-01-21 12:16:50 -05:00
tempHigh : 1455.5 ,
stateHigh : [ "molten_aluminium" , "diamond" , "molten_iron" , "molten_tin" ] ,
density : 3515 ,
2024-05-08 06:05:22 -04:00
hardness : 0.99 ,
2025-01-21 12:16:50 -05:00
conduct : 0.01 ,
2024-05-08 06:05:22 -04:00
state : "solid" ,
2025-01-21 12:16:50 -05:00
maxSize : 1 ,
} ;
2024-05-08 06:05:22 -04:00
2025-01-21 12:16:50 -05:00
elements . void _drill = {
color : "#262626" ,
properties : {
x _direction : 0 ,
y _direction : 0 ,
2024-05-08 06:05:22 -04:00
} ,
tick : function ( pixel ) {
2025-01-21 12:16:50 -05:00
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)? " ) ) ;
2024-06-21 07:56:47 -04:00
} ;
2024-05-08 06:05:22 -04:00
} ;
2025-01-21 12:16:50 -05:00
drill _function ( pixel , pixel . x _direction , pixel . y _direction ) ;
2024-05-08 06:05:22 -04:00
} ,
category : "Drills" ,
2025-01-21 12:16:50 -05:00
breakInto : [ "metal_scrap" , "void" , "iron" , "tin" ] ,
tempHigh : 1455.5 ,
stateHigh : [ "molten_aluminium" , "void" , "molten_iron" , "molten_tin" ] ,
density : 7850 ,
hardness : 1 ,
conduct : 0.01 ,
2024-05-08 06:05:22 -04:00
state : "solid" ,
maxSize : 1 ,
2025-01-21 12:16:50 -05:00
} ;
2024-05-08 06:05:22 -04:00
2025-01-21 12:16:50 -05:00
elements . steel _drill _missile = {
color : [ "#71797e" , "#ff0000" ] ,
2024-05-08 06:05:22 -04:00
properties : {
2025-01-21 12:16:50 -05:00
x _direction : 0 ,
y _direction : 0 ,
die : - 1 ,
2024-05-08 06:05:22 -04:00
primed : false ,
} ,
tick : function ( pixel ) {
2025-01-21 12:16:50 -05:00
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 . die == - 1 ) {
pixel . die = Number ( prompt ( "How many ticks (after priming) until explosion (enter as number)? " ) ) ;
} ;
drill _missile _function ( pixel , pixel . x _direction , pixel . y _direction ) ;
2024-05-08 06:05:22 -04:00
} ,
category : "Drills" ,
2025-01-21 12:16:50 -05:00
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 ,
2024-05-08 06:05:22 -04:00
state : "solid" ,
maxSize : 1 ,
2025-01-21 12:16:50 -05:00
} ;
2024-05-08 06:05:22 -04:00
2025-01-21 12:16:50 -05:00
elements . diamond _drill _missile = {
color : [ "#03fcec" , "#ff0000" ] ,
2024-05-08 06:05:22 -04:00
properties : {
2025-01-21 12:16:50 -05:00
x _direction : 0 ,
y _direction : 0 ,
die : - 1 ,
2024-05-08 06:05:22 -04:00
primed : false ,
} ,
tick : function ( pixel ) {
2025-01-21 12:16:50 -05:00
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 . die == - 1 ) {
pixel . die = Number ( prompt ( "How many ticks (after priming) until explosion (enter as number)? " ) ) ;
} ;
drill _missile _function ( pixel , pixel . x _direction , pixel . y _direction ) ;
2024-05-08 06:05:22 -04:00
} ,
category : "Drills" ,
2025-01-21 12:16:50 -05:00
breakInto : [ "metal_scrap" , "diamond" , "iron" , "tin" ] ,
tempHigh : 1455.5 ,
stateHigh : [ "molten_aluminium" , "diamond" , "molten_iron" , "molten_tin" ] ,
density : 3515 ,
2024-05-08 06:05:22 -04:00
hardness : 0.99 ,
2025-01-21 12:16:50 -05:00
conduct : 0.01 ,
2024-05-08 06:05:22 -04:00
state : "solid" ,
maxSize : 1 ,
2025-01-21 12:16:50 -05:00
} ;
2024-05-08 06:05:22 -04:00
2025-01-21 12:16:50 -05:00
elements . void _drill _missile = {
color : [ "#262626" , "#ff0000" ] ,
2024-05-08 06:05:22 -04:00
properties : {
2025-01-21 12:16:50 -05:00
x _direction : 0 ,
y _direction : 0 ,
die : - 1 ,
2024-05-08 06:05:22 -04:00
primed : false ,
} ,
tick : function ( pixel ) {
2025-01-21 12:16:50 -05:00
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)? " ) ) ;
2024-06-21 07:56:47 -04:00
} ;
2024-05-08 06:05:22 -04:00
} ;
2025-01-21 12:16:50 -05:00
if ( pixel . die == - 1 ) {
pixel . die = Number ( prompt ( "How many ticks (after priming) until explosion (enter as number)? " ) ) ;
2024-05-08 06:05:22 -04:00
} ;
2025-01-21 12:16:50 -05:00
drill _missile _function ( pixel , pixel . x _direction , pixel . y _direction ) ;
2024-05-08 06:05:22 -04:00
} ,
category : "Drills" ,
2025-01-21 12:16:50 -05:00
breakInto : [ "metal_scrap" , "void" , "iron" , "tin" ] ,
tempHigh : 1455.5 ,
stateHigh : [ "molten_aluminium" , "void" , "molten_iron" , "molten_tin" ] ,
density : 7850 ,
2024-05-08 06:05:22 -04:00
hardness : 1 ,
2025-01-21 12:16:50 -05:00
conduct : 0.01 ,
2024-05-08 06:05:22 -04:00
state : "solid" ,
maxSize : 1 ,
2025-01-21 12:16:50 -05:00
} ;
2024-05-08 06:05:22 -04:00
2025-01-21 12:16:50 -05:00
elements . steel _reverse _drill = {
color : "#e79717" , //reverse drill colours are the hexidecimal for the origional drills but reversed
2024-05-08 06:05:22 -04:00
properties : {
2025-01-21 12:16:50 -05:00
x _direction : 0 ,
y _direction : 0 ,
2024-05-08 06:05:22 -04:00
} ,
tick : function ( pixel ) {
2025-01-21 12:16:50 -05:00
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)? " ) ) ;
} ;
} ;
reverse _drill _function ( pixel , pixel . x _direction , pixel . y _direction , "steel" ) ;
2024-05-08 06:05:22 -04:00
} ,
category : "Drills" ,
2025-01-21 12:16:50 -05:00
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 ,
2024-05-08 06:05:22 -04:00
state : "solid" ,
maxSize : 1 ,
2025-01-21 12:16:50 -05:00
} ;
2024-05-08 06:05:22 -04:00
2025-01-21 12:16:50 -05:00
elements . diamond _reverse _drill = {
color : "#cecf30" , //reverse drill colours are the hexidecimal for the origional drills but reversed
2024-05-08 06:05:22 -04:00
properties : {
2025-01-21 12:16:50 -05:00
x _direction : 0 ,
y _direction : 0 ,
2024-05-08 06:05:22 -04:00
} ,
tick : function ( pixel ) {
2025-01-21 12:16:50 -05:00
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)? " ) ) ;
} ;
} ;
reverse _drill _function ( pixel , pixel . x _direction , pixel . y _direction , "diamond" ) ;
2024-05-08 06:05:22 -04:00
} ,
category : "Drills" ,
2025-01-21 12:16:50 -05:00
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 ,
2024-05-08 06:05:22 -04:00
state : "solid" ,
maxSize : 1 ,
2025-01-21 12:16:50 -05:00
} ;
2024-05-08 06:05:22 -04:00
2025-01-21 12:16:50 -05:00
elements . void _reverse _drill = {
color : "#626262" , //reverse drill colours are the hexidecimal for the origional drills but reversed
2024-05-08 06:05:22 -04:00
properties : {
2025-01-21 12:16:50 -05:00
x _direction : 0 ,
y _direction : 0 ,
2024-05-08 06:05:22 -04:00
} ,
tick : function ( pixel ) {
2025-01-21 12:16:50 -05:00
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)? " ) ) ;
} ;
} ;
reverse _drill _function ( pixel , pixel . x _direction , pixel . y _direction , "void" ) ;
2024-05-08 06:05:22 -04:00
} ,
category : "Drills" ,
2025-01-21 12:16:50 -05:00
breakInto : [ "metal_scrap" , "void" , "iron" , "tin" ] ,
tempHigh : 1455.5 ,
stateHigh : [ "molten_aluminium" , "void" , "molten_iron" , "molten_tin" ] ,
density : 7850 ,
2024-05-08 06:05:22 -04:00
hardness : 1 ,
2025-01-21 12:16:50 -05:00
conduct : 0.01 ,
2024-05-08 06:05:22 -04:00
state : "solid" ,
maxSize : 1 ,
2025-01-21 12:16:50 -05:00
} ;