level.labs() is live, new map

new level labs is done (it's kinda randomized, so expect it to feel different each run)
  (I know there are tons of bugs, but I figure we can find them together :)

foam gun now gets about 20% less ammo
new junk tech: "emergency broadcasting" - plays some fun sounds and gives you health

updated matter.js to a newer build matter-js 0.17.1 by @liabru
  (was matter-js 0.14.2 by @liabru 2018-06-11)
  matter.js patch notes suggest a possible 30% physics performance increase
  decomp.min.js was removed because I don't think it does anything anymore
    I did get one error message about it being missing, but there were other bugs too
This commit is contained in:
landgreen
2021-06-24 13:52:58 -07:00
parent 88f595642f
commit 0263ef7d57
9 changed files with 993 additions and 351 deletions

View File

@@ -3381,7 +3381,7 @@ const b = {
// makeNeedle(m.angle - spread)
},
fireRivets() {
m.fireCDcycle = m.cycle + Math.floor((m.crouch ? 23 : 15) * b.fireCD); // cool down
m.fireCDcycle = m.cycle + Math.floor((m.crouch ? 25 : 17) * b.fireCD); // cool down
const me = bullet.length;
const size = tech.rivetSize * 7.5
@@ -4176,7 +4176,7 @@ const b = {
name: "foam",
description: "spray bubbly foam that <strong>sticks</strong> to mobs<br><strong class='color-s'>slows</strong> mobs and does <strong class='color-d'>damage</strong> over time",
ammo: 0,
ammoPack: 27,
ammoPack: 22,
have: false,
charge: 0,
isDischarge: false,

File diff suppressed because it is too large Load Diff

View File

@@ -1172,7 +1172,7 @@ const mobs = {
//replace dead mob with a regular body
replace(i) {
//if there are too many bodies don't turn into blocks to help performance
if (this.leaveBody && body.length < 60 && this.mass < 200 && this.radius > 18) {
if (this.leaveBody && body.length < 40 && this.mass < 200 && this.radius > 18) {
const len = body.length;
const v = Matter.Vertices.hull(Matter.Vertices.clockwiseSort(this.vertices)) //might help with vertex collision issue, not sure
body[len] = Matter.Bodies.fromVertices(this.position.x, this.position.y, v);

View File

@@ -526,6 +526,7 @@ const simulation = {
level.levels = shuffle(level.levels); //shuffles order of maps
}
level.levels.unshift("intro"); //add level to the start of the randomized levels list
level.levels.push("labs"); //add level to the end of the randomized levels list
level.levels.push("gauntlet"); //add level to the end of the randomized levels list
level.levels.push("final"); //add level to the end of the randomized levels list
@@ -595,6 +596,7 @@ const simulation = {
m.holdingTarget = null
//set to default field
tech.healMaxEnergyBonus = 0
m.setMaxEnergy();
m.fieldMode = 0;
// simulation.makeTextLog(`${simulation.SVGrightMouse}<strong style='font-size:30px;'> ${m.fieldUpgrades[m.fieldMode].name}</strong><br><span class='faded'></span><br>${m.fieldUpgrades[m.fieldMode].description}`, 600);
@@ -1125,6 +1127,7 @@ const simulation = {
}
},
enableConstructMode() {
level.isProcedural = false //this is set to be true in levels like labs that need x+ and y+ in front of positions
simulation.isConstructionMode = true;
simulation.isHorizontalFlipped = false;
simulation.isAutoZoom = false;
@@ -1143,11 +1146,20 @@ const simulation = {
const dy = Math.max(25, round(simulation.mouseInGame.y) - y)
if (e.which === 2) {
simulation.outputMapString(`spawn.randomMob(${x}, ${y},0.5);`);
if (level.isProcedural) {
simulation.outputMapString(`spawn.randomMob(x+${x}, y+${y},0.5);`);
} else {
simulation.outputMapString(`spawn.randomMob(${x}, ${y},0.5);`);
}
} else if (simulation.mouseInGame.x > simulation.constructMouseDownPosition.x && simulation.mouseInGame.y > simulation.constructMouseDownPosition.y) { //make sure that the width and height are positive
if (e.which === 1) { //add map
simulation.outputMapString(`spawn.mapRect(${x}, ${y}, ${dx}, ${dy});`);
if (level.isProcedural) {
simulation.outputMapString(`spawn.mapRect(x+${x}, y+${y}, ${dx}, ${dy});`);
} else {
simulation.outputMapString(`spawn.mapRect(${x}, ${y}, ${dx}, ${dy});`);
}
//see map in world
spawn.mapRect(x, y, dx, dy);
len = map.length - 1
@@ -1158,7 +1170,11 @@ const simulation = {
simulation.draw.setPaths() //update map graphics
} else if (e.which === 3) { //add body
simulation.outputMapString(`spawn.bodyRect(${x}, ${y}, ${dx}, ${dy});`);
if (level.isProcedural) {
simulation.outputMapString(`spawn.bodyRect(x+${x}, y+${y}, ${dx}, ${dy});`);
} else {
simulation.outputMapString(`spawn.bodyRect(${x}, ${y}, ${dx}, ${dy});`);
}
//see map in world
spawn.bodyRect(x, y, dx, dy);

View File

@@ -110,7 +110,7 @@
if (tech.isMetaAnalysis && tech.tech[index].isJunk) {
simulation.makeTextLog(`//tech: meta-analysis replaced junk tech with random tech`);
tech.giveTech('random')
for (let i = 0; i < 2; i++) powerUps.spawn(m.pos.x + 10 * Math.random(), m.pos.y + 10 * Math.random(), "research");
for (let i = 0; i < 5; i++) powerUps.spawn(m.pos.x + 40 * Math.random(), m.pos.y + 40 * Math.random(), "research");
return
}
@@ -404,7 +404,7 @@
},
{
name: "catabolism",
description: "when you <strong>fire</strong> while <strong>out</strong> of <strong class='color-g'>ammo</strong><br>gain <strong>4</strong> <strong class='color-g'>ammo</strong>, but lose <strong>1</strong> max <strong class='color-h'>health</strong>",
description: "firing while <strong>out</strong> of <strong class='color-g'>ammo</strong> spawns <strong>4</strong> <strong class='color-g'>ammo</strong><br>and reduces your <strong>maximum</strong> <strong class='color-h'>health</strong> by <strong>1</strong>",
maxCount: 1,
count: 0,
frequency: 1,
@@ -2119,12 +2119,12 @@
description: "each unused <strong>power up</strong> at the end of a <strong>level</strong><br>adds 3 <strong>max</strong> <strong class='color-f'>energy</strong>", // <em>(up to 51 health per level)</em>",
maxCount: 1,
count: 0,
frequency: 2,
frequencyDefault: 2,
frequency: 1,
frequencyDefault: 1,
allowed() {
return tech.isEnergyHealth && !tech.isDroneGrab
return !tech.isDroneGrab
},
requires: "mass-energy equivalence, not drone harvester",
requires: "not drone harvester",
effect() {
tech.isExtraMaxEnergy = true; //tracked by tech.extraMaxHealth
},
@@ -2615,7 +2615,7 @@
},
{
name: "quantum immortality",
description: "after <strong>dying</strong>, continue in an <strong class='alt'>alternate reality</strong><br>reduce <strong class='color-harm'>harm</strong> by <strong>33%</strong>", //spawn <strong>4</strong> <strong class='color-r'>research</strong>
description: "reduce <strong class='color-harm'>harm</strong> by <strong>33%</strong><br>after <strong>dying</strong>, continue in an <strong class='alt'>alternate reality</strong>",
maxCount: 1,
count: 0,
frequency: 4,
@@ -2626,7 +2626,6 @@
requires: "anthropic principle, not many-worlds, Ψ(t) collapse, non-unitary",
effect() {
tech.isImmortal = true;
// for (let i = 0; i < 4; i++) powerUps.spawn(m.pos.x + Math.random() * 10, m.pos.y + Math.random() * 10, "research", false);
},
remove() {
tech.isImmortal = false;
@@ -2840,7 +2839,7 @@
},
{
name: "meta-analysis",
description: "if you choose a <strong class='color-j'>JUNK</strong> <strong class='color-m'>tech</strong> you instead get a <br>random normal <strong class='color-m'>tech</strong> and <strong>2</strong> <strong class='color-r'>research</strong>",
description: "if you choose a <strong class='color-j'>JUNK</strong> <strong class='color-m'>tech</strong> you instead get a <br>random normal <strong class='color-m'>tech</strong> and <strong>5</strong> <strong class='color-r'>research</strong>",
maxCount: 1,
count: 0,
frequency: 1,
@@ -4511,7 +4510,7 @@
},
{
name: "laser diodes",
description: "all <strong class='color-laser'>lasers</strong> drain <strong>30%</strong> less <strong class='color-f'>energy</strong><br><em>effects laser-gun, laser-bot, and laser-mines</em>",
description: "all <strong class='color-laser'>lasers</strong> drain <strong>30%</strong> less <strong class='color-f'>energy</strong><br><em>affects laser-gun, laser-bot, and laser-mines</em>",
isGunTech: true,
maxCount: 1,
count: 0,
@@ -4530,7 +4529,7 @@
},
{
name: "relativistic momentum",
description: "all <strong class='color-laser'>lasers</strong> push mobs away<br><em>effects laser-gun, laser-bot, and laser-mines</em>",
description: "all <strong class='color-laser'>lasers</strong> push mobs away<br><em>affects laser-gun, laser-bot, and laser-mines</em>",
isGunTech: true,
maxCount: 1,
count: 0,
@@ -5667,6 +5666,102 @@
// },
// remove() {}
// },
{
name: "emergency broadcasting",
description: "emit 2 sound sine waveforms at 853 Hz and 960 Hz<br><em>lower your volume</em>",
maxCount: 1,
count: 0,
frequency: 0,
isExperimentHide: true,
isJunk: true,
isNonRefundable: true,
allowed() {
return true
},
requires: "",
effect: () => {
//setup audio context
function tone(frequency) {
const audioCtx = new(window.AudioContext || window.webkitAudioContext)();
const oscillator1 = audioCtx.createOscillator();
const gainNode1 = audioCtx.createGain();
gainNode1.gain.value = 0.5; //controls volume
oscillator1.connect(gainNode1);
gainNode1.connect(audioCtx.destination);
oscillator1.type = "sine"; // 'sine' 'square', 'sawtooth', 'triangle' and 'custom'
oscillator1.frequency.value = frequency; // value in hertz
oscillator1.start();
return audioCtx
}
// let sound = tone(1050)
function EBS() {
const audioCtx = new(window.AudioContext || window.webkitAudioContext)();
const oscillator1 = audioCtx.createOscillator();
const gainNode1 = audioCtx.createGain();
gainNode1.gain.value = 0.3; //controls volume
oscillator1.connect(gainNode1);
gainNode1.connect(audioCtx.destination);
oscillator1.type = "sine"; // 'sine' 'square', 'sawtooth', 'triangle' and 'custom'
oscillator1.frequency.value = 853; // value in hertz
oscillator1.start();
const oscillator2 = audioCtx.createOscillator();
const gainNode2 = audioCtx.createGain();
gainNode2.gain.value = 0.3; //controls volume
oscillator2.connect(gainNode2);
gainNode2.connect(audioCtx.destination);
oscillator2.type = "sine"; // 'sine' 'square', 'sawtooth', 'triangle' and 'custom'
oscillator2.frequency.value = 960; // value in hertz
oscillator2.start();
return audioCtx
}
let sound = EBS()
delay = 1000
setTimeout(() => {
sound.suspend()
powerUps.spawn(m.pos.x + 160 * (Math.random() - 0.5), m.pos.y + 160 * (Math.random() - 0.5), "heal");
setTimeout(() => {
sound.resume()
setTimeout(() => {
sound.suspend()
powerUps.spawn(m.pos.x + 160 * (Math.random() - 0.5), m.pos.y + 160 * (Math.random() - 0.5), "heal");
setTimeout(() => {
sound.resume()
setTimeout(() => {
sound.suspend()
powerUps.spawn(m.pos.x + 160 * (Math.random() - 0.5), m.pos.y + 160 * (Math.random() - 0.5), "heal");
setTimeout(() => {
sound.resume()
setTimeout(() => {
sound.suspend()
powerUps.spawn(m.pos.x + 160 * (Math.random() - 0.5), m.pos.y + 160 * (Math.random() - 0.5), "heal");
setTimeout(() => {
sound.resume()
setTimeout(() => {
sound.suspend()
powerUps.spawn(m.pos.x + 160 * (Math.random() - 0.5), m.pos.y + 160 * (Math.random() - 0.5), "heal");
setTimeout(() => {
sound.resume()
setTimeout(() => {
sound.suspend()
powerUps.spawn(m.pos.x + 160 * (Math.random() - 0.5), m.pos.y + 160 * (Math.random() - 0.5), "heal");
}, delay);
}, delay);
}, delay);
}, delay);
}, delay);
}, delay);
}, delay);
}, delay);
}, delay);
}, delay);
}, delay);
},
remove() {}
},
{
name: "automatic",
description: "you can't fire when moving<br>always <strong>fire</strong> when at <strong>rest</strong>",