Skip to main content

BuildModeOwnershipProvider

An implementation of OwnershipProvider that determines and manages player ownership of an interior for Build Mode interactions. This class synchronizes ownership data across clients and integrates with the dependency injection system via ISelfRegisteredInjectionTarget.

public class BuildModeOwnershipProvider : OwnershipProvider, ISelfRegisteredInjectionTarget

🧩 Purpose​

This provider:

  • Tracks owner user IDs of an interior.
  • Validates player access for Build Mode features.
  • Uses RPC to synchronize ownership status to non-authoritative clients.
  • Integrates with a GameServiceFactory to pull ownership data.

πŸ—‚οΈ Key Properties​

ownerUserIDs​

Type: List<string>
Description: User IDs permitted to interact with this interior.

interiorID​

Type: string
Description: The identifier for the specific interior being validated.

doIHaveOwnership​

Type: bool
Description: Cached client-side flag indicating local ownership status.


🧠 Core Methods​

SetInteriorID(string intID)​

Sets the interior ID and fetches the associated owners.

CheckOwnership(PlayerActor actor)​

Validates ownership:

  • On server: checks ownerUserIDs directly.
  • On client: returns the locally cached doIHaveOwnership.

RegisterOwner(string interiorID, string userID)​

Fetches current owners and confirms if the given user ID is included.


πŸ” Ownership Synchronization​

RequestOwnershipDetails_Rpc(string userID)​

Client β†’ Server request to check if the user owns the current interior.

InformOfOwnershipStatus_Rpc(PlayerRef player, bool status)​

Server β†’ Client response to cache the ownership result.

NotifyOfDataUpdate_Rpc()​

Triggers ownership refresh on all proxies (clients).


πŸ§ͺ Initialization​

Awake()​

Performs injection setup for ISelfRegisteredInjectionTarget.

InjectionCompleted()​

Empty placeholder to satisfy interfaceβ€”ready for post-injection logic if needed.


πŸ”— Dependencies​

  • GameServiceFactory (Injected)
  • IGameDataProvider.CheckOwnershipOfInterior(): Resolves owner user list
  • Injector: Handles auto-registration for injection targets

βœ… Usage Summary​

Attach this to any interior GameObject that needs to restrict Build Mode actions by ownership. It handles server-authoritative checks and synchronizes results to clients efficiently via RPC.

Use in conjunction with:

  • PlayerInteractionPoint
  • OwnershipProvider
  • GameOrchestrator