Esempio n. 1
0
 public override void OnDespawnServer(DespawnInfo info)
 {
     base.OnDespawnServer(info);
     dirSprites.SetToBodyLayer();
     alienScreechPlayed      = false;
     registerObject.Passable = true;
 }
 public void OnDespawnServer(DespawnInfo info)
 {
     if (ItemStorage != null)
     {
         RemoveSelf(ItemStorage);
     }
 }
 /// <summary>
 /// cleaning up for reuse
 /// </summary>
 public void OnDespawnServer(DespawnInfo info)
 {
     centComm.OnStatusDisplayUpdate.RemoveListener(OnTextBroadcastReceived);
     channel        = StatusDisplayChannel.Command;
     textField.text = string.Empty;
     this.TryStopCoroutine(ref blinkHandle);
 }
Esempio n. 4
0
 public void OnDespawnServer(DespawnInfo info)
 {
     if (virtualContainer != null)
     {
         Despawn.ServerSingle(virtualContainer.gameObject);
     }
 }
Esempio n. 5
0
 public override void OnDespawnServer(DespawnInfo info)
 {
     base.OnDespawnServer(info);
     mobSprite.SetToBodyLayer();
     deathSoundPlayed        = false;
     registerObject.Passable = true;
 }
 public void OnDespawnServer(DespawnInfo info)
 {
     foreach (DisposalVirtualContainer container in receivedContainers)
     {
         Despawn.ServerSingle(container.gameObject);
     }
 }
Esempio n. 7
0
 public void OnDespawnServer(DespawnInfo info)
 {
     for (int i = ConnectedDevices.Count - 1; i >= 0; i--)
     {
         ConnectedDevices[i].RemoveFromAPC();
     }
 }
Esempio n. 8
0
    public virtual void OnDespawnServer(DespawnInfo info)
    {
        //cancel all relationships
        if (sameMatrixRelationships != null)
        {
            for (int i = sameMatrixRelationships.Count - 1; i >= 0; i--)
            {
                var relationship = sameMatrixRelationships[i];
                Logger.LogTraceFormat("Cancelling spatial relationship {0} because {1} is despawning.",
                                      Category.SpatialRelationship, relationship, this);
                SpatialRelationship.ServerEnd(relationship);
            }
        }

        if (crossMatrixRelationships != null)
        {
            for (int i = crossMatrixRelationships.Count - 1; i >= 0; i--)
            {
                var relationship = crossMatrixRelationships[i];
                Logger.LogTraceFormat("Cancelling spatial relationship {0} because {1} is despawning.",
                                      Category.SpatialRelationship, relationship, this);
                SpatialRelationship.ServerEnd(relationship);
            }
        }

        OnDespawnedServer.Invoke();
    }
Esempio n. 9
0
 public void OnDespawnServer(DespawnInfo info)
 {
     if (Controller == null)
     {
         return;
     }
     Controller.RemoveSlave(device);
 }
Esempio n. 10
0
 public void OnDespawnServer(DespawnInfo info)
 {
     // remove it from global artifacts registry
     if (ServerSpawnedArtifacts.Contains(this))
     {
         ServerSpawnedArtifacts.Remove(this);
     }
 }
Esempio n. 11
0
	/// <summary>
	/// If the object is about to despawn, eject its contents (unless already open)
	/// so they are not stranded at HiddenPos.
	/// </summary>
	/// <param name="despawnInfo"></param>
	public void OnDespawnServer(DespawnInfo despawnInfo)
	{
		if (drawerState == DrawerState.Open) return;

		EjectItems(true);
		EjectPlayers(true);
		Despawn.ServerSingle(tray);
	}
Esempio n. 12
0
 public void OnDespawnServer(DespawnInfo info)
 {
     PanelInputCurrentPorts.Clear();
     PanelOutputCurrentPorts.Clear();
     DictionaryCurrentPorts.Clear();
     Connections.Clear();
     Cables.Clear();
 }
Esempio n. 13
0
 public void OnDespawnServer(DespawnInfo info)
 {
     // Set grenade to locked state by default
     UpdateSprite(LOCKED_SPRITE);
     // Reset grenade timer
     timerRunning = false;
     hasExploded  = false;
 }
Esempio n. 14
0
        public void OnDespawnServer(DespawnInfo info)
        {
            UpdateManager.Remove(CallbackType.PERIODIC_UPDATE, ServerPeriodicUpdate);

            mobAi.health.applyDamageEvent -= OnDamageReceived;
            mobAi.PettedEvent             -= OnPetted;
            mobExplore.FoodEatenEvent     -= OnFoodEaten;
        }
Esempio n. 15
0
 public void OnDespawnServer(DespawnInfo info)
 {
     //remove ourselves from inventory if we aren't already removed
     if (itemSlot != null)
     {
         Inventory.ServerDespawn(itemSlot);
     }
 }
