-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e324643
commit 359ff29
Showing
8 changed files
with
571 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,242 @@ | ||
## Ignore Visual Studio temporary files, build results, and | ||
## files generated by popular Visual Studio add-ons. | ||
|
||
# User-specific files | ||
*.suo | ||
*.user | ||
*.userosscache | ||
*.sln.docstates | ||
|
||
# User-specific files (MonoDevelop/Xamarin Studio) | ||
*.userprefs | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
[Rr]elease/ | ||
[Rr]eleases/ | ||
[Xx]64/ | ||
[Xx]86/ | ||
[Bb]uild/ | ||
bld/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
|
||
# Visual Studio 2015 cache/options directory | ||
.vs/ | ||
# Uncomment if you have tasks that create the project's static files in wwwroot | ||
#wwwroot/ | ||
|
||
# MSTest test Results | ||
[Tt]est[Rr]esult*/ | ||
[Bb]uild[Ll]og.* | ||
|
||
# NUNIT | ||
*.VisualState.xml | ||
TestResult.xml | ||
|
||
# Build Results of an ATL Project | ||
[Dd]ebugPS/ | ||
[Rr]eleasePS/ | ||
dlldata.c | ||
|
||
# DNX | ||
project.lock.json | ||
artifacts/ | ||
|
||
*_i.c | ||
*_p.c | ||
*_i.h | ||
*.ilk | ||
*.meta | ||
*.obj | ||
*.pch | ||
*.pdb | ||
*.pgc | ||
*.pgd | ||
*.rsp | ||
*.sbr | ||
*.tlb | ||
*.tli | ||
*.tlh | ||
*.tmp | ||
*.tmp_proj | ||
*.log | ||
*.vspscc | ||
*.vssscc | ||
.builds | ||
*.pidb | ||
*.svclog | ||
*.scc | ||
|
||
# Chutzpah Test files | ||
_Chutzpah* | ||
|
||
# Visual C++ cache files | ||
ipch/ | ||
*.aps | ||
*.ncb | ||
*.opendb | ||
*.opensdf | ||
*.sdf | ||
*.cachefile | ||
*.VC.db | ||
|
||
# Visual Studio profiler | ||
*.psess | ||
*.vsp | ||
*.vspx | ||
*.sap | ||
|
||
# TFS 2012 Local Workspace | ||
$tf/ | ||
|
||
# Guidance Automation Toolkit | ||
*.gpState | ||
|
||
# ReSharper is a .NET coding add-in | ||
_ReSharper*/ | ||
*.[Rr]e[Ss]harper | ||
*.DotSettings.user | ||
|
||
# JustCode is a .NET coding add-in | ||
.JustCode | ||
|
||
# TeamCity is a build add-in | ||
_TeamCity* | ||
|
||
# DotCover is a Code Coverage Tool | ||
*.dotCover | ||
|
||
# NCrunch | ||
_NCrunch_* | ||
.*crunch*.local.xml | ||
nCrunchTemp_* | ||
|
||
# MightyMoose | ||
*.mm.* | ||
AutoTest.Net/ | ||
|
||
# Web workbench (sass) | ||
.sass-cache/ | ||
|
||
# Installshield output folder | ||
[Ee]xpress/ | ||
|
||
# DocProject is a documentation generator add-in | ||
DocProject/buildhelp/ | ||
DocProject/Help/*.HxT | ||
DocProject/Help/*.HxC | ||
DocProject/Help/*.hhc | ||
DocProject/Help/*.hhk | ||
DocProject/Help/*.hhp | ||
DocProject/Help/Html2 | ||
DocProject/Help/html | ||
|
||
# Click-Once directory | ||
publish/ | ||
|
||
# Publish Web Output | ||
*.[Pp]ublish.xml | ||
*.azurePubxml | ||
|
||
# TODO: Un-comment the next line if you do not want to checkin | ||
# your web deploy settings because they may include unencrypted | ||
# passwords | ||
#*.pubxml | ||
*.publishproj | ||
|
||
# NuGet Packages | ||
*.nupkg | ||
# The packages folder can be ignored because of Package Restore | ||
**/packages/* | ||
# except build/, which is used as an MSBuild target. | ||
!**/packages/build/ | ||
# Uncomment if necessary however generally it will be regenerated when needed | ||
#!**/packages/repositories.config | ||
# NuGet v3's project.json files produces more ignoreable files | ||
*.nuget.props | ||
*.nuget.targets | ||
|
||
# Microsoft Azure Build Output | ||
csx/ | ||
*.build.csdef | ||
|
||
# Microsoft Azure Emulator | ||
ecf/ | ||
rcf/ | ||
|
||
# Windows Store app package directory | ||
AppPackages/ | ||
BundleArtifacts/ | ||
|
||
# Visual Studio cache files | ||
# files ending in .cache can be ignored | ||
*.[Cc]ache | ||
# but keep track of directories ending in .cache | ||
!*.[Cc]ache/ | ||
|
||
# Others | ||
ClientBin/ | ||
[Ss]tyle[Cc]op.* | ||
~$* | ||
*~ | ||
*.dbmdl | ||
*.dbproj.schemaview | ||
*.pfx | ||
*.publishsettings | ||
node_modules/ | ||
orleans.codegen.cs | ||
|
||
# RIA/Silverlight projects | ||
Generated_Code/ | ||
|
||
# Backup & report files from converting an old project file | ||
# to a newer Visual Studio version. Backup files are not needed, | ||
# because we have git ;-) | ||
_UpgradeReport_Files/ | ||
Backup*/ | ||
UpgradeLog*.XML | ||
UpgradeLog*.htm | ||
|
||
# SQL Server files | ||
*.mdf | ||
*.ldf | ||
|
||
# Business Intelligence projects | ||
*.rdl.data | ||
*.bim.layout | ||
*.bim_*.settings | ||
|
||
# Microsoft Fakes | ||
FakesAssemblies/ | ||
|
||
# GhostDoc plugin setting file | ||
*.GhostDoc.xml | ||
|
||
# Node.js Tools for Visual Studio | ||
.ntvs_analysis.dat | ||
|
||
# Visual Studio 6 build log | ||
*.plg | ||
|
||
# Visual Studio 6 workspace options file | ||
*.opt | ||
|
||
# Visual Studio LightSwitch build output | ||
**/*.HTMLClient/GeneratedArtifacts | ||
**/*.DesktopClient/GeneratedArtifacts | ||
**/*.DesktopClient/ModelManifest.xml | ||
**/*.Server/GeneratedArtifacts | ||
**/*.Server/ModelManifest.xml | ||
_Pvt_Extensions | ||
|
||
# LightSwitch generated files | ||
GeneratedArtifacts/ | ||
ModelManifest.xml | ||
|
||
# Paket dependency manager | ||
.paket/paket.exe | ||
|
||
# FAKE - F# Make | ||
.fake/ |
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,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.4.33213.308 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CS2Retake", "CS2Retake\CS2Retake.csproj", "{3B202901-0697-40CE-AD55-FC18A891A1F3}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{3B202901-0697-40CE-AD55-FC18A891A1F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{3B202901-0697-40CE-AD55-FC18A891A1F3}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{3B202901-0697-40CE-AD55-FC18A891A1F3}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{3B202901-0697-40CE-AD55-FC18A891A1F3}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {CE98A4EE-5C9E-4FB8-99F9-4E5DF57D3DF7} | ||
EndGlobalSection | ||
EndGlobal |
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,105 @@ | ||
using CounterStrikeSharp.API; | ||
using CounterStrikeSharp.API.Core; | ||
using CounterStrikeSharp.API.Core.Attributes; | ||
using CounterStrikeSharp.API.Core.Attributes.Registration; | ||
using CounterStrikeSharp.API.Modules.Commands; | ||
using CounterStrikeSharp.API.Modules.Entities; | ||
using CounterStrikeSharp.API.Modules.Utils; | ||
using CS2Retake.Entity; | ||
|
||
namespace CS2Retake | ||
{ | ||
public class CS2Retake : BasePlugin | ||
{ | ||
public override string ModuleName => "CS2Retake"; | ||
public override string ModuleVersion => "0.0.1"; | ||
public override string ModuleAuthor => "LordFetznschaedl"; | ||
public override string ModuleDescription => "Retake Plugin implementation for CS2"; | ||
|
||
private MapEntity _currentMap { get; set; } = null; | ||
|
||
|
||
public override void Load(bool hotReload) | ||
{ | ||
this.Log(PluginInfo()); | ||
this.Log(this.ModuleDescription); | ||
|
||
this.RegisterEventHandler<EventPlayerSpawn>(OnPlayerSpawn); | ||
|
||
if(this._currentMap == null) | ||
{ | ||
this._currentMap = new MapEntity(Server.MapName, this.ModuleDirectory); | ||
} | ||
|
||
this.RegisterListener<Listeners.OnMapStart>((mapName) => | ||
{ | ||
this._currentMap = new MapEntity(mapName, this.ModuleDirectory); | ||
}); | ||
} | ||
|
||
[ConsoleCommand("css_retakeinfo", "This command prints the plugin information")] | ||
public void OnCommandInfo(CCSPlayerController? player, CommandInfo command) | ||
{ | ||
if (player == null) | ||
{ | ||
Console.WriteLine("Command has been called by the server."); | ||
return; | ||
} | ||
|
||
player.PrintToChat(PluginInfo()); | ||
player.PrintToConsole(PluginInfo()); | ||
} | ||
|
||
[ConsoleCommand("css_retakewrite", "This command writes the spawns")] | ||
public void OnCommandWrite(CCSPlayerController? player, CommandInfo command) | ||
{ | ||
this._currentMap.WriteSpawns(); | ||
} | ||
|
||
[GameEventHandler] | ||
public HookResult OnPlayerSpawn(EventPlayerSpawn @event, GameEventInfo info) | ||
{ | ||
return HookResult.Continue; | ||
|
||
if (@event == null) | ||
{ | ||
return HookResult.Continue; | ||
} | ||
if(@event.Userid.IsValid) | ||
{ | ||
return HookResult.Continue; | ||
} | ||
|
||
|
||
var spawnPoint = this._currentMap.GetRandomSpawn((CsTeam)@event.Userid.TeamNum); | ||
|
||
var absOrigin = @event.Userid.CBodyComponent!.SceneNode!.AbsOrigin; | ||
absOrigin.X = 0; | ||
absOrigin.Y = 0; | ||
absOrigin.Z = 0; | ||
|
||
var absRotation = @event.Userid.CBodyComponent!.SceneNode!.AbsRotation; | ||
absRotation.X = 0; | ||
absRotation.Y = 0; | ||
absRotation.Z = 0; | ||
|
||
//@event.Userid.Teleport(); | ||
|
||
this.Log(@event.Userid.TeamNum.ToString()); | ||
|
||
return HookResult.Continue; | ||
} | ||
|
||
private string PluginInfo() | ||
{ | ||
return $"Plugin: {ModuleName} - Version: {ModuleVersion}"; | ||
} | ||
|
||
private void Log(string message) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.Green; | ||
Console.WriteLine(message); | ||
Console.ResetColor(); | ||
} | ||
} | ||
} |
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,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="CounterStrikeSharp.API"> | ||
<HintPath>C:/Source/CS2Plugins/lib/counterstrikesharp-with-runtime/addons/counterstrikesharp/api/CounterStrikeSharp.API.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.