Skip to content

Commit

Permalink
v1.2.2.0
Browse files Browse the repository at this point in the history
-recognize conflict FS22_Contracts_Plus,
-adjust harvest keep formulas to FS22 1.3.1
-details for transport missions
  • Loading branch information
Mmtrx committed Mar 29, 2022
1 parent df594d7 commit 07a1f2c
Show file tree
Hide file tree
Showing 11 changed files with 529 additions and 453 deletions.
819 changes: 416 additions & 403 deletions betterContracts.lua

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gui/SCGui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<GuiElement type="button" profile="SeeContsortProf" id="sortprof" />
<GuiElement type="button" profile="SeeContsortpMin" id="sortpmin" />
</GuiElement>
<GuiElement type="text" profile="betterContractsLeft" position="5px 0px" text="$l10n_SC_sort" debugEnabled="false"/>
<GuiElement type="text" profile="betterContractsLeft" id="sort" position="5px 0px" text="$l10n_SC_sort" debugEnabled="false"/>
<GuiElement type="text" profile="betterContractsRight" id="helpsort" size="125px 40px" position="55px 0px" text="" debugEnabled="false"/>
</GuiElement>
</GuiElement>
Expand Down
1 change: 1 addition & 0 deletions l10n/l10n_de.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<text name="SC_usage" text="Verbrauch:" />
<text name="SC_cost" text="Materialkosten:" />
<text name="SC_togo" text="Fehlt noch:" />
<text name="SC_timeleft" text="Restzeit:" />

<!-- Sort button help text -->
<text name="SC_sortCat" text="Missionstyp" />
Expand Down
2 changes: 2 additions & 0 deletions l10n/l10n_en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
<text name="SC_usage" text="Usage:" />
<text name="SC_cost" text="Cost of material:" />
<text name="SC_togo" text="To go:" />
<text name="SC_timeleft" text="Time left:" />

<!-- Sort button help text -->
<text name="SC_sort" text="SORT" />
<text name="SC_sortCat" text="mission type" />
<text name="SC_sortProf" text="net profit" />
<text name="SC_sortpMin" text="profit per minute" />
Expand Down
5 changes: 4 additions & 1 deletion l10n/l10n_fr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@
<text name="SC_usage" text="Utilisation:" />
<text name="SC_cost" text="Coûts des équipements:" />
<text name="SC_togo" text="A venir:" />
<text name="SC_fillType" text="Produit:" />
<text name="SC_profitSupply" text="Profit:" />
<text name="SC_timeleft" text="Temps restant:" />

<!-- Sort button help text -->
<text name="SC_sortCat" text="Type / champ" />
<text name="SC_sortProf" text="Profit net" />
<text name="SC_sortpMin" text="profit par minute" />
<text name="SC_sortpMin" text="Profit par minute" />
</texts>
</l10n>
3 changes: 3 additions & 0 deletions l10n/l10n_it.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
<text name="SC_usage" text="Usage:" />
<text name="SC_cost" text="Cost of material:" />
<text name="SC_togo" text="To go:" />
<text name="SC_fillType" text="Type of goods:" />
<text name="SC_profitSupply" text="Profit:" />
<text name="SC_timeleft" text="Time left:" />

<!-- Sort button help text -->
<text name="SC_sortCat" text="mission type/ fieldnumber" />
Expand Down
3 changes: 3 additions & 0 deletions l10n/l10n_jp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
<text name="SC_usage" text="消費量:" />
<text name="SC_cost" text="負担額:" />
<text name="SC_togo" text="納品(残):" />
<text name="SC_fillType" text="Type of goods:" />
<text name="SC_profitSupply" text="Profit:" />
<text name="SC_timeleft" text="Time left:" />

<!-- Sort button help text -->
<text name="SC_sortCat" text="作業別" />
Expand Down
3 changes: 3 additions & 0 deletions l10n/l10n_pl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
<text name="SC_usage" text="Zużycie:" />
<text name="SC_cost" text="Koszt materiału:" />
<text name="SC_togo" text="Przejdź do:" />
<text name="SC_fillType" text="Type of goods:" />
<text name="SC_profitSupply" text="Profit:" />
<text name="SC_timeleft" text="Time left:" />

<!-- Sort button help text -->
<text name="SC_sortCat" text="Typ kontraktu/Nr pola" />
Expand Down
3 changes: 3 additions & 0 deletions l10n/l10n_ru.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
<text name="SC_usage" text="Расходовать:" />
<text name="SC_cost" text="Стоимость материала:" />
<text name="SC_togo" text="Необходимо доставить:" />
<text name="SC_fillType" text="Type of goods:" />
<text name="SC_profitSupply" text="Profit:" />
<text name="SC_timeleft" text="Time left:" />

