start work for live radar
This commit is contained in:
parent
2542b7de12
commit
e5cd824c99
@ -284,6 +284,7 @@ namespace IW4MAdmin.Application.EventParsers
|
||||
return new GameEvent()
|
||||
{
|
||||
Type = GameEvent.EventType.Unknown,
|
||||
Data = logLine,
|
||||
Origin = Utilities.IW4MAdminClient(),
|
||||
Target = Utilities.IW4MAdminClient(),
|
||||
RequiredEntity = GameEvent.EventRequiredEntity.None
|
||||
|
@ -1,6 +1,6 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.28803.352
|
||||
VisualStudioVersion = 16.0.29009.5
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{26E8B310-269E-46D4-A612-24601F16065F}"
|
||||
EndProject
|
||||
@ -53,6 +53,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StatsWeb", "Plugins\Web\Sta
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutomessageFeed", "Plugins\AutomessageFeed\AutomessageFeed.csproj", "{F5815359-CFC7-44B4-9A3B-C04BACAD5836}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiveRadar", "Plugins\LiveRadar\LiveRadar.csproj", "{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -377,6 +379,30 @@ Global
|
||||
{F5815359-CFC7-44B4-9A3B-C04BACAD5836}.Release|x64.Build.0 = Release|Any CPU
|
||||
{F5815359-CFC7-44B4-9A3B-C04BACAD5836}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{F5815359-CFC7-44B4-9A3B-C04BACAD5836}.Release|x86.Build.0 = Release|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Prerelease|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Prerelease|Any CPU.Build.0 = Debug|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Prerelease|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Prerelease|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Prerelease|x64.ActiveCfg = Debug|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Prerelease|x64.Build.0 = Debug|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Prerelease|x86.ActiveCfg = Debug|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Prerelease|x86.Build.0 = Debug|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Release|x64.Build.0 = Release|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -392,6 +418,7 @@ Global
|
||||
{A848FCF1-8527-4AA8-A1AA-50D29695C678} = {26E8B310-269E-46D4-A612-24601F16065F}
|
||||
{776B348B-F818-4A0F-A625-D0AF8BAD3E9B} = {A848FCF1-8527-4AA8-A1AA-50D29695C678}
|
||||
{F5815359-CFC7-44B4-9A3B-C04BACAD5836} = {26E8B310-269E-46D4-A612-24601F16065F}
|
||||
{00A1FED2-2254-4AF7-A5DB-2357FA7C88CD} = {26E8B310-269E-46D4-A612-24601F16065F}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {84F8F8E0-1F73-41E0-BD8D-BB6676E2EE87}
|
||||
|
29
Plugins/LiveRadar/LiveRadar.csproj
Normal file
29
Plugins/LiveRadar/LiveRadar.csproj
Normal file
@ -0,0 +1,29 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<Version>0.1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj">
|
||||
<Private>false</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\WebfrontCore\WebfrontCore.csproj">
|
||||
<Private>false</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Web\wwwroot\images\" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="copy "$(TargetPath)" "$(SolutionDir)BUILD\Plugins"" />
|
||||
</Target>
|
||||
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<Exec Command="xcopy /S /E /H /Y /I "$(ProjectDir)Web\Views\LiveRadar" "$(SolutionDir)WebfrontCore\Views\Plugins\Radar"
xcopy /S /E /H /Y "$(ProjectDir)Web\wwwroot\images" "$(SolutionDir)WebfrontCore\wwwroot\images"" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
25
Plugins/LiveRadar/MapInfo.cs
Normal file
25
Plugins/LiveRadar/MapInfo.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace LiveRadar
|
||||
{
|
||||
public class MapInfo
|
||||
{
|
||||
public string Name { get; set; }
|
||||
// distance from the edge of the minimap image
|
||||
// to the "playable" area
|
||||
public int Top { get; set; }
|
||||
public int Bottom { get; set; }
|
||||
public int Left { get; set; }
|
||||
public int Right { get; set; }
|
||||
// maximum coordinate values for the map
|
||||
public int MaxTop { get; set; }
|
||||
public int MaxBottom { get; set; }
|
||||
public int MaxLeft { get; set; }
|
||||
public int MaxRight { get; set; }
|
||||
|
||||
public int Width => MaxLeft - MaxRight;
|
||||
public int Height => MaxTop - MaxBottom;
|
||||
}
|
||||
}
|
48
Plugins/LiveRadar/Plugin.cs
Normal file
48
Plugins/LiveRadar/Plugin.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LiveRadar
|
||||
{
|
||||
public class Plugin : IPlugin
|
||||
{
|
||||
public string Name => "Live Radar";
|
||||
|
||||
public float Version => (float)Utilities.GetVersionAsDouble();
|
||||
|
||||
public string Author => "RaidMax";
|
||||
|
||||
public Task OnEventAsync(GameEvent E, Server S)
|
||||
{
|
||||
if (E.Type == GameEvent.EventType.Unknown)
|
||||
{
|
||||
if (E.Data?.StartsWith("LiveRadar") ?? false)
|
||||
{
|
||||
var radarUpdate = RadarEvent.Parse(E.Data);
|
||||
var client = S.GetClientsAsList().First(_client => _client.NetworkId == radarUpdate.Guid);
|
||||
radarUpdate.Name = client.Name;
|
||||
client.SetAdditionalProperty("LiveRadar", radarUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task OnLoadAsync(IManager manager)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task OnTickAsync(Server S)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task OnUnloadAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
46
Plugins/LiveRadar/RadarEvent.cs
Normal file
46
Plugins/LiveRadar/RadarEvent.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace LiveRadar
|
||||
{
|
||||
public class RadarEvent
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public long Guid { get; set; }
|
||||
public Vector3 Location { get; set; }
|
||||
public Vector3 ViewAngles { get; set; }
|
||||
public string Team { get; set; }
|
||||
public int Kills { get; set; }
|
||||
public int Deaths { get; set; }
|
||||
public int Score { get; set; }
|
||||
public string Weapon { get; set; }
|
||||
public int Health { get; set; }
|
||||
public bool IsAlive { get; set; }
|
||||
public Vector3 RadianAngles => new Vector3(ViewAngles.X.ToRadians(), ViewAngles.Y.ToRadians(), ViewAngles.Z.ToRadians());
|
||||
|
||||
public static RadarEvent Parse(string input)
|
||||
{
|
||||
var items = input.Split(';').ToList();
|
||||
|
||||
var parsedEvent = new RadarEvent()
|
||||
{
|
||||
Guid = items[0].ConvertLong(),
|
||||
Location = Vector3.Parse(items[1]),
|
||||
ViewAngles = Vector3.Parse(items[2]),
|
||||
Team = items[3],
|
||||
Kills = int.Parse(items[4]),
|
||||
Deaths = int.Parse(items[5]),
|
||||
Score = int.Parse(items[6]),
|
||||
Weapon = items[7],
|
||||
Health = int.Parse(items[8]),
|
||||
IsAlive = items[9] == "1"
|
||||
};
|
||||
|
||||
return parsedEvent;
|
||||
}
|
||||
}
|
||||
}
|
59
Plugins/LiveRadar/Web/Controllers/RadarController.cs
Normal file
59
Plugins/LiveRadar/Web/Controllers/RadarController.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using WebfrontCore.Controllers;
|
||||
|
||||
namespace LiveRadar.Web.Controllers
|
||||
{
|
||||
public class RadarController : BaseController
|
||||
{
|
||||
[HttpGet]
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Map(long? serverId = null)
|
||||
{
|
||||
var map = new MapInfo()
|
||||
{
|
||||
Name = "mp_rust",
|
||||
Top = 248,
|
||||
Bottom = 212,
|
||||
Left = 314,
|
||||
Right = 167,
|
||||
MaxRight = -225,
|
||||
MaxLeft = 1809,
|
||||
MaxTop = 1641,
|
||||
MaxBottom = -469
|
||||
};
|
||||
|
||||
return Json(map);
|
||||
}
|
||||
|
||||
public IActionResult Data(long? serverId = null)
|
||||
{
|
||||
var server = serverId == null ? Manager.GetServers()[0] : Manager.GetServers().First(_server => _server.GetHashCode() == serverId);
|
||||
var radarInfo = server.GetClientsAsList().Select(_client => _client.GetAdditionalProperty<RadarEvent>("LiveRadar"));
|
||||
|
||||
return Json(radarInfo);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Update(string payload)
|
||||
{
|
||||
return Ok();
|
||||
|
||||
var radarUpdate = RadarEvent.Parse(payload);
|
||||
var client = Manager.GetActiveClients().First(_client => _client.NetworkId == radarUpdate.Guid);
|
||||
radarUpdate.Name = client.Name;
|
||||
|
||||
client.SetAdditionalProperty("LiveRadar", radarUpdate);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
122
Plugins/LiveRadar/Web/Views/LiveRadar/Index.cshtml
Normal file
122
Plugins/LiveRadar/Web/Views/LiveRadar/Index.cshtml
Normal file
@ -0,0 +1,122 @@
|
||||
@model IEnumerable<long>
|
||||
|
||||
|
||||
|
||||
<canvas id="map_canvas" style="position:absolute; z-index:1"></canvas>
|
||||
<div id="map_list" style="position:absolute">
|
||||
</div>
|
||||
|
||||
@section scripts {
|
||||
<script>
|
||||
let map = undefined;
|
||||
let radarItem = undefined;
|
||||
|
||||
function drawCircle(context, x, y, color) {
|
||||
context.beginPath();
|
||||
context.arc(x, y, 6, 0, 2 * Math.PI, false);
|
||||
context.fillStyle = color;
|
||||
context.fill();
|
||||
context.lineWidth = 3;
|
||||
context.strokeStyle = 'rgba(255, 255, 255, 0.5)';
|
||||
context.stroke();
|
||||
}
|
||||
|
||||
function drawLine(context, x1, y1, x2, y2, color) {
|
||||
context.beginPath();
|
||||
context.lineWidth = '1';
|
||||
var grad = context.createLinearGradient(x1, y1, x2, y2);
|
||||
grad.addColorStop(0, 'rgba(0, 255, 0, 0.75)');
|
||||
grad.addColorStop(0.75, 'rgba(223, 66, 244, 0.8)');
|
||||
context.strokeStyle = grad;
|
||||
context.moveTo(x1, y1);
|
||||
context.lineTo(x2, y2);
|
||||
context.stroke();
|
||||
}
|
||||
|
||||
function drawTriangle(context, v1, v2, v3, color) {
|
||||
context.beginPath();
|
||||
context.moveTo(v1.x, v1.y);
|
||||
context.lineTo(v2.x, v2.y);
|
||||
context.lineTo(v3.x, v3.y);
|
||||
|
||||
context.closePath();
|
||||
|
||||
context.fillStyle = color;
|
||||
context.fill();
|
||||
}
|
||||
|
||||
function checkCanvasSize(canvas, context, minimap, map) {
|
||||
var height = minimap.height() - map.top - map.bottom;
|
||||
var width = minimap.width() - map.left - map.right;
|
||||
if (context.canvas.height != height || context.canvas.width != width) {
|
||||
context.canvas.height = height;
|
||||
context.canvas.width = width;
|
||||
|
||||
canvas.css('position', 'absolute');
|
||||
canvas.css('left', map.left + minimap.offset().left);
|
||||
canvas.css('top', map.top + minimap.offset().top);
|
||||
}
|
||||
}
|
||||
|
||||
function calculateViewPosition(x, y, distance) {
|
||||
let nx = Math.cos(x) * Math.cos(y);
|
||||
let ny = Math.sin(x) * Math.cos(y);
|
||||
let nz = Math.sin(360.0 - y);
|
||||
|
||||
return { x: nx * distance, y: ny * distance, z: nz * distance};
|
||||
}
|
||||
|
||||
function updateRadarData() {
|
||||
$.getJSON('@Url.Action("Data", "Radar", null)', function (_radarItem) {
|
||||
radarItem = _radarItem;
|
||||
});
|
||||
}
|
||||
|
||||
function updateMap() {
|
||||
let canvas = $('#map_canvas');
|
||||
let ctx = undefined;
|
||||
let mapImage = $('#map_list');
|
||||
|
||||
if (canvas[0].getContext) {
|
||||
ctx = canvas[0].getContext('2d');
|
||||
}
|
||||
|
||||
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
||||
checkCanvasSize(canvas, ctx, mapImage, map)
|
||||
let forwardDistance = 500.0 / (map.width / canvas.width());
|
||||
let fovWidth = 32.5 / (map.width / canvas.width()) ;
|
||||
|
||||
|
||||
$.each(radarItem, function (index, value) {
|
||||
|
||||
// todo: fix this naming up
|
||||
let xPos = (map.maxLeft - value.location.y) / (map.width / canvas.width());
|
||||
let yPos = (map.maxTop - value.location.x) / (map.height / canvas.height());
|
||||
let color = value.team == 'allies' ? 'rgba(0, 122, 204, 1)' : 'rgba(255,69,69,.85)';
|
||||
let fovColor = value.team == 'allies' ? 'rgba(0, 122, 204, 0.25)' : 'rgba(255,69,69,.25)';
|
||||
|
||||
let firstVertex = calculateViewPosition(((Math.PI * 2 * 0.75) - value.radianAngles.y) - fovWidth, value.radianAngles.x, forwardDistance);
|
||||
let secondVertex = calculateViewPosition(((Math.PI * 2 * 0.75) - value.radianAngles.y) + fovWidth, value.radianAngles.x, forwardDistance);
|
||||
|
||||
drawCircle(ctx, xPos, yPos, color);
|
||||
drawTriangle(ctx, { x: xPos, y: yPos }, { x: xPos + firstVertex.x, y: yPos + firstVertex.y }, { x: xPos + secondVertex.x, y: yPos + secondVertex.y }, fovColor);
|
||||
|
||||
ctx.font = 'bold 24px segoe ui';
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = '0.5';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.fillText(value.name, xPos, yPos - 15);
|
||||
ctx.strokeText(value.name, xPos, yPos - 15);
|
||||
});
|
||||
window.requestAnimationFrame(updateMap);
|
||||
}
|
||||
|
||||
$.getJSON('@Url.Action("Map", "Radar", null)', function (_map) {
|
||||
let div = $('#map_list').append(`<img src=../images/compass_map_${_map.name}@('@')2x.png></img>`);
|
||||
map = _map
|
||||
setInterval(updateRadarData, 250);
|
||||
window.requestAnimationFrame(updateMap);
|
||||
});
|
||||
</script>
|
||||
}
|
BIN
Plugins/LiveRadar/Web/wwwroot/images/compass_map_mp_rust@2x.png
Normal file
BIN
Plugins/LiveRadar/Web/wwwroot/images/compass_map_mp_rust@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 MiB |
@ -1,4 +1,5 @@
|
||||
using SharedLibraryCore.Helpers;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Helpers;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -23,7 +24,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
|
||||
|
||||
double decayFactor = GetDecay(deltaTime);
|
||||
CurrentStrain *= decayFactor;
|
||||
double[] distance = Helpers.Extensions.AngleStuff(newAngle, LastAngle);
|
||||
double[] distance = Utilities.AngleStuff(newAngle, LastAngle);
|
||||
LastDistance = distance[0] + distance[1];
|
||||
|
||||
#if DEBUG == true
|
||||
|
@ -1,33 +0,0 @@
|
||||
using SharedLibraryCore.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IW4MAdmin.Plugins.Stats.Helpers
|
||||
{
|
||||
static class Extensions
|
||||
{
|
||||
|
||||
public static Vector3 FixIW4Angles(this Vector3 vector)
|
||||
{
|
||||
float X = vector.X >= 0 ? vector.X : 360.0f + vector.X;
|
||||
float Y = vector.Y >= 0 ? vector.Y : 360.0f + vector.Y;
|
||||
|
||||
return new Vector3(Y, X, vector.Z);
|
||||
}
|
||||
|
||||
public static float ToRadians(this float value) => (float)Math.PI * value / 180.0f;
|
||||
|
||||
public static float ToDegrees(this float value) => value * 180.0f / (float)Math.PI;
|
||||
|
||||
public static double[] AngleStuff(Vector3 a, Vector3 b)
|
||||
{
|
||||
double deltaX = 180.0 - Math.Abs(Math.Abs(a.X - b.X) - 180.0);
|
||||
double deltaY = 180.0 - Math.Abs(Math.Abs(a.Y - b.Y) - 180.0);
|
||||
|
||||
return new[] { deltaX, deltaY };
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore.Query.Internal;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
#endif
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using SharedLibraryCore.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@ -812,6 +813,27 @@ namespace SharedLibraryCore
|
||||
return Regex.IsMatch(message, @"^\u0014(?:[A-Z]|_)+$");
|
||||
}
|
||||
|
||||
public static Vector3 FixIW4Angles(this Vector3 vector)
|
||||
{
|
||||
float X = vector.X >= 0 ? vector.X : 360.0f + vector.X;
|
||||
float Y = vector.Y >= 0 ? vector.Y : 360.0f + vector.Y;
|
||||
float Z = vector.Z >= 0 ? vector.Z : 360.0f + vector.Z;
|
||||
|
||||
return new Vector3(Y, X, Z);
|
||||
}
|
||||
|
||||
public static float ToRadians(this float value) => (float)Math.PI * value / 180.0f;
|
||||
|
||||
public static float ToDegrees(this float value) => value * 180.0f / (float)Math.PI;
|
||||
|
||||
public static double[] AngleStuff(Vector3 a, Vector3 b)
|
||||
{
|
||||
double deltaX = 180.0 - Math.Abs(Math.Abs(a.X - b.X) - 180.0);
|
||||
double deltaY = 180.0 - Math.Abs(Math.Abs(a.Y - b.Y) - 180.0);
|
||||
|
||||
return new[] { deltaX, deltaY };
|
||||
}
|
||||
|
||||
#if DEBUG == true
|
||||
|
||||
private static readonly TypeInfo QueryCompilerTypeInfo = typeof(QueryCompiler).GetTypeInfo();
|
||||
|
BIN
WebfrontCore/wwwroot/images/compass_map_mp_rust@2x.png
Normal file
BIN
WebfrontCore/wwwroot/images/compass_map_mp_rust@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 MiB |
Loading…
Reference in New Issue
Block a user