-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from oscar-wos/beam
Config + Beams
- Loading branch information
Showing
14 changed files
with
408 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,8 +47,8 @@ jobs: | |
|
||
- name: Create Directories | ||
run: | | ||
mkdir -p ./plugin/plugins/${{ github.event.repository.name }} | ||
mkdir -p ./plugin/shared/Menu | ||
mkdir -p plugin/plugins/${{ github.event.repository.name }} | ||
mkdir -p plugin/shared/Menu | ||
- name: Move Files | ||
run: | | ||
|
@@ -61,25 +61,27 @@ jobs: | |
- name: Zip | ||
run: | | ||
cd ./plugin/ | ||
cd ./plugin | ||
zip -r ${{ github.event.repository.name }}-${{ github.sha }}.zip . | ||
- name: Extract version and create tag | ||
- name: Extract version | ||
id: extract_version | ||
run: | | ||
version=$(grep -oP 'public override string ModuleVersion => "\K(.*)(?=";)' ./src/Globals.cs) | ||
echo "Version found: $version" | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions" | ||
git tag $version | ||
git push origin $version | ||
echo "::set-output name=version::$version" | ||
- name: Publish | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ github.event.repository.name }}-${{ github.sha }} | ||
path: plugin | ||
path: ./plugin | ||
|
||
- name: Create Tag | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions" | ||
git tag ${{ env.version }} | ||
git push origin ${{ env.version }} | ||
- name: Create Release | ||
id: create_release | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using CounterStrikeSharp.API.Core; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace AntiRush; | ||
|
||
public class AntiRushConfig : BasePluginConfig | ||
{ | ||
public override int Version { get; set; } = 3; | ||
[JsonPropertyName("Messages")] public string Messages { get; set; } = "simple"; | ||
[JsonPropertyName("DrawZones")] public bool DrawZones { get; set; } = false; | ||
[JsonPropertyName("Warmup")] public bool Warmup { get; set; } = false; | ||
[JsonPropertyName("NoRushTime")] public int NoRushTime { get; set; } = 0; | ||
[JsonPropertyName("NoCampTime")] public int NoCampTime { get; set; } = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using CounterStrikeSharp.API; | ||
using CounterStrikeSharp.API.Core; | ||
using CounterStrikeSharp.API.Modules.Admin; | ||
|
||
namespace AntiRush; | ||
|
||
public static class ControllerExtends | ||
{ | ||
public static bool IsValid(this CCSPlayerController? controller, bool checkBot = false) | ||
{ | ||
if (checkBot) | ||
return controller is { IsValid: true, IsBot: false }; | ||
|
||
return controller is { IsValid: true }; | ||
} | ||
|
||
public static void Damage(this CCSPlayerController? controller, int damage) | ||
{ | ||
if (controller == null || !controller.IsValid() || controller!.PlayerPawn.Value == null) | ||
return; | ||
|
||
controller.PlayerPawn.Value.Health -= damage; | ||
Utilities.SetStateChanged(controller.PlayerPawn.Value, "CBaseEntity", "m_iHealth"); | ||
|
||
if (controller.PlayerPawn.Value.Health <= 0) | ||
controller.PlayerPawn.Value.CommitSuicide(true, true); | ||
} | ||
|
||
public static void Bounce(this CCSPlayerController? controller) | ||
{ | ||
if (controller == null || !controller.IsValid() || controller!.PlayerPawn.Value == null) | ||
return; | ||
|
||
var vel = controller.PlayerPawn.Value.AbsVelocity; | ||
var speed = Math.Sqrt(vel.X * vel.X + vel.Y * vel.Y); | ||
|
||
vel *= (-350 / (float)speed); | ||
vel.Z = vel.Z <= 0 ? 150 : Math.Min(vel.Z, 150); | ||
controller.PlayerPawn.Value.Teleport(controller.PlayerPawn.Value.AbsOrigin, controller.PlayerPawn.Value.EyeAngles, vel); | ||
} | ||
|
||
public static bool HasPermission(this CCSPlayerController? controller, string permission) | ||
{ | ||
return controller != null && controller.IsValid() && AdminManager.PlayerHasPermissions(controller, permission); | ||
} | ||
} |
Oops, something went wrong.