Add Name property for blip, fix blip scale

This commit is contained in:
Sardelka
2022-07-03 21:00:05 +08:00
parent f866151cc5
commit 0a5bb67c54
5 changed files with 20 additions and 9 deletions

View File

@ -42,9 +42,10 @@ namespace RageCoop.Client.Scripting
int id= (int)obj.Args[0];
var sprite=(BlipSprite)(short)obj.Args[1];
var color = (BlipColor)(byte)obj.Args[2];
var scale=(Vector2)obj.Args[3];
var scale=(float)obj.Args[3];
var pos=(Vector3)obj.Args[4];
int rot= (int)obj.Args[5];
var name=(string)obj.Args[6];
Blip blip;
API.QueueAction(() =>
{
@ -55,10 +56,10 @@ namespace RageCoop.Client.Scripting
}
blip.Sprite = sprite;
blip.Color = color;
blip.ScaleX = scale.X;
blip.ScaleY = scale.Y;
blip.Scale = scale;
blip.Position = pos;
blip.Rotation = rot;
blip.Name = name;
});
}

View File

@ -48,7 +48,7 @@ namespace RageCoop.Server.Scripting
{
foreach (var obj in objects)
{
API.SendCustomEvent(CustomEvents.ServerBlipSync, new() { obj.ID, (short)obj.Sprite, (byte)obj.Color, obj.Scale,obj.Position,obj.Rotation }, clients);
API.SendCustomEvent(CustomEvents.ServerBlipSync, new() { obj.ID, (short)obj.Sprite, (byte)obj.Color, obj.Scale,obj.Position,obj.Rotation,obj.Name }, clients);
}
}
void NativeResponse(CustomEventReceivedArgs e)

View File

@ -37,7 +37,7 @@ namespace RageCoop.Server.Scripting
public int Hash { get; set; }
/// <summary>
/// Supported types: byte, short, ushort, int, uint, long, ulong, float, bool, string, Vector3, Quaternion, ServerPed, ServerVehicle, ServerProp
/// Supported types: byte, short, ushort, int, uint, long, ulong, float, bool, string, Vector3, Quaternion, Vector2 <see cref="ServerObject.Handle"/>
/// </summary>
public List<object> Args { get; set; }
}

View File

@ -164,7 +164,7 @@ namespace RageCoop.Server
}
/// <summary>
/// Get all static objects owned by server
/// Get all blips owned by server
/// </summary>
/// <returns></returns>
public ServerBlip[] GetAllBlips()

View File

@ -228,11 +228,11 @@ namespace RageCoop.Server
set { _sprite=value; Update();}
}
internal Vector2 _scale=new(1f,1f);
internal float _scale =1;
/// <summary>
/// Scale of this blip
/// </summary>
public Vector2 Scale
public float Scale
{
get { return _scale; }
set { _scale=value;Update(); }
@ -250,7 +250,7 @@ namespace RageCoop.Server
internal int _rot;
/// <summary>
/// Scale of this blip
/// Rotation of this blip
/// </summary>
public int Rotation
{
@ -258,6 +258,16 @@ namespace RageCoop.Server
set { _rot=value; Update(); }
}
internal string _name="Beeeeeee";
/// <summary>
/// Name of this blip
/// </summary>
public string Name
{
get { return _name;}
set { _name=value; Update(); }
}
/// <summary>
/// Delete this blip
/// </summary>