haus system auf core geändert
This commit is contained in:
@@ -16,6 +16,8 @@ namespace ReallifeGamemode.Server.Core.RageMP
|
||||
|
||||
public ITextLabelAPI TextLabel => new RageTextLabelAPI();
|
||||
|
||||
public IBlipAPI Blip => new RageBlipAPI();
|
||||
|
||||
public void DisableDefaultCommandErrorMessages()
|
||||
{
|
||||
NAPI.Server.SetCommandErrorMessage(null);
|
||||
@@ -61,5 +63,18 @@ namespace ReallifeGamemode.Server.Core.RageMP
|
||||
{
|
||||
NAPI.ClientEvent.TriggerClientEventForAll("SERVER:" + eventName, args);
|
||||
}
|
||||
|
||||
public TEntity ToEntity<TEntity>(ushort handle) where TEntity : class, IEntity
|
||||
{
|
||||
return typeof(TEntity).Name switch
|
||||
{
|
||||
"IPlayer" => new RagePlayer(new NetHandle(handle, EntityType.Player).Entity<Player>()) as TEntity,
|
||||
"IVehicle" => new RageVehicle(new NetHandle(handle, EntityType.Vehicle).Entity<Vehicle>()) as TEntity,
|
||||
"IMarker" => new RageMarker(new NetHandle(handle, EntityType.Marker).Entity<Marker>()) as TEntity,
|
||||
"ITextLabel" => new RageTextLabel(new NetHandle(handle, EntityType.TextLabel).Entity<TextLabel>()) as TEntity,
|
||||
"IColShape" => new RageColShape(new NetHandle(handle, EntityType.Colshape).Entity<ColShape>()) as TEntity,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
ReallifeGamemode.Server.Core.RageMP/RageBlip.cs
Normal file
18
ReallifeGamemode.Server.Core.RageMP/RageBlip.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.RageMP
|
||||
{
|
||||
class RageBlip : RageEntity, IBlip
|
||||
{
|
||||
private Blip blip;
|
||||
|
||||
public RageBlip(Blip blip) : base(blip)
|
||||
{
|
||||
this.blip = blip;
|
||||
}
|
||||
}
|
||||
}
|
||||
16
ReallifeGamemode.Server.Core.RageMP/RageBlipAPI.cs
Normal file
16
ReallifeGamemode.Server.Core.RageMP/RageBlipAPI.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.RageMP
|
||||
{
|
||||
class RageBlipAPI : IBlipAPI
|
||||
{
|
||||
public IBlip CreateBlip(uint sprite, Position position, string name, byte color, byte alpha, float scale, float drawDistance, bool shortRange)
|
||||
{
|
||||
return new RageBlip(NAPI.Blip.CreateBlip(sprite, position.ToVector3(), scale, color, name, alpha, drawDistance, shortRange));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,8 @@ namespace ReallifeGamemode.Server.Core.RageMP
|
||||
}
|
||||
}
|
||||
|
||||
public uint Dimension { get => entity.Dimension; set => entity.Dimension = value; }
|
||||
|
||||
public RageEntity(GTANetworkAPI.Entity rageEntity)
|
||||
{
|
||||
entity = rageEntity;
|
||||
@@ -57,7 +59,9 @@ namespace ReallifeGamemode.Server.Core.RageMP
|
||||
return fallback;
|
||||
}
|
||||
|
||||
return (entity.GetSharedData<string>(key)).DeserializeJson<T>();
|
||||
var data = entity.GetSharedData<string>(key);
|
||||
|
||||
return data.DeserializeJson<T>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user