Begin script abstraction
This commit is contained in:
39
ReallifeGamemode.Server.Core.RageMP/RageExtensions.cs
Normal file
39
ReallifeGamemode.Server.Core.RageMP/RageExtensions.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.RageMP
|
||||
{
|
||||
public static class RageExtensions
|
||||
{
|
||||
public static Vector3 ToVector3(this Position position)
|
||||
{
|
||||
return new Vector3(position.X, position.Y, position.Z);
|
||||
}
|
||||
|
||||
public static Position ToPosition(this Vector3 vector)
|
||||
{
|
||||
return new Position(vector.X, vector.Y, vector.Z);
|
||||
}
|
||||
|
||||
public static DisconnectReason ToDisconnectReason(this DisconnectionType disconnectionType)
|
||||
{
|
||||
switch (disconnectionType)
|
||||
{
|
||||
case DisconnectionType.Left:
|
||||
return DisconnectReason.Quit;
|
||||
|
||||
case DisconnectionType.Kicked:
|
||||
return DisconnectReason.Kick;
|
||||
|
||||
case DisconnectionType.Timeout:
|
||||
return DisconnectReason.Timeout;
|
||||
default:
|
||||
return DisconnectReason.Unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user