public static AbstractWorldEntity Read(AbstractWorldEntity entity, ref BinaryReader reader)
 {
     entity.ID            = EntityIDHandler.Read(ref reader);
     entity.pos           = WorldCoordinateHandler.Read(ref reader);
     entity.InDen         = reader.ReadBoolean();
     entity.timeSpentHere = reader.ReadInt32();
     return(entity);
 }
        /* public static AbstractPhysicalObject Read(AbstractPhysicalObject physicalObject, ref BinaryReader reader)
         * {
         *  physicalObject.ID = EntityIDHandler.Read(ref reader);
         *  physicalObject.pos = WorldCoordinateHandler.Read(ref reader);
         *  physicalObject.InDen = reader.ReadBoolean();
         *  physicalObject.timeSpentHere = reader.ReadInt32();
         *  physicalObject.type = (AbstractPhysicalObject.AbstractObjectType)reader.ReadByte();
         *  physicalObject.ID.number = reader.ReadInt32();
         *  physicalObject.destroyOnAbstraction = true;
         *  return physicalObject;
         * } */

        public static void Read(AbstractPhysicalObject physicalObject, ref BinaryReader reader)
        {
            physicalObject.ID                   = EntityIDHandler.Read(ref reader);
            physicalObject.pos                  = WorldCoordinateHandler.Read(ref reader);
            physicalObject.InDen                = reader.ReadBoolean();
            physicalObject.timeSpentHere        = reader.ReadInt32();
            physicalObject.type                 = (AbstractPhysicalObject.AbstractObjectType)reader.ReadByte();
            physicalObject.ID.number            = reader.ReadInt32();
            physicalObject.destroyOnAbstraction = true;
        }
Esempio n. 3
0
            public static AbstractCreatureAI Read(AbstractCreatureAI abstractCreatureAI, ref BinaryReader reader)
            {
                int numberOfNodes = reader.ReadInt32();

                abstractCreatureAI.path.Clear();
                for (int a = 0; a < numberOfNodes; a++)
                {
                    abstractCreatureAI.path.Add(WorldCoordinateHandler.Read(ref reader));
                }
                return(abstractCreatureAI);
            }
Esempio n. 4
0
 public static AbstractPhysicalObject Read(AbstractPhysicalObject physicalObject, ref BinaryReader reader)
 {
     physicalObject.ID            = EntityIDHandler.Read(ref reader);
     physicalObject.pos           = WorldCoordinateHandler.Read(ref reader);
     physicalObject.InDen         = reader.ReadBoolean();
     physicalObject.timeSpentHere = reader.ReadInt32();
     physicalObject.type          = (AbstractPhysicalObject.AbstractObjectType)reader.ReadByte();
     (physicalObject as Patches.patch_AbstractPhysicalObject).dist = reader.ReadInt32();
     physicalObject.destroyOnAbstraction = true;
     return(physicalObject);
 }
Esempio n. 5
0
 public static void Read(Creature creature, ref BinaryReader reader)
 {
     AbstractCreatureHandler.Read(creature, ref reader);
     PhysicalObjectHandler.Read(creature, ref reader);
     //creature.blind = reader.ReadInt32();
     CreatureHK.Sync(creature, reader.ReadBoolean());
     creature.enteringShortCut             = IntVector2NHandler.Read(ref reader);
     creature.lastCoord                    = WorldCoordinateHandler.Read(ref reader);
     creature.leechedOut                   = reader.ReadBoolean();
     creature.newToRoomInvinsibility       = reader.ReadInt32();
     creature.NPCTransportationDestination = WorldCoordinateHandler.Read(ref reader);
     creature.shortcutDelay                = reader.ReadInt32();
     // return creature;
 }
Esempio n. 6
0
 public static Creature Read(Creature creature, ref BinaryReader reader)
 {
     creature.abstractPhysicalObject = AbstractCreatureHandler.Read(creature.abstractCreature, ref reader);
     creature = PhysicalObjectHandler.Read(creature, ref reader);
     //creature.blind = reader.ReadInt32();
     (creature as Patches.patch_Player).Sync(reader.ReadBoolean());
     creature.enteringShortCut             = IntVector2NHandler.Read(ref reader);
     creature.lastCoord                    = WorldCoordinateHandler.Read(ref reader);
     creature.leechedOut                   = reader.ReadBoolean();
     creature.newToRoomInvinsibility       = reader.ReadInt32();
     creature.NPCTransportationDestination = WorldCoordinateHandler.Read(ref reader);
     creature.shortcutDelay                = reader.ReadInt32();
     return(creature);
 }
Esempio n. 7
0
 public static void Read(AbstractCreature creature, ref BinaryReader reader)
 {
     creature.ID            = EntityIDHandler.Read(ref reader);
     creature.pos           = WorldCoordinateHandler.Read(ref reader);
     creature.InDen         = reader.ReadBoolean();
     creature.timeSpentHere = reader.ReadInt32();
     //creature.type = (AbstractPhysicalObject.AbstractObjectType)reader.ReadByte();
     creature.ID.number            = reader.ReadInt32();
     creature.destroyOnAbstraction = true;
     //creature.abstractAI = AbstractCreatureAIHandler.Read(creature.abstractAI, ref reader);
     //Additional personality and relationship traits should be synced here!
     creature.remainInDenCounter = reader.ReadInt32();
     creature.spawnDen           = WorldCoordinateHandler.Read(ref reader);
     //creature state should also be synced here!!
     //return creature;
 }