Esempio n. 16
0
    /// <summary>
    /// Despawn the object server side and sync the despawn to all clients. Despawning removes an
    /// object from the game, but may not necessarilly destroy it completely - it may end up back in the
    /// object pool to be later reused.
    /// </summary>
    /// <param name="info"></param>
    /// <param name="skipInventoryDespawn">If the indicated object is in inventory, it will
    /// be despawned via the inventory API instead. Set this to true to bypass this. This is only
    /// intended to be set to true for particular internal use cases in the lifecycle system, so should
    /// almost always be left at the default</param>
    /// <returns></returns>
    private static DespawnResult Server(DespawnInfo info, bool skipInventoryDespawn = false)
    {
        if (info == null)
        {
            Logger.LogError("Cannot despawn - info is null", Category.ItemSpawn);
            return(DespawnResult.Fail(info));
        }

        if (!skipInventoryDespawn)
        {
            var pu = info.GameObject.GetComponent <Pickupable>();
            if (pu != null && pu.ItemSlot != null)
            {
                if (Inventory.ServerDespawn(pu.ItemSlot))
                {
                    return(DespawnResult.Single(info));
                }
                else
                {
                    return(DespawnResult.Fail(info));
                }
            }
        }

        //even if it has a pool prefab tracker, will still destroy it if it has no object behavior
        var poolPrefabTracker = info.GameObject.GetComponent <PoolPrefabTracker>();
        var transform         = info.GameObject.GetComponent <IPushable>();
        var Electrical        = info.GameObject.GetComponent <ElectricalOIinheritance>();

        if (Electrical != null)
        {
            if (!Electrical.InData.DestroyAuthorised)
            {
                Electrical.DestroyThisPlease();
                return(DespawnResult.Single(info));
            }
        }

        _ServerFireDespawnHooks(DespawnResult.Single(info));
        if (transform != null)
        {
            transform.VisibleState = false;
        }

        if (poolPrefabTracker != null)
        {
            //pooled
            Spawn._AddToPool(info.GameObject);
        }
        else
        {
            //not pooled
            NetworkServer.Destroy(info.GameObject);
        }


        return(DespawnResult.Single(info));
    }
Esempio n. 17
0
 public void OnDespawnServer(DespawnInfo info)
 {
     // make sure we despawn what we are holding
     foreach (var heldItem in serverHeldItems)
     {
         _ = Despawn.ServerSingle(heldItem.gameObject);
     }
     serverHeldItems.Clear();
 }
Esempio n. 18
0
 /// <summary>
 /// is the function to denote that it will be pooled or destroyed immediately after this function is finished, Used for cleaning up anything that needs to be cleaned up before this happens
 /// </summary>
 public void OnDespawnServer(DespawnInfo info)
 {
     if (!InData.DestroyQueueing || !InData.DestroyAuthorised)
     {
         Logger.Log("REEEEEEEEEEEEEE Wait your turn to destroy, Electrical thread is busy!!", Category.Electrical);
         DestroyThisPlease();
         var yy = InData.ConnectionReaction[PowerTypeCategory.Transformer];
     }
 }
Esempio n. 19
0
        /// <summary>
        /// If the drawer is about to despawn, despawn the tray too, so it is not stranded at HiddenPos.
        /// </summary>
        public void OnDespawnServer(DespawnInfo despawnInfo)
        {
            if (drawerState == DrawerState.Open)
            {
                return;
            }

            _ = Despawn.ServerSingle(tray);
        }
Esempio n. 20
0
 public void OnDespawnServer(DespawnInfo info)
 {
     //make sure we despawn what we are holding
     foreach (var heldItem in serverHeldItems)
     {
         Despawn.ServerSingle(heldItem.gameObject);
     }
     serverHeldItems = Enumerable.Empty <ObjectBehaviour>();
 }
Esempio n. 21
0
    /// <summary>
    /// Despawn the object server side and sync the despawn to all clients. Should only be
    /// called on networked objects (i.e. ones which have NetworkIdentity component). Despawning removes an
    /// object from the game, but may not necessarilly destroy it completely - it may end up back in the
    /// object pool to be later reused.
    /// </summary>
    /// <param name="info"></param>
    /// <param name="skipInventoryDespawn">If the indicated object is in inventory, it will
    /// be despawned via the inventory API instead. Set this to true to bypass this. This is only
    /// intended to be set to true for particular internal use cases in the lifecycle system, so should
    /// almost always be left at the default</param>
    /// <returns></returns>
    private static async Task <DespawnResult> Server(DespawnInfo info, bool skipInventoryDespawn = false)
    {
        if (info == null)
        {
            Logger.LogError("Cannot despawn - info is null", Category.ItemSpawn);
            return(DespawnResult.Fail(info));
        }

        if (!skipInventoryDespawn)
        {
            var pu = info.GameObject.GetComponent <Pickupable>();
            if (pu != null && pu.ItemSlot != null)
            {
                if (Inventory.ServerDespawn(pu.ItemSlot))
                {
                    return(DespawnResult.Single(info));
                }
                else
                {
                    return(DespawnResult.Fail(info));
                }
            }
        }

        var Electrical = info.GameObject.GetComponent <ElectricalOIinheritance>();

        //TODO: What's the purpose of this?
        if (Electrical != null)
        {
            if (!Electrical.InData.DestroyAuthorised)
            {
                Electrical.DestroyThisPlease();
                return(DespawnResult.Single(info));
            }
        }

        _ServerFireDespawnHooks(DespawnResult.Single(info));

        var cnt = info.GameObject.GetComponent <CustomNetTransform>();

        if (cnt != null)
        {
            cnt.DisappearFromWorldServer();
        }

        await Task.Delay(10);

        if (Spawn._ObjectPool.TryDespawnToPool(info.GameObject, false))
        {
            return(DespawnResult.Single(info));
        }
        else
        {
            return(DespawnResult.Fail(info));
        }
    }
