public void Realize()
 {
     try {
         OriginalRealize();
     } catch (Exception e) {
         Debug.LogError(e);
         Debug.LogError(this.type + "|" + this.world + "|" + this.stuckObjects);
     }
     try {
         patch_PhysicalObject phys = (this.realizedObject as patch_PhysicalObject);
         phys.ownerID = ownerID;
     } catch (Exception e) {
         Debug.LogError(e);
     }
 }
Exemple #2
0
        public void Update()
        {
            if (ownerID == 0)
            {
                ownerID = NetworkGameManager.playerID;
            }

            if (mainWorld == null)
            {
                mainWorld = this.world;
            }

            if (NetworkGameManager.playerID != ownerID)
            {
                List <UpdatableAndDeletable> deletes = new List <UpdatableAndDeletable>();

                foreach (UpdatableAndDeletable uad in updateList)
                {
                    if (uad is Creature && ((Creature)uad).Template.TopAncestor().type == CreatureTemplate.Type.Slugcat)
                    {
                    }
                    else if (uad is PhysicalObject)
                    {
                        if (!MonklandSteamManager.ObjectManager.IsNetObject(uad as PhysicalObject))
                        {
                            deletes.Add(uad);
                        }
                    }
                }

                foreach (UpdatableAndDeletable uad in deletes)
                {
                    RemoveObject(uad);
                }
            }

            orig_Update();

            HashSet <string> updatedThisFrame = new HashSet <string>();

            foreach (UpdatableAndDeletable uad in updateList)
            {
                if (uad is PhysicalObject)
                {
                    //If the UAD is a physics object, but not a creature
                    patch_PhysicalObject physicalObject = uad as patch_PhysicalObject;
                    if (uad.slatedForDeletetion)
                    {
                        continue;
                    }

                    if (MonklandSteamManager.ObjectManager.OwnsObject(physicalObject))
                    {
                        physicalObject.NetworkUpdate();
                        continue;
                    }

                    if (MonklandSteamManager.ObjectManager.IsNetObject(physicalObject))
                    {
                        physicalObject.PostUpdate();
                        continue;
                    }
                }
            }
        }