1. OnEntitySpawned is called after the entity has spawned. Is there a function called before or during an entity spawn?

    if I call entity.kill inside OnEntitySpawned and it's an ore, it leaves the little glowing star where the ore node used to be.
     
    Last edited by a moderator: Apr 12, 2018
  2. To remove the node and the glow use this
    Code:
    var node = entity.GetComponent<OreResourceEntity>();
                if (node != null)
                {
                    node.CleanupBonus();
                    node.KillMessage();
                    return;
                }
     
  3. Thank you! What's the difference between node.Kill and node.KillMessage?
     
  4. I'm not sure, from what I see here
    Code:
    public void KillMessage()
        {
            this.Kill(BaseNetworkable.DestroyMode.None);
        }
    it is same, maybe there was a difference before...
     
  5. I'm still struggling here. Even with spawn.max_rate 0.25 my server wants to spawn like 10 sulfur nodes per minute. Using this code in the OnEntitySpawned is killing the performance of the server. Basically what I'm doing is everytime OnEntitySpawned is called I'm checking to see if it is sulfur ore, then if it is I have to get the count of sulfur ore on the server, then kill that newly spawned ore if over X amount already exist. There has got to be a better way to limit the sulfur ore nodes on the map. Any suggestions? Each minute when OnEntitySpawned is fired, the server lags just a hair and it's noticeable in game.