Beispiel #1
0
    public override void PrePlayerDismount(BasePlayer player, BaseMountable seat)
    {
        base.PrePlayerDismount(player, seat);
        CardTablePlayerStorage playerStorage = GetPlayerStorage(player.userID);

        if (playerStorage != null)
        {
            playerStorage.inventory.GetSlot(0)?.MoveToContainer(player.inventory.containerMain, -1, true, true);
        }
    }
Beispiel #2
0
    internal override void DoServerDestroy()
    {
        GameController?.OnTableDestroyed();
        PlayerStorageInfo[] array = playerStoragePoints;
        for (int i = 0; i < array.Length; i++)
        {
            CardTablePlayerStorage storage = array[i].GetStorage();
            if (storage != null)
            {
                storage.DropItems();
            }
        }
        StorageContainer pot = GetPot();

        if (pot != null)
        {
            pot.DropItems();
        }
        base.DoServerDestroy();
    }
Beispiel #3
0
    public override void SpawnSubEntities()
    {
        base.SpawnSubEntities();
        if (Rust.Application.isLoadingSave)
        {
            return;
        }
        BaseEntity       baseEntity       = GameManager.server.CreateEntity(potPrefab.resourcePath, Vector3.zero, Quaternion.identity);
        StorageContainer storageContainer = baseEntity as StorageContainer;

        if (storageContainer != null)
        {
            storageContainer.SetParent(this);
            storageContainer.Spawn();
            PotInstance.Set(baseEntity);
        }
        else
        {
            Debug.LogError(GetType().Name + ": Spawned prefab is not a StorageContainer as expected.");
        }
        PlayerStorageInfo[] array = playerStoragePoints;
        foreach (PlayerStorageInfo playerStorageInfo in array)
        {
            baseEntity = GameManager.server.CreateEntity(playerStoragePrefab.resourcePath, playerStorageInfo.storagePos.localPosition, playerStorageInfo.storagePos.localRotation);
            CardTablePlayerStorage cardTablePlayerStorage = baseEntity as CardTablePlayerStorage;
            if (cardTablePlayerStorage != null)
            {
                cardTablePlayerStorage.SetCardTable(this);
                cardTablePlayerStorage.SetParent(this);
                cardTablePlayerStorage.Spawn();
                playerStorageInfo.storageInstance.Set(baseEntity);
            }
            else
            {
                Debug.LogError(GetType().Name + ": Spawned prefab is not a CardTablePlayerStorage as expected.");
            }
        }
    }