Exemplo n.º 1
0
        public override ICustomObject recreate(Dictionary <string, string> additionalSaveData, object replacement)
        {
            //instead of using this.offsetkey.x use get additional save data function and store offset key there

            Vector2    offsetKey = new Vector2(Convert.ToInt32(additionalSaveData["offsetKeyX"]), Convert.ToInt32(additionalSaveData["offsetKeyY"]));
            SolarPanel self      = Revitalize.ModCore.Serializer.DeserializeGUID <SolarPanel>(additionalSaveData["GUID"]);

            if (self == null)
            {
                return(null);
            }

            if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"]))
            {
                //Get new container
                MultiTiledObject obj = (MultiTiledObject)Revitalize.ModCore.Serializer.DeserializeGUID <MultiTiledObject>(additionalSaveData["ParentGUID"]);
                self.containerObject = obj;
                obj.addComponent(offsetKey, self);
                //Revitalize.ModCore.log("ADD IN AN OBJECT!!!!");
                Revitalize.ModCore.ObjectGroups.Add(additionalSaveData["ParentGUID"], (MultiTiledObject)obj);
            }
            else
            {
                self.containerObject = Revitalize.ModCore.ObjectGroups[additionalSaveData["ParentGUID"]];
                Revitalize.ModCore.ObjectGroups[additionalSaveData["GUID"]].addComponent(offsetKey, self);
                //Revitalize.ModCore.log("READD AN OBJECT!!!!");
            }

            return((ICustomObject)self);
        }
Exemplo n.º 2
0
        public override Item getOne()
        {
            SolarPanel component = new SolarPanel(this.data, this.info.Copy(), this.TileLocation, this.offsetKey, this.energyRequiredPer10Minutes, this.timeToProduce, this.updatesContainerObjectForProduction);

            return(component);
        }