Beispiel #1
0
        public override ICustomObject recreate(Dictionary <string, string> additionalSaveData, object replacement)
        {
            Vector2   offsetKey = new Vector2(Convert.ToInt32(additionalSaveData["offsetKeyX"]), Convert.ToInt32(additionalSaveData["offsetKeyY"]));
            string    GUID      = additionalSaveData["GUID"];
            WaterPump self      = Revitalize.ModCore.Serializer.DeserializeGUID <WaterPump>(additionalSaveData["GUID"]);

            if (ModCore.IsNullOrDefault <Machine>(self))
            {
                return(null);
            }
            try
            {
                if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"]))
                {
                    MultiTiledObject obj = (MultiTiledObject)Revitalize.ModCore.Serializer.DeserializeGUID <MultiTiledObject>(additionalSaveData["ParentGUID"]);
                    self.containerObject = obj;
                    self.containerObject.removeComponent(offsetKey);
                    self.containerObject.addComponent(offsetKey, self);
                    Revitalize.ModCore.ObjectGroups.Add(additionalSaveData["ParentGUID"], obj);
                }
                else
                {
                    self.containerObject = Revitalize.ModCore.ObjectGroups[additionalSaveData["ParentGUID"]];
                    self.containerObject.removeComponent(offsetKey);
                    self.containerObject.addComponent(offsetKey, self);
                }
            }
            catch (Exception err)
            {
                ModCore.log(err);
            }

            return(self);
        }
Beispiel #2
0
        public override Item getOne()
        {
            WaterPump component = new WaterPump(this.data, this.info.Copy(), this.producedResources, this.energyRequiredPer10Minutes, this.timeToProduce, this.updatesContainerObjectForProduction, this.craftingRecipeBook);

            component.containerObject = this.containerObject;
            component.offsetKey       = this.offsetKey;
            return(component);

            return(component);
        }
        public override Item getOne()
        {
            WaterPump component = new WaterPump(this.basicItemInfo.Copy(), this.producedResources, this.energyRequiredPer10Minutes, this.timeToProduce, this.craftingRecipeBook);

            return(component);
        }