<!-- Sort button help text -->
<text name="SC_sortCat" text="тип работ/ номер поля" />
Expand Down
24 changes: 22 additions & 2 deletions 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="63">
<modDesc descVersion="64">
<author>Mmtrx</author>
<version>1.2.0.2</version>
<version>1.2.2.0</version>
<title>
<en>Better Contracts</en>
</title>
Expand All @@ -23,6 +23,11 @@
- With the "Details" button you can toggle on/ off the display of additional contract information. Like cost estimates for usage material as fertilizer, herbicide, or seeds. For harvest and baling contracts, it shows the minimum amount to be delivered, and the amount that you can keep (and sell). From this it calculates the total profit value for a contract, i.e. reward minus cost for fertilize/ spray/ sow contracts, and reward plus value of kept harvest for harvest/ baling contracts. It even estimates the time you will probably need for total completion of the job, by taking into account the work speed and work width of the appropriate leasing vehicles/ tools that are offered with the contract.
Disclaimer: All values shown in details display are ESTIMATES. You should not take them absolutely, but rather as an indication of what contracts to prefer among others.
Changelog v1.2.2.0:
- Adjusted calculation of keep / deliver values for harvest / baling contracts
- Added conflicts prevention with other mods
- Added support for FS22_SupplyTransportContracts, FS22_TransportMissions
]]>
</en>
<de>
Expand All @@ -42,6 +47,11 @@ Disclaimer: All values shown in details display are ESTIMATES. You should not ta
- Mit dem "Details" Button kann die Anzeige der zusätzlichen Vertragsdetails ein- und ausgeschaltet werden. Z.B. die geschätzten Kosten des Verbrauchsmaterials (Dünger, Pflanzenschutzmittel, Saatgut). Bei Ernte- und Gras-Missionen wird die abzuliefernde Mindestmenge angezeigt, sowie die Erntemenge, die Sie behalten (und verkaufen) können. Daraus ermittelt der Mod den Gesamtertrag der Mission, also Belohnung minus Kosten für Dünge-, Spritz-, und Sähen-Verträge; und Belohnung plus Wert der behaltenen Erntemenge bei den Ernte- und Gras-Verträgen. Er schätzt sogar die Gesamtzeit, die Sie für die Erledigung des Auftrags benötigen werden, und berücksichtigt dafür Arbeitsgeschwindigkeit und Arbeitsbreite der entsprechenden Leasing-Geräte, die für den Vertrag angeboten werden.
Warnung: Alle in der Detailanzeige angegebenen Werte sind GESCHÄTZT. Sie sollten sie also nicht als absolute Zahlen verstehen, sondern als Hinweis, welche Verträge vielleicht anderen vorzuziehen sind.
Changelog v1.2.2.0:
- Berechnung der Mindestliefer- und Eigenmengen angepasst bei Ernte- und Gras-Verträgen
- Konfliktvermeidung mit anderen Mods
- Unterstützung für FS22_SupplyTransportContracts, FS22_TransportMissions
]]>
</de>
<fr>
Expand All @@ -62,6 +72,11 @@ Ce mod permet d'améliorer le système de contrat, à la fois en solo et multijo
- Affichage des détails supplémentaires des contrats directement à l'aide d'un raccourci clavier depuis le menu des contrats. En plus du type de contrat et du numéro+taille du champ, vous trouverez maintenant les coûts estimés du contrat (engrais, herbicide, semence), le surplus de récolte ou de pressage, le calcul automatique du profit net généré. Il y a même l'affichage du temps que vous passerez à réaliser le contrat avec le matériel proposé en location avec celui-ci.
Avertissement: toutes les valeurs indiquées dans l'affichage détaillé sont des ESTIMATIONS. Il ne faut donc pas les considérer comme des chiffres absolus, mais plutôt comme une indication des contrats qui pourraient être préférés à d'autres.
Changelog v1.2.2.0:
- Calcul ajusté des valeurs de conservation et de livraison pour les contrats de récolte et de mise en balles
- Ajout de la prévention des conflits avec d'autres mods
- Ajout de support pour FS22_SupplyTransportContracts, FS22_TransportMissions
]]>
</fr>
<ru>
Expand All @@ -81,6 +96,11 @@ Avertissement: toutes les valeurs indiquées dans l'affichage détaillé sont de
- Добавлено много новых комбинаций техники для контрактов
Внимание: Все значения, указанные на подробном дисплее, являются ИСКЛЮЧИТЕЛЬНЫМИ. Поэтому не следует воспринимать их как абсолютные цифры, а как указание на то, какие контракты могут быть предпочтительнее других.
Changelog v1.2.2.0:
- Adjusted calculation of keep / deliver values for harvest / baling contracts
- Added conflicts prevention with other mods
- Added support for FS22_SupplyTransportContracts, FS22_TransportMissions
]]>
</ru>
</description>
Expand Down
117 changes: 71 additions & 46 deletions scripts/gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,41 @@
-- v1.1.1.0 24.04.2021 (Mmtrx) gui enhancements: addtl details, sort buttons
-- v1.1.1.4 07.07.2021 (Mmtrx) add user-defined missionVehicles.xml, allow missions with no vehicles
-- v1.2.0.0 18.01.2022 (Mmtrx) adapt for FS22
-- v1.2.2.0 30.03.2022 recognize conflict FS22_Contracts_Plus,
-- details for transport missions
--=======================================================================================================

