Compare commits

..

No commits in common. "3bb0fec67661132521ba419855378609cb4f14cf" and "53ae95cac5224acbdcfe44b4105de5084732c8c6" have entirely different histories.

10 changed files with 835 additions and 3614 deletions

41
.github/workflows/build.yaml vendored Normal file
View File

@ -0,0 +1,41 @@
name: Build Solution
on:
workflow_call:
inputs:
branch-postfix:
required: false
type: string
jobs:
build:
name: Build Oxide Solution
runs-on: windows-2022
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Increment Version
uses: action-pack/increment@v2
with:
name: "VERSION"
token: ${{ secrets.REPO_ACCESS_TOKEN }}
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
- name: Build Solution
run: msbuild Oxide.Rust.sln -t:rebuild -restore -property:Configuration=Release -property:Version=2.0.${{ vars.VERSION }}${{ inputs.branch-postfix }}
- name: Compress Bundles
run: |
cd src\bin\Bundle
7z a Oxide.Rust.zip .\Oxide.Rust\*
7z a Oxide.Rust-linux.zip .\Oxide.Rust-linux\*
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}
path: src\bin\Bundle\Oxide.*.zip

View File

@ -8,16 +8,14 @@ on:
jobs:
build:
name: Run Build
uses: OxideMod/Actions/.github/workflows/game-build.yaml@main
uses: ./.github/workflows/build.yaml
secrets: inherit
with:
game: "Rust"
branch-postfix: "-${{ github.ref_name }}"
secrets:
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
deploy:
name: Deploy to S3
uses: OxideMod/Actions/.github/workflows/r2-publish.yaml@main
uses: OxideMod/Actions/.github/workflows/r2-publish.yml@main
needs: build
with:
generate-filehash: true

View File

@ -8,11 +8,8 @@ on:
jobs:
build:
name: Run Build
uses: OxideMod/Actions/.github/workflows/game-build.yaml@main
with:
game: "Rust"
secrets:
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
uses: ./.github/workflows/build.yaml
secrets: inherit
release:
name: Create Release
@ -35,26 +32,3 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
See https://umod.org/games/rust for changes
update-docs:
name: Update Documentation
runs-on: ubuntu-22.04
needs: build
steps:
- name: Checkout Docs Repository
uses: actions/checkout@v4
with:
repository: ${{ github.event.repository.owner.name }}/Oxide.Docs
token: ${{ secrets.REPO_ACCESS_TOKEN }}
ref: main
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: ${{ github.event.repository.name }}-docs
- name: Commit and Push Changes
run: |
git config --global user.email github-actions@github.com
git config --global user.name github-actions
git add docs.json
git diff-index --quiet HEAD || git commit -m "Update hooks index to 2.0.${{ vars.VERSION }}"
git push

1
.gitignore vendored
View File

@ -21,7 +21,6 @@ TestResult.xml
*.nupkg
**/packages/*
**/tools/*
**/docs/*
!**/packages/build/
!**/packages/repositories.config

View File

@ -14,10 +14,9 @@
<BranchArg Condition="'$(SteamBranch)' != ''">-steam_branch $(SteamBranch)</BranchArg>
<DepotArg Condition="'$(SteamDepot)' != ''">-steam_depot $(SteamDepot)</DepotArg>
<LoginArg Condition="'$(SteamLogin)' != ''">-steam_access $(SteamLogin)</LoginArg>
<ReferencesOverrideArg Condition="'$(ReferencesOverride)' != ''">-references_override $(ReferencesOverride)</ReferencesOverrideArg>
</PropertyGroup>
<Message Text="Setting up environment for $(TargetPlatform)..." Importance="High" />
<Exec Command="$(SteamCommand) -game_name $(GameName) -dotnet $(TargetFramework) -target_dir $(TargetDir) -managed_dir $(ManagedDir) $(PlatformArg) $(DeobfArg) $(AppIdArg) $(BranchArg) $(DepotArg) $(LoginArg) $(ReferencesOverrideArg)" />
<Exec Command="$(SteamCommand) -game_name $(GameName) -dotnet $(TargetFramework) -target_dir $(TargetDir) -managed_dir $(ManagedDir) $(PlatformArg) $(DeobfArg) $(AppIdArg) $(BranchArg) $(DepotArg) $(LoginArg)" />
</Target>
<Target Name="ChangeAliasesOfStrongNameAssemblies" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences">
<ItemGroup>

