Skip to content

Commit

Permalink
v1.2.8.2
Browse files Browse the repository at this point in the history
- Save NPC farmland owners to farmland.xml (#153).
- Insta-ferment only in debug mode (#158)
- Support chaff mission
  • Loading branch information
Mmtrx committed Sep 25, 2023
1 parent 7f5617e commit 7670fc7
Show file tree
Hide file tree
Showing 16 changed files with 77 additions and 6 deletions.
4 changes: 4 additions & 0 deletions betterContracts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions l10n/l10n_br.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<text name="bc_discount" text=" (%d%% desconto)" />
<text name="bc_discValue" text="%s concede a você %d %% desconto para futuras compras de campo." />
<!-- Display texts -->
<text name="bc_chaff" text="Cut %s" />
<text name="bc_jobType_chaff" text="Forage" />
<text name="bc_harvest" text="Colheita de:" />
<text name="bc_leased" text="Alugado " />
<text name="bc_enoughMissions" text="Sua fazenda já tem o número máximo de contratos." />
Expand Down
2 changes: 2 additions & 0 deletions l10n/l10n_cs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<text name="bc_detailsOn" text="开启详情" />

<!-- Display texts -->
<text name="bc_chaff" text="Cut %s" />
<text name="bc_jobType_chaff" text="Forage" />
<text name="bc_harvest" text="收割" />
<text name="bc_leased" text="/租借" />
<text name="bc_enoughMissions" text="你的农场承接的合同已达到最大数量。 " />
Expand Down
2 changes: 2 additions & 0 deletions l10n/l10n_cz.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<text name="bc_discValue" text="%s vám poskytne %d %% slevu na budoucí nákupy polí." />

<!-- Display texts -->
<text name="bc_chaff" text="Cut %s" />
<text name="bc_jobType_chaff" text="Forage" />
<text name="bc_harvest" text="Skliz. " />
<text name="bc_leased" text="/ Nájem " />
<text name="bc_enoughMissions" text="Vaše farma již má maximální počet zakázek." />
Expand Down
2 changes: 2 additions & 0 deletions l10n/l10n_da.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<text name="bc_detailsOn" text="Detaljer til" />

<!-- Display texts -->
<text name="bc_chaff" text="Cut %s" />
<text name="bc_jobType_chaff" text="Forage" />
<text name="bc_harvest" text="Høst. " />
<text name="bc_leased" text="/ Leaset " />
<text name="bc_enoughMissions" text="Din gård har allerede maximum af kontrakter." />
Expand Down
6 changes: 4 additions & 2 deletions l10n/l10n_de.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
<text name="bc_detailsOff" text="Details aus" />
<text name="bc_detailsOn" text="Details an" />

<!-- Display texts -->
<text name="bc_harvest" text="Ernte " />
<!-- Display texts -->
<text name="bc_chaff" text="Häcksle %s" />
<text name="bc_jobType_chaff" text="Häckseln" />
<text name="bc_harvest" text="Ernte %s" />
<text name="bc_leased" text="/ Leased " />
<text name="bc_enoughMissions" text="Deine Farm hat bereits die maximale Zahl aktiver Lohnaufträge." />
<text name="bc_jobsCompleted" text="Anzahl erfolgreicher Jobs: %d" />
Expand Down
2 changes: 2 additions & 0 deletions l10n/l10n_en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<text name="bc_detailsOn" text="Details on" />

<!-- Display texts -->
<text name="bc_chaff" text="Cut %s" />
<text name="bc_jobType_chaff" text="Forage" />
<text name="bc_harvest" text="Harv. " />
<text name="bc_leased" text="/ Leased " />
<text name="bc_enoughMissions" text="Your farm already has the maximum number of contracts." />
Expand Down
2 changes: 2 additions & 0 deletions l10n/l10n_fr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<text name="bc_discValue" text="%s grants you %d %% discount for future field purchases." />

<!-- Display texts -->
<text name="bc_chaff" text="Hachez %s" />
<text name="bc_jobType_chaff" text="Hacheuse" />
<text name="bc_harvest" text="Réco. " />
<text name="bc_leased" text="/ Leased " />
<text name="bc_enoughMissions" text="Votre ferme a déjà maximum des contrats actifs." />
Expand Down
2 changes: 2 additions & 0 deletions l10n/l10n_it.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<text name="bc_discValue" text="%s grants you %d %% discount for future field purchases." />

<!-- Display texts -->
<text name="bc_chaff" text="Cut %s" />
<text name="bc_jobType_chaff" text="Forage" />
<text name="bc_harvest" text="Harv. " />
<text name="bc_leased" text="/ Leased " />
<text name="bc_enoughMissions" text="Your farm already has the maximum number of contracts." />
Expand Down
2 changes: 2 additions & 0 deletions l10n/l10n_jp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<text name="bc_warnCancel" text=" Contract penalty will be at least " />

<!-- discount mode -->
<text name="bc_chaff" text="Cut %s" />
<text name="bc_jobType_chaff" text="Forage" />
<text name="bc_maxJobs" text="You have reached the maximum discount for %s." />
<text name="bc_discount" text=" (%d%% discount)" />
<text name="bc_discValue" text="%s grants you %d %% discount for future field purchases." />
Expand Down
2 changes: 2 additions & 0 deletions l10n/l10n_pl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<text name="bc_detailsOff" text="Szczegóły wył." />
<text name="bc_detailsOn" text="Szczegóły wł." />

<text name="bc_chaff" text="Cut %s" />
<text name="bc_jobType_chaff" text="Forage" />
<text name="bc_harvest" text="Zbiór " />
<text name="bc_leased" text="/ Wynajęte " />
<text name="bc_enoughMissions" text="Twój gospodarstwo osiągnęło już maksymalną liczbę kontraktów." />
Expand Down
2 changes: 2 additions & 0 deletions l10n/l10n_ru.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<text name="bc_discValue" text="%s предоставляет вам скидку %d %% на будущую покупку участка." />

<!-- Display texts -->
<text name="bc_chaff" text="Cut %s" />
<text name="bc_jobType_chaff" text="Forage" />
<text name="bc_harvest" text="Собр. " />
<text name="bc_leased" text="/Аренд. техника " />
<text name="bc_enoughMissions" text="Ваша ферма уже имеет максимальное количество контрактов." />
Expand Down
17 changes: 16 additions & 1 deletion modDesc.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<modDesc descVersion="75">
<author>Mmtrx</author>
<version>1.2.8.0</version>
<version>1.2.8.2</version>
<title>
<en>Better Contracts</en>
</title>
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion scripts/gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
28 changes: 27 additions & 1 deletion scripts/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion scripts/userint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7670fc7

Please sign in to comment.