From eea2c9ffcd8a05f433f7a136f59686917f193d0b Mon Sep 17 00:00:00 2001 From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io> Date: Sun, 23 Aug 2020 15:37:03 -0700 Subject: [PATCH] SecExp-Fix-phase-0 --- src/Mods/SecExp/js/buildingsJS.js | 4 +-- src/Mods/SecExp/js/secExp.js | 7 ++-- src/Mods/SecExp/js/secExpBC.js | 34 +++++++------------- src/Mods/SecExp/widgets/miscSecExpWidgets.tw | 3 -- 4 files changed, 16 insertions(+), 32 deletions(-) diff --git a/src/Mods/SecExp/js/buildingsJS.js b/src/Mods/SecExp/js/buildingsJS.js index 505208bf5a8..0b6650b04f0 100644 --- a/src/Mods/SecExp/js/buildingsJS.js +++ b/src/Mods/SecExp/js/buildingsJS.js @@ -294,7 +294,7 @@ App.SecExp.weapManu = (function() { Init:Init, BC:BC }; - + function Init() { V.SecExp.buildings.weapManu = { menials: 0, @@ -353,7 +353,7 @@ App.SecExp.weapManu = (function() { V.SecExp.buildings.weapManu.upgrades.human.morale = V.SecExp.buildings.weapManu.upgrades.human.morale || 0; V.SecExp.buildings.weapManu.upgrades.current = V.SecExp.buildings.weapManu.upgrades.current || {time: 0}; - if (V.currentUpgrade) { + if (jsDef(V.currentUpgrade)) { V.SecExp.buildings.weapManu.upgrades.current = {ID: V.currentUpgrade.ID, time: V.currentUpgrade.time}; } } diff --git a/src/Mods/SecExp/js/secExp.js b/src/Mods/SecExp/js/secExp.js index c035d050103..25a3d310cd5 100644 --- a/src/Mods/SecExp/js/secExp.js +++ b/src/Mods/SecExp/js/secExp.js @@ -56,9 +56,9 @@ App.SecExp.generalInit = function(){ allowSlavePrestige: 1, force: 0, showStats: 0, + frequency: 1, major: { enabled: 0, - frequency: 1, gameOver: 1, mult: 1, force: 0 @@ -91,6 +91,7 @@ App.SecExp.generalInit = function(){ waterway: 0 }, units: { + bots: {}, slaves: { created: 0, casualties: 0, @@ -150,9 +151,7 @@ App.SecExp.generalInit = function(){ pharaonTradition: 0, } }, - smilingMan: { - progress : 0, - } + smilingMan: { progress : 0 } }); App.SecExp.initTrade(); diff --git a/src/Mods/SecExp/js/secExpBC.js b/src/Mods/SecExp/js/secExpBC.js index d6dddc8d68c..8884e43a3ef 100644 --- a/src/Mods/SecExp/js/secExpBC.js +++ b/src/Mods/SecExp/js/secExpBC.js @@ -80,8 +80,8 @@ App.SecExp.generalBC = function() { active: V.secBots.active || V.arcologyUpgrade.drones > 0 ? 1 : 0, ID: -1, isDeployed: V.secBots.isDeployed || 0, - troops: Math.max(V.secBots.troops, V.arcologyUpgrade.drones > 0 ? 30 : 0), - maxTroops: Math.max(V.secBots.maxTroops, V.arcologyUpgrade.drones > 0 ? 30 : 0) + troops: Math.max(V.secBots.troops || 0, V.arcologyUpgrade.drones > 0 ? 30 : 0), + maxTroops: Math.max(V.secBots.maxTroops || 0, V.arcologyUpgrade.drones > 0 ? 30 : 0) }); /* if (V.secBots) { V.SecExp.units.bots = V.secBots; @@ -161,7 +161,7 @@ App.SecExp.generalBC = function() { V.SecExp.core.security = V.SecExp.security.cap; delete V.SecExp.security; } - V.SecExp.core.totalKills = V.SecExp.core.totalKills || V.totalKills || 0; + V.SecExp.core.totalKills = +V.SecExp.core.totalKills || V.totalKills || 0; if (V.week === 1 || !jsDef(V.SecExp.core.crimeLow)) { V.SecExp.core.crimeLow = 30; @@ -306,37 +306,25 @@ App.SecExp.generalBC = function() { /* V.SecExp.rebellions.repairTime = V.SecExp.rebellions.repairTime || {}; V.SecExp.rebellions.repairTime.waterway = V.SecExp.rebellions.repairTime.waterway || 0; - if (V.garrison && V.garrison.waterwayTime) { - V.SecExp.rebellions.repairTime.waterway = V.garrison.waterwayTime; - } V.SecExp.rebellions.repairTime.assistant = V.SecExp.rebellions.repairTime.assistant || 0; - if (V.garrison && V.garrison.assistantTime) { - V.SecExp.rebellions.repairTime.assistant = V.garrison.assistantTime; - } V.SecExp.rebellions.repairTime.reactor = V.SecExp.rebellions.repairTime.reactor || 0; - if (V.garrison && V.garrison.reactorTime) { - V.SecExp.rebellions.repairTime.reactor = V.garrison.reactorTime; - } V.SecExp.rebellions.repairTime.arc = V.SecExp.rebellions.repairTime.arc || 0; - if (V.arcRepairTime) { + if (jsDef(V.garrison)) { + V.SecExp.rebellions.repairTime.waterway = V.garrison.waterwayTime; + V.SecExp.rebellions.repairTime.assistant = V.garrison.assistantTime; + V.SecExp.rebellions.repairTime.reactor = V.garrison.reactorTime; V.SecExp.rebellions.repairTime.arc = V.arcRepairTime; } V.SecExp.rebellions.garrison = V.SecExp.rebellions.garrison || {}; V.SecExp.rebellions.garrison.penthouse = V.SecExp.rebellions.garrison.penthouse || 0; - if (V.garrison && V.garrison.penthouse) { - V.SecExp.rebellions.garrison.penthouse = V.garrison.penthouse; - } V.SecExp.rebellions.garrison.reactor = V.SecExp.rebellions.garrison.reactor || 0; - if (V.garrison && V.garrison.reactor) { - V.SecExp.rebellions.garrison.reactor = V.garrison.reactor; - } V.SecExp.rebellions.garrison.assistant = V.SecExp.rebellions.garrison.assistant || 0; - if (V.garrison && V.garrison.assistant) { - V.SecExp.rebellions.garrison.assistant = V.garrison.assistant; - } V.SecExp.rebellions.garrison.waterway = V.SecExp.rebellions.garrison.waterway || 0; - if (V.garrison && V.garrison.waterway) { + if (jsDef(V.garrison)) { + V.SecExp.rebellions.garrison.penthouse = V.garrison.penthouse; + V.SecExp.rebellions.garrison.reactor = V.garrison.reactor; + V.SecExp.rebellions.garrison.assistant = V.garrison.assistant; V.SecExp.rebellions.garrison.waterway = V.garrison.waterway; } */ diff --git a/src/Mods/SecExp/widgets/miscSecExpWidgets.tw b/src/Mods/SecExp/widgets/miscSecExpWidgets.tw index 23f8b40b0e7..f2e993457f0 100644 --- a/src/Mods/SecExp/widgets/miscSecExpWidgets.tw +++ b/src/Mods/SecExp/widgets/miscSecExpWidgets.tw @@ -1,9 +1,6 @@ :: miscSecExpWidgets [widget nobr] <<widget "fixBrokenStats">> - <<if !Number.isInteger($SecExp.core.totalKills)>> - <<set $SecExp.core.totalKills = 0>> - <</if>> <<if !Number.isInteger($mercTotalCasualties)>> <<set $mercTotalCasualties = 0>> <</if>> -- GitLab