Merge branch 'main' of https://github.com/R74nCom/sandboxels
This commit is contained in:
commit
336ebe6e17
|
|
@ -1,16 +1,24 @@
|
||||||
(() => {
|
(() => {
|
||||||
function runKeybind() {
|
function runKeybind() {
|
||||||
promptInput("Input the keybind you want to run. (e.g. KeyA, Digit1, Backspace)", (keybind) => {
|
promptInput("Input the keybind you want to run. (e.g. KeyA, Digit1, Backspace)", (keybind) => {
|
||||||
|
if (/^[A-Za-z]$/.test(keybind)) keybind = "Key" + keybind.toUpperCase()
|
||||||
|
if (/^[0-9]$/.test(keybind)) {
|
||||||
|
setView(Number(keybind))
|
||||||
|
}
|
||||||
if (keybinds[keybind]) {
|
if (keybinds[keybind]) {
|
||||||
keybinds[keybind]();
|
keybinds[keybind]();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMobile) {
|
function loadButton() {
|
||||||
const keybindButton = document.createElement("button")
|
const keybindButton = document.createElement("button")
|
||||||
|
if (!keybindButton) {
|
||||||
|
setTimeout(loadButton, 100)
|
||||||
|
return
|
||||||
|
}
|
||||||
keybindButton.id = "keybindButton"
|
keybindButton.id = "keybindButton"
|
||||||
keybindButton.title = "Change static mode"
|
keybindButton.title = "Input a keybind"
|
||||||
keybindButton.classList.add("controlButton")
|
keybindButton.classList.add("controlButton")
|
||||||
keybindButton.onclick = () => {
|
keybindButton.onclick = () => {
|
||||||
runKeybind()
|
runKeybind()
|
||||||
|
|
@ -18,4 +26,8 @@
|
||||||
keybindButton.textContent = "Keybind"
|
keybindButton.textContent = "Keybind"
|
||||||
document.getElementById("pauseButton").before(keybindButton)
|
document.getElementById("pauseButton").before(keybindButton)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isMobile) {
|
||||||
|
loadButton()
|
||||||
|
}
|
||||||
})()
|
})()
|
||||||
|
|
@ -0,0 +1,308 @@
|
||||||
|
// made by me haha
|
||||||
|
// didn't expect that, didn't you?
|
||||||
|
console.log('oh no')
|
||||||
|
|
||||||
|
// My Testing Stuff
|
||||||
|
elements.solid_element = {
|
||||||
|
color: "#287cb8",
|
||||||
|
behaviors: behaviors.WALL,
|
||||||
|
category: "My Stuff",
|
||||||
|
state: "solid",
|
||||||
|
stateHigh: "ash",
|
||||||
|
tempHigh: "2345",
|
||||||
|
tempLow: "-234",
|
||||||
|
stateLow: "ice",
|
||||||
|
desc: "Test solid"
|
||||||
|
}
|
||||||
|
elements.liquid_element = {
|
||||||
|
color: "#00eeff",
|
||||||
|
behavior: behaviors.LIQUID,
|
||||||
|
category: "My Stuff",
|
||||||
|
state: "liquid",
|
||||||
|
stateHigh: "steam",
|
||||||
|
tempHigh: "2345",
|
||||||
|
tempLow: "-234",
|
||||||
|
stateLow: "ice",
|
||||||
|
desc: "Test liquid"
|
||||||
|
}
|
||||||
|
|
||||||
|
// i based this off of cell machine
|
||||||
|
// movers
|
||||||
|
elements.mover = {
|
||||||
|
color: "#2f00ff",
|
||||||
|
behavior: [
|
||||||
|
"XX|XX|XX",
|
||||||
|
"XX|XX|M1",
|
||||||
|
"XX|XX|XX",
|
||||||
|
],
|
||||||
|
category: "Movers",
|
||||||
|
state: "solid",
|
||||||
|
stateHigh: "molten_metal",
|
||||||
|
tempHigh: "2500",
|
||||||
|
tempLow: "-2345",
|
||||||
|
stateLow: "ice",
|
||||||
|
desc: "Right mover"
|
||||||
|
}
|
||||||
|
|
||||||
|
elements.reverse_mover = {
|
||||||
|
color: "#2f00ff",
|
||||||
|
behavior: [
|
||||||
|
"XX|XX|XX",
|
||||||
|
"M1|XX|XX",
|
||||||
|
"XX|XX|XX",
|
||||||
|
],
|
||||||
|
category: "Movers",
|
||||||
|
state: "solid",
|
||||||
|
stateHigh: "molten_metal",
|
||||||
|
tempHigh: "2500",
|
||||||
|
tempLow: "-2345",
|
||||||
|
stateLow: "ice",
|
||||||
|
desc: "Left mover"
|
||||||
|
}
|
||||||
|
|
||||||
|
elements.up_mover = {
|
||||||
|
color: "#2f00ff",
|
||||||
|
behavior: [
|
||||||
|
"XX|M1|XX",
|
||||||
|
"XX|XX|XX",
|
||||||
|
"XX|XX|XX",
|
||||||
|
],
|
||||||
|
category: "Movers",
|
||||||
|
state: "solid",
|
||||||
|
stateHigh: "molten_metal",
|
||||||
|
tempHigh: "2500",
|
||||||
|
tempLow: "-2345",
|
||||||
|
stateLow: "ice",
|
||||||
|
}
|
||||||
|
|
||||||
|
elements.down_mover = {
|
||||||
|
color: "#2f00ff",
|
||||||
|
behavior: [
|
||||||
|
"XX|XX|XX",
|
||||||
|
"XX|XX|XX",
|
||||||
|
"XX|M1|XX",
|
||||||
|
],
|
||||||
|
category: "Movers",
|
||||||
|
state: "solid",
|
||||||
|
stateHigh: "molten_metal",
|
||||||
|
tempHigh: "2500",
|
||||||
|
tempLow: "-2345",
|
||||||
|
stateLow: "ice",
|
||||||
|
}
|
||||||
|
|
||||||
|
// converter
|
||||||
|
elements.sand_converter = {
|
||||||
|
color: "#000397",
|
||||||
|
behavior: [
|
||||||
|
"XX|XX|CH:sand",
|
||||||
|
"XX|XX|M1",
|
||||||
|
"XX|XX|CH:sand",
|
||||||
|
],
|
||||||
|
category: "Movers",
|
||||||
|
state: "solid",
|
||||||
|
stateHigh: "molten_metal",
|
||||||
|
tempHigh: "2500",
|
||||||
|
tempLow: "-2345",
|
||||||
|
stateLow: "ice",
|
||||||
|
}
|
||||||
|
// trashes
|
||||||
|
elements.trash = {
|
||||||
|
color: "#ff00ff",
|
||||||
|
behavior: [
|
||||||
|
"XX|DL|XX",
|
||||||
|
"DL|XX|DL",
|
||||||
|
"XX|DL|XX",
|
||||||
|
],
|
||||||
|
category: "Trashes",
|
||||||
|
state: "solid",
|
||||||
|
stateHigh: "molten_metal",
|
||||||
|
tempHigh: "2500",
|
||||||
|
tempLow: "-2345",
|
||||||
|
stateLow: "ice",
|
||||||
|
}
|
||||||
|
|
||||||
|
// does enemies count as trashes?
|
||||||
|
// eh , why not
|
||||||
|
elements.enemy = {
|
||||||
|
color: "#ff0000",
|
||||||
|
behavior: [
|
||||||
|
"XX|DB|XX",
|
||||||
|
"DB|XX|DB",
|
||||||
|
"XX|DB|XX",
|
||||||
|
],
|
||||||
|
category: "Trashes",
|
||||||
|
state: "solid",
|
||||||
|
stateHigh: "molten_metal",
|
||||||
|
stateHigh: "molten_metal",
|
||||||
|
tempHigh: "2500",
|
||||||
|
tempLow: "-2345",
|
||||||
|
stateLow: "ice",
|
||||||
|
}
|
||||||
|
|
||||||
|
// generators
|
||||||
|
elements.directional_generator = {
|
||||||
|
color: "#00ff00",
|
||||||
|
behavior: [
|
||||||
|
"XX|CF|XX",
|
||||||
|
"CF|XX|CF",
|
||||||
|
"XX|CF|XX",
|
||||||
|
],
|
||||||
|
category: "Generators",
|
||||||
|
state: "solid",
|
||||||
|
stateHigh: "molten_metal",
|
||||||
|
stateHigh: "molten_metal",
|
||||||
|
tempHigh: "2500",
|
||||||
|
tempLow: "-2345",
|
||||||
|
stateLow: "ice",
|
||||||
|
}
|
||||||
|
|
||||||
|
// nuke cell
|
||||||
|
elements.nuke_cell = {
|
||||||
|
color: "#ffff00",
|
||||||
|
behavior: [
|
||||||
|
"DL|CL|DL",
|
||||||
|
"CL|XX|CL",
|
||||||
|
"DL|CL|DL",
|
||||||
|
],
|
||||||
|
category: "Special Cells",
|
||||||
|
state: "solid",
|
||||||
|
stateHigh: "molten_metal",
|
||||||
|
tempHigh: "2500",
|
||||||
|
tempLow: "-2345",
|
||||||
|
stateLow: "ice",
|
||||||
|
}
|
||||||
|
// some stuff
|
||||||
|
elements.rad_shrimp = {
|
||||||
|
color: ["#ff8484" , "#ff0000" , "#87ff62"],
|
||||||
|
behavior: [
|
||||||
|
"XX|XX|XX",
|
||||||
|
"XX|LB:radiation|XX",
|
||||||
|
"M1|M2|M1",
|
||||||
|
],
|
||||||
|
category: "food",
|
||||||
|
state: "powder",
|
||||||
|
stateHigh: "cooked_rad_shrimp",
|
||||||
|
tempHigh: "250",
|
||||||
|
tempLow: "-234",
|
||||||
|
stateLow: "frozen_rad_shrimp",
|
||||||
|
}
|
||||||
|
elements.cooked_rad_shrimp = {
|
||||||
|
color: ["#ff0000" , "#ffc278"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
category: "food",
|
||||||
|
stateHigh: "ash",
|
||||||
|
tempHigh: "450",
|
||||||
|
stateLow: "rad_shrimp",
|
||||||
|
tempLow: "20",
|
||||||
|
temp: 250,
|
||||||
|
}
|
||||||
|
elements.frozen_rad_shrimp = {
|
||||||
|
color: ["#6193ff" , "#0044d6"],
|
||||||
|
category: "food",
|
||||||
|
stateHigh: "rad_shrimp",
|
||||||
|
temp: "-234",
|
||||||
|
temphigh: "20",
|
||||||
|
stateLow: "frozen_rad_shrimp",
|
||||||
|
temp: -234,
|
||||||
|
}
|
||||||
|
|
||||||
|
// more sand
|
||||||
|
// lol
|
||||||
|
|
||||||
|
// fresh sand
|
||||||
|
elements.fresh_sand = {
|
||||||
|
color: ["#f2e2a1" , "#d4b95b" , "#ffeb99"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
category: "land",
|
||||||
|
stateHigh: "molten_glass",
|
||||||
|
tempHigh: "1450",
|
||||||
|
stateLow: "clay",
|
||||||
|
tempLow: "-234",
|
||||||
|
desc : "Sand fresh from the beach(jk its just retextured sand)."
|
||||||
|
}
|
||||||
|
|
||||||
|
// blue sand
|
||||||
|
elements.blue_sand = {
|
||||||
|
color: ["#a1c4f2" , "#5b9ed4" , "#99caff"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
category: "land",
|
||||||
|
stateHigh: "molten_glass",
|
||||||
|
tempHigh: "1450",
|
||||||
|
stateLow: "clay",
|
||||||
|
tempLow: "-234",
|
||||||
|
desc : "Blue sand from a cool island."
|
||||||
|
}
|
||||||
|
elements.wet_blue_sand = {
|
||||||
|
color: ["#6a89b7" , "#3c5f86" , "#7199d0"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
category: "states",
|
||||||
|
tempHigh: "50",
|
||||||
|
stateHigh: "blue_sand",
|
||||||
|
desc: "so cool",
|
||||||
|
}
|
||||||
|
|
||||||
|
// green sand
|
||||||
|
elements.green_sand = {
|
||||||
|
color: ["#a1f2b8" , "#5bd48e" , "#99ffd6"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
category: "land",
|
||||||
|
stateHigh: "molten_glass",
|
||||||
|
tempHigh: "1450",
|
||||||
|
stateLow: "clay",
|
||||||
|
tempLow: "-234",
|
||||||
|
desc : "Green sand from money island.",
|
||||||
|
reactions: {
|
||||||
|
"water": { elem1:null, elem2:"wet_green_sand"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
elements.wet_green_sand = {
|
||||||
|
color: ["#6a9a78" , "#3c865b" , "#71bfa0"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
category: "states",
|
||||||
|
tempHigh: "40",
|
||||||
|
stateHigh: "green_sand",
|
||||||
|
desc: "vro is not tuff",
|
||||||
|
}
|
||||||
|
// purple sand
|
||||||
|
elements.purple_sand = {
|
||||||
|
color: ["#dba1f2" , "#9e5bd4" , "#ff99ff"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
category: "land",
|
||||||
|
stateHigh: "molten_glass",
|
||||||
|
tempHigh: "1450",
|
||||||
|
stateLow: "clay",
|
||||||
|
tempLow: "-234",
|
||||||
|
desc : "Purple sand from a magical island.",
|
||||||
|
reactions: {
|
||||||
|
"sawdust": { elem1:null, elem2:"confetti"},
|
||||||
|
"water": { elem1:null, elem2:"wet_purple_sand"}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
elements.wet_purple_sand = {
|
||||||
|
color: ["#845796" , "#5b2d80" , "#b069b0"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
category: "states",
|
||||||
|
tempHigh: "60",
|
||||||
|
stateHigh: "purple_sand",
|
||||||
|
desc: "ts so tuff",
|
||||||
|
}
|
||||||
|
// emeralds
|
||||||
|
elements.emerald = {
|
||||||
|
color: ["#50c878" , "#2e8b57" , "#a8e4a0"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
category: "powders",
|
||||||
|
stateHigh: "molten_emerald",
|
||||||
|
tempHigh: "2100",
|
||||||
|
stateLow: "diamond",
|
||||||
|
tempLow: "-234",
|
||||||
|
desc : "A precious green gem."
|
||||||
|
}
|
||||||
|
elements.molten_emerald = {
|
||||||
|
color: "#7fffd4",
|
||||||
|
behavior: behaviors.LIQUID,
|
||||||
|
category: "liquids",
|
||||||
|
stateLow: "emerald",
|
||||||
|
tempLow: "-2100",
|
||||||
|
temp: 2100,
|
||||||
|
desc : "Molten emerald."
|
||||||
|
}
|
||||||
17
mods/zoom.js
17
mods/zoom.js
|
|
@ -72,8 +72,9 @@ function gen_button(row, col, html, click, nopos, id){
|
||||||
|
|
||||||
function add_css(){
|
function add_css(){
|
||||||
const CSS = `
|
const CSS = `
|
||||||
#zm_data_div { margin-bottom: 10px; }
|
#zm_data_div { margin-bottom: 10px }
|
||||||
#canvasDiv { overflow: hidden }
|
#canvasDiv { overflow: hidden }
|
||||||
|
#game { border: solid white }
|
||||||
|
|
||||||
@media(pointer=coarse){
|
@media(pointer=coarse){
|
||||||
#zm_floater_container#zm_floater_container {
|
#zm_floater_container#zm_floater_container {
|
||||||
|
|
@ -159,7 +160,7 @@ function add_zoom_floaters(){
|
||||||
)
|
)
|
||||||
|
|
||||||
const speed = () =>
|
const speed = () =>
|
||||||
(window.zoom_level > 3 ? 5 : 10) * // More granular at higher zoom levels
|
(window.zoom_level > 3 ? 5 : 10) * // More granular at higher zoom levels
|
||||||
(pan_mode_sel.dataset.mode == "F" ? 0.25 : 1) // Increase granularity in fine mode
|
(pan_mode_sel.dataset.mode == "F" ? 0.25 : 1) // Increase granularity in fine mode
|
||||||
|
|
||||||
container.append(
|
container.append(
|
||||||
|
|
@ -199,6 +200,16 @@ function rescale(){
|
||||||
const y = zoom_panning[1] * (pixelSize * scale)
|
const y = zoom_panning[1] * (pixelSize * scale)
|
||||||
|
|
||||||
gameCanvas.style.transform = `translate(${x}px,${y}px) scale(${scale})`
|
gameCanvas.style.transform = `translate(${x}px,${y}px) scale(${scale})`
|
||||||
|
|
||||||
|
const width = 2 / scale
|
||||||
|
gameCanvas.style.borderTopWidth =
|
||||||
|
`${zoom_panning[1] > 0 ? width : 0}px`
|
||||||
|
gameCanvas.style.borderBottomWidth =
|
||||||
|
`${zoom_panning[1] < 0 ? width : 0}px`
|
||||||
|
gameCanvas.style.borderLeftWidth =
|
||||||
|
`${zoom_panning[0] > 0 ? width : 0}px`
|
||||||
|
gameCanvas.style.borderRightWidth =
|
||||||
|
`${zoom_panning[0] < 0 ? width : 0}px`
|
||||||
}
|
}
|
||||||
|
|
||||||
function log_info(){
|
function log_info(){
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue