1.1.2
This commit is contained in:
parent
b27529ef5e
commit
812a469d50
|
|
@ -2,6 +2,14 @@
|
||||||
+ Artists' Update (Painting, Lines, Shapes, etc.)
|
+ Artists' Update (Painting, Lines, Shapes, etc.)
|
||||||
+ Machines Update
|
+ Machines Update
|
||||||
|
|
||||||
|
[Version 1.1.2]
|
||||||
|
+ Technical: New functions to use in coded elements
|
||||||
|
doBurning(pixel); // Using this function will allow burning simulation
|
||||||
|
doHeat(pixel); // Using this function will allow heat simulation
|
||||||
|
doElectricity(pixel); // Using this function will allow electricity simulation
|
||||||
|
+ Technical: New hidden example elements: tick_sand, tick_wood, tick_wall, tick_props
|
||||||
|
+ Technical: New "properties" element attribute. See the tick_props element
|
||||||
|
|
||||||
[Version 1.1.1]
|
[Version 1.1.1]
|
||||||
+ Technical: "tick" element attribute, takes a function
|
+ Technical: "tick" element attribute, takes a function
|
||||||
tick: function(pixel) {
|
tick: function(pixel) {
|
||||||
|
|
|
||||||
100
index.html
100
index.html
|
|
@ -571,6 +571,56 @@
|
||||||
state: "solid",
|
state: "solid",
|
||||||
density: 1602,
|
density: 1602,
|
||||||
},
|
},
|
||||||
|
"tick_sand": {
|
||||||
|
color: "#e6d577",
|
||||||
|
tick: function(pixel) {
|
||||||
|
tryMove(pixel, pixel.x, pixel.y+1);
|
||||||
|
doHeat(pixel);
|
||||||
|
},
|
||||||
|
tempHigh: 1700,
|
||||||
|
stateHigh: "molten_glass",
|
||||||
|
category: "land",
|
||||||
|
state: "solid",
|
||||||
|
density: 1602,
|
||||||
|
hidden: true,
|
||||||
|
},
|
||||||
|
"tick_wood": {
|
||||||
|
color: "#a0522d",
|
||||||
|
tick: function(pixel) {
|
||||||
|
doBurning(pixel);
|
||||||
|
doHeat(pixel);
|
||||||
|
},
|
||||||
|
tempHigh: 400,
|
||||||
|
stateHigh: "fire",
|
||||||
|
category: "solids",
|
||||||
|
burn: 5,
|
||||||
|
burnTime: 300,
|
||||||
|
burnInto: ["ash","charcoal","fire"],
|
||||||
|
state: "solid",
|
||||||
|
hardness: 0.15,
|
||||||
|
breakInto: "sawdust",
|
||||||
|
hidden: true,
|
||||||
|
},
|
||||||
|
"tick_wall": {
|
||||||
|
color: "#808080",
|
||||||
|
hidden: true,
|
||||||
|
},
|
||||||
|
"tick_props": {
|
||||||
|
color: "#ffffff",
|
||||||
|
tick: function(pixel) {
|
||||||
|
if (tryMove(pixel, pixel.x, pixel.y+1)) {
|
||||||
|
pixel.moves += 1;
|
||||||
|
}
|
||||||
|
pixel.age += 1;
|
||||||
|
if (pixel.moves > 20) { // This pixel will delete itself if it moves 20 times
|
||||||
|
deletePixel(pixel.x, pixel.y);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
properties: { // Default properties to set when the pixel is created:
|
||||||
|
"moves": 0,
|
||||||
|
"age": 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
"water": {
|
"water": {
|
||||||
color: "#2167ff",
|
color: "#2167ff",
|
||||||
behavior: behaviors.LIQUID,
|
behavior: behaviors.LIQUID,
|
||||||
|
|
@ -4171,6 +4221,12 @@
|
||||||
else if (elementInfo.rotatable) {
|
else if (elementInfo.rotatable) {
|
||||||
this.r = Math.floor(Math.random() * 4);
|
this.r = Math.floor(Math.random() * 4);
|
||||||
}
|
}
|
||||||
|
// If elementInfo.properties, set each key to its value
|
||||||
|
if (elementInfo.properties !== undefined) {
|
||||||
|
for (var key in elementInfo.properties) {
|
||||||
|
this[key] = elementInfo.properties[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
pixelMap[x][y] = this;
|
pixelMap[x][y] = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4928,7 +4984,30 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Change tempearture if needed (unused)
|
||||||
|
/*if (info.tempChange != undefined) {
|
||||||
|
pixel.temp += info.tempChange;
|
||||||
|
pixelTempCheck(pixel);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// Burning
|
||||||
|
doBurning(pixel);
|
||||||
|
|
||||||
|
// Heat Transfer
|
||||||
|
if (info.insulate != true) {
|
||||||
|
doHeat(pixel);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Electricity Transfer
|
||||||
|
doElectricity(pixel);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function doBurning(pixel) {
|
||||||
if (pixel.burning) { // Burning
|
if (pixel.burning) { // Burning
|
||||||
|
var info = elements[pixel.element];
|
||||||
pixel.temp += 1;
|
pixel.temp += 1;
|
||||||
pixelTempCheck(pixel);
|
pixelTempCheck(pixel);
|
||||||
var burnSpots = [
|
var burnSpots = [
|
||||||
|
|
@ -4989,15 +5068,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Change tempearture if needed (unused)
|
function doHeat(pixel) {
|
||||||
/*if (info.tempChange != undefined) {
|
|
||||||
pixel.temp += info.tempChange;
|
|
||||||
pixelTempCheck(pixel);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// Heat Transfer
|
|
||||||
if (info.insulate != true) {
|
|
||||||
// Check right and bottom adjacent pixels
|
// Check right and bottom adjacent pixels
|
||||||
var coordsToCheck = [
|
var coordsToCheck = [
|
||||||
{x:pixel.x+1,y:pixel.y},
|
{x:pixel.x+1,y:pixel.y},
|
||||||
|
|
@ -5021,7 +5094,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Electricity Transfer
|
function doElectricity(pixel) {
|
||||||
if (pixel.charge) {
|
if (pixel.charge) {
|
||||||
// Check each adjacent pixel, if that pixel's charge is false, set it to the same charge
|
// Check each adjacent pixel, if that pixel's charge is false, set it to the same charge
|
||||||
var coordsToCheck = [
|
var coordsToCheck = [
|
||||||
|
|
@ -5066,9 +5139,8 @@
|
||||||
delete pixel.chargeCD;
|
delete pixel.chargeCD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function pixelColorPick(pixel,customColor=null) {
|
function pixelColorPick(pixel,customColor=null) {
|
||||||
var element = pixel.element;
|
var element = pixel.element;
|
||||||
var elementInfo = elements[element];
|
var elementInfo = elements[element];
|
||||||
|
|
@ -6152,14 +6224,15 @@ for (var k = 0; k < b0.split(" AND ").length; k++) {
|
||||||
// Loop through each element, final checks
|
// Loop through each element, final checks
|
||||||
for (key in elements) {
|
for (key in elements) {
|
||||||
// If the element has no behavior, set it to behaviors.WALL
|
// If the element has no behavior, set it to behaviors.WALL
|
||||||
if (!elements[key].behavior) {
|
if (!elements[key].behavior && !elements[key].tick) {
|
||||||
elements[key].behavior = behaviors.WALL;
|
elements[key].tick = function(pixel) {};
|
||||||
}
|
}
|
||||||
// If the element has no color, set it to white
|
// If the element has no color, set it to white
|
||||||
if (elements[key].color === undefined) {
|
if (elements[key].color === undefined) {
|
||||||
elements[key].color = "rgb(255,255,255)";
|
elements[key].color = "rgb(255,255,255)";
|
||||||
elements[key].colorObject = {r:255,g:255,b:255};
|
elements[key].colorObject = {r:255,g:255,b:255};
|
||||||
}
|
}
|
||||||
|
if (elements[key].behavior) {
|
||||||
// If the element's behavior[1][1] includes "FX", set it's flippableX to true
|
// If the element's behavior[1][1] includes "FX", set it's flippableX to true
|
||||||
if (elements[key].behavior[1][1].includes("FX")) {
|
if (elements[key].behavior[1][1].includes("FX")) {
|
||||||
elements[key].flippableX = true;
|
elements[key].flippableX = true;
|
||||||
|
|
@ -6195,6 +6268,7 @@ for (var k = 0; k < b0.split(" AND ").length; k++) {
|
||||||
if (elements[key].behavior[1][1].includes("RT")) {
|
if (elements[key].behavior[1][1].includes("RT")) {
|
||||||
elements[key].rotatable = true;
|
elements[key].rotatable = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If the element has reactions, loop through each one (it is an object), if the value for elem1 or elem2 is not an element and is not null, remove that key
|
// If the element has reactions, loop through each one (it is an object), if the value for elem1 or elem2 is not an element and is not null, remove that key
|
||||||
if (elements[key].reactions) {
|
if (elements[key].reactions) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue