Skip to content

Commit

Permalink
Sync settings in multiplayer
Browse files Browse the repository at this point in the history
  • Loading branch information
schliesser committed Dec 24, 2021
1 parent 3edea46 commit 0bd820d
Show file tree
Hide file tree
Showing 8 changed files with 288 additions and 227 deletions.
4 changes: 2 additions & 2 deletions gui/AtbGeneralFrame.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@
<GuiElement type="text" profile="settingsMenuSubtitle" text="$l10n_ATB_sub_farms" />

<GuiElement type="empty" profile="ingameMenuGameSettingsTextInputWrapper">
<GuiElement type="textInput" profile="ingameMenuGameSettingsTextInput" id="farmsLoanMin" onEscPressed="onEscPressed" onEnterPressed="onEnterPressed" imeKeyboardType="numeric" imeTitle="Minimal Loan" imeDescription="Minimal Loan for farms (Default: 500,000)" imePlaceholder="Place Holder lol" />
<GuiElement type="textInput" profile="ingameMenuGameSettingsTextInput" id="farmsLoanMin" onEscPressed="onEscPressed" onEnterPressed="onEnterPressed" imeKeyboardType="numeric" />
<GuiElement type="text" profile="multiTextOptionSettingsTitle" text="$l10n_ATB_title_loanMin"/>
<GuiElement type="text" profile="multiTextOptionSettingsTooltip" text="$l10n_ATB_tip_loanMin" />
</GuiElement>

<GuiElement type="empty" profile="ingameMenuGameSettingsTextInputWrapper">
<GuiElement type="textInput" profile="ingameMenuGameSettingsTextInput" id="farmsLoanMax" onEscPressed="onEscPressed" onEnterPressed="onEnterPressed" imeKeyboardType="numeric" imeTitle="Maximum Loan" imeDescription="Maximum loan for farms (Default: 500,000)" imePlaceholder="Place Holder2 lol" />
<GuiElement type="textInput" profile="ingameMenuGameSettingsTextInput" id="farmsLoanMax" onEscPressed="onEscPressed" onEnterPressed="onEnterPressed" imeKeyboardType="numeric" />
<GuiElement type="text" profile="multiTextOptionSettingsTitle" text="$l10n_ATB_title_loanMax"/>
<GuiElement type="text" profile="multiTextOptionSettingsTooltip" text="$l10n_ATB_tip_loanMax" />
</GuiElement>
Expand Down
26 changes: 26 additions & 0 deletions runMP.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@ECHO off

SET gameProfile="G:\Dokumente\My Games\FarmingSimulator2022\"

@REM Pack mod
CALL pack.cmd

IF %ERRORLEVEL% NEQ 0 ( exit 1 )

ECHO Copy file to mod folder
COPY %filename% %gameProfile%mods\
ECHO Copy file to remote PC
COPY %filename% \\DESKTOP-4IT0MJR\FarmingSimulator2022\mods\


@REM ECHO Starting game ...
@REM start steam://rungameid/1248130
@REM "C:\Program Files (x86)\Steam\steam.exe" -applaunch 1248130 -cheats -autoStartSavegameId 2

ECHO Happy Testing: %modName%

@REM Available FS19 start params
@REM -cheats (enables cheats in the console)
@REM -autoStartSavegameId 3 (loads the savegame automatically | *Replace "3" with the savegame ID of your choice)
@REM -restart (prevents intro videos from playing | will also keep logging the game to the logfile)
@REM -disableFramerateLimiter (removes the FPS cap | not recommended )
14 changes: 7 additions & 7 deletions scripts/AtbOverrides.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
AtbOverrides = {}

function AtbOverrides:storeLease(storeItem, vehicle, saleItem)
storeItem.allowLeasing = g_adminToolBox.settings:getValue(AtbSettings.SETTING.STORE_LEASING)
storeItem.allowLeasing = g_atb.settings:getValue(AtbSettings.SETTING.STORE_LEASING)
end

function AtbOverrides:missionLease()
return self.vehiclesToLoad ~= nil and g_adminToolBox.settings:getValue(AtbSettings.SETTING.MISSIONS_LEASING)
return self.vehiclesToLoad ~= nil and g_atb.settings:getValue(AtbSettings.SETTING.MISSIONS_LEASING)
end

function AtbOverrides:getCanSleep()
return not self.isSleeping and g_adminToolBox.settings:getValue(AtbSettings.SETTING.GENERAL_SLEEP)
return not self.isSleeping and g_atb.settings:getValue(AtbSettings.SETTING.GENERAL_SLEEP)
end

function AtbOverrides:openShop(guiName)
Expand All @@ -18,7 +18,7 @@ function AtbOverrides:openShop(guiName)
end

-- general enable/disable of the shop
if not g_adminToolBox.settings:getValue(AtbSettings.SETTING.STORE_ACTIVE) then
if not g_atb.settings:getValue(AtbSettings.SETTING.STORE_ACTIVE) then
g_gui:showGui("")
g_gui:showInfoDialog({
text = g_i18n:getText("ATB_storeDialogDisabled")
Expand All @@ -27,8 +27,8 @@ function AtbOverrides:openShop(guiName)
end

-- closed by time
local openTime = g_adminToolBox.settings:getValue(AtbSettings.SETTING.STORE_OPEN_TIME)
local closeTime = g_adminToolBox.settings:getValue(AtbSettings.SETTING.STORE_CLOSE_TIME)
local openTime = g_atb.settings:getValue(AtbSettings.SETTING.STORE_OPEN_TIME)
local closeTime = g_atb.settings:getValue(AtbSettings.SETTING.STORE_CLOSE_TIME)
if not (g_currentMission.environment.currentHour >= openTime and g_currentMission.environment.currentHour < closeTime) then
g_gui:showGui("")
g_gui:showInfoDialog({
Expand All @@ -40,7 +40,7 @@ end
-- check if vehicle switching is allowed
function AtbOverrides:onSwitchVehicle(_, _, directionValue)
if not self.isPlayerFrozen and self.isRunning then
if g_adminToolBox.settings:getValue(AtbSettings.SETTING.VEHICLE_TABBING) then
if g_atb.settings:getValue(AtbSettings.SETTING.VEHICLE_TABBING) then
self:toggleVehicle(directionValue)
end
end
Expand Down
Loading

0 comments on commit 0bd820d

Please sign in to comment.