View File

@ -8,8 +8,7 @@ param (
[string]$steam_appid = "0",
[string]$steam_branch = "public",
[string]$steam_depot = "",
[string]$steam_access = "anonymous",
[string]$references_override = ""
[string]$steam_access = "anonymous"
)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
@ -35,13 +34,12 @@ $resources_dir = Join-Path $root_dir "resources"
$deps_dir = Join-Path $project_dir "Dependencies"
$platform_dir = Join-Path $deps_dir $platform
$managed_dir = Join-Path $platform_dir $managed_dir # TODO: Make sure passed path is Linux-compatible
$docs_dir = Join-Path $root_dir "docs"
$patcher_exe = Join-Path $tools_dir "OxidePatcher.exe"
$references_file = Join-Path $tools_dir ".references"
New-Item "$tools_dir", "$managed_dir", "$docs_dir" -ItemType Directory -Force | Out-Null
New-Item "$tools_dir", "$managed_dir" -ItemType Directory -Force | Out-Null
# Set URLs of dependencies and tools to download
$steam_depotdl_url = "https://github.com/SteamRE/DepotDownloader/releases/download/DepotDownloader_2.5.0/depotdownloader-2.5.0.zip"
$steam_depotdl_url = "https://img.mrblue.io/ed3a2b1054f5482e95832dba85953955.zip"
$de4dot_url = "https://github.com/0xd4d/de4dot/suites/507020524/artifacts/2658127"
$patcher_url = "https://github.com/OxideMod/Oxide.Patcher/releases/download/latest/OxidePatcher.exe"
@ -80,13 +78,8 @@ function Find-Dependencies {
Write-Host "Getting references for $steam_branch branch of $steam_appid"
try {
# TODO: Exclude dependencies included in repository
if ($references_override) {
$references_override | Out-File $references_file
Write-Host "References:" ((Get-Content $references_file) -Join ', ')
} else {
($xml.selectNodes("//Reference") | Select-Object Include -ExpandProperty Include) -Replace "\S+$", "regex:$&.dll" | Out-File $references_file
Write-Host "References:" ((Get-Content $references_file).Replace('regex:', '') -Join ', ')
}
($xml.selectNodes("//Reference") | Select-Object Include -ExpandProperty Include) -Replace "\S+$", "regex:$&.dll" | Out-File $references_file
Write-Host "References:" ((Get-Content $references_file).Replace('regex:', '') -Join ', ')
} catch {
Write-Host "Error: Could not get references or none found in $project.csproj"
Write-Host $_.Exception | Format-List -Force
@ -318,7 +311,7 @@ function Start-Patcher {
if ($IsLinux) {
Start-Process mono -WorkingDirectory $managed_dir -ArgumentList "$patcher_exe -c -p `"$managed_dir`" $patcher_file" -NoNewWindow -Wait
} elseif ($IsWindows) {
Start-Process $patcher_exe -WorkingDirectory $managed_dir -ArgumentList "-c -p `"$managed_dir`" -docs $docs_dir/docs.json $patcher_file" -NoNewWindow -Wait
Start-Process $patcher_exe -WorkingDirectory $managed_dir -ArgumentList "-c -p `"$managed_dir`" $patcher_file" -NoNewWindow -Wait
}
} catch {
Write-Host "Error: Could not start or complete patching process"

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,6 @@
<ManagedDir>RustDedicated_Data/Managed</ManagedDir>
<NoWarn>NU1701</NoWarn>
<GitBranch></GitBranch>
<ReferencesOverride>regex:Managed/(.*).dll</ReferencesOverride>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Oxide.References" Version="2.0.*" />
@ -62,7 +61,7 @@
</ItemGroup>
<Target Name="AddGitBranchMeta" BeforeTargets="CoreGenerateAssemblyInfo">
<Exec Command="git name-rev --name-only HEAD" WorkingDirectory="$(MSBuildProjectDirectory)" ConsoleToMSBuild="True">
<Output TaskParameter="ConsoleOutput" PropertyName="GitBranch" />
<Output TaskParameter="ConsoleOutput" PropertyName="GitBranch"/>
</Exec>
<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="$(GitBranch) != ''">

View File

@ -319,7 +319,7 @@ namespace Oxide.Game.Rust
int number = 1;
foreach (Plugin plugin in loadedPlugins.Where(p => p.Filename != null))
{
output += $"\n {number++:00} \"{plugin.Title}\" ({plugin.Version}) by {plugin.Author} ({plugin.TotalHookTime:0.00}s / {FormatBytes(plugin.TotalHookMemory)}) - {plugin.Filename.Basename()}";
output += $"\n {number++:00} \"{plugin.Title}\" ({plugin.Version}) by {plugin.Author} ({plugin.TotalHookTime:0.00}s) - {plugin.Filename.Basename()}";
}
foreach (string pluginName in unloadedPluginErrors.Keys)
@ -330,14 +330,6 @@ namespace Oxide.Game.Rust
player.Reply(output);
}
private static string FormatBytes(long bytes)
{
if (bytes < 1024) return $"{bytes:0} B";
if (bytes < 1048576) return $"{bytes / 1024:0} KB";
if (bytes < 1073741824) return $"{bytes / 1048576:0} MB";
return $"{bytes / 1073741824:0} GB";
}
#endregion Plugins Command
#region Reload Command

View File

@ -286,16 +286,6 @@ namespace Oxide.Game.Rust
return true;
}
// Check if chat command
string chatCommandPrefix = CommandHandler.GetChatCommandPrefix(message);
if ( chatCommandPrefix != null )
{
TryRunPlayerCommand( basePlayer, message, chatCommandPrefix );
return false;
}
message = message.EscapeRichText();
// Check if using Rust+ app
if (basePlayer == null || !basePlayer.IsConnected)
{
@ -315,7 +305,8 @@ namespace Oxide.Game.Rust
/// <param name="basePlayer"></param>
/// <param name="message"></param>
/// <returns></returns>
private void TryRunPlayerCommand(BasePlayer basePlayer, string message, string commandPrefix)
[HookMethod("IOnPlayerCommand")]
private void IOnPlayerCommand(BasePlayer basePlayer, string message)
{
if (basePlayer == null)
{
@ -325,13 +316,13 @@ namespace Oxide.Game.Rust
string str = message.Replace("\n", "").Replace("\r", "").Trim();
// Check if it is a chat command
if (string.IsNullOrEmpty(str))
if (string.IsNullOrEmpty(str) || str[0] != '/' || str.Length <= 1)
{
return;
}
// Parse the command
ParseCommand(str.Substring(commandPrefix.Length), out string cmd, out string[] args);
ParseCommand(str.TrimStart('/'), out string cmd, out string[] args);
if (cmd == null)
{
return;
@ -638,5 +629,16 @@ namespace Oxide.Game.Rust
}
#endregion Server Hooks
#region Depricated Hooks
[HookMethod( "OnMapMarkerRemove" )]
private object OnMapMarkerRemove(BasePlayer player, List<ProtoBuf.MapNote> mapMarker, int index)
{
return Interface.Oxide.CallDeprecatedHook("OnMapMarkerRemove", "OnMapMarkerRemove(BasePlayer player, List<MapNote> mapMarker, int index)",
new DateTime(2023, 12, 31), player, mapMarker[index]);
}
#endregion
}
}