1. So question: how to count furnaces, owned by user (someone) and check & update it with low load for server?
    To compact it with quicksmelt for furnaces (if user can fast smelt => count furnaces who can fast smelt amd if reach limit - other furnaces smelt in normal (stock) mode?)
     
  2. Calytic

    Calytic Community Admin Community Mod

    The only way to accomplish this with low load on the server is to have a custom plugin track and save the entity ID's as the furnaces are constructed/destroyed.

    Aside from that your only option is a much heavier loop through every entity on the server.
     
  3. What would that loop look like? I am trying to find turrets built by a player and on death destroy them. I was going to reference CorpseID as shown below... but I have no idea how to find "turret" entities. Thanks for your help!
    Code:
            void OnEntitySpawned(BaseNetworkable entity)
          
            {
                heliPrefabId = StringPool.Get(heliPrefab);
                corpsePrefabId = StringPool.Get(corpsePrefab);            if (entity == null) return;
                if (entity.prefabID == heliPrefabId)
                {
                    entity.Kill();
                    Puts("NoHeli : Patrol Stopped!");
                }
                if (entity.prefabID == corpsePrefabId)
                {
                    //var corpseOwner = entity.OwnerID;
                        //check for turrets in game
                       // {
                      //  if turretFound.OwnerID == corpseOwner;
                      //  entity.kill();
                      //  }
                    entity.Kill();
                    Puts("Corpse Deleted");
                }        }
     
  4. Calytic

    Calytic Community Admin Community Mod

    Code:
    BaseOven[] ovens = GameObject.FindObjectsOfType<BaseOven>();foreach (BaseOven oven in ovens)
    {
        //check ownerid here
        oven.Kill(BaseNetworkable.DestroyMode.None);
    }
    Replace "BaseOven" with "AutoTurret" for the same thing with turrets
     
  5. Thanks for the response! I ended up building a dictionary and writing to it on turret spawn. Then removing them on death, etc. k1lly0u helped me out :)

    Thanks again!
     
  6. This is not recommended though because it will lag out the server when there is a lot of buildings.
     
  7. For first - check user flags. That users on server are not much. Then check how many furnaces have user with flag. Then Check if more that (1,2,3,4) and next action...
     
  8. Counting is the expensive operation. The only check to effectively reduce load in your list is the check that ensures that the load on the server is low right now.
     
  9. If I was you I would account for all furnaces ONCE at server start and then add/remove furnaces from your own lookup table as they are created/destroyed.