Beispiel #1
0
        public OBJfFunctionEntry[] GenerateFunctionTable(OBJD obj)
        {
            OBJfFunctionEntry[] result = new OBJfFunctionEntry[33];

            result[0].ActionFunction  = obj.BHAV_Init;
            result[1].ActionFunction  = obj.BHAV_MainID;
            result[2].ActionFunction  = obj.BHAV_Load;
            result[3].ActionFunction  = obj.BHAV_Cleanup;
            result[4].ActionFunction  = obj.BHAV_QueueSkipped;
            result[5].ActionFunction  = obj.BHAV_AllowIntersectionID;
            result[6].ActionFunction  = obj.BHAV_WallAdjacencyChanged;
            result[7].ActionFunction  = obj.BHAV_RoomChange;
            result[8].ActionFunction  = obj.BHAV_DynamicMultiTileUpdate;
            result[9].ActionFunction  = obj.BHAV_Place;
            result[10].ActionFunction = obj.BHAV_Pickup;
            result[11].ActionFunction = obj.BHAV_UserPlace;
            result[12].ActionFunction = obj.BHAV_UserPickup;
            result[13].ActionFunction = obj.BHAV_LevelInfo;
            result[14].ActionFunction = obj.BHAV_ServingSurface;
            result[15].ActionFunction = obj.BHAV_Portal; //portal
            result[16].ActionFunction = obj.BHAV_GardeningID;
            result[17].ActionFunction = obj.BHAV_WashHandsID;
            result[18].ActionFunction = obj.BHAV_PrepareFoodID;
            result[19].ActionFunction = obj.BHAV_CookFoodID;
            result[20].ActionFunction = obj.BHAV_PlaceSurfaceID;
            result[21].ActionFunction = obj.BHAV_DisposeID;
            result[22].ActionFunction = obj.BHAV_EatID;
            result[23].ActionFunction = obj.BHAV_PickupFromSlotID; //pickup from slot
            result[24].ActionFunction = obj.BHAV_WashDishID;
            result[25].ActionFunction = obj.BHAV_EatSurfaceID;
            result[26].ActionFunction = obj.BHAV_SitID;
            result[27].ActionFunction = obj.BHAV_StandID;
            result[28].ActionFunction = obj.BHAV_Clean;
            result[29].ActionFunction = obj.BHAV_Repair; //repair
            result[30].ActionFunction = 0;               //client house join
            result[31].ActionFunction = 0;               //prepare for sale
            result[32].ActionFunction = 0;               //house unload

            return(result);
        }
Beispiel #2
0
 public OBJfFunctionEntry[] GetFunctionTable()
 {
     if (IsOBJDFunc)
     {
         var result = new OBJfFunctionEntry[FunctionOBJDNames.Length];
         for (int i = 0; i < FunctionOBJDNames.Length; i++)
         {
             if (FunctionOBJDNames[i] == "")
             {
                 continue;
             }
             result[i] = new OBJfFunctionEntry
             {
                 ActionFunction = ActiveObject.OBJ.GetPropertyByName <ushort>(FunctionOBJDNames[i])
             };
         }
         return(result);
     }
     else
     {
         return(ActiveObject.Resource.Get <OBJf>(ActiveObject.OBJ.ChunkID).functions);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Constructs a new VMEntity instance.
        /// </summary>
        /// <param name="obj">A GameObject instance.</param>
        public VMEntity(GameObject obj)
        {
            this.Object = obj;

            /**
             * For some reason, in the aquarium object (maybe others) the numAttributes is set to 0
             * but it should be 4. There are 4 entries in the label table. Go figure?
             */
            ObjectData   = new short[80];
            MeToObject   = new Dictionary <ushort,List <short> >();
            SoundThreads = new List <VMSoundEntry>();

            RTTI = new VMEntityRTTI();
            var numAttributes = obj.OBJ.NumAttributes;

            if (obj.OBJ.UsesFnTable == 0)
            {
                EntryPoints = GenerateFunctionTable(obj.OBJ);
            }
            else
            {
                var OBJfChunk = obj.Resource.Get <OBJf>(obj.OBJ.ChunkID); //objf has same id as objd
                if (OBJfChunk != null)
                {
                    EntryPoints = OBJfChunk.functions;
                }
            }

            if (obj.GUID == 0xa9bb3a76)
            {
                EntryPoints[17] = new OBJfFunctionEntry();
            }

            var test = obj.Resource.List <OBJf>();

            SemiGlobal = obj.Resource.SemiGlobal;

            Slots = obj.Resource.Get <SLOT>(obj.OBJ.SlotID); //containment slots are dealt with in the avatar and object classes respectively.

            var attributeTable = obj.Resource.Get <STR>(256);

            if (attributeTable != null)
            {
                numAttributes        = (ushort)Math.Max(numAttributes,attributeTable.Length);
                RTTI.AttributeLabels = new string[numAttributes];
                for (var i = 0; i < numAttributes; i++)
                {
                    RTTI.AttributeLabels[i] = attributeTable.GetString(i);
                }
            }

            TreeTable = obj.Resource.Get <TTAB>(obj.OBJ.TreeTableID);
            if (TreeTable != null)
            {
                TreeTableStrings = obj.Resource.Get <TTAs>(obj.OBJ.TreeTableID);
            }
            if (TreeTable == null && SemiGlobal != null)
            {
                TreeTable        = SemiGlobal.Get <TTAB>(obj.OBJ.TreeTableID); //tree not in local, try semiglobal
                TreeTableStrings = SemiGlobal.Get <TTAs>(obj.OBJ.TreeTableID);
            }
            //no you cannot get global tree tables don't even ask

            this.Attributes = new List <short>(numAttributes);
            SetFlag(VMEntityFlags.ChairFacing,true);
        }