using QSB.Messaging;
using QSB.Player;
namespace QSB.AuthoritySync;
public static class IAuthWorldObject_Extensions
{
///
/// try and gain authority over the object
///
public static void RequestOwnership(this IAuthWorldObject authWorldObject)
{
if (authWorldObject.Owner != 0)
{
return;
}
authWorldObject.SendMessage(new AuthWorldObjectMessage(QSBPlayerManager.LocalPlayerId));
}
///
/// release authority over the object,
/// potentially to giving it to someone else
///
public static void ReleaseOwnership(this IAuthWorldObject authWorldObject)
{
if (authWorldObject.Owner != QSBPlayerManager.LocalPlayerId)
{
return;
}
authWorldObject.SendMessage(new AuthWorldObjectMessage(0));
}
}