Exemplo n.º 1
0
        public ChunkMapLayer(ICoreAPI api, IWorldMapManager mapSink) : base(api, mapSink)
        {
            api.Event.ChunkDirty += Event_OnChunkDirty;

            if (api.Side == EnumAppSide.Server)
            {
                (api as ICoreServerAPI).Event.DidPlaceBlock += Event_DidPlaceBlock;
            }
            else
            {
                (api as ICoreClientAPI).RegisterCommand("map", "world map stuff", "", onMapCmd);
            }

            if (api.Side == EnumAppSide.Client)
            {
                api.World.Logger.Notification("Loading world map cache db...");
                mapdb = new MapDB(api.World.Logger);
                string errorMessage  = null;
                string mapdbfilepath = getMapDbFilePath();
                mapdb.OpenOrCreate(mapdbfilepath, ref errorMessage, true, false, false);
                if (errorMessage != null)
                {
                    throw new Exception(string.Format("Cannot open {0}, possibly corrupted. Please fix manually or delete this file to continue playing", mapdbfilepath));
                }
            }
        }
Exemplo n.º 2
0
 public ChunkMapLayer(ICoreAPI api, IWorldMapManager mapSink) : base(api, mapSink)
 {
     api.Event.ChunkDirty += Event_OnChunkDirty;
     if (api.Side == EnumAppSide.Server)
     {
         (api as ICoreServerAPI).Event.DidPlaceBlock += Event_DidPlaceBlock;
     }
 }
Exemplo n.º 3
0
        public WaypointMapLayer(ICoreAPI api, IWorldMapManager mapSink) : base(api, mapSink)
        {
            if (api.Side == EnumAppSide.Server)
            {
                ICoreServerAPI sapi = api as ICoreServerAPI;
                this.sapi = sapi;

                sapi.Event.GameWorldSave += OnSaveGameGettingSaved;
                sapi.RegisterCommand("waypoint", "Put a waypoint at this location which will be visible for you on the map", "[add|remove|list]", OnCmdWayPoint, Privilege.chat);
            }
        }
        public WaypointMapLayer(ICoreAPI api, IWorldMapManager mapSink) : base(api, mapSink)
        {
            if (api.Side == EnumAppSide.Server)
            {
                ICoreServerAPI sapi = api as ICoreServerAPI;
                this.sapi = sapi;

                sapi.Event.GameWorldSave += OnSaveGameGettingSaved;
                sapi.RegisterCommand("waypoint", "Put a waypoint at this location which will be visible for you on the map", "[add|addat|modify|remove|list]", OnCmdWayPoint, Privilege.chat);
                sapi.RegisterCommand("tpwp", "Teleport yourself to a waypoint starting with the supplied name", "[name]", OnCmdTpTo, Privilege.tp);
            }
        }
Exemplo n.º 5
0
 public ProspectorOverlayLayer(ICoreAPI api, IWorldMapManager mapSink) : base(api, mapSink)
 {
     _worldMapManager = mapSink;
     _chunksize       = api.World.BlockAccessor.ChunkSize;
     _messages        = api.LoadOrCreateDataFile <ProspectorMessages>(Filename);
     _triggerword     = Lang.GetUnformatted("propick-reading-title")?.Split().FirstOrDefault();
     _cleanupRegex    = new Regex("<.*?>", RegexOptions.Compiled);
     if (api.Side == EnumAppSide.Client)
     {
         _clientApi = (ICoreClientAPI)api;
         _clientApi.Event.ChatMessage += OnChatMessage;
     }
 }
Exemplo n.º 6
0
        public ProspectorOverlayLayer(ICoreAPI api, IWorldMapManager mapSink) : base(api, mapSink)
        {
            _worldMapManager = mapSink;
            _chunksize       = api.World.BlockAccessor.ChunkSize;
            _messages        = api.LoadOrCreateDataFile <ProspectorMessages>(Filename);
            _triggerwords    = LangUtils.GetAllLanguageStringsOfKey("propick-reading-title").Select(x => x.Split().FirstOrDefault()).Where(x => !string.IsNullOrEmpty(x)).ToArray();
            _cleanupRegex    = new Regex("<.*?>", RegexOptions.Compiled);

            var modSystem = this.api.ModLoader.GetModSystem <ProspectorInfoModSystem>();

            _config = modSystem.Config;

            if (api.Side == EnumAppSide.Client)
            {
                _clientApi = (ICoreClientAPI)api;
                _clientApi.Event.ChatMessage            += OnChatMessage;
                _clientApi.Event.AfterActiveSlotChanged += Event_AfterActiveSlotChanged;
                _clientApi.Event.PlayerJoin             += (p) =>
                {
                    if (p == _clientApi?.World.Player)
                    {
                        var invMan = p?.InventoryManager?.GetHotbarInventory();
                        invMan.SlotModified += Event_SlotModified;
                    }
                };
                _clientApi.Event.PlayerLeave += (p) =>
                {
                    if (p == _clientApi?.World.Player)
                    {
                        var invMan = p?.InventoryManager?.GetHotbarInventory();
                        invMan.SlotModified -= Event_SlotModified;
                    }
                };

                _clientApi.RegisterCommand("pi", "ProspectorInfo main command. Allows you to toggle the visibility of the chunk texture overlay.", "", OnPiCommand);

                _colorTexture?.Dispose();
                _colorTexture = GenerateOverlayTexture();
            }
        }
Exemplo n.º 7
0
 public PlayerMapLayer(ICoreAPI api, IWorldMapManager mapsink) : base(api, mapsink)
 {
     capi = (api as ICoreClientAPI);
 }
Exemplo n.º 8
0
 public MapLayer(ICoreAPI api, IWorldMapManager mapSink)
 {
     this.api     = api;
     this.mapSink = mapSink;
 }
Exemplo n.º 9
0
 public MarkerMapLayer(ICoreAPI api, IWorldMapManager mapSink) : base(api, mapSink)
 {
 }
Exemplo n.º 10
0
 public ChunkMapLayer(ICoreAPI api, IWorldMapManager mapSink) : base(api, mapSink)
 {
     api.Event.ChunkDirty += Event_OnChunkDirty;
 }