-------------------- Gui enhance functions ---------------------------------------------------
function onFrameOpen(self, superFunc, ...)
if BetterContracts.needsRefreshContractsConflictsPrevention then
function onFrameOpen(superself, superFunc, ...)
local self = BetterContracts
local inGameMenu = self.gameMenu
if self.needsRefreshContractsConflictsPrevention then
-- this will prevent execution of FS22_RefreshContracts code (because they check for that field to be nil)
BetterContracts.gameMenu.refreshContractsElement_Button = 1
inGameMenu.refreshContractsElement_Button = 1
end
if self.preventContractsPlus then
-- this will prevent execution of FS22_Contracts_Plus code (because they check for those fields to be nil)
inGameMenu.newContractsButton = 1
inGameMenu.clearContractsButton = 1
end
superFunc(self, ...)
BetterContracts.gameMenu.refreshContractsElement_Button = nil
superFunc(superself, ...)
inGameMenu.refreshContractsElement_Button = nil
inGameMenu.newContractsButton = nil
inGameMenu.clearContractsButton = nil

local self = BetterContracts
local inGameMenu = self.gameMenu
local parent = inGameMenu.menuButton[1].parent
-- add new buttons
if inGameMenu.newContractsButton == nil then
inGameMenu.newContractsButton = inGameMenu.menuButton[1]:clone(parent)
inGameMenu.newContractsButton.onClickCallback = onClickNewContractsCallback
inGameMenu.newContractsButton:setText(g_i18n:getText("bc_new_contracts"))
inGameMenu.newContractsButton:setInputAction("MENU_EXTRA_1")
end
if inGameMenu.clearContractsButton == nil then
inGameMenu.clearContractsButton = inGameMenu.menuButton[1]:clone(parent)
inGameMenu.clearContractsButton.onClickCallback = onClickClearContractsCallback
inGameMenu.clearContractsButton:setText(g_i18n:getText("bc_clear_contracts"))
inGameMenu.clearContractsButton:setInputAction("MENU_EXTRA_2")
if inGameMenu.newButton == nil then
inGameMenu.newButton = inGameMenu.menuButton[1]:clone(parent)
inGameMenu.newButton.onClickCallback = onClickNewContractsCallback
inGameMenu.newButton:setText(g_i18n:getText("bc_new_contracts"))
inGameMenu.newButton:setInputAction("MENU_EXTRA_1")
end
if inGameMenu.clearButton == nil then
inGameMenu.clearButton = inGameMenu.menuButton[1]:clone(parent)
inGameMenu.clearButton.onClickCallback = onClickClearContractsCallback
inGameMenu.clearButton:setText(g_i18n:getText("bc_clear_contracts"))
inGameMenu.clearButton:setInputAction("MENU_EXTRA_2")
end
if inGameMenu.detailsButton == nil then
local button = inGameMenu.menuButton[1]:clone(parent)
Expand All @@ -61,8 +70,8 @@ function onFrameClose()
local inGameMenu = g_currentMission.inGameMenu
for _, button in ipairs(
{
inGameMenu.newContractsButton,
inGameMenu.clearContractsButton,
inGameMenu.newButton,
inGameMenu.clearButton,
inGameMenu.detailsButton
}
) do
Expand All @@ -74,25 +83,25 @@ function onFrameClose()
if BetterContracts.eventExtra3 ~= nil then
g_inputBinding:removeActionEvent(BetterContracts.eventExtra3)
end
inGameMenu.newContractsButton = nil
inGameMenu.clearContractsButton = nil
inGameMenu.newButton = nil
inGameMenu.clearButton = nil
inGameMenu.detailsButton = nil
end

