Esempio n. 1
0
        internal static void Init()
        {
            if (PowerManager.IsEnabled())
            {
                string saveloc = "";

                saveloc = NewColonyAPI.Helpers.Utilities.GetWorldJSONPath("portals.json");
                if (JSON.Deserialize(saveloc, out JSONNode initportals, false))
                {
                    foreach (var item in initportals.LoopArray())
                    {
                        portals.Add(item.GetAs <int>("id"), new TeleporterData(NewColonyAPI.Helpers.Utilities.NodeToVector3Int(item.GetAs <JSONNode>("location")), item.GetAs <string>("key")));
                    }
                }

                saveloc = NewColonyAPI.Helpers.Utilities.GetWorldJSONPath("recallinfo.json");
                if (JSON.Deserialize(saveloc, out JSONNode initrecall, false))
                {
                    foreach (var item in initrecall.LoopArray())
                    {
                        if (NetworkID.TryParse(item.GetAs <string>("id"), out NetworkID networkID))
                        {
                            lastpos.Add(Players.GetPlayer(networkID), item.GetAs <JSONNode>("location").ToVector3());
                        }
                    }
                }
            }
        }