Got custom furniture to sync before and after saves!
This commit is contained in:
parent
b53379736d
commit
a752503964
|
@ -112,7 +112,7 @@ namespace Revitalize.Framework.Objects
|
||||||
|
|
||||||
if (this.info == null)
|
if (this.info == null)
|
||||||
{
|
{
|
||||||
ModCore.log("Info was null when getting data.");
|
//ModCore.log("Info was null when getting data.");
|
||||||
this.updateInfo();
|
this.updateInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PyTK.CustomElementHandler;
|
using PyTK.CustomElementHandler;
|
||||||
using Revitalize.Framework.Objects.InformationFiles.Furniture;
|
using Revitalize.Framework.Objects.InformationFiles.Furniture;
|
||||||
using StardewValley;
|
using StardewValley;
|
||||||
|
@ -22,11 +23,12 @@ namespace Revitalize.Framework.Objects.Furniture
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if the player can sit "on" this component.
|
/// Checks if the player can sit "on" this component.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
public bool CanSitHere
|
public bool CanSitHere
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return (this.furnitureInfo as InformationFiles.Furniture.ChairInformation).canSitHere;
|
return this.furnitureInfo.canSitHere;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PyTK.CustomElementHandler;
|
using PyTK.CustomElementHandler;
|
||||||
using Revitalize.Framework.Illuminate;
|
using Revitalize.Framework.Illuminate;
|
||||||
using Revitalize.Framework.Utilities.Serialization;
|
using Revitalize.Framework.Utilities.Serialization;
|
||||||
|
@ -15,6 +16,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
||||||
{
|
{
|
||||||
public class LampTileComponent:FurnitureTileComponent
|
public class LampTileComponent:FurnitureTileComponent
|
||||||
{
|
{
|
||||||
|
[JsonIgnore]
|
||||||
public bool canTurnOn
|
public bool canTurnOn
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using PyTK.CustomElementHandler;
|
using PyTK.CustomElementHandler;
|
||||||
using Revitalize.Framework.Objects.InformationFiles.Furniture;
|
using Revitalize.Framework.Objects.InformationFiles.Furniture;
|
||||||
using Revitalize.Framework.Utilities.Serialization;
|
using Revitalize.Framework.Utilities.Serialization;
|
||||||
|
@ -18,6 +19,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
||||||
public TableInformation furnitureInfo;
|
public TableInformation furnitureInfo;
|
||||||
|
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public bool CanPlaceItemsHere
|
public bool CanPlaceItemsHere
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Revitalize.Framework.Objects.InformationFiles.Furniture
|
namespace Revitalize.Framework.Objects.InformationFiles.Furniture
|
||||||
{
|
{
|
||||||
public class ChairInformation:FurnitureInformation
|
public class ChairInformation
|
||||||
{
|
{
|
||||||
public bool canSitHere;
|
public bool canSitHere;
|
||||||
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Revitalize.Framework.Objects.InformationFiles.Furniture
|
|
||||||
{
|
|
||||||
public class FurnitureInformation
|
|
||||||
{
|
|
||||||
public FurnitureInformation()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -365,7 +365,7 @@ namespace Revitalize.Framework.Objects
|
||||||
if (this.info == null || this.containerObject==null)
|
if (this.info == null || this.containerObject==null)
|
||||||
{
|
{
|
||||||
this.ItemInfo = this.text;
|
this.ItemInfo = this.text;
|
||||||
ModCore.log("Updated item info!");
|
//ModCore.log("Updated item info!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,17 +18,17 @@ namespace Revitalize.Framework.Utilities
|
||||||
public static string RequestALLModObjects = "Revitalize.EndOfDayRequestAllObjects";
|
public static string RequestALLModObjects = "Revitalize.EndOfDayRequestAllObjects";
|
||||||
public static void GetModMessage(object o, StardewModdingAPI.Events.ModMessageReceivedEventArgs e)
|
public static void GetModMessage(object o, StardewModdingAPI.Events.ModMessageReceivedEventArgs e)
|
||||||
{
|
{
|
||||||
ModCore.log("Get a mod message: "+e.Type);
|
//ModCore.log("Get a mod message: "+e.Type);
|
||||||
if (e.Type.Equals(RequestGUIDMessage))
|
if (e.Type.Equals(RequestGUIDMessage))
|
||||||
{
|
{
|
||||||
ModCore.log("Send GUID Request");
|
//ModCore.log("Send GUID Request");
|
||||||
Guid request = Guid.Parse(e.ReadAs<string>());
|
Guid request = Guid.Parse(e.ReadAs<string>());
|
||||||
SendGuidObject(request);
|
SendGuidObject(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.Type.Equals(ReceieveGUIDMessage))
|
if (e.Type.Equals(ReceieveGUIDMessage))
|
||||||
{
|
{
|
||||||
ModCore.log("Receieve GUID Request");
|
//ModCore.log("Receieve GUID Request");
|
||||||
string objStr = e.ReadAs <string>();
|
string objStr = e.ReadAs <string>();
|
||||||
CustomObject v=(CustomObject)ModCore.Serializer.DeserializeFromJSONString<Item>(objStr);
|
CustomObject v=(CustomObject)ModCore.Serializer.DeserializeFromJSONString<Item>(objStr);
|
||||||
if (ModCore.CustomObjects.ContainsKey((v as CustomObject).guid) == false)
|
if (ModCore.CustomObjects.ContainsKey((v as CustomObject).guid) == false)
|
||||||
|
@ -45,13 +45,13 @@ namespace Revitalize.Framework.Utilities
|
||||||
|
|
||||||
if(e.Type.Equals(RequestGUIDMessage_Tile))
|
if(e.Type.Equals(RequestGUIDMessage_Tile))
|
||||||
{
|
{
|
||||||
ModCore.log("Send GUID Request FOR TILE");
|
//odCore.log("Send GUID Request FOR TILE");
|
||||||
Guid request = Guid.Parse(e.ReadAs<string>());
|
Guid request = Guid.Parse(e.ReadAs<string>());
|
||||||
SendGuidObject_Tile(request);
|
SendGuidObject_Tile(request);
|
||||||
}
|
}
|
||||||
if(e.Type.Equals(ReceieveGUIDMessage_Tile))
|
if(e.Type.Equals(ReceieveGUIDMessage_Tile))
|
||||||
{
|
{
|
||||||
ModCore.log("Receieve GUID Request FOR TILE");
|
//ModCore.log("Receieve GUID Request FOR TILE");
|
||||||
string objStr = e.ReadAs<string>();
|
string objStr = e.ReadAs<string>();
|
||||||
CustomObject v =(CustomObject)ModCore.Serializer.DeserializeFromJSONString<Item>(objStr);
|
CustomObject v =(CustomObject)ModCore.Serializer.DeserializeFromJSONString<Item>(objStr);
|
||||||
if (ModCore.CustomObjects.ContainsKey((v as CustomObject).guid) == false)
|
if (ModCore.CustomObjects.ContainsKey((v as CustomObject).guid) == false)
|
||||||
|
@ -81,13 +81,13 @@ namespace Revitalize.Framework.Utilities
|
||||||
{
|
{
|
||||||
if (ModCore.CustomObjects.ContainsKey(request))
|
if (ModCore.CustomObjects.ContainsKey(request))
|
||||||
{
|
{
|
||||||
ModCore.log("Send guid request!");
|
//ModCore.log("Send guid request!");
|
||||||
//ModCore.CustomObjects[request].forceUpdate();
|
//ModCore.CustomObjects[request].forceUpdate();
|
||||||
ModCore.ModHelper.Multiplayer.SendMessage<string>(ModCore.Serializer.ToJSONString(ModCore.CustomObjects[request]), ReceieveGUIDMessage, new string[] { Revitalize.ModCore.Manifest.UniqueID.ToString() });
|
ModCore.ModHelper.Multiplayer.SendMessage<string>(ModCore.Serializer.ToJSONString(ModCore.CustomObjects[request]), ReceieveGUIDMessage, new string[] { Revitalize.ModCore.Manifest.UniqueID.ToString() });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ModCore.log("This mod doesn't have the guid object");
|
//ModCore.log("This mod doesn't have the guid object");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ namespace Revitalize.Framework.Utilities
|
||||||
{
|
{
|
||||||
if (ModCore.CustomObjects.ContainsKey(request))
|
if (ModCore.CustomObjects.ContainsKey(request))
|
||||||
{
|
{
|
||||||
ModCore.log("Send guid tile request!");
|
//ModCore.log("Send guid tile request!");
|
||||||
//(ModCore.CustomObjects[request] as MultiTiledComponent).forceUpdate();
|
//(ModCore.CustomObjects[request] as MultiTiledComponent).forceUpdate();
|
||||||
//(ModCore.CustomObjects[request] as MultiTiledComponent).containerObject.forceUpdate();
|
//(ModCore.CustomObjects[request] as MultiTiledComponent).containerObject.forceUpdate();
|
||||||
(ModCore.CustomObjects[request] as MultiTiledComponent).containerObject.updateInfo();
|
(ModCore.CustomObjects[request] as MultiTiledComponent).containerObject.updateInfo();
|
||||||
|
@ -103,7 +103,7 @@ namespace Revitalize.Framework.Utilities
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ModCore.log("This mod doesn't have the guid tile");
|
//ModCore.log("This mod doesn't have the guid tile");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -263,14 +263,14 @@ namespace Revitalize.Framework.Utilities
|
||||||
{
|
{
|
||||||
//ModCore.log("Found a custom object in a chest!");
|
//ModCore.log("Found a custom object in a chest!");
|
||||||
string jsonString = JsonName;
|
string jsonString = JsonName;
|
||||||
ModCore.log(JsonName);
|
//ModCore.log(JsonName);
|
||||||
string dataSplit= jsonString.Split(new string[] { "<" }, StringSplitOptions.None)[1];
|
string dataSplit= jsonString.Split(new string[] { "<" }, StringSplitOptions.None)[1];
|
||||||
string backUpGUID = dataSplit.Split('|')[0];
|
string backUpGUID = dataSplit.Split('|')[0];
|
||||||
string[] guidArr = jsonString.Split(new string[] { "|" }, StringSplitOptions.None);
|
string[] guidArr = jsonString.Split(new string[] { "|" }, StringSplitOptions.None);
|
||||||
|
|
||||||
foreach(string s in guidArr)
|
foreach(string s in guidArr)
|
||||||
{
|
{
|
||||||
ModCore.log(s);
|
//ModCore.log(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
string guidName = guidArr[guidArr.Length - 1];
|
string guidName = guidArr[guidArr.Length - 1];
|
||||||
|
@ -285,7 +285,7 @@ namespace Revitalize.Framework.Utilities
|
||||||
Guid d = Guid.Parse(backUpGUID);
|
Guid d = Guid.Parse(backUpGUID);
|
||||||
guidName = backUpGUID;
|
guidName = backUpGUID;
|
||||||
}
|
}
|
||||||
ModCore.log("THE GUID IS:"+ guidName);
|
//ModCore.log("THE GUID IS:"+ guidName);
|
||||||
|
|
||||||
//ModCore.log(jsonString);
|
//ModCore.log(jsonString);
|
||||||
string type = jsonString.Split('|')[2];
|
string type = jsonString.Split('|')[2];
|
||||||
|
|
|
@ -127,7 +127,6 @@
|
||||||
<Compile Include="Framework\Objects\Furniture\TableTileComponent.cs" />
|
<Compile Include="Framework\Objects\Furniture\TableTileComponent.cs" />
|
||||||
<Compile Include="Framework\Objects\InformationFiles\Furniture\ArcadeCabinetInformation.cs" />
|
<Compile Include="Framework\Objects\InformationFiles\Furniture\ArcadeCabinetInformation.cs" />
|
||||||
<Compile Include="Framework\Objects\InformationFiles\Furniture\ChairInformation.cs" />
|
<Compile Include="Framework\Objects\InformationFiles\Furniture\ChairInformation.cs" />
|
||||||
<Compile Include="Framework\Objects\InformationFiles\Furniture\FurnitureInformation.cs" />
|
|
||||||
<Compile Include="Framework\Objects\InformationFiles\Furniture\TableInformation.cs" />
|
<Compile Include="Framework\Objects\InformationFiles\Furniture\TableInformation.cs" />
|
||||||
<Compile Include="Framework\Objects\InformationFiles\ObjectGUIDInfo.cs" />
|
<Compile Include="Framework\Objects\InformationFiles\ObjectGUIDInfo.cs" />
|
||||||
<Compile Include="Framework\Objects\InformationFiles\ResourceInformaton.cs" />
|
<Compile Include="Framework\Objects\InformationFiles\ResourceInformaton.cs" />
|
||||||
|
|
Loading…
Reference in New Issue