Esempio n. 1
0
 partial void pBeforeRemoveVob(BaseVob vob)
 {
     if (!vob.IsStatic)
     {
         vob.RemoveFromCell();
     }
 }
Esempio n. 2
0
        partial void pAfterAddVob(BaseVob vob)
        {
            // add the vob to the gothic world
            gWorld.AddVob(vob.gVob);

            // add the gothic-object's address to the dictionary
            vobAddr.Add(vob.gVob.Address, vob);
        }
Esempio n. 3
0
 /// <summary>
 /// 1000 ingame units accuracy
 /// </summary>
 public void ForEachNPCRough(BaseVob vob, float radius, Action <NPC> action)
 {
     if (vob == null)
     {
         throw new ArgumentException("Vob is null!");
     }
     this.ForEachNPCRough(vob.Position, radius, action);
 }
Esempio n. 4
0
            public static void ReadVobSpawn(PacketReader stream)
            {
                byte    type = stream.ReadByte();
                BaseVob vob  = ScriptManager.Interface.CreateVob(type);

                vob.ReadStream(stream);
                vob.ScriptObject.Spawn(current);
            }
Esempio n. 5
0
 /// <summary>
 /// 5000 units accuracy
 /// </summary>
 public void ForEachClientRougherPredicate(BaseVob vob, float radius, Predicate <GameClient> predicate)
 {
     if (vob == null)
     {
         throw new ArgumentNullException("Vob is null!");
     }
     this.ForEachClientRougherPredicate(vob.Position, radius, predicate);
 }
Esempio n. 6
0
 /// <summary>
 /// 1000 ingame units accuracy
 /// </summary>
 public void ForEachNPCRoughPredicate(BaseVob vob, float radius, Predicate <NPC> predicate)
 {
     if (vob == null)
     {
         throw new ArgumentException("Vob is null!");
     }
     this.ForEachNPCRoughPredicate(vob.Position, radius, predicate);
 }
Esempio n. 7
0
 /// <summary>
 /// 5000 units accuracy
 /// </summary>
 public void ForEachClientRougher(BaseVob vob, float radius, Action <GameClient> action)
 {
     if (vob == null)
     {
         throw new ArgumentNullException("Vob is null!");
     }
     this.ForEachClientRougher(vob.Position, radius, action);
 }
Esempio n. 8
0
        partial void pBeforeRemoveVob(BaseVob vob)
        {
            var gVob = vob.gVob;

            // update position & direction one last time
            //vob.UpdateOrientation();
            //vob.UpdateEnvironment();

            // remove gothic-object from the gothic-world
            gWorld.RemoveVob(gVob);

            // remove the gothic-object's address from the dictionary
            vobAddr.Remove(gVob.Address);
        }
Esempio n. 9
0
        partial void pAfterAddVob(BaseVob vob)
        {
            if (!vob.IsStatic)
            {
                // find the cell for this vob
                Vec2i   coords = BigCell.GetCoords(vob.Position);
                int     coord  = BigCell.GetCoordinate(coords.X, coords.Y);
                BigCell cell;
                if (!cells.TryGetValue(coord, out cell))
                {
                    cell = new BigCell(this, coords.X, coords.Y);
                    cells.Add(coord, cell);
                }

                vob.AddToCell(cell);
            }
        }
Esempio n. 10
0
        internal void RemoveVob(BaseVob vob)
        {
            if (vob == null)
            {
                throw new ArgumentNullException("Vob is null!");
            }

            if (vob.World != this)
            {
                throw new ArgumentException("Vob is not in this world!");
            }

            pBeforeRemoveVob(vob);

            vobsByID.Remove(vob); // sets the vob ID to -1 on the server!!!
            vobs.Remove(ref vob.collID);

            pAfterRemoveVob(vob);
        }
Esempio n. 11
0
        internal void AddVob(BaseVob vob)
        {
            if (vob == null)
            {
                throw new ArgumentNullException("Vob is null!");
            }

            if (vob.IsSpawned)
            {
                throw new ArgumentException("Vob is already in a world!");
            }

            if (vob.Instance == null)
            {
                throw new ArgumentException("Vob has no instance!");
            }

            pBeforeAddVob(vob);

            vobsByID.Add(vob); // sets or checks the vob ID on the server
            vobs.Add(vob, ref vob.collID);

            pAfterAddVob(vob);
        }
Esempio n. 12
0
        internal void UpdateVobCell(BaseVob vob, Vec3f pos)
        {
            if (vob == null)
            {
                throw new ArgumentNullException("Vob is null!");
            }

            Vec2i coords = BigCell.GetCoords(pos);

            if (coords.X != vob.Cell.X || coords.Y != vob.Cell.Y)
            {
                vob.RemoveFromCell();

                int     coord = BigCell.GetCoordinate(coords.X, coords.Y);
                BigCell cell;
                if (!cells.TryGetValue(coord, out cell))
                {
                    cell = new BigCell(this, coords.X, coords.Y);
                    cells.Add(coord, cell);
                }

                vob.AddToCell(cell);
            }
        }
Esempio n. 13
0
 /// <summary> Gets a vob by ID from this world. </summary>
 public bool TryGetVob(int id, out BaseVob vob)
 {
     return(vobsByID.TryGet(id, out vob));
 }
Esempio n. 14
0
 partial void pAfterRemoveVob(BaseVob vob);
Esempio n. 15
0
 partial void pBeforeRemoveVob(BaseVob vob);
Esempio n. 16
0
 partial void pAfterAddVob(BaseVob vob);
Esempio n. 17
0
        DynamicCollection <BaseVob> vobs    = new DynamicCollection <BaseVob>(); // all vobs for fast foreach loops

        #region Add & Remove

        partial void pBeforeAddVob(BaseVob vob);
Esempio n. 18
0
 public bool TryGetVobByAddress(int address, out BaseVob vob)
 {
     return(vobAddr.TryGetValue(address, out vob));
 }