Esempio n. 22
0
    public void OnDespawnServer(DespawnInfo info)
    {
        OnServerDespawnEvent?.Invoke();
        var cnt = GetComponent <CustomNetTransform>();

        if (cnt != null)
        {
            cnt.DisappearFromWorldServer();
        }
    }
Esempio n. 23
0
        public void OnDespawnServer(DespawnInfo info)
        {
            if (currentProduction != null)
            {
                StopCoroutine(currentProduction);
                currentProduction = null;
            }

            materialStorageLink.usedStorage.DropAllMaterials();
        }
Esempio n. 24
0
 public void UpDespawn(DespawnInfo info)
 {
     if (UpdateRequestDictionary.ContainsKey(ElectricalUpdateTypeCategory.GoingOffStage))
     {
         foreach (ElectricalModuleTypeCategory Module in UpdateRequestDictionary[ElectricalUpdateTypeCategory.GoingOffStage])
         {
             UpdateDelegateDictionary[Module].OnDespawnServer(info);
         }
     }
 }
Esempio n. 25
0
 public void OnDespawnServer(DespawnInfo info)
 {
     //if this is a player's inventory, make them no longer an observer of all slots
     if (GetComponent <PlayerScript>() != null)
     {
         ServerRemoveObserverPlayer(gameObject);
     }
     //reclaim the space in the slot pool.
     ItemSlot.Free(this);
 }
Esempio n. 26
0
 public void UpDespawn(DespawnInfo info)
 {
     if (UpdateRequestDictionary.TryGetValue(ElectricalUpdateTypeCategory.GoingOffStage, out HashSet <ElectricalModuleTypeCategory> updateRequest))
     {
         foreach (ElectricalModuleTypeCategory Module in updateRequest)
         {
             UpdateDelegateDictionary[Module].OnDespawnServer(info);
         }
     }
 }
Esempio n. 27
0
        public void OnDespawnServer(DespawnInfo info)
        {
            if (CustomNetworkManager.Instance._isServer)
            {
                UpdateManager.Remove(CallbackType.UPDATE, UpdateMe);
            }

            mobAi.health.applyDamageEvent -= OnDamageReceived;
            mobAi.PettedEvent             -= OnPetted;
            mobExplore.FoodEatenEvent     -= OnFoodEaten;
        }
Esempio n. 28
0
        public void OnDespawnServer(DespawnInfo info)
        {
            Vector3 spawnPos = gameObject.RegisterTile().WorldPositionServer;

            foreach (var packet in seedPackets)
            {
                CustomNetTransform netTransform = packet.GetComponent <CustomNetTransform>();
                netTransform.AppearAtPosition(spawnPos);
                netTransform.AppearAtPositionServer(spawnPos);
            }
        }
Esempio n. 29
0
 public void OnDespawnServer(DespawnInfo info)
 {
     materialStorage.DropAllMaterials();
     foreach (var linkedMat in linkedStorages)
     {
         if (linkedMat == null)                 //they were destroyed at some point, irrelevant to us
         {
             continue;
         }
         linkedMat.DisconnectFromSilo();
     }
 }
Esempio n. 30
0
    /// <summary>
    /// Despawn the object locally, on this client only. Should ONLY be called on non-networked objects
    /// (i.e. ones which don't have NetworkIdentity component). Despawning removes an
    /// object from the game, but may not necessarilly destroy it completely - it may end up back in the
    /// object pool to be later reused.
    /// </summary>
    /// <param name="info"></param>
    /// <returns></returns>
    public static DespawnResult Client(DespawnInfo info)
    {
        if (info == null)
        {
            Logger.LogError("Cannot despawn - info is null", Category.ItemSpawn);
            return(DespawnResult.Fail(info));
        }

        if (Spawn._ObjectPool.TryDespawnToPool(info.GameObject, true))
        {
            return(DespawnResult.Single(info));
        }
        else
        {
            return(DespawnResult.Fail(info));
        }
    }