@@ -631,6 +638,7 @@
'M5': 'Module 5: ',
'F': 'Frame: '
}
+ excess_draw = ['Weapon', 'Equipment'];
components = {};
selected_slot = null;
available_p = {
@@ -708,7 +716,7 @@
for (let x of ['pwr-m', 'pwr-e', 'pwr-s', 'cool', 'cpu']) {
for (let slot in _components) {
if (_components[slot] != null) {
- if (x in _components[slot]) {
+ if (x in _components[slot] && !excess_draw.includes(_components[slot].type)) {
if (_components[slot][x] > 0) {
available[x] += parseInt(_components[slot][x]);
}
@@ -730,8 +738,8 @@
validation = validatePlacement(part, selected_slot);
if (validation.valid) {
components[selected_slot] = part;
- calculate_resources();
validateAllComponents();
+ calculate_resources();
update_slot_text();
update_components_cookie();
}
@@ -740,6 +748,14 @@
}
}
+ function clearSlotClick() {
+ delete components[selected_slot];
+ validateAllComponents();
+ calculate_resources();
+ update_slot_text();
+ update_components_cookie();
+ }
+
function validatePlacement(part, slot) {
if (!valid_placements[slot].includes(part.type)) {
return {valid: false, message: 'That type of part cannot go in that slot.'};
@@ -881,7 +897,7 @@
function showHelp() {
modal_title.innerHTML = 'Mech Builder Help';
- modal_content.innerHTML = '
The Mech Builder allows you to validate and tinker with mech builds by doing the calculations for you. Simply click on a slot to select it, then search for a part, and click the select button next to the part to put it in the slot.
';
+ modal_content.innerHTML = '
The Mech Builder allows you to validate and tinker with mech builds by doing the calculations for you. Simply click on a slot to select it, then search for a part, and click the select button next to the part to put it in the slot. Click the trash can button while a slot is selected to clear the part from that slot.
';
}
diff --git a/mechdb/viewer/index.html b/mechdb/viewer/index.html
index 5e9c38a..8baf353 100644
--- a/mechdb/viewer/index.html
+++ b/mechdb/viewer/index.html
@@ -252,7 +252,7 @@