function onClickMenuExtra1(inGameMenu, superFunc, ...)
if superFunc ~= nil then
superFunc(inGameMenu, ...)
end
if inGameMenu.newContractsButton ~= nil then
inGameMenu.newContractsButton.onClickCallback(inGameMenu)
if inGameMenu.newButton ~= nil then
inGameMenu.newButton.onClickCallback(inGameMenu)
end
end
function onClickMenuExtra2(inGameMenu, superFunc, ...)
if superFunc ~= nil then
superFunc(inGameMenu, ...)
end
if inGameMenu.clearContractsButton ~= nil then
inGameMenu.clearContractsButton.onClickCallback(inGameMenu)
if inGameMenu.clearButton ~= nil then
inGameMenu.clearButton.onClickCallback(inGameMenu)
end
end
function onClickMenuExtra3(inGameMenu)
Expand Down Expand Up @@ -268,43 +277,59 @@ function updateFarmersBox(frCon, field, npc)
self.my.npcbox:setVisible(true)

-- handle non-field missions
if cat == SC.TRANSP then -- it's a transport/snow mission
self.my.npcbox:setVisible(false)
self.my.field:setText(g_i18n:getText("SC_fillType")) -- line 1
self.my.filltype:setText(c.ftype)
self.my.widhei:setText("") -- line 2
self.my.dimen:setText("")
self.my.line3:setText("") -- line 3
self.my.etime:setText("")
if cont.active then
self.my.line4a:setText(g_i18n:getText("SC_delivered"))
self.my.line4b:setText(g_i18n:getText("SC_togo"))
else
self.my.line4a:setText(g_i18n:getText("SC_deliver"))
self.my.line4b:setText("")
self.my.valu4b:setText("")
end
self.my.line6:setText(g_i18n:getText("SC_profitSupply"))
self.my.valu6:setText(g_i18n:formatMoney(c.profit))
self.my.ppmin:setText("")
self.my.valu7:setText("")

if cat == SC.TRANSP then -- it's a transport mission (maybe mod)
if cont.active then
self.my.valu4a:setText(string.format("%d Pal.", m.numFinished))
self.my.valu4b:setText(string.format("%d Pal.",m.numObjects - m.numFinished))
else
self.my.valu4a:setText(string.format("%d Pal.",m.numObjects))
self.my.ppmin:setText(g_i18n:getText("SC_timeleft"))
local secLeft = m.timeLeft / 1000
local hh = math.floor(secLeft / 3600)
local mm = (secLeft - 3600*hh) / 60
local ss = (mm - math.floor(mm)) *60
self.my.valu7:setText(string.format("%02d:%02d:%02d",hh,mm,ss))
end
self.my.line5:setText("")
self.my.price:setText("")
return
elseif cat == SC.SUPPLY then -- a supplyTransp mission (mod)
self.my.field:setText(g_i18n:getText("SC_fillType")) -- line 1
self.my.filltype:setText(c.ftype)
self.my.widhei:setText("") -- line 2
self.my.dimen:setText("")
self.my.line3:setText("") -- line 3
self.my.etime:setText("")
if cont.active then
self.my.line4a:setText(g_i18n:getText("SC_delivered"))
self.my.line4b:setText(g_i18n:getText("SC_togo"))
self.my.valu4a:setText(g_i18n:formatVolume(MathUtil.round(m.deliveredLiters,-2)))
self.my.valu4b:setText(g_i18n:formatVolume(MathUtil.round(m.contractLiters-m.deliveredLiters,-2)))
else
self.my.line4a:setText(g_i18n:getText("SC_deliver"))
self.my.line4b:setText("")
self.my.valu4a:setText(g_i18n:formatVolume(MathUtil.round(m.contractLiters,-2)))
self.my.valu4b:setText("")
end

self.my.line5:setText(g_i18n:getText("SC_price"))
self.my.price:setText(g_i18n:formatMoney(c.price))
self.my.line6:setText(g_i18n:getText("SC_profitSupply"))
self.my.valu6:setText(g_i18n:formatMoney(c.profit))
self.my.ppmin:setText("")
self.my.valu7:setText("")
return
end

-- handle field missions
if field ~= nil then
local text = string.format(g_i18n:getText("SC_field"), field.fieldId, g_i18n:formatArea(field.fieldArea, 2))
self.my.field:setText(text)
self.my.widhei:setText(g_i18n:getText("SC_widhei"))
self.my.ppmin:setText(g_i18n:getText("SC_profpmin"))
self.my.widhei:setText(g_i18n:getText("SC_widhei"))
self.my.ppmin:setText(g_i18n:getText("SC_profpmin"))
end
local etime = c.worktime
if cat == SC.SPREAD then
Expand Down

0 comments on commit 07a1f2c

Please sign in to comment.