42 lines
1013 B
C#
Raw Normal View History

2022-07-20 17:50:01 +08:00
using GTA;
2022-07-02 17:14:56 +08:00
namespace RageCoop.Client
{
/// <summary>
/// Synchronized prop, mostly owned by server
/// </summary>
public class SyncedProp : SyncedEntity
{
internal SyncedProp(int id)
{
ID= id;
}
/// <summary>
/// The real entity
/// </summary>
public Prop MainProp { get; set; }
2022-07-20 17:50:01 +08:00
internal new int OwnerID
{
get
2022-07-02 17:14:56 +08:00
{
// alwayse owned by server
return 0;
2022-07-20 17:50:01 +08:00
}
}
2022-07-02 17:14:56 +08:00
internal override void Update()
{
if (!NeedUpdate) { return; }
if (MainProp== null || !MainProp.Exists())
{
2022-07-20 17:50:01 +08:00
MainProp=World.CreateProp(Model, Position, Rotation, false, false);
2022-07-02 17:14:56 +08:00
MainProp.IsInvincible=true;
}
MainProp.Position=Position;
MainProp.Rotation=Rotation;
MainProp.SetFrozen(true);
LastUpdated=Main.Ticked;
}
}
}