Begin weaponschein

This commit is contained in:
hydrant
2020-03-09 20:56:51 +01:00
parent baba3e1ae2
commit 6965875406
12 changed files with 156 additions and 5 deletions

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ReallifeGamemode.Server.Core.API
{
public struct Color
{
public int R { get; set; }
public int G { get; set; }
public int B { get; set; }
public Color(int r, int g, int b)
{
R = r;
G = g;
B = b;
}
}
}

View File

@@ -13,6 +13,8 @@ namespace ReallifeGamemode.Server.Core.API
IVehicleAPI Vehicle { get; } IVehicleAPI Vehicle { get; }
IMarkerAPI Marker { get; }
void DisableDefaultCommandErrorMessages(); void DisableDefaultCommandErrorMessages();
void DisableDefaultSpawnBehavior(); void DisableDefaultSpawnBehavior();

View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ReallifeGamemode.Server.Core.API
{
public interface IMarker : IEntity
{
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
using ReallifeGamemode.Server.Types;
namespace ReallifeGamemode.Server.Core.API
{
public interface IMarkerAPI
{
IMarker CreateMarker(MarkerType markerType, Position position, Position direction, Position rotation, float scale, Color color);
}
}

View File

@@ -12,6 +12,8 @@ namespace ReallifeGamemode.Server.Core.RageMP
public IVehicleAPI Vehicle => new RageVehicleAPI(); public IVehicleAPI Vehicle => new RageVehicleAPI();
public IMarkerAPI Marker => new RageMarkerAPI();
public void DisableDefaultCommandErrorMessages() public void DisableDefaultCommandErrorMessages()
{ {
NAPI.Server.SetCommandErrorMessage(null); NAPI.Server.SetCommandErrorMessage(null);

View File

@@ -35,5 +35,10 @@ namespace ReallifeGamemode.Server.Core.RageMP
return DisconnectReason.Unknown; return DisconnectReason.Unknown;
} }
} }
public static GTANetworkAPI.Color ToColor(this API.Color color)
{
return new GTANetworkAPI.Color(color.R, color.G, color.B);
}
} }
} }

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
using GTANetworkAPI;
using ReallifeGamemode.Server.Core.API;
namespace ReallifeGamemode.Server.Core.RageMP
{
public class RageMarker : RageEntity, IMarker
{
private readonly Marker marker;
public RageMarker(Marker marker) : base(marker)
{
this.marker = marker;
}
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;
using GTANetworkAPI;
using ReallifeGamemode.Server.Core.API;
namespace ReallifeGamemode.Server.Core.RageMP
{
public class RageMarkerAPI : IMarkerAPI
{
public IMarker CreateMarker(Types.MarkerType markerType, Position position, Position direction, Position rotation, float scale, API.Color color)
{
Marker rageMarker = NAPI.Marker.CreateMarker(
(int)markerType,
position.ToVector3(),
direction.ToVector3(),
rotation.ToVector3(),
scale,
color.ToColor());
return new RageMarker(rageMarker);
}
}
}

View File

@@ -16,7 +16,7 @@ namespace ReallifeGamemode.Server.Core
internal static IAPI API { get; private set; } internal static IAPI API { get; private set; }
internal static Events.EventHandler EventHandler { get; private set; } internal static Events.EventHandler EventHandler { get; private set; }
private static List<Script> loadedScripts = new List<Script>(); private static readonly List<Script> loadedScripts = new List<Script>();
private readonly ILogger logger = LogManager.GetLogger<Main>(); private readonly ILogger logger = LogManager.GetLogger<Main>();
@@ -36,10 +36,10 @@ namespace ReallifeGamemode.Server.Core
private void LoadScript() private void LoadScript()
{ {
var allTypes = Assembly.GetExecutingAssembly().GetTypes(); var allTypes = typeof(Main).Assembly.GetTypes();
var commandTypes = allTypes.Where(t => t.IsSubclassOf(typeof(Script)) && !t.IsAbstract); var scriptTypes = allTypes.Where(t => t.IsSubclassOf(typeof(Script)) && !t.IsAbstract);
foreach (var scriptType in commandTypes) foreach (var scriptType in scriptTypes)
{ {
logger.LogDebug("Loading script '{FullName}'", scriptType.FullName); logger.LogDebug("Loading script '{FullName}'", scriptType.FullName);
var script = Activator.CreateInstance(scriptType) as Script; var script = Activator.CreateInstance(scriptType) as Script;

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ReallifeGamemode.Server.Core.Menus
{
internal class PoliceDepartment : Script
{
public PoliceDepartment()
{
}
}
}

View File

@@ -9,7 +9,7 @@ namespace ReallifeGamemode.Server.Log
{ {
builder.AddConsole(); builder.AddConsole();
builder.AddDebug(); builder.AddDebug();
builder.AddFilter("RageMP.Server", LogLevel.Debug); builder.AddFilter("ReallifeGamemode.Server", LogLevel.Debug);
builder.AddFilter("Microsoft.EntityFrameworkCore", LogLevel.Information); builder.AddFilter("Microsoft.EntityFrameworkCore", LogLevel.Information);
}); });

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ReallifeGamemode.Server.Types
{
public enum MarkerType
{
UpsideDownCone = 0,
VerticalCylinder = 1,
ThickChevronUp = 2,
ThinChevronUp = 3,
CheckeredFlagRect = 4,
CheckeredFlagCircle = 5,
VerticleCircle = 6,
PlaneModel = 7,
LostMCDark = 8,
LostMCLight = 9,
Number0 = 10,
Number1 = 11,
Number2 = 12,
Number3 = 13,
Number4 = 14,
Number5 = 15,
Number6 = 16,
Number7 = 17,
Number8 = 18,
Number9 = 19,
ChevronUpx1 = 20,
ChevronUpx2 = 21,
ChevronUpx3 = 22,
HorizontalCircleFat = 23,
ReplayIcon = 24,
HorizontalCircleSkinny = 25,
HorizontalCircleSkinnyArrow = 26,
HorizontalSplitArrowCircle = 27,
DebugSphere = 28
}
}