From a3455455a11209031900f517993de94a6109e1fa Mon Sep 17 00:00:00 2001 From: yarukishi <150128243+yarukishi@users.noreply.github.com> Date: Mon, 22 Sep 2025 17:24:34 +0900 Subject: [PATCH 1/3] Use incrementStruct() on several structures Affected structures include soul capacitors, fasting challenge buildings, red universities, red factories, space casinos, and a couple of multisegmented projects. Resolves #1492. --- src/portal.js | 8 ++++---- src/space.js | 18 ++++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/portal.js b/src/portal.js index cb0efe89d..4f5d06ba8 100644 --- a/src/portal.js +++ b/src/portal.js @@ -1671,7 +1671,7 @@ const fortressModules = { }, action(args){ if (global.portal.soul_capacitor.count < 40 && payCosts($(this)[0])){ - global.portal.soul_capacitor.count++; + incrementStruct('soul_capacitor','portal'); powerOnNewStruct($(this)[0]); return true; } @@ -2888,7 +2888,7 @@ const fortressModules = { }, action(args){ if (global.portal.oven.count < 100 && payCosts($(this)[0])){ - global.portal['oven'].count++; + incrementStruct('oven','portal'); if (global.portal.oven.count >= 100){ global.tech['dish'] = 3; initStruct(fortressModules.prtl_lake.oven_complete); @@ -2977,7 +2977,7 @@ const fortressModules = { }, action(args){ if (payCosts($(this)[0])){ - global.portal['dish_soul_steeper'].count++; + incrementStruct('dish_soul_steeper','portal'); global.portal['dish_soul_steeper'].on++; return true; } @@ -3008,7 +3008,7 @@ const fortressModules = { }, action(args){ if (payCosts($(this)[0])){ - global.portal['dish_life_infuser'].count++; + incrementStruct('dish_life_infuser','portal'); global.portal['dish_life_infuser'].on++; return true; } diff --git a/src/space.js b/src/space.js index 8a516b399..c2edba61a 100644 --- a/src/space.js +++ b/src/space.js @@ -1093,7 +1093,7 @@ const spaceProjects = { special: true, action(args){ if (payCosts($(this)[0])){ - global.space.red_factory.count++; + incrementStruct('red_factory','space'); if (powerOnNewStruct($(this)[0])){ global.city.factory.Alloy++; } @@ -1218,14 +1218,14 @@ const spaceProjects = { }, action(args){ if (payCosts($(this)[0])){ + incrementStruct('university','city'); + global.space.red_university.count = global.city.university.count; let gain = global.tech['science'] && global.tech['science'] >= 8 ? 700 : 500; if (global.tech['supercollider']){ let ratio = global.tech['particles'] && global.tech['particles'] >= 3 ? 12.5: 25; gain *= (global.tech['supercollider'] / ratio) + 1; } global['resource']['Knowledge'].max += gain; - global.city.university.count++; - global.space.red_university.count = global.city.university.count; global.civic.professor.display = true; global.civic.professor.max = jobScale(global.city.university.count); return true; @@ -1602,7 +1602,7 @@ const spaceProjects = { powered(){ return powerCostMod(global.stats.achieve['dissipated'] && global.stats.achieve['dissipated'].l >= 2 ? 2 : 3); }, action(args){ if (payCosts($(this)[0])){ - global.space.spc_casino.count++; + incrementStruct('spc_casino','space'); if (global.tech['theatre'] && !global.race['joyless']){ global.civic.entertainer.max += jobScale(1); global.civic.entertainer.display = true; @@ -1805,11 +1805,9 @@ const spaceProjects = { } }, action(args){ - if (payCosts($(this)[0])){ - if (global.space.jump_gate.count < 100){ - global.space.jump_gate.count++; - return true; - } + if (global.space.jump_gate.count < 100 && payCosts($(this)[0])){ + incrementStruct('jump_gate','space'); + return true; } return false; }, @@ -2636,7 +2634,7 @@ const spaceProjects = { }, action(args){ if (global.space.mass_relay.count < 100 && payCosts($(this)[0])){ - global.space.mass_relay.count++; + incrementStruct('mass_relay','space'); if (global.space.mass_relay.count >= 100){ global.tech['outer'] = 6; initStruct(spaceProjects.spc_dwarf.m_relay); From abe9d5e72763241607adee9d4ca11821c29a8d1f Mon Sep 17 00:00:00 2001 From: yarukishi <150128243+yarukishi@users.noreply.github.com> Date: Mon, 22 Sep 2025 18:09:10 +0900 Subject: [PATCH 2/3] When purging structs, also purge from build queues --- src/actions.js | 5 ++--- src/main.js | 15 +++++++-------- src/races.js | 39 +++++++++++++++++++++++++++++++++++++++ src/space.js | 2 ++ 4 files changed, 50 insertions(+), 11 deletions(-) diff --git a/src/actions.js b/src/actions.js index 558c045d0..1196bb24f 100644 --- a/src/actions.js +++ b/src/actions.js @@ -7,7 +7,7 @@ import { defineResources, unlockCrates, unlockContainers, crateValue, containerV import { loadFoundry, defineJobs, jobScale, workerScale, job_desc } from './jobs.js'; import { loadIndustry, defineIndustry, nf_resources, gridDefs, addSmelter, cancelRituals } from './industry.js'; import { defineGovernment, defineGarrison, buildGarrison, commisionGarrison, foreignGov, armyRating, garrisonSize, govEffect } from './civics.js'; -import { spaceTech, interstellarTech, galaxyTech, incrementStruct, universe_affixes, renderSpace, piracy, fuel_adjust, isStargateOn } from './space.js'; +import { spaceTech, interstellarTech, galaxyTech, incrementStruct, universe_affixes, renderSpace, piracy, fuel_adjust, isStargateOn, spaceSectors } from './space.js'; import { renderFortress, fortressTech, warlordSetup } from './portal.js'; import { edenicTech, renderEdenic } from './edenic.js'; import { tauCetiTech, renderTauCeti, loneSurvivor } from './truepath.js'; @@ -8287,11 +8287,10 @@ export function structName(type){ export function updateQueueNames(both, items){ if (global.tech['queue'] && global.queue.display){ - let deepScan = ['space','interstellar','galaxy','portal','tauceti']; for (let i=0; i -1){ - if (deepScan.includes(currItem.action)){ + if (spaceSectors.includes(currItem.action)){ let scan = true; Object.keys(actions[currItem.action]).forEach(function (region){ if (actions[currItem.action][region][currItem.type] && scan){ global.queue.queue[i].label = diff --git a/src/main.js b/src/main.js index a7f7ee0f6..0dba9ad97 100644 --- a/src/main.js +++ b/src/main.js @@ -8,7 +8,7 @@ import { defineJobs, job_desc, loadFoundry, farmerValue, jobName, jobScale, work import { defineIndustry, f_rate, manaCost, setPowerGrid, gridEnabled, gridDefs, nf_resources, replicator, luxGoodPrice, smelterUnlocked, smelterFuelConfig, setupRituals, maxRitualNum, ritual_types } from './industry.js'; import { checkControlling, garrisonSize, armyRating, govTitle, govCivics, govEffect, weaponTechModifer } from './civics.js'; import { actions, updateDesc, checkTechRequirements, drawEvolution, BHStorageMulti, storageMultipler, checkAffordable, checkPowerRequirements, drawCity, drawTech, gainTech, housingLabel, updateQueueNames, wardenLabel, planetGeology, resQueue, bank_vault, start_cataclysm, orbitDecayed, postBuild, skipRequirement, structName, templeCount, initStruct, casino_vault, casinoEarn, doCallbacks, cLabels } from './actions.js'; -import { renderSpace, convertSpaceSector, fuel_adjust, int_fuel_adjust, zigguratBonus, planetName, genPlanets, setUniverse, universe_types, gatewayStorage, piracy, spaceTech, universe_affixes, galaxyRegions, gatewayArmada, galaxy_ship_types } from './space.js'; +import { renderSpace, convertSpaceSector, fuel_adjust, int_fuel_adjust, zigguratBonus, planetName, genPlanets, setUniverse, universe_types, gatewayStorage, piracy, spaceTech, universe_affixes, galaxyRegions, gatewayArmada, galaxy_ship_types, spaceSectors } from './space.js'; import { renderFortress, bloodwar, soulForgeSoldiers, hellSupression, genSpireFloor, mechRating, mechCollect, updateMechbay, hellguard, buildMechQueue, mechCost } from './portal.js'; import { asphodelResist, mechStationEffect, renderEdenic } from './edenic.js'; import { renderTauCeti, syndicate, shipFuelUse, spacePlanetStats, genXYcoord, shipCrewSize, tpStorageMultiplier, tritonWar, sensorRange, erisWar, calcAIDrift, drawMap, tauEnabled, shipCosts, buildTPShipQueue } from './truepath.js'; @@ -10739,9 +10739,8 @@ function midLoop(){ } }); - let spc_locations = ['space','interstellar','galaxy','portal','tauceti','eden']; - for (let i=0; i= t_action.grant[1]){ global.r_queue.queue.splice(i,1); - clearPopper(`rq${c_action.id}`); + clearPopper(`rq${t_action.id}`); break; } else { @@ -11177,7 +11176,6 @@ function midLoop(){ let idx = -1; let c_action = false; let stop = false; - let deepScan = ['space','interstellar','galaxy','portal','tauceti','eden']; let time = 0; let spent = { t: {t:0,rt:0}, r: {}, rr: {}, id: {}}; let arpa = false; @@ -11213,7 +11211,7 @@ function midLoop(){ doNotAdjustCost: true, }; } - else if (deepScan.includes(struct.action)){ + else if (spaceSectors.includes(struct.action)){ for (let region in actions[struct.action]) { if (actions[struct.action][region][struct.type]){ t_action = actions[struct.action][region][struct.type]; @@ -12706,7 +12704,8 @@ function longLoop(){ } if (global.race['living_materials']){ - ['city','space','interstellar','galaxy','portal','eden','tauceti'].forEach(function(sector){ + const structSectors = ['city'].concat(spaceSectors); + structSectors.forEach(function(sector){ Object.keys(global[sector]).forEach(function(struct){ if (global[sector][struct].hasOwnProperty('l_m')){ global[sector][struct].l_m++; diff --git a/src/races.js b/src/races.js index 20098de8d..9987a268c 100644 --- a/src/races.js +++ b/src/races.js @@ -14,6 +14,7 @@ import { renderEdenic } from './edenic.js'; import { events, eventList } from './events.js'; import { swissKnife } from './tech.js'; import { warhead, big_bang } from './resets.js'; +import { spaceSectors } from './space.js'; const date = new Date(); const easter = getEaster(); @@ -6818,6 +6819,44 @@ function setPurgatory(s,t){ global.race.purgatory[s][t] = global[s][t]; delete global[s][t]; } + // Remove tech from research queue + if (s === 'tech'){ + if (global.tech['r_queue'] && global.r_queue.display){ + for (let i=0; i Date: Wed, 5 Nov 2025 20:43:19 +0900 Subject: [PATCH 3/3] Fix condition checks for structures in city region --- src/actions.js | 18 +++++------------- src/space.js | 2 +- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/actions.js b/src/actions.js index 1196bb24f..c41ec61b9 100644 --- a/src/actions.js +++ b/src/actions.js @@ -7,7 +7,7 @@ import { defineResources, unlockCrates, unlockContainers, crateValue, containerV import { loadFoundry, defineJobs, jobScale, workerScale, job_desc } from './jobs.js'; import { loadIndustry, defineIndustry, nf_resources, gridDefs, addSmelter, cancelRituals } from './industry.js'; import { defineGovernment, defineGarrison, buildGarrison, commisionGarrison, foreignGov, armyRating, garrisonSize, govEffect } from './civics.js'; -import { spaceTech, interstellarTech, galaxyTech, incrementStruct, universe_affixes, renderSpace, piracy, fuel_adjust, isStargateOn, spaceSectors } from './space.js'; +import { spaceTech, interstellarTech, galaxyTech, incrementStruct, universe_affixes, renderSpace, piracy, fuel_adjust, isStargateOn, spaceSectors, checkRequirements } from './space.js'; import { renderFortress, fortressTech, warlordSetup } from './portal.js'; import { edenicTech, renderEdenic } from './edenic.js'; import { tauCetiTech, renderTauCeti, loneSurvivor } from './truepath.js'; @@ -5840,23 +5840,15 @@ export function storageMultipler(scale = 1, wiki = false){ } export function checkCityRequirements(action){ - if ((global.race['kindling_kindred'] || global.race['smoldering']) && action === 'lumber'){ + if (action === 'lumber' && (global.race['kindling_kindred'] || global.race['smoldering'])){ return false; } - else if ((global.race['kindling_kindred'] || global.race['smoldering']) && action === 'stone'){ + else if (action === 'stone' && (global.race['kindling_kindred'] || global.race['smoldering'])){ return true; } - let c_path = global.race['truepath'] ? 'truepath' : 'standard'; - if (actions.city[action].hasOwnProperty('path') && !actions.city[action].path.includes(c_path)){ - return false; + else { + return checkRequirements(actions, 'city', action); } - var isMet = true; - Object.keys(actions.city[action].reqs).forEach(function (req){ - if (!global.tech[req] || global.tech[req] < actions.city[action].reqs[req]){ - isMet = false; - } - }); - return isMet; } function checkTechPath(tech){ diff --git a/src/space.js b/src/space.js index 7489b9b00..e5343ecd8 100644 --- a/src/space.js +++ b/src/space.js @@ -6749,7 +6749,7 @@ export function checkRequirements(action_set,region,action){ if (action_set[region][action].hasOwnProperty('path') && !action_set[region][action].path.includes(path)){ return false; } - var isMet = true; + let isMet = true; Object.keys(action_set[region][action].reqs).forEach(function (req){ if (!global.tech[req] || global.tech[req] < action_set[region][action].reqs[req]){ isMet = false;