Esempio n. 8
0
        public void ReadPlayer(BinaryReader br, CSteamID sentPlayer)
        {
            if (!MonklandSteamManager.WorldManager.gameRunning)
            {
                return;
            }
            string roomName = br.ReadString();//Read Room Name

            if (!MonklandSteamManager.WorldManager.commonRooms.ContainsKey(roomName))
            {
                return;
            }
            AbstractRoom abstractRoom = patch_RainWorldGame.mainGame.world.GetAbstractRoom(roomName);

            if (abstractRoom == null || abstractRoom.realizedRoom == null)
            {
                return;
            }
            int             dist     = br.ReadInt32();                      // Read Disinguisher
            WorldCoordinate startPos = WorldCoordinateHandler.Read(ref br); // Read World Coordinate

            foreach (AbstractCreature cr in abstractRoom.creatures)
            {
                if (((cr as AbstractPhysicalObject) as patch_AbstractPhysicalObject).dist == dist && cr.realizedCreature != null)
                {
                    cr.realizedCreature = PlayerHandler.Read((cr.realizedCreature as Player), ref br);// Read Player
                    cr.pos.room         = abstractRoom.index;
                    return;
                }
            }
            startPos.room         = abstractRoom.index;
            startPos.abstractNode = -1;
            AbstractCreature abstractCreature = new AbstractCreature(patch_RainWorldGame.mainGame.world, StaticWorld.GetCreatureTemplate("Slugcat"), null, startPos, new EntityID(-1, 1));

            abstractCreature.state = new PlayerState(abstractCreature, 1, 0, false);
            ((abstractCreature as AbstractPhysicalObject) as patch_AbstractPhysicalObject).dist  = dist;
            ((abstractCreature as AbstractPhysicalObject) as patch_AbstractPhysicalObject).owner = sentPlayer.m_SteamID;
            abstractCreature.pos.room = abstractRoom.index;
            patch_RainWorldGame.mainGame.world.GetAbstractRoom(abstractCreature.pos.room).AddEntity(abstractCreature);
            abstractCreature.RealizeInRoom();
            abstractCreature.realizedCreature = PlayerHandler.Read((abstractCreature.realizedCreature as Player), ref br);// Read Player
            abstractCreature.pos.room         = abstractRoom.index;
        }
Esempio n. 9
0
        public static Player Read(Player creature, ref BinaryReader reader)
        {
            creature.abstractPhysicalObject = AbstractCreatureHandler.Read(creature.abstractCreature, ref reader);
            creature = PhysicalObjectHandler.Read(creature, ref reader);
            //creature.blind = reader.ReadInt32();
            (creature as Patches.patch_Player).Sync(reader.ReadBoolean());
            creature.enteringShortCut             = IntVector2NHandler.Read(ref reader);
            creature.lastCoord                    = WorldCoordinateHandler.Read(ref reader);
            creature.leechedOut                   = reader.ReadBoolean();
            creature.newToRoomInvinsibility       = reader.ReadInt32();
            creature.NPCTransportationDestination = WorldCoordinateHandler.Read(ref reader);
            creature.shortcutDelay                = reader.ReadInt32();

            /*int len = reader.ReadInt32();
             * for (int i = 0; i < len; i++)
             * {
             *  if (i < creature.grasps.Length && creature.grasps[i] != null)
             *  {
             *      creature.grasps[i] = GraspHandler.Read(ref creature.grasps[i], creature, ref reader, creature.room);
             *  }
             *  else
             *  {
             *      Creature.Grasp grasp = GraspHandler.Read(creature, ref reader, creature.room);
             *      if (i < creature.grasps.Length && grasp != null && grasp.grabbed != null && grasp.grabber != null)
             *      {
             *          MonklandSteamManager.Log("Grabbed Rock!");
             *          (creature as Player).switchHandsCounter = 0;
             *          ((creature as Player) as patch_Player).setWantToPickUp(0);
             *          (creature as Player).noPickUpOnRelease = 20;
             *          if (creature.grasps[i] != null)
             *          {
             *              creature.ReleaseGrasp(i);
             *          }
             *          creature.grasps[i] = new Creature.Grasp(creature, grasp.grabbed, i, grasp.chunkGrabbed, grasp.shareability, grasp.dominance, grasp.pacifying);
             *          grasp.grabbed.Grabbed(creature.grasps[i]);
             *          new AbstractPhysicalObject.CreatureGripStick(creature.abstractCreature, grasp.grabbed.abstractPhysicalObject, i, grasp.pacifying);
             *      }
             *  }
             * }*/
            return(creature);
        }