From 7670fc7859cb9111fc2ccfbe7cdfe5b99a6e74c0 Mon Sep 17 00:00:00 2001 From: Mmtrx Date: Mon, 25 Sep 2023 21:37:35 +0200 Subject: [PATCH] v1.2.8.2 - Save NPC farmland owners to farmland.xml (#153). - Insta-ferment only in debug mode (#158) - Support chaff mission --- betterContracts.lua | 4 ++++ l10n/l10n_br.xml | 2 ++ l10n/l10n_cs.xml | 2 ++ l10n/l10n_cz.xml | 2 ++ l10n/l10n_da.xml | 2 ++ l10n/l10n_de.xml | 6 ++++-- l10n/l10n_en.xml | 2 ++ l10n/l10n_fr.xml | 2 ++ l10n/l10n_it.xml | 2 ++ l10n/l10n_jp.xml | 2 ++ l10n/l10n_pl.xml | 2 ++ l10n/l10n_ru.xml | 2 ++ modDesc.xml | 17 ++++++++++++++++- scripts/gui.lua | 6 +++++- scripts/options.lua | 28 +++++++++++++++++++++++++++- scripts/userint.lua | 2 +- 16 files changed, 77 insertions(+), 6 deletions(-) diff --git a/betterContracts.lua b/betterContracts.lua index 0ddd3d8..a80446f 100644 --- a/betterContracts.lua +++ b/betterContracts.lua @@ -60,6 +60,8 @@ -- Add 240er bales to Kuhn sw4014 wrapper -- v1.2.8.0 03.08.2023 Sort per NPC and contract value. Allow Göweil mission bales. -- Allow mowers/ swathers on harvest missions. Tweak plow reward (#137) +-- v1.2.8.1 17.08.2023 save NPC farmland owners to farmland.xml (#153). +-- v1.2.8.2 22.09.2023 support chaff mission. Insta-ferment only in debug mode (#158) --======================================================================================================= SC = { FERTILIZER = 1, -- prices index @@ -168,6 +170,7 @@ function catMissionTypes(self) addMapping("destructibleRocks","destructibleRockMission_title", SC.OTHER) -- Platinum DLC mission by Giants addMapping("roll","helpLine_ImproveYield_Rolling", SC.SIMPLE) -- roller mission by tn4799 addMapping("lime","helpLine_ImproveYield_Liming", SC.SPREAD) -- lime mission by Mmtrx + addMapping("chaff","bc_jobType_chaff", SC.HARVEST) -- chaff mission by Mmtrx for _, missionType in pairs(g_missionManager.missionTypes) do if self.typeToCat[missionType.typeId] == nil then addMapping(missionType.name, SC.OTHER) -- default category for not registered mission types @@ -515,6 +518,7 @@ function BetterContracts:initialize() Utility.appendedFunction(FarmStats,"loadFromXMLFile",loadFromXML) Utility.appendedFunction(Farm,"writeStream",farmWrite) Utility.appendedFunction(Farm,"readStream",farmRead) + Utility.overwrittenFunction(FarmlandManager, "saveToXMLFile", farmlandManagerSaveToXMLFile) -- to adjust contracts reward / vehicle lease values: Utility.overwrittenFunction(AbstractFieldMission,"getReward",getReward) diff --git a/l10n/l10n_br.xml b/l10n/l10n_br.xml index 92e86a7..52e2812 100644 --- a/l10n/l10n_br.xml +++ b/l10n/l10n_br.xml @@ -23,6 +23,8 @@ + + diff --git a/l10n/l10n_cs.xml b/l10n/l10n_cs.xml index 8de211e..36bfdb2 100644 --- a/l10n/l10n_cs.xml +++ b/l10n/l10n_cs.xml @@ -14,6 +14,8 @@ + + diff --git a/l10n/l10n_cz.xml b/l10n/l10n_cz.xml index 6560a82..78809b5 100644 --- a/l10n/l10n_cz.xml +++ b/l10n/l10n_cz.xml @@ -24,6 +24,8 @@ + + diff --git a/l10n/l10n_da.xml b/l10n/l10n_da.xml index 74a6130..5e8d1da 100644 --- a/l10n/l10n_da.xml +++ b/l10n/l10n_da.xml @@ -14,6 +14,8 @@ + + diff --git a/l10n/l10n_de.xml b/l10n/l10n_de.xml index 72da433..ca90fd9 100644 --- a/l10n/l10n_de.xml +++ b/l10n/l10n_de.xml @@ -13,8 +13,10 @@ - - + + + + diff --git a/l10n/l10n_en.xml b/l10n/l10n_en.xml index f3d1b26..17b4910 100644 --- a/l10n/l10n_en.xml +++ b/l10n/l10n_en.xml @@ -14,6 +14,8 @@ + + diff --git a/l10n/l10n_fr.xml b/l10n/l10n_fr.xml index d5716bf..372c90c 100644 --- a/l10n/l10n_fr.xml +++ b/l10n/l10n_fr.xml @@ -24,6 +24,8 @@ + + diff --git a/l10n/l10n_it.xml b/l10n/l10n_it.xml index 916550e..5b22341 100644 --- a/l10n/l10n_it.xml +++ b/l10n/l10n_it.xml @@ -24,6 +24,8 @@ + + diff --git a/l10n/l10n_jp.xml b/l10n/l10n_jp.xml index f9c9047..18127ed 100644 --- a/l10n/l10n_jp.xml +++ b/l10n/l10n_jp.xml @@ -19,6 +19,8 @@ + + diff --git a/l10n/l10n_pl.xml b/l10n/l10n_pl.xml index 5bf20e4..6e74639 100644 --- a/l10n/l10n_pl.xml +++ b/l10n/l10n_pl.xml @@ -13,6 +13,8 @@ + + diff --git a/l10n/l10n_ru.xml b/l10n/l10n_ru.xml index e729559..86fe9ee 100644 --- a/l10n/l10n_ru.xml +++ b/l10n/l10n_ru.xml @@ -24,6 +24,8 @@ + + diff --git a/modDesc.xml b/modDesc.xml index 1ba3d7e..f275411 100644 --- a/modDesc.xml +++ b/modDesc.xml @@ -1,7 +1,7 @@  Mmtrx - 1.2.8.0 + 1.2.8.2 <en>Better Contracts</en> @@ -24,6 +24,11 @@ Disclaimer: All values shown in details display are ESTIMATES. You should not ta The mod keeps track of the amount of contracts you completed for each of the NPC farmers (number of completed jobs is displayed below the farmers image, if "Details" on). If you enable the optional discount mode or hard mode options (on the mods settings page), the amount of completed jobs influence gameplay. +Changelog v1.2.8.2 +- Save NPC farmland owners to farmland.xml (#153). +- Insta-ferment only in debug mode (#158) +- Support chaff mission + Changelog v1.2.8.0 - Tweak plow reward. Sort per NPC and contract value (#137) - Allow mowers/ swathers on harvest missions (#137) @@ -112,6 +117,16 @@ Warnung: Alle in der Detailanzeige angegebenen Werte sind GESCHÄTZT. Sie sollte Die Mod merkt sich die Anzahl Verträge, die Sie für jeden der NPC Farmer abgeschlossen haben (die Zahl wird unter dem Bild des Farmers angezeigt, wenn "Details" an ist). Wenn der optionale Discount Modus oder der Hard Modus aktiviert wird, beeinflusst die Anzahl abgeschlossener Jobs das Spielgeschehen. +Changelog v1.2.8.2 +- NPC Farmland-Besitzer speichern, damit nach Restart ein Feld noch den selben Besitzer hat (#153). +- Schnell-gären nur noch im debug mode (#158) +- Unterstützung für Häckselaufträge (FS22_ChaffMissions) + +Changelog v1.2.8.0 +- Tweak plow reward. Sort per NPC and contract value (#137) +- Allow mowers/ swathers on harvest missions (#137) +- Allow Göweil mission bales (#144) + Changelog v1.2.7.9 - Gepackte 240er Ballen können mit dem im Mod enthaltenen arcusin Multipack D14 nun auch bei Gras-Missionen verwendet werden (#131) - Kuhn sw4014 Ballenwickler (im Mod) verarbeitet auch gepackte 240er Ballen diff --git a/scripts/gui.lua b/scripts/gui.lua index 896f472..6119696 100644 --- a/scripts/gui.lua +++ b/scripts/gui.lua @@ -443,7 +443,11 @@ function populateCell(frCon, list, sect, index, cell) if cat == SC.HARVEST and cont ~= nil then -- overwrite "contract" with fruittype to harvest local fruit = cell:getAttribute("contract") - fruit:setText(g_i18n:getText("bc_harvest").. cont.ftype) + local txt = string.format(g_i18n:getText("bc_harvest"), cont.ftype) + if m.type.name == "chaff" then + txt = string.format(g_i18n:getText("bc_chaff"), self.ft[m.orgFillType].title) + end + fruit:setText(txt) end end profit:setVisible(showProf) diff --git a/scripts/options.lua b/scripts/options.lua index 8f65af4..b68c51e 100644 --- a/scripts/options.lua +++ b/scripts/options.lua @@ -236,7 +236,7 @@ function updateDetails(self, section, index) -- toggle standard / enhanced progress bars bc:showProgressBars(contract, not noActive and - table.hasElement({"harvest","mow_bale"}, mission.type.name)) + table.hasElement({"harvest","mow_bale", "chaff"}, mission.type.name)) if noActive then return end -- update display for active contracts @@ -504,6 +504,31 @@ function BetterContracts:onFarmlandStateChanged(landId, farmId) farm.stats.npcJobs[npcIndex] = 0 end end +function farmlandManagerSaveToXMLFile(self, superf, xmlFilename) + local xmlFile = createXMLFile("farmlandsXML", xmlFilename, "farmlands") + if xmlFile ~= nil then + local index = 0 + + for farmlandId, farmId in pairs(self.farmlandMapping) do + local farmlandKey = string.format("farmlands.farmland(%d)", index) + + setXMLInt(xmlFile, farmlandKey .. "#id", farmlandId) + setXMLInt(xmlFile, farmlandKey .. "#farmId", Utils.getNoNil(farmId, FarmlandManager.NO_OWNER_FARM_ID)) + local farmland = self.farmlands[farmlandId] + if farmland ~= nil then + setXMLInt(xmlFile, farmlandKey .. "#npcIndex", farmland.npcIndex) + end + index = index + 1 + end + + saveXMLFile(xmlFile) + delete(xmlFile) + + return true + end + + return false +end ---------------------------------------- function renderIcon(self, x, y, rot) -- appended to FieldHotspot:render() @@ -522,6 +547,7 @@ function renderIcon(self, x, y, rot) if icon == nil then if typeName == "cultivate" or typeName=="roll" then other = "plow" elseif typeName=="spray" or typeName=="lime" then other = "fertilize" + elseif typeName=="chaff" then other = "harvest" elseif typeName=="mow_bale" then other = "hay" if mission.fillType == FillType.SILAGE then other = "silage" diff --git a/scripts/userint.lua b/scripts/userint.lua index d5c003a..491fa73 100644 --- a/scripts/userint.lua +++ b/scripts/userint.lua @@ -307,7 +307,7 @@ function BaleActivatable:getIsActivatable() self.action = BC_Action.BC_CUT return true end - if self.bale:getIsFermenting() then + if BetterContracts.config.debug and self.bale:getIsFermenting() then self.activateText = g_i18n:getText("bc_ferment") self.action = BC_Action.BC_FERMENT return true