Merge branch 'R74nCom:main' into main

This commit is contained in:
JustAGenericUsername 2024-08-08 15:50:27 -04:00 committed by GitHub
commit 5ea800d411
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 491 additions and 145 deletions

View File

@ -15060,12 +15060,12 @@ behaviorRules = {
categoryButton.setAttribute("current", true);
}
function setView(n) {
if (viewInfo[n]) {
view = n;
}
else { // reset view
if (!viewInfo[n] || n === 1) { // reset view
view = null;
}
else {
view = n;
}
}
function centerMouse() {
mousePos = {x:width/2,y:height/2};

View File

@ -545,5 +545,9 @@
"freeze_ray":"冷雷",
"kelp":"海帶",
"mixer":"混合機",
"grinder":"混合機"
"grinder":"混合機",
"rice":"米",
"galvanized_steel":"鍍鋅鋼",
"midas_touch":"點石成金",
"liquid_ozone":"液臭氧"
}

View File

@ -347,6 +347,7 @@
<tr><td>food_mods.js</td><td>A mod combining most food mods</td><td>stefanblox, moss, Tisquares, SquareScreamYT, Adora, pixelegend4, Alice, Nubo318, Clide4, rottenEgghead</td></tr>
<!----><tr><td class="modCat" colspan="3">Technical Libraries & Tests</td></tr><!---->
<tr><td>1.10example.js</td><td>Examples for modern rendering modding and more</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
<tr><td>a_bundle_of_tests.js</td><td>Several test functions</td><td>Alice</td></tr>
<tr><td>all_stain.js</td><td>Makes every element stain solids</td><td>stefanblox</td></tr>
<tr><td>betterMenuScreens.js</td><td>Library for mods to create their own menus</td><td>ggod</td></tr>

View File

@ -214,6 +214,11 @@ class MenuScreen {
return this;
}
setMenuTextId(id) {
this.menuTextId = id;
return this;
}
/**
* Adds a node to the menu screen content
* @param {Node|Node[]} node Any HTML node/element or array of HTML nodes/elements
@ -262,12 +267,13 @@ class MenuScreen {
parent.style.display = "none";
const inner = document.createElement("div");
inner.className = this.innerDivClass ?? "menuScreen";
inner.id = this.innerDivId;
inner.innerHTML = `${this.showCloseButton ? `<button class="${this.closeButtonClass ?? "XButton"}" onclick="closeMenu();">${this.closeButtonText}` : ""}</button>
<span class="menuTitle"${this.titleId ? ` id="${this.titleId}"` : ""}>${this.title ?? "Menu Screen"}</span><br><br><div class="menuText">` + this.innerHtml + "</div>";
<span class="menuTitle"${this.titleId ? ` id="${this.titleId}"` : ""}>${this.title ?? "Menu Screen"}</span><br><br><div class="menuText" id="${this.menuTextId}">` + this.innerHtml + "</div>";
this.nodes.forEach(n => inner.querySelector(".menuText").appendChild(n));
parent.appendChild(inner);
document.getElementById(id).appendChild(parent);
}
}
runAfterLoadList.push(inject);
runAfterLoadList.push(inject);

View File

@ -98,15 +98,23 @@ function createCircuitFrame(pixel, width_, height_, center=true, rotation=0) {
var [rx, ry] = rotateCoordinate(x, y, rotation);
var px = pixel.x + rx;
var py = pixel.y + ry;
if (!(0 <= px && px < width && 0 <= py && py < height)) {continue;}
// Create the pixel
if (!pixelMap[px] || pixelMap[px][py] === undefined) {
createPixel("circuit_material", px, py);
}
// Set the core position property
if (pixelMap[px] && pixelMap[px][py] && pixelMap[px][py].element === "circuit_material") {
pixelMap[px][py].corePosition = { x: pixel.x, y: pixel.y };
}
}
}
}
function createPins(pixel, pins, rotation=0) {
for (var i = 0; i < pins.length; i++) {
var [rx, ry] = rotateCoordinate(pins[i][0], pins[i][1], rotation);
@ -691,75 +699,75 @@ elements.four_bit_SIPO_shift_register_circuit = {
};
elements.four_bit_program_counter_circuit = {
tick: function(pixel) {
var pins = [
// Data inputs (D0-D3)
[-3, -3, true], // D0
[-1, -3, true], // D1
[1, -3, true], // D2
[3, -3, true], // D3
tick: function(pixel) {
var pins = [
// Data inputs (D0-D3)
[-3, -3, true], // D0
[-1, -3, true], // D1
[1, -3, true], // D2
[3, -3, true], // D3
// Control inputs (Increment, Write Enable)
[5, -1, true], // Increment
[5, 1, true], // Write Enable
// Control inputs (Increment, Write Enable)
[5, -1, true], // Increment
[5, 1, true], // Write Enable
// Outputs (Q0-Q3)
[-3, 3, false], // Q0
[-1, 3, false], // Q1
[1, 3, false], // Q2
[3, 3, false], // Q3
];
// Outputs (Q0-Q3)
[-3, 3, false], // Q0
[-1, 3, false], // Q1
[1, 3, false], // Q2
[3, 3, false], // Q3
];
initializeCircuit(pixel, pins, 9, 5);
initializeCircuit(pixel, pins, 9, 5);
// Read data inputs
var D = [
checkPin(pixel, pins, 0),
checkPin(pixel, pins, 1),
checkPin(pixel, pins, 2),
checkPin(pixel, pins, 3)
];
// Read data inputs
var D = [
checkPin(pixel, pins, 0),
checkPin(pixel, pins, 1),
checkPin(pixel, pins, 2),
checkPin(pixel, pins, 3)
];
// Read control inputs
var Increment = checkPin(pixel, pins, 4);
var WriteEnable = checkPin(pixel, pins, 5);
// Read control inputs
var Increment = checkPin(pixel, pins, 4);
var WriteEnable = checkPin(pixel, pins, 5);
// Initialize the state if not already done
if (pixel._state === undefined) {
pixel._state = [false, false, false, false];
pixel.prevIncrement = false; // Previous state of Increment pin
}
// Initialize the state if not already done
if (pixel._state === undefined) {
pixel._state = [false, false, false, false];
pixel.prevIncrement = false; // Previous state of Increment pin
}
// Convert the state to a 4-bit binary number
var stateValue = binaryArrayToNumber(pixel._state);
// Convert the state to a 4-bit binary number
var stateValue = binaryArrayToNumber(pixel._state);
// Detect the positive edge on the Increment pin
if (Increment && !pixel.prevIncrement) {
stateValue = (stateValue + 1) % 16; // Ensure the value wraps around at 4 bits
}
// Detect the positive edge on the Increment pin
if (Increment && !pixel.prevIncrement) {
stateValue = (stateValue + 1) % 16; // Ensure the value wraps around at 4 bits
}
// Update the register state if WriteEnable is active
if (WriteEnable) {
stateValue = binaryArrayToNumber(D); // Load data inputs into state
}
// Update the register state if WriteEnable is active
if (WriteEnable) {
stateValue = binaryArrayToNumber(D); // Load data inputs into state
}
// Update the state
pixel._state = [
(stateValue & 8) !== 0,
(stateValue & 4) !== 0,
(stateValue & 2) !== 0,
(stateValue & 1) !== 0
];
// Update the state
pixel._state = [
(stateValue & 8) !== 0,
(stateValue & 4) !== 0,
(stateValue & 2) !== 0,
(stateValue & 1) !== 0
];
// Output the register state
setPin(pixel, pins, 6, pixel._state[0]); // Q0
setPin(pixel, pins, 7, pixel._state[1]); // Q1
setPin(pixel, pins, 8, pixel._state[2]); // Q2
setPin(pixel, pins, 9, pixel._state[3]); // Q3
// Output the register state
setPin(pixel, pins, 6, pixel._state[0]); // Q0
setPin(pixel, pins, 7, pixel._state[1]); // Q1
setPin(pixel, pins, 8, pixel._state[2]); // Q2
setPin(pixel, pins, 9, pixel._state[3]); // Q3
// Update previous state of Increment pin
pixel.prevIncrement = Increment;
}
// Update previous state of Increment pin
pixel.prevIncrement = Increment;
}
};
elements.four_bit_register_circuit = {
@ -1200,6 +1208,11 @@ elements.very_fast_clock = {
tick: general_clock(8, 4),
}
elements.fast_clock = {
color: "#FFAAFF",
tick: general_clock(16, 8),
}
var addDisplayCallback = function(pixel, pins, w, h) {
for (var y = 1; y < h - 1; y++) {
for (var x = 1; x < w - 1; x++) {
@ -1324,15 +1337,84 @@ elements.simple_double_seven_segment_display = {
}
};
function malfunction_chip(pixel) {
var emptySpaces = [];
// Search in a 5x5 neighborhood for empty spaces
for (var dy = -2; dy <= 2; dy++) {
for (var dx = -2; dx <= 2; dx++) {
var neighborX = pixel.x + dx;
var neighborY = pixel.y + dy;
if (pixelMap[neighborX] && pixelMap[neighborX][neighborY] === undefined) {
emptySpaces.push({ x: neighborX, y: neighborY });
}
}
}
if (emptySpaces.length > 0) {
// Randomly select one of the empty spaces
var randomSpace = emptySpaces[Math.floor(Math.random() * emptySpaces.length)];
// Determine what to spawn based on probability
var rand = Math.random();
if (rand < 0.7) {
createPixel("electric", randomSpace.x, randomSpace.y);
} else if (rand < 0.99) {
createPixel("fire", randomSpace.x, randomSpace.y);
} else {
createPixel("explosion", randomSpace.x, randomSpace.y);
}
}
}
elements.circuit_material = {
color: "#444444",
category: "logic"
category: "logic",
state: "solid",
behavior: behaviors.WALL,
hoverStat: function(pixel) {
return `Circuit: ${pixel.corePosition}`;
},
tick: function(pixel) {
// Make it that extreme temperatures can stop the chip from working (for realism)
if (Math.random() < 0.003) { // Chance to check for temperature or nearby particles
// Check temperature
if (pixel.temp > 120) {
// Replace the circuit core with lead if overheating
if (pixel.corePosition && Math.random() < (0.00015) * (pixel.temp - 120)) {
var corePos = pixel.corePosition;
if (pixelMap[corePos.x] && pixelMap[corePos.x][corePos.y]) {
deletePixel(corePos.x, corePos.y);
createPixel("lead", corePos.x, corePos.y);
}
}
// Randomly trigger malfunction if overheating
if (Math.random() < 0.001 * (pixel.temp - 120)) {
malfunction_chip(pixel);
}
// Break the circuit material itself if overheating
if (Math.random() < 0.001 * (pixel.temp - 120)) {
var px = pixel.x;
var py = pixel.y;
deletePixel(px, py);
if (Math.random() < 0.5) {createPixel("lead", px, py);}
}
}
}
}
};
elements.input_pin = {
color: "#DDAA33",
category: "logic",
state: "solid",
active: false,
stateHigh: "lead",
tempHigh: 570,
behavior: behaviors.WALL,
tick: function(pixel) {
pixel.active = false;
var neighbors = getNeighbors(pixel);
@ -1349,7 +1431,11 @@ elements.input_pin = {
elements.output_pin = {
color: "#AAAAAA",
category: "logic",
state: "solid",
active: false,
stateHigh: "lead",
tempHigh: 570,
behavior: behaviors.WALL,
tick: function(pixel) {
var neighbors = getNeighbors(pixel);
for (var i = 0;i < neighbors.length;i++) {
@ -1486,6 +1572,7 @@ var circuits = [
{ circuit: elements.medium_clock },
{ circuit: elements.fast_clock },
{ circuit: elements.very_fast_clock },
{ circuit: elements.very_fast_clock },
// Displays/visual circuits: white
{ circuit: elements.simple_seven_segment_display, color: cc_WHITE, size: [5, 9, false] },
{ circuit: elements.simple_double_seven_segment_display, color: cc_WHITE, size: [9, 9, false] },
@ -1497,6 +1584,32 @@ circuits.forEach(circuitInfo => {
circuitInfo.circuit.maxSize = 1;
circuitInfo.circuit.isCircuitCore = true;
circuitInfo.circuit.previewSize = circuitInfo.size;
// Exclude circuits without a frame
if (circuitInfo.size) {
var previousCircuitTick = circuitInfo.circuit.tick;
circuitInfo.circuit.tick = function(pixel) {
previousCircuitTick(pixel);
// Don't constantly check
if (Math.random() < 0.1) {
// If there aren't 4 neighboring circuit_material elements then remove the circuit's core
var neighbors = getNeighbors(pixel);
var circuitMaterialCount = 0;
for (var i = 0;i < neighbors.length;i++) {
if (neighbors[i].element == "circuit_material") {
circuitMaterialCount++;
}
}
if (circuitMaterialCount < 2) {
deletePixel(pixel.x, pixel.y);
}
pixel.temp += Math.random(0, 5);
}
}
}
});
var circuitRotation = 0;
@ -1508,41 +1621,41 @@ document.addEventListener('keydown', function(event) {
});
function drawCircuitExtras() {
if (elements[currentElement].isCircuitCore && elements[currentElement].previewSize) {
var circuitWidth = elements[currentElement].previewSize[0];
var circuitHeight = elements[currentElement].previewSize[1];
var centered = elements[currentElement].previewSize[2];
var rotation = circuitRotation;
if (elements[currentElement].isCircuitCore && elements[currentElement].previewSize) {
var circuitWidth = elements[currentElement].previewSize[0];
var circuitHeight = elements[currentElement].previewSize[1];
var centered = elements[currentElement].previewSize[2];
var rotation = circuitRotation;
var startX = 0;
var startY = 0;
var endX = circuitWidth - 1;
var endY = circuitHeight - 1;
var startX = 0;
var startY = 0;
var endX = circuitWidth - 1;
var endY = circuitHeight - 1;
if (centered) {
startX = -Math.floor(circuitWidth / 2);
startY = -Math.floor(circuitHeight / 2);
endX = Math.floor(circuitWidth / 2);
endY = Math.floor(circuitHeight / 2);
}
if (centered) {
startX = -Math.floor(circuitWidth / 2);
startY = -Math.floor(circuitHeight / 2);
endX = Math.floor(circuitWidth / 2);
endY = Math.floor(circuitHeight / 2);
}
for (var y = startY; y <= endY; y++) {
for (var x = startX; x <= endX; x++) {
// if (!(0 <= x && x < width && 0 <= y && y < height)) {continue;}
for (var y = startY; y <= endY; y++) {
for (var x = startX; x <= endX; x++) {
// if (!(0 <= x && x < width && 0 <= y && y < height)) {continue;}
var [rx, ry] = rotateCoordinate(x, y, rotation);
var px = mousePos.x + rx;
var py = mousePos.y + ry;
var [rx, ry] = rotateCoordinate(x, y, rotation);
var px = mousePos.x + rx;
var py = mousePos.y + ry;
ctx.fillStyle = "rgba(255, 255, 255, 0.1)";
ctx.fillStyle = "rgba(255, 255, 255, 0.1)";
if ((rotation != 0 && !centered) || (0 <= px && px < width && 0 <= py && py < height) && pixelMap[px][py]) {
ctx.fillStyle = "rgba(255, 0, 0, 0.3)";
}
ctx.fillRect(px * pixelSize, py * pixelSize, pixelSize, pixelSize);
}
}
}
ctx.fillRect(px * pixelSize, py * pixelSize, pixelSize, pixelSize);
}
}
}
}
runAfterLoad(() => {
@ -1550,6 +1663,7 @@ runAfterLoad(() => {
drawPixels = function(forceTick=false) {
originalDrawPixels3(forceTick);
drawCircuitExtras();
return true;
};
});
resetInterval(tps);

View File

@ -1,3 +1,5 @@
/* code by nekonico aka doobienecoarc */
elements.fossil = {
color: ["#bbb3ae","#b4b4b4","#c0c0c0"],
behavior: [
@ -6,12 +8,12 @@ elements.fossil = {
"M2%75|M1|M2%75",
],
reactions: {
"water": {elem1: "wet_sand", chance: 0.00035},
"salt_water": {elem1: "wet_sand", chance: 0.0005},
"sugar_water": {elem1: "wet_sand", chance: 0.0004},
"seltzer": {elem1: "wet_sand", chance: 0.0004},
"dirty_water": {elem1: "wet_sand", chance: 0.0004},
"soda": {elem1: "wet_sand", chance: 0.0004},
"water": {elem1: ["wet_sand","fossil_sand"], chance: 0.00035},
"salt_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0005},
"sugar_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"seltzer": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"dirty_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"soda": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"bone": {elem2: "fossil", chance: 0.000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.00002},
@ -20,7 +22,7 @@ elements.fossil = {
"tree_branch": {elem2: "petrified_wood", chance: 0.000015},
"grape": {elem2: "juice", chance: 0.1, color2: "#291824"},
"wheat": {elem2: "flour"},
"primordial_soup": {elem1: "wet_sand", chance: 0.001}
"primordial_soup": {elem1: ["wet_sand","fossil_sand"], chance: 0.001}
},
tempHigh: 950,
stateHigh: "magma",
@ -31,10 +33,9 @@ elements.fossil = {
breakInto: ["rock","gravel","gravel","gravel","sand"],
};
elements.marrow_fossil = {
color: ["#cbb2b3","#c1a8a8","#d0b0b0"],
hidden:true,
behavior: behaviors.SUPPORTPOWDER,
elements.fossil_sand = {
color: ["#bbb3ae","#b4b4b4","#c0c0c0"],
behavior: behaviors.POWDER,
reactions: {
"water": {elem1: "wet_sand", chance: 0.00035},
"salt_water": {elem1: "wet_sand", chance: 0.0005},
@ -42,6 +43,32 @@ elements.marrow_fossil = {
"seltzer": {elem1: "wet_sand", chance: 0.0004},
"dirty_water": {elem1: "wet_sand", chance: 0.0004},
"soda": {elem1: "wet_sand", chance: 0.0004},
"bone": {elem2: "fossil", chance: 0.0000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.000002},
"skull": {elem2: ["human_fossil","human_fossil","fossil"], chance: 0.0000025},
"wood": {elem2: "petrified_wood", chance: 0.0000015},
"tree_branch": {elem2: "petrified_wood", chance: 0.0000015},
"primordial_soup": {elem1: "wet_sand", chance: 0.001}
},
tempHigh: 1700,
stateHigh: "molten_glass",
category: "land",
state: "solid",
density: 2000,
breakInto: ["gravel","gravel","sand"],
};
elements.marrow_fossil = {
color: ["#cbb2b3","#c1a8a8","#d0b0b0"],
hidden:true,
behavior: behaviors.SUPPORTPOWDER,
reactions: {
"water": {elem1: ["wet_sand","fossil_sand"], chance: 0.00035},
"salt_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0005},
"sugar_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"seltzer": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"dirty_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"soda": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"bone": {elem2: "fossil", chance: 0.000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.00002},
@ -70,12 +97,12 @@ elements.human_fossil = {
"M2%50|M1|M2%50",
],
reactions: {
"water": {elem1: "wet_sand", chance: 0.00035},
"salt_water": {elem1: "wet_sand", chance: 0.0005},
"sugar_water": {elem1: "wet_sand", chance: 0.0004},
"seltzer": {elem1: "wet_sand", chance: 0.0004},
"dirty_water": {elem1: "wet_sand", chance: 0.0004},
"soda": {elem1: "wet_sand", chance: 0.0004},
"water": {elem1: ["wet_sand","fossil_sand"], chance: 0.00035},
"salt_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0005},
"sugar_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"seltzer": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"dirty_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"soda": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"bone": {elem2: "fossil", chance: 0.000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.00002},
@ -103,12 +130,12 @@ elements.dino_fossil = {
"M2%75|M1|M2%75",
],
reactions: {
"water": {elem1: "wet_sand", chance: 0.00035},
"salt_water": {elem1: "wet_sand", chance: 0.0005},
"sugar_water": {elem1: "wet_sand", chance: 0.0004},
"seltzer": {elem1: "wet_sand", chance: 0.0004},
"dirty_water": {elem1: "wet_sand", chance: 0.0004},
"soda": {elem1: "wet_sand", chance: 0.0004},
"water": {elem1: ["wet_sand","fossil_sand"], chance: 0.00035},
"salt_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0005},
"sugar_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"seltzer": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"dirty_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"soda": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"bone": {elem2: "fossil", chance: 0.000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.00002},
@ -133,12 +160,12 @@ elements.petrified_wood = {
hidden:true,
behavior: behaviors.STURDYPOWDER,
reactions: {
"water": {elem1: "wet_sand", chance: 0.00035},
"salt_water": {elem1: "wet_sand", chance: 0.0005},
"sugar_water": {elem1: "wet_sand", chance: 0.0004},
"seltzer": {elem1: "wet_sand", chance: 0.0004},
"dirty_water": {elem1: "wet_sand", chance: 0.0004},
"soda": {elem1: "wet_sand", chance: 0.0004},
"water": {elem1: ["wet_sand","fossil_sand"], chance: 0.00035},
"salt_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0005},
"sugar_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"seltzer": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"dirty_water": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"soda": {elem1: ["wet_sand","fossil_sand"], chance: 0.0004},
"lichen": {elem1: "dirt", chance: 0.0025},
"bone": {elem2: "fossil", chance: 0.000025},
"bone_marrow": {elem2: "marrow_fossil", chance: 0.00002},
@ -189,10 +216,47 @@ elements.skull = {
state: "solid",
density: 1000,
hardness: 0.5,
breakInto: ["quicklime","bone","human_bones","bone_marrow"]
},
elements.human_bones = {
name: "bone",
color: "#d9d9d9",
hidden:true,
behavior: behaviors.SUPPORT,
reactions: {
"water": { elem2:"broth", tempMin:70, color2:"#d7db69" },
"salt_water": { elem2:"broth", tempMin:70, color2:"#d7db69" },
"sugar_water": { elem2:"broth", tempMin:70, color2:"#d7db69" },
"seltzer": { elem2:"broth", tempMin:70, color2:"#d7db69" },
"rock": { "elem1": "human_fossil", chance:0.00005 },
"sand": { "elem1": "human_fossil", chance:0.000035 },
"dirt": { "elem1": "human_fossil", chance:0.00003 },
"tuff": { "elem1": "human_fossil", chance:0.00005 },
"basalt": { "elem1": "human_fossil", chance:0.00004 },
"mudstone": { "elem1": "human_fossil", chance:0.00004 },
"packed_sand": { "elem1": "human_fossil", chance:0.00004 },
"gravel": { "elem1": "human_fossil", chance:0.000035 },
"clay": { "elem1": "human_fossil", chance:0.00003 },
"clay_soil": { "elem1": "human_fossil", chance:0.00003 },
"permafrost": { "elem1": "human_fossil", chance:0.000035 },
"mulch": { "elem1": "human_fossil", chance:0.00003 },
"ant_wall": { "elem1": "human_fossil", chance:0.00002 },
"limestone": { "elem1": "human_fossil", chance:0.00005 },
"quicklime": { "elem1": "human_fossil", chance:0.000045 },
"slaked_lime": { "elem1": "human_fossil", chance:0.000035 },
},
category:"life",
tempHigh: 760,
stateHigh: "quicklime",
state: "solid",
density: 1000,
hardness: 0.5,
breakInto: ["quicklime","bone","bone","bone_marrow"]
},
elements.dino_bones = {
name: "bone",
color: "#d9d9d9",
hidden:true,
behavior: behaviors.SUPPORT,
@ -242,17 +306,19 @@ elements.coal = {
},
burn: 28,
burnTime: 1000,
burnInto: ["fire","fire","fire","fire","ash","carbon_dioxide"],
burnInto: ["fire","fire","fire","fire","dust","carbon_dioxide"],
tempHigh: 6000,
stateHigh: "fire",
category: "powders",
state: "solid",
density: 250,
breakInto: ["ash","ash","carbon_dioxide"],
breakInto: ["dust","ash","carbon_dioxide"],
hardness: 0.5,
},
elements.bug_amber = {
hidden:true,
name: "amber",
color: ["#ffc000","#b67f18","#c86305","#cf7a19","#e4ae3a"],
temp: 20,
tempHigh: 345,
@ -262,6 +328,8 @@ elements.bug_amber = {
},
elements.hive_amber = {
hidden:true,
name: "amber",
color: "#ffc000",
temp: 20,
tempHigh: 345,
@ -271,6 +339,7 @@ elements.hive_amber = {
},
elements.dinosaur = {
hidden:true,
color: ["#7F2B0A","#808080","#006400"],
behavior: [
"XX|M2%5|XX",
@ -308,31 +377,130 @@ elements.dinosaur = {
"glass": { elem2: "glass_shard", chance: 0.05 },
"concrete": { elem2: "dust", chance: 0.03 },
}
},
elements.trilobite = {
hidden:true,
color: "#808080",
behavior: [
"XX|M2%5|SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water,primordial_soup%05",
"XX|FX%0.5|M2%50 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water,primordial_soup%10 AND BO",
"M2%50|M1|M2%50 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water,primordial_soup%10",
],
reactions: {
"algae": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"kelp": { elem2:"water", chance:0.25 },
"plant": { elem2:null, chance:0.125, func:behaviors.FEEDPIXEL },
"fly": { elem2:null, chance:0.4, func:behaviors.FEEDPIXEL },
"firefly": { elem2:null, chance:0.6, func:behaviors.FEEDPIXEL },
"worm": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"tadpole": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL },
"oxygen": { elem2:"carbon_dioxide", chance:0.5 },
"broth": { elem2:"water", chance:0.2, func:behaviors.FEEDPIXEL },
"slug": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"herb": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"lettuce": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"dead_plant": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"lichen": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"yeast": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"yogurt": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"tea": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL },
"yolk": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"cell": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL },
"crumb": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL },
"alcohol": { elem1:"dead_bug", chance:0.001 },
"water": { elem2:"bubble", attr2:{"clone":"water"}, chance:0.002, oneway:true },
"salt_water": { elem2:"bubble", attr2:{"clone":"salt_water"}, chance:0.002, oneway:true },
"pool_water": { elem1:"dead_bug", chance:0.001 },
"chlorine": { elem1:"dead_bug", chance:0.1 },
"vinegar": { elem1:"dead_bug", chance:0.001 },
},
foodNeed: 10,
temp: 20,
tempHigh: 150,
stateHigh: "meat",
tempLow: -20,
stateLow: ["dead_bug","frozen_meat"],
category:"life",
breakInto: ["dead_bug","blood"],
burn:25,
burnTime:250,
state: "solid",
density: 1080,
conduct: 0.2,
eggColor: ["#211316","#2C1A1D","#503734"]
},
elements.extracted_dna = {
hidden:true,
name: "artificial_egg",
color: ["#211316","#2C1A1D","#503734","#e0d3ab","#d1c6be","#b5c0ad","#b9b8bc"],
behavior: behaviors.POWDER,
tick: function(pixel) {
if (Math.random() < 0.00025 || (pixel.dna && pixel.temp > 40 && pixel.temp < 150)) {
if (pixel.dna) {
changePixel(pixel,pixel.dna);
}
else changePixel(pixel,"cell")
}
},
innerColor: "#ffffff",
tempHigh: 1200,
stateHigh: ["steam","dna","calcium","carbon_dioxide","sulfur_gas"],
breakInto: ["yolk","yolk","dna","cell"],
category:"life",
conduct: 1,
};
elements.head.breakInto = ["blood","meat","skull"]
elements.extractor = {
name: "dna-extractor",
color: ["#d1c6be","#b5c0ad","#b9b8bc"],
behavior: behaviors.STURDYPOWDER,
reactions: {
"hive_amber": { elem2:"extracted_dna", chance:0.2 },
"bug_amber": { elem2:"extracted_dna", chance:0.2 },
"dino_bones": { elem2:"extracted_dna", attr1:{"dna":"dinosaur"}, chance:0.2 },
"skull": { elem2:"extracted_dna", attr1:{"dna":"human"}, chance:0.2 },
"dino_fossil": { elem2:"extracted_dna", attr1:{"dna":"dinosaur"}, chance:0.02 },
"human_fossil": { elem2:"extracted_dna", attr1:{"dna":"human"}, chance:0.02 },
},
category:"machines",
conduct: 1,
hardness: 1,
};
elements.head.burnInto = ["ash","cooked_meat","skull"]
elements.head.breakInto = ["blood","meat","human_bones","skull"]
elements.head.stateHigh = ["cooked_meat","cooked_meat","skull"]
elements.head.burnInto = ["ash","cooked_meat","human_bones","skull","skull"]
elements.head.stateLow = ["frozen_meat","frozen_meat","skull"]
elements.head.stateHigh = ["cooked_meat","human_bones","skull","skull"]
elements.head.stateLow = ["frozen_meat","human_bones","skull","skull","skull"]
elements.body.breakInto = ["blood","meat","human_bones","bone"]
elements.body.burnInto = ["ash","cooked_meat","human_bones"]
elements.body.stateHigh = ["cooked_meat","human_bones"]
elements.body.stateLow = ["frozen_meat","human_bones","human_bones"]
elements.dead_bug.breakInto = ["calcium","calcium","calcium","quicklime"]
if (!elements.sap.reactions) { elements.sap.reactions = {} }
elements.sap.reactions.dead_bug = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.hive = { elem1:null, elem2:"hive_amber", chance:0.01 };
elements.sap.reactions.ant = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.fly = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.flea = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.termite = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.worm = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.bee = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.firefly = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.stinkbug = { elem1:"bug_amber", elem2:null, chance:0.1 };
elements.sap.reactions.slug = { elem1:"bug_amber", elem2:null, chance:0.08 };
elements.sap.reactions.snail = { elem1:"bug_amber", elem2:null, chance:0.05 };
elements.sap.reactions.hive = { elem1:null, elem2:"hive_amber", attr2:{"dna":"bee"}, chance:0.01 };
elements.sap.reactions.ant = { elem1:"bug_amber", attr1:{"dna":"ant"}, elem2:null, chance:0.1 };
elements.sap.reactions.fly = { elem1:"bug_amber", attr1:{"dna":"fly"}, elem2:null, chance:0.1 };
elements.sap.reactions.flea = { elem1:"bug_amber", attr1:{"dna":"flea"}, elem2:null, chance:0.1 };
elements.sap.reactions.termite = { elem1:"bug_amber", attr1:{"dna":"termite"}, elem2:null, chance:0.1 };
elements.sap.reactions.worm = { elem1:"bug_amber", attr1:{"dna":"worm"}, elem2:null, chance:0.1 };
elements.sap.reactions.bee = { elem1:"bug_amber", attr1:{"dna":"bee"}, elem2:null, chance:0.1 };
elements.sap.reactions.firefly = { elem1:"bug_amber", attr1:{"dna":"firefly"}, elem2:null, chance:0.1 };
elements.sap.reactions.stinkbug = { elem1:"bug_amber", attr1:{"dna":"stinkbug"}, elem2:null, chance:0.1 };
elements.sap.reactions.slug = { elem1:"bug_amber", attr1:{"dna":"slug"}, elem2:null, chance:0.08 };
elements.sap.reactions.snail = { elem1:"bug_amber", attr1:{"dna":"snail"}, elem2:null, chance:0.05 };
elements.sap.reactions.trilobite = { elem1:"bug_amber", attr1:{"dna":"trilobite"}, elem2:null, chance:0.1 };
if (!elements.bone.reactions) { elements.bone.reactions = {} }

View File

@ -1116,16 +1116,16 @@ elements.shy_body = {
}
if (pixel.dir == 1) {
if (!isEmpty(pixel.x+2, pixel.y-1, true) && pixelMap[pixel.x+2][pixel.y-1].element == "head") {
pixel.panic += 0.1;
pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x+3, pixel.y-1, true) && pixelMap[pixel.x+2][pixel.y-1].element == "head") {
pixel.panic += 0.1;
pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x+4, pixel.y-1, true) && pixelMap[pixel.x+4][pixel.y-1].element == "head") {
pixel.panic += 0.1;
pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x+5, pixel.y-1, true) && pixelMap[pixel.x+5][pixel.y-1].element == "head") {
pixel.panic += 0.1;
pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x+5, pixel.y-1, true) && pixelMap[pixel.x+5][pixel.y-1].element == "head") {
pixel.panic += 0.1;
@ -1139,19 +1139,31 @@ elements.shy_body = {
else if (!isEmpty(pixel.x+8, pixel.y-1, true) && pixelMap[pixel.x+8][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x+9, pixel.y-1, true) && pixelMap[pixel.x+9][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x+10, pixel.y-1, true) && pixelMap[pixel.x+10][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x+11, pixel.y-1, true) && pixelMap[pixel.x+11][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x+12, pixel.y-1, true) && pixelMap[pixel.x+12][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
}
else if (pixel.dir == -1) {
if (!isEmpty(pixel.x-2, pixel.y-1, true) && pixelMap[pixel.x-2][pixel.y-1].element == "head") {
pixel.panic += 0.1;
pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x-3, pixel.y-1, true) && pixelMap[pixel.x-3][pixel.y-1].element == "head") {
pixel.panic += 0.1;
pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x-4, pixel.y-1, true) && pixelMap[pixel.x-4][pixel.y-1].element == "head") {
pixel.panic += 0.1;
pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x-5, pixel.y-1, true) && pixelMap[pixel.x-5][pixel.y-1].element == "head") {
pixel.panic += 0.1;
pixel.panic += 0.2;
}
else if (!isEmpty(pixel.x-5, pixel.y-1, true) && pixelMap[pixel.x-5][pixel.y-1].element == "head") {
pixel.panic += 0.1;
@ -1165,6 +1177,18 @@ elements.shy_body = {
else if (!isEmpty(pixel.x-8, pixel.y-1, true) && pixelMap[pixel.x-8][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x-9, pixel.y-1, true) && pixelMap[pixel.x-9][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x-10, pixel.y-1, true) && pixelMap[pixel.x-10][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x-11, pixel.y-1, true) && pixelMap[pixel.x-11][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
else if (!isEmpty(pixel.x-12, pixel.y-1, true) && pixelMap[pixel.x-12][pixel.y-1].element == "head") {
pixel.panic += 0.1;
}
}
},
density: 1080,

View File

@ -0,0 +1,29 @@
//texture_pack_by_jayd
document.body.style.backgroundImage = 'url("https://jayd-rubies.github.io/1236951076024877107.png")';
gameDiv.style.border = "0px solid #ffffff";
function drawCursor() {
canvas.style.backgroundColor = "#00000000";
var layerCtx = canvasLayers.gui.getContext('2d');
var mouseOffset = Math.trunc(mouseSize/2);
var topLeft = [mousePos.x-mouseOffset,mousePos.y-mouseOffset];
var bottomRight = [mousePos.x+mouseOffset,mousePos.y+mouseOffset];
// Draw a square around the mouse
layerCtx.strokeStyle = "#FFFFFF80";
layerCtx.strokeRect(topLeft[0]*pixelSize,topLeft[1]*pixelSize,(bottomRight[0]-topLeft[0]+1)*pixelSize,(bottomRight[1]-topLeft[1]+1)*pixelSize);
// draw one transparent pixel in the center
if (settings.precision) {
layerCtx.fillStyle = "#ffffffc8";
layerCtx.fillRect(mousePos.x*pixelSize,mousePos.y*pixelSize,pixelSize,pixelSize);
}
if (shaping) {
if (shaping === 1) { // Draw a white line from shapeStart.x to shapeStart.y
layerCtx.beginPath();
layerCtx.strokeStyle = "#FFFFFF80";
layerCtx.lineWidth = 2;
layerCtx.moveTo(shapeStart.x*pixelSize+pixelSizeHalf, shapeStart.y*pixelSize+pixelSizeHalf);
layerCtx.lineTo(mousePos.x*pixelSize+pixelSizeHalf, mousePos.y*pixelSize+pixelSizeHalf);
layerCtx.stroke();
layerCtx.lineWidth = 1;
}
}
}