Skip to content

Commit

Permalink
Massive refactors, improvements, automatic packaging
Browse files Browse the repository at this point in the history
* Completely refactored antilag's admin backend
* Added includes & common utilities
* No-op now has a status command
* Split CIs into different workflows
* It is now impossible for Antilag to false ban
* Un-bumped plugins down to SM 1.11
  • Loading branch information
Mooshua committed Feb 17, 2023
1 parent e4d707a commit f6847c2
Show file tree
Hide file tree
Showing 15 changed files with 2,689 additions and 89 deletions.
27 changes: 5 additions & 22 deletions .github/workflows/test.yml → .github/workflows/gamedata.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Test
name: Gamedata
on:
pull_request:
push:
schedule:
- cron: "0 17 * * *"
- cron: "0 0,8,16 * * *"
repository_dispatch:

jobs:
Expand Down Expand Up @@ -33,34 +33,17 @@ jobs:
shell: pwsh
run: cd test && ./test.ps1 -USE_BUILDX:$True -SUPPRESS_BUILD:$True
- name: Upload Binaries
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: binaries
path: |
test/bin
!test/bin/.gitkeep
- name: Upload Logs
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: gdc-logs
path: |
test/logs
plugins:
runs-on: ubuntu-latest
name: Build Plugins
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build Plugins
shell: pwsh
run: cd src && ./build.ps1
- name: Upload Plugins
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: plugins
path: |
src/plugins
!src/plugins/.gitkeep
test/logs
26 changes: 26 additions & 0 deletions .github/workflows/plugins.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Plugins
on:
pull_request:
push:
repository_dispatch:

jobs:
plugins:
runs-on: ubuntu-latest
name: Build Plugins
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build Plugins
shell: pwsh
run: cd src && ./build.ps1
- name: Upload Plugins
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: plugins
path: |
src/plugins
!src/plugins/.gitkeep
15 changes: 12 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# Test outputs
/test/bin/*.dll
/test/bin/*.so

# Test logs
test/output.temp
test/exporter.temp
/src/plugins/*.smx
/src/scripting/private/
test/output.temp
test/cache
test/logs
test/logs

# Plugin things
/src/plugins/*.smx
/src/scripting/private/

# Package things
package/
sourceforks.zip
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Maintained forks of various sourcemod plugins and gamedatas

## Plugins

**Current SourceMod Version:** 1.11

### Antilag
*Originally by Backwards*

Expand All @@ -17,6 +19,9 @@ You can use the cvar `sourceforks_antilag_punishment` to configure the punishmen
- **2**: Kick the cheater if they continue
- **3**: Permanently ban the cheater if they continue.

> **Note**: It is impossible for any legitimate player on a vanilla client to reach the "attempted DDOS" alert.
> If you see this, or they were banned for DDoSing, they are cheating. Period.
> It is possible, however, for the "suspicious network activity" alert to trigger on really, really bad connections on 93 tick or above servers.
### MovementUnlocker
*Originally by Peace-Maker*
Expand Down
50 changes: 50 additions & 0 deletions package.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

Write-Host ":::: =========================="
Write-Host ":::: TESTING GAMEDATA FOR CS:GO"
Write-Host ":::: =========================="

$base = Get-Location

Set-Location test
& ./test.ps1 -SUPPRESS_BUILD:$True

Write-Host ":::: ==========================="
Write-Host ":::: BUILDING INDIVIDUAL PLUGINS"
Write-Host ":::: ==========================="

Set-Location $base
Set-Location src
& ./build.ps1

Write-Host ":::: ============================"
Write-Host ":::: PACKAGING SOURCEFORKS ASSETS"
Write-Host ":::: ============================"

Set-Location $base

if (Test-Path -PathType Container package)
{
Write-Host "* Clearing old package"
Remove-Item -Path package -Recurse
}

Write-Host "* Creating package directory"
New-Item -Path package -Type Directory

Write-Host "* Creating directories"
New-Item -Path package/addons -Type Directory
New-Item -Path package/addons/sourcemod -Type Directory

Copy-Item -Recurse -Path gamedata -Destination package/addons/sourcemod
Remove-Item -Path package/addons/sourcemod/gamedata/partial -Recurse
# ^ Remove partial gamedatas

Copy-Item -Recurse -Path src/plugins -Destination package/addons/sourcemod
Copy-Item -Recurse -Path src/cfg -Destination package/

Write-Host ":::: =========================="
Write-Host ":::: COMPRESSING PACKAGE TO ZIP"
Write-Host ":::: =========================="

Compress-Archive -Force -Path package/* -DestinationPath sourceforks.zip
Write-Host "* Done!"
2 changes: 1 addition & 1 deletion src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM alpine AS sourcemod_huge

RUN wget -c https://sm.alliedmods.net/smdrop/1.12/sourcemod-1.12.0-git6982-linux.tar.gz -O - | tar -xz
RUN wget -c https://sm.alliedmods.net/smdrop/1.11/sourcemod-1.11.0-git6931-linux.tar.gz -O - | tar -xz

FROM bitnami/minideb:bullseye as sourcemod

Expand Down
8 changes: 8 additions & 0 deletions src/cfg/sourcemod/sourceforks_antilag.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This file was auto-generated by SourceMod (v1.12.0.6968)
// ConVars for plugin "sourceforks_antilag.smx"


// 0 = None, 1 = Alert Admins, 2 = Kick, 3 = Permanent Ban (Default)
// -
// Default: "3"
sourceforks_antilag_punishment "3"
50 changes: 50 additions & 0 deletions src/scripting/include/admin_utils.sp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Utilities to assist with printing messages to admins

#include <multicolors>
#include <sourcemod>

#define BUFFER_SIZE 512

stock void PrintToAdmins(const char[] format, AdminFlag flags, ...)
{
char buffer[BUFFER_SIZE];
VFormat(buffer, sizeof(buffer), format, 3);

PrintToServer("[SourceForks Server]: %s", buffer);

for (int admin = 1; admin < MAXPLAYERS; admin++)
{
if (!CheckCommandAccess(admin, "", int:flags, true))
continue;

PrintToChat(admin, "[SourceForks]: %s", buffer);
}
}

stock void CPrintToAdmins(const char[] in_format, AdminFlag flags, ...)
{
char buffer[BUFFER_SIZE];
char format[BUFFER_SIZE];

strcopy(format, sizeof(format), in_format);
// Consume buffer early to print to server
{
CRemoveTags(format, sizeof(format));
VFormat(buffer, sizeof(buffer), format, 3);
PrintToServer("[SourceForks Server]: %s", buffer);
}
strcopy(format, sizeof(format), in_format);

// Now do color formatting
{
CFormatColor(format, sizeof(format), -1);
VFormat(buffer, sizeof(buffer), format, 3);
}
for (int admin = 1; admin < MAXPLAYERS; admin++)
{
if (!CheckCommandAccess(admin, "", int:flags, true))
continue;

PrintToChat(admin, "[SourceForks]: %s", buffer);
}
}
Loading

0 comments on commit f6847c2

Please sign in to comment.