Added warnings when trying to play with revitalize in multiplayer.

This commit is contained in:
Joshua Navarro 2019-01-10 13:37:35 -08:00
parent dfe374e428
commit 01483cdaff
6 changed files with 18 additions and 56 deletions

View File

@ -1,8 +1,6 @@
using System;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Netcode;
using PyTK.CustomElementHandler;
using Revitalize.Framework.Graphics.Animations;
using Revitalize.Framework.Illuminate;
@ -11,11 +9,7 @@ using StardewValley;
namespace Revitalize.Framework.Objects
{
/// <summary>
/// In Order to make this network compatible, I MUST, MUST, MUST make it use this INetSerializable functionality.
/// </summary>
public class BasicItemInformation : CustomObjectData, INetSerializable
public class BasicItemInformation : CustomObjectData
{
public string name;
public string description;
@ -97,36 +91,7 @@ namespace Revitalize.Framework.Objects
this.inventory = Inventory ?? new InventoryManager();
this.lightManager = Lights ?? new LightManager();
this.facingDirection = Enums.Direction.Down;
}
public uint DirtyTick { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public bool Dirty => throw new NotImplementedException();
public bool NeedsTick { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public bool ChildNeedsTick { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public INetSerializable Parent { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public INetRoot Root => throw new NotImplementedException();
public void MarkClean()
{
throw new NotImplementedException();
}
public void MarkDirty()
{
throw new NotImplementedException();
}
public void Read(BinaryReader reader, NetVersion version)
{
throw new NotImplementedException();
}
public void ReadFull(BinaryReader reader, NetVersion version)
{
throw new NotImplementedException();
}
public void recreateDataString()
@ -134,19 +99,6 @@ namespace Revitalize.Framework.Objects
this.data = $"{this.name}/{this.price}/{this.edibility}/Crafting -9/{this.description}/{this.canBeSetOutdoors}/{this.canBeSetIndoors}/{this.fragility}/{this.isLamp}/{this.name}";
}
public bool Tick()
{
throw new NotImplementedException();
}
public void Write(BinaryWriter writer)
{
throw new NotImplementedException();
}
public void WriteFull(BinaryWriter writer)
{
throw new NotImplementedException();
}
}
}

View File

@ -77,6 +77,9 @@ namespace Revitalize.Framework.Objects
this.bigCraftable.Value = false;
this.initNetFields();
//if (this.info.ignoreBoundingBox)
// this.boundingBox.Value = new Rectangle(int.MinValue, int.MinValue, 0, 0);
}
@ -369,6 +372,8 @@ namespace Revitalize.Framework.Objects
public void InitNetFields()
{
this.initNetFields();
this.syncObject = new PySync(this);
this.NetFields.AddField(this.syncObject);
}

View File

@ -228,11 +228,13 @@ namespace Revitalize.Framework.Objects
obj.childrenGuids.Remove(pair.Key);
Revitalize.ModCore.log("DESERIALIZE: " + pair.Value.ToString());
MultiTiledComponent component= (MultiTiledComponent)Revitalize.ModCore.Serializer.Deserialize<MultiTiledComponent>(Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, pair.Value + ".json"));
component.InitNetFields();
obj.addComponent(pair.Key, component);
}
obj.InitNetFields();
if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["GUID"]))
{

View File

@ -30,7 +30,7 @@ namespace Revitalize.Framework.Utilities
this.addConverter(new Framework.Utilities.Serialization.Converters.RectangleConverter());
this.addConverter(new Framework.Utilities.Serialization.Converters.Texture2DConverter());
this.addConverter(new Framework.Utilities.Serialization.Converters.NetFieldConverter());
//this.addConverter(new Framework.Utilities.Serialization.Converters.NetFieldConverter());
//this.addConverter(new Framework.Utilities.Serialization.Converters.Vector2Converter());
}

View File

@ -275,7 +275,10 @@ namespace Revitalize
private void GameLoop_SaveLoaded(object sender, StardewModdingAPI.Events.SaveLoadedEventArgs e)
{
if (Game1.IsServer || Game1.IsMultiplayer || Game1.IsClient)
{
throw new Exception("Can't run in multiplayer!");
}
Game1.player.addItemToInventory(customObjects["Omegasis.BigTiledTest"]);