Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 24 additions & 18 deletions AssettoServer.sln
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30420.98
# Visual Studio Version 17
VisualStudioVersion = 17.9.34701.34
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssettoServer", "AssettoServer\AssettoServer.csproj", "{7FDA59D8-BF5B-4B50-8F61-37611D087D24}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssettoServer", "AssettoServer\AssettoServer.csproj", "{7FDA59D8-BF5B-4B50-8F61-37611D087D24}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscordAuditPlugin", "DiscordAuditPlugin\DiscordAuditPlugin.csproj", "{9C7F1530-DF2D-41D4-A6F1-857955106869}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscordAuditPlugin", "DiscordAuditPlugin\DiscordAuditPlugin.csproj", "{9C7F1530-DF2D-41D4-A6F1-857955106869}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SamplePlugin", "SamplePlugin\SamplePlugin.csproj", "{DAF372D3-E030-4911-8537-A55325B4F6B5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SamplePlugin", "SamplePlugin\SamplePlugin.csproj", "{DAF372D3-E030-4911-8537-A55325B4F6B5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VotingWeatherPlugin", "VotingWeatherPlugin\VotingWeatherPlugin.csproj", "{1C5C55F2-C818-4277-9DBE-0EAFF35F59AA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VotingWeatherPlugin", "VotingWeatherPlugin\VotingWeatherPlugin.csproj", "{1C5C55F2-C818-4277-9DBE-0EAFF35F59AA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiveWeatherPlugin", "LiveWeatherPlugin\LiveWeatherPlugin.csproj", "{02FEF3DC-BCEC-4888-9B4E-BDE31DD6E58D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiveWeatherPlugin", "LiveWeatherPlugin\LiveWeatherPlugin.csproj", "{02FEF3DC-BCEC-4888-9B4E-BDE31DD6E58D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WordFilterPlugin", "WordFilterPlugin\WordFilterPlugin.csproj", "{C16217E0-D82B-43EF-A5E0-836ED135AA8C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WordFilterPlugin", "WordFilterPlugin\WordFilterPlugin.csproj", "{C16217E0-D82B-43EF-A5E0-836ED135AA8C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RaceChallengePlugin", "RaceChallengePlugin\RaceChallengePlugin.csproj", "{2F522CD8-2890-4E00-97DB-4E2E1B407677}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RaceChallengePlugin", "RaceChallengePlugin\RaceChallengePlugin.csproj", "{2F522CD8-2890-4E00-97DB-4E2E1B407677}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeoIPPlugin", "GeoIPPlugin\GeoIPPlugin.csproj", "{F0F4ECA0-24FA-4913-92CB-B48A0DD129F3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeoIPPlugin", "GeoIPPlugin\GeoIPPlugin.csproj", "{F0F4ECA0-24FA-4913-92CB-B48A0DD129F3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReportPlugin", "ReportPlugin\ReportPlugin.csproj", "{AF514EA8-5FC5-4A1B-9065-EC0AD34639B1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReportPlugin", "ReportPlugin\ReportPlugin.csproj", "{AF514EA8-5FC5-4A1B-9065-EC0AD34639B1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FastLaneUtils", "FastLaneUtils\FastLaneUtils.csproj", "{12A71A2F-CB26-4452-8B24-D3DA2A32466E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FastLaneUtils", "FastLaneUtils\FastLaneUtils.csproj", "{12A71A2F-CB26-4452-8B24-D3DA2A32466E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TimeDilationPlugin", "TimeDilationPlugin\TimeDilationPlugin.csproj", "{F479976E-7BB0-49EB-A97E-5389C0601D91}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TimeDilationPlugin", "TimeDilationPlugin\TimeDilationPlugin.csproj", "{F479976E-7BB0-49EB-A97E-5389C0601D91}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoModerationPlugin", "AutoModerationPlugin\AutoModerationPlugin.csproj", "{59C320A4-11D8-4BAE-81F1-226D012F5484}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoModerationPlugin", "AutoModerationPlugin\AutoModerationPlugin.csproj", "{59C320A4-11D8-4BAE-81F1-226D012F5484}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RandomWeatherPlugin", "RandomWeatherPlugin\RandomWeatherPlugin.csproj", "{7289448F-D8EF-4EB7-AFE3-4EDB27EE75E0}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RandomWeatherPlugin", "RandomWeatherPlugin\RandomWeatherPlugin.csproj", "{7289448F-D8EF-4EB7-AFE3-4EDB27EE75E0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssettoServer.Shared", "AssettoServer.Shared\AssettoServer.Shared.csproj", "{C7A903BD-6640-460A-BDD1-DFF6FC407E31}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssettoServer.Shared", "AssettoServer.Shared\AssettoServer.Shared.csproj", "{C7A903BD-6640-460A-BDD1-DFF6FC407E31}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssettoServer.Tests", "AssettoServer.Tests\AssettoServer.Tests.csproj", "{DA97DFBB-EA56-468C-BEDE-7CBEB360DD0E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssettoServer.Tests", "AssettoServer.Tests\AssettoServer.Tests.csproj", "{DA97DFBB-EA56-468C-BEDE-7CBEB360DD0E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VotingPresetPlugin", "VotingPresetPlugin\VotingPresetPlugin.csproj", "{458FEEA8-D472-4FA9-8E50-63F04F05180A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VotingPresetPlugin", "VotingPresetPlugin\VotingPresetPlugin.csproj", "{458FEEA8-D472-4FA9-8E50-63F04F05180A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChangeWeatherPlugin", "ChangeWeatherPlugin\ChangeWeatherPlugin.csproj", "{EA2EF463-13B2-42ED-8923-1B880C44403B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -105,6 +107,10 @@ Global
{458FEEA8-D472-4FA9-8E50-63F04F05180A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{458FEEA8-D472-4FA9-8E50-63F04F05180A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{458FEEA8-D472-4FA9-8E50-63F04F05180A}.Release|Any CPU.Build.0 = Release|Any CPU
{EA2EF463-13B2-42ED-8923-1B880C44403B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA2EF463-13B2-42ED-8923-1B880C44403B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA2EF463-13B2-42ED-8923-1B880C44403B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA2EF463-13B2-42ED-8923-1B880C44403B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
12 changes: 12 additions & 0 deletions ChangeWeatherPlugin/ChangeWeatherModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using AssettoServer.Server.Plugin;
using Autofac;

namespace ChangeWeatherPlugin;

public class ChangeWeatherModule : AssettoServerModule
{
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType<ChangeWeatherPlugin>().AsSelf().AutoActivate().SingleInstance();
}
}
15 changes: 15 additions & 0 deletions ChangeWeatherPlugin/ChangeWeatherPlugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Reflection;
using AssettoServer.Server;

namespace ChangeWeatherPlugin;

public class ChangeWeatherPlugin
{
public ChangeWeatherPlugin(CSPServerScriptProvider scriptProvider)
{
scriptProvider.AddScript(
new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("ChangeWeatherPlugin.lua.change-weather.lua")!).ReadToEnd(),
"change-weather.lua"
);
}
}
35 changes: 35 additions & 0 deletions ChangeWeatherPlugin/ChangeWeatherPlugin.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EnableDynamicLoading>true</EnableDynamicLoading>
<SelfContained>false</SelfContained>
<DebugType>embedded</DebugType>
<PublishDir>..\out-$(RuntimeIdentifier)\plugins\$(MSBuildProjectName)\</PublishDir>
<PathMap>$(MSBuildProjectDirectory)=$(MSBuildProjectName)</PathMap>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>..\AssettoServer\bin\$(Configuration)\$(TargetFramework)\plugins\$(MSBuildProjectName)</OutputPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\AssettoServer.Shared\AssettoServer.Shared.csproj">
<Private>false</Private>
<ExcludeAssets>runtime</ExcludeAssets>
</ProjectReference>
<ProjectReference Include="..\AssettoServer\AssettoServer.csproj">
<Private>false</Private>
<ExcludeAssets>runtime</ExcludeAssets>
</ProjectReference>
</ItemGroup>

<ItemGroup>
<None Remove="lua\change-weather.lua" />
<EmbeddedResource Include="lua\change-weather.lua" />
</ItemGroup>

</Project>
9 changes: 9 additions & 0 deletions ChangeWeatherPlugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ChangeWeatherPlugin
Plugin to let admins change the weather with a GUI.

## Configuration
Enable the plugin in `extra_cfg.yml`
```yaml
EnablePlugins:
- ChangeWeatherPlugin
```
28 changes: 28 additions & 0 deletions ChangeWeatherPlugin/lua/change-weather.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-- Copyright 2024 <github.com/razaqq>

local selectedWeather = nil ---@type ac.WeatherType
local transitionDuration = 0.0 ---@type number

local function ChangeWeatherHUD()
ui.text('Select Weather:')

--ac.INIConfig()

ui.childWindow('##weathers', vec2(ui.availableSpaceX(), 250), function ()
for name, id in pairs(ac.WeatherType) do
if ui.selectable(name, refbool(selectedWeather == name)) then
selectedWeather = name
end
end
end)

transitionDuration = ui.slider('##someSliderID', transitionDuration, 0, 60, 'Transition Duration: %.0f mins')
end

local function ChangeWeatherHUDClosed(okClicked)
if okClicked and selectedWeather then
ac.sendChatMessage(string.format('/setcspweather %s %d', selectedWeather, transitionDuration * 60))
end
end

ui.registerOnlineExtra(ui.Icons.FastForward, 'Change Weather', nil, ChangeWeatherHUD, ChangeWeatherHUDClosed, ui.OnlineExtraFlags.Admin)