diff --git a/js/bullet.js b/js/bullet.js
index 85167e2..eb07b33 100644
--- a/js/bullet.js
+++ b/js/bullet.js
@@ -140,7 +140,10 @@ const b = {
if (!b.guns[gun].have) b.inventory.push(gun);
b.guns[gun].have = true;
b.guns[gun].ammo = Math.floor(b.guns[gun].ammoPack * ammoPacks);
- if (b.activeGun === null) b.activeGun = gun //if no active gun switch to new gun
+ if (b.activeGun === null) {
+ b.activeGun = gun //if no active gun switch to new gun
+ if (b.guns[b.activeGun].charge) b.guns[b.activeGun].charge = 0; //set foam charge to zero if foam is a new gun
+ }
}
simulation.makeGunHUD();
b.setFireCD();
@@ -4046,14 +4049,27 @@ const b = {
name: "foam",
description: "spray bubbly foam that sticks to mobs
slows mobs and does damage over time",
ammo: 0,
- ammoPack: 36,
+ ammoPack: 30,
have: false,
charge: 0,
- isCharging: false,
+ isDischarge: false,
do() {
- if (this.charge > 0 && !input.fire) {
- this.charge--
- this.fireFoam()
+ if (this.charge > 0) {
+ //draw charge level
+ ctx.fillStyle = "rgba(0,50,50,0.2)";
+ ctx.beginPath();
+ ctx.arc(m.pos.x + 35 * Math.cos(m.angle), m.pos.y + 35 * Math.sin(m.angle), 10 * Math.sqrt(this.charge), 0, 2 * Math.PI);
+ ctx.fill();
+
+ if (this.isDischarge) {
+ this.charge--
+ this.fireFoam()
+ m.fireCDcycle = m.cycle + 1; //disable firing and adding more charge
+ } else if (!input.fire) {
+ this.isDischarge = true;
+ }
+ } else {
+ this.isDischarge = false
}
},
fire() {
@@ -4091,45 +4107,6 @@ const b = {
b.foam(position, Vector.rotate(velocity, spread), radius)
}
}
- // fire() {
- // let radius, spread
- // if (m.crouch) {
- // spread = 0.2 * (Math.random() - 0.5)
- // radius = 10 + 5 * Math.random() + (tech.isAmmoFoamSize && this.ammo < 300) * 12
- // m.fireCDcycle = m.cycle + Math.floor(15 * b.fireCD); // cool down
- // } else {
- // spread = 0.5 * (Math.random() - 0.5)
- // radius = 4 + 6 * Math.random() + (tech.isAmmoFoamSize && this.ammo < 300) * 12
- // m.fireCDcycle = m.cycle + Math.floor(5 * b.fireCD); // cool down
- // }
- // const SPEED = 18 - radius * 0.4;
- // const dir = m.angle + 0.15 * (Math.random() - 0.5)
- // const velocity = {
- // x: SPEED * Math.cos(dir),
- // y: SPEED * Math.sin(dir)
- // }
- // const position = {
- // x: m.pos.x + 30 * Math.cos(m.angle),
- // y: m.pos.y + 30 * Math.sin(m.angle)
- // }
- // if (tech.foamFutureFire) {
- // simulation.drawList.push({ //add dmg to draw queue
- // x: position.x,
- // y: position.y,
- // radius: 5,
- // color: "rgba(0,0,0,0.1)",
- // time: 15 * tech.foamFutureFire
- // });
- // setTimeout(() => {
- // if (!simulation.paused) {
- // b.foam(position, Vector.rotate(velocity, spread), radius)
- // bullet[bullet.length - 1].damage = (1 + 1.27 * tech.foamFutureFire) * (tech.isFastFoam ? 0.048 : 0.012) //double damage
- // }
- // }, 250 * tech.foamFutureFire);
- // } else {
- // b.foam(position, Vector.rotate(velocity, spread), radius)
- // }
- // }
}, {
name: "rail gun",
description: "use energy to launch a high-speed dense rod
hold left mouse to charge, release to fire",
diff --git a/js/level.js b/js/level.js
index f90ca47..1cd3858 100644
--- a/js/level.js
+++ b/js/level.js
@@ -18,7 +18,7 @@ const level = {
// m.setField("nano-scale manufacturing")
// b.giveGuns("foam")
// tech.isExplodeRadio = true
- // for (let i = 0; i < 1; i++) tech.giveTech("dynamo-bot")
+ // for (let i = 0; i < 9; i++) tech.giveTech("auto-loading heuristics")
// tech.giveTech("superfluidity")
// tech.giveTech("ice crystal nucleation")
// tech.giveTech("needle gun")
diff --git a/js/simulation.js b/js/simulation.js
index 9531fe6..5a1fd84 100644
--- a/js/simulation.js
+++ b/js/simulation.js
@@ -355,6 +355,7 @@ const simulation = {
switchGun() {
if (tech.isCrouchAmmo) tech.isCrouchAmmo = 1 //this prevents hacking the tech by switching guns
b.activeGun = b.inventory[b.inventoryGun];
+ if (b.guns[b.activeGun].charge) b.guns[b.activeGun].charge = 0; //if switching into foam set charge to 0
simulation.updateGunHUD();
simulation.boldActiveGunHUD();
},
diff --git a/js/tech.js b/js/tech.js
index e63d9c5..d230a40 100644
--- a/js/tech.js
+++ b/js/tech.js
@@ -5018,7 +5018,7 @@
isBadRandomOption: true,
isExperimentalMode: true,
allowed() {
- return build.isExperimentSelection && !m.isShipMode && m.fieldUpgrades[m.fieldMode].name !== "negative mass field"
+ return build.isExperimentSelection && !m.isShipMode && m.fieldUpgrades[m.fieldMode].name !== "negative mass field" && !tech.isFireNotMove
},
requires: "",
effect() {
diff --git a/todo.txt b/todo.txt
index cae17fd..c40df5c 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,8 +1,5 @@
******************************************************** NEXT PATCH ********************************************************
-apomixis spawns 8 bosses (up from 4)
-
-foam gun now charges up until you release the fire button
******************************************************** BUGS ********************************************************
@@ -36,7 +33,8 @@ fix door.isOpen actually meaning isClosed?
******************************************************** TODO ********************************************************
-edit foam gun text
+edit foam gun text?
+add a foam charge meter would be nice
apply the new gun.do functions to other guns
rail gun