From 9950a6d0c0e50184eb9a2d558a69a5ee5476d51f Mon Sep 17 00:00:00 2001 From: JoshuaNavarro Date: Mon, 26 Aug 2019 21:46:36 -0700 Subject: [PATCH] Better pytk sync. --- .../Framework/Objects/BasicItemInformation.cs | 5 +++++ .../Revitalize/Framework/Objects/CustomObject.cs | 16 ++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs b/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs index 9b46d975..ce3405dc 100644 --- a/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs +++ b/GeneralMods/Revitalize/Framework/Objects/BasicItemInformation.cs @@ -113,6 +113,11 @@ namespace Revitalize.Framework.Objects { return new BasicItemInformation(this.name, this.id,this.description, this.categoryName, this.categoryColor, this.edibility, this.fragility, this.isLamp, this.price, this.canBeSetOutdoors, this.canBeSetIndoors, this.animationManager.getTexture(), this.animationManager, this.drawColor, this.ignoreBoundingBox, this.inventory.Copy(), this.lightManager.Copy()); } + + public bool requiresSyncUpdate() + { + return true; + } } } diff --git a/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs b/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs index 26c354eb..dbcfed3e 100644 --- a/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs +++ b/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs @@ -20,7 +20,7 @@ namespace Revitalize.Framework.Objects public class CustomObject : PySObject { - public string text + public virtual string text { get { @@ -154,6 +154,7 @@ namespace Revitalize.Framework.Objects } set { + if (string.IsNullOrEmpty(value)) return; this.info = (BasicItemInformation)Revitalize.ModCore.Serializer.DeserializeFromJSONString(value, typeof(BasicItemInformation)); } } @@ -208,7 +209,7 @@ namespace Revitalize.Framework.Objects //this.initNetFields(); this.InitNetFields(); this.updateInfo(); - this.Price = info.price; + this.Price = this.info.price; //if (this.info.ignoreBoundingBox) // this.boundingBox.Value = new Rectangle(int.MinValue, int.MinValue, 0, 0); } @@ -594,14 +595,9 @@ namespace Revitalize.Framework.Objects return; } - if (string.IsNullOrEmpty(this.ItemInfo)) - { - this.ItemInfo = this.text; - } - else - { - this.text = this.ItemInfo; - } + this.ItemInfo = this.text; + this.text = this.ItemInfo; + } //~~~~~~~~~~~~~~~~~~~~~~~~~//