Files
RAGECOOP-V/Client/Scripts/Sync/Entities/SyncedProp.cs
sardelka9515 2828b9b74f Clean up
2022-10-23 19:02:39 +08:00

45 lines
1.0 KiB
C#

using GTA;
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; }
internal new int OwnerID =>
// alwayse owned by server
0;
internal override void Update()
{
if (!NeedUpdate) return;
if (!Model.IsLoaded)
{
Model.Request();
return;
}
if (MainProp == null || !MainProp.Exists())
{
MainProp = World.CreateProp(Model, Position, Rotation, false, false);
MainProp.IsInvincible = true;
}
MainProp.Position = Position;
MainProp.Rotation = Rotation;
MainProp.SetFrozen(true);
LastUpdated = Main.Ticked;
}
}
}