Exemplo n.º 1
0
        private MapMarkerGenericRadius GetOrAddMarker(BasePlayer player, Vector3 pos)
        {
            if (!permission.UserHasPermission(player.UserIDString, permUse))
            {
                return(null);
            }
            List <MapMarkerGenericRadius> playerMarkers;

            if (!_mapMarker.TryGetValue(player.userID, out playerMarkers))
            {
                _mapMarker.Add(player.userID, playerMarkers = new List <MapMarkerGenericRadius>());
            }
            MapMarkerGenericRadius marker = playerMarkers.FirstOrDefault(m => m.transform.position == pos);

            marker = GameManager.server.CreateEntity("assets/prefabs/tools/map/genericradiusmarker.prefab", pos) as MapMarkerGenericRadius;
            if (marker == null)
            {
                return(null);
            }
            marker.alpha = _config.markerAlpha;
            string colorMarker  = _config.markerColor;
            string colorOutline = _config.markerColorOutline;

            ColorUtility.TryParseHtmlString($"#{colorMarker}", out marker.color1);
            ColorUtility.TryParseHtmlString($"#{colorOutline}", out marker.color2);
            marker.radius  = _config.markerRadius;
            marker.OwnerID = player.userID;
            playerMarkers.Add(marker);
            marker.Spawn();
            return(marker);
        }
Exemplo n.º 2
0
            private void SpawnCrate()
            {
                _marker = GameManager.server.CreateEntity(MARKER_PREFAB, _position) as MapMarkerGenericRadius;
                if (_marker == null)
                {
                    return;
                }

                _marker.enableSaving = false;
                _marker.color1       = GetColor(_settings.MarkerColor);
                _marker.color2       = GetColor(_settings.MarkerBorderColor);
                _marker.alpha        = _settings.MarkerOpacity;
                _marker.radius       = 0.5f;
                _marker.Spawn();

                _crate = GameManager.server.CreateEntity(CRATE_PREFAB, _position, Quaternion.identity) as HackableLockedCrate;
                if (_crate == null)
                {
                    return;
                }

                _crate.enableSaving = false;
                _crate.shouldDecay  = false;
                _crate.SetWasDropped();
                _crate.Spawn();
                _crate.gameObject.GetOrAddComponent <DropComponent>();

                _marker.SetParent(_crate);
                _marker.transform.localPosition = Vector3.zero;
                _marker.SendUpdate();
            }
Exemplo n.º 3
0
        private void GenerateMarkers()
        {
            // Generate the map marker
            // Clear all the previously generated map markers
            if (dropradius != null)
            {
                foreach (var paire in dropradius)
                {
                    MapMarkerGenericRadius MapMarkerDel = paire.Value;

                    if (MapMarkerDel != null)
                    {
                        MapMarkerDel.Kill();
                        MapMarkerDel.SendUpdate();
                    }
                }
            }

            // For each of the drops, generate a marker on the map
            foreach (var paire in dropposition)
            {
                // Variables needed
                Vector3 position = paire.Value;
                bool    looted;
                lootedornot.TryGetValue(paire.Key, out looted);
                MapMarkerGenericRadius MapMarker = GameManager.server.CreateEntity("assets/prefabs/tools/map/genericradiusmarker.prefab", position) as MapMarkerGenericRadius;

                // Check if map marker was generated, if not end this whole function because there was an error
                if (MapMarker == null)
                {
                    return;
                }

                // Set the marker's color and alpha
                MapMarker.alpha  = mapMarkerAlpha;
                MapMarker.color1 = markerColor;

                // Set the color to looted if the crate has already been looted
                if (looted)
                {
                    MapMarker.color1 = markerLootedColor;
                }

                MapMarker.color2 = Color.black;                 // I honestly dont know why is this here

                // Set the marker's radius
                MapMarker.radius = mapmarkerradius;

                // Remove the previous marker data if there is then add the new one
                dropradius.Remove(paire.Key);
                dropradius.Add(paire.Key, MapMarker);
            }

            // Spawn the markers
            foreach (var markers in dropradius)
            {
                markers.Value.Spawn();
                markers.Value.SendUpdate();
            }
        }
Exemplo n.º 4
0
        // MAP MARKERS
        private void PutTCMarksOnMap(Vector3 tcPos, string markerAuthNames)
        {
            MapMarkerGenericRadius m = GameManager.server.CreateEntity("assets/prefabs/tools/map/genericradiusmarker.prefab", tcPos) as MapMarkerGenericRadius;

            m.alpha  = 1.0f;
            m.color1 = Color.black;
            m.color2 = Color.black;
            m.radius = 2.5f;

            MapMarkerGenericRadius m2 = GameManager.server.CreateEntity("assets/prefabs/tools/map/genericradiusmarker.prefab", tcPos) as MapMarkerGenericRadius;

            m2.alpha  = 1.0f;
            m2.color1 = Color.cyan;
            m2.color2 = Color.black;
            m2.radius = 2.0f;

            VendingMachineMapMarker m3 = GameManager.server.CreateEntity("assets/prefabs/deployable/vendingmachine/vending_mapmarker.prefab", tcPos) as VendingMachineMapMarker;

            m3.markerShopName = markerAuthNames;

            m3.Spawn();
            m.Spawn();
            m.SendUpdate();
            m2.Spawn();
            m2.SendUpdate();

            listMarkersIDs.Add(m.GetInstanceID());
            listMarkersIDs.Add(m2.GetInstanceID());
            listMarkersIDs.Add(m3.GetInstanceID());
        }
Exemplo n.º 5
0
 private void OnServerInitialized()
 {
     _marker        = GameManager.server.CreateEntity("assets/prefabs/tools/map/genericradiusmarker.prefab", new Vector3(0, 100, 0)) as MapMarkerGenericRadius;
     _marker.alpha  = 1;
     _marker.color1 = Color.black;
     _marker.color2 = Color.black;
     _marker.radius = ConVar.Server.worldsize;
     _marker.Spawn();
     _marker.SendUpdate();
 }
Exemplo n.º 6
0
        void CanHideStash(BasePlayer player, StashContainer stash)
        {
            if (!permission.UserHasPermission(player.UserIDString, permUse))
            {
                return;
            }
            MapMarkerGenericRadius marker = GetOrAddMarker(player, stash.transform.position);

            marker.SendUpdate();
        }
Exemplo n.º 7
0
 private void UpdateMarker(Vector3 position)
 {
     mapMarker?.Kill();
     mapMarker        = GameManager.server.CreateEntity("assets/prefabs/tools/map/genericradiusmarker.prefab", position) as MapMarkerGenericRadius;
     mapMarker.alpha  = 0.8f;
     mapMarker.color1 = Color.red;
     mapMarker.color2 = Color.red;
     mapMarker.radius = 2;
     mapMarker.Spawn();
     mapMarker.SendUpdate();
 }
Exemplo n.º 8
0
        private void OnEntityKill(StashContainer stash)
        {
            _stashes.Remove(stash);
            List <MapMarkerGenericRadius> playerMarkers = _mapMarker[stash.OwnerID];
            MapMarkerGenericRadius        marker        = playerMarkers?.FirstOrDefault(m => m.transform.position == stash.transform.position);

            if (marker == null || marker.IsDestroyed)
            {
                return;
            }
            marker.Kill();
            playerMarkers.Remove(marker);
        }
Exemplo n.º 9
0
        private object CanNetworkTo(MapMarkerGenericRadius marker, BasePlayer target)
        {
            if (marker == null)
            {
                return(null);
            }

            List <MapMarkerGenericRadius> playerMarkers;

            if (!_mapMarker.TryGetValue(marker.OwnerID, out playerMarkers) || !playerMarkers.Contains(marker))
            {
                return(null);
            }

            return(marker.OwnerID == target.userID || permission.UserHasPermission(target.UserIDString, permAdmin) ? (object)true : false);
        }
Exemplo n.º 10
0
 void GenerateMarkers()
 {
     if (dropradius != null)
     {
         foreach (var paire in dropradius)
         {
             MapMarkerGenericRadius MapMarkerDel = paire.Value;
             if (MapMarkerDel != null)
             {
                 MapMarkerDel.Kill(); MapMarkerDel.SendUpdate();
             }
         }
     }
     foreach (var paire in dropposition)
     {
         Vector3 position;
         position = paire.Value;
         bool looted;
         lootedornot.TryGetValue(paire.Key, out looted);
         MapMarkerGenericRadius MapMarker = GameManager.server.CreateEntity("assets/prefabs/tools/map/genericradiusmarker.prefab", position) as MapMarkerGenericRadius;
         if (MapMarker == null)
         {
             return;
         }
         MapMarker.alpha  = 0.4f;
         MapMarker.color1 = Color.magenta;
         if (looted)
         {
             MapMarker.color1 = Color.cyan;
         }
         MapMarker.color2 = Color.black;
         MapMarker.radius = mapmarkerradius;
         dropradius.Remove(paire.Key);
         dropradius.Add(paire.Key, MapMarker);
         if (debug)
         {
             Puts($"CARGO MARKER ADDED IN DICO");
         }
     }
     foreach (var markers in dropradius)
     {
         markers.Value.Spawn();
         markers.Value.SendUpdate();
     }
 }
Exemplo n.º 11
0
        void CanSeeStash(BasePlayer player, StashContainer stash)
        {
            List <MapMarkerGenericRadius> playerMarkers;

            if (!_mapMarker.TryGetValue(player.userID, out playerMarkers))
            {
                _mapMarker.Add(player.userID, playerMarkers = new List <MapMarkerGenericRadius>());
            }

            MapMarkerGenericRadius marker = playerMarkers?.FirstOrDefault(m => m.transform.position == stash.transform.position);

            if (marker == null || marker.IsDestroyed)
            {
                return;
            }
            marker.Kill();
            playerMarkers.Remove(marker);
        }
Exemplo n.º 12
0
        void GenerateMarkers()
        {
            if (baseradius != null)
            {
                foreach (var paire in baseradius)
                {
                    MapMarkerGenericRadius MapMarkerDel = paire.Value;
                    if (MapMarkerDel != null)
                    {
                        MapMarkerDel.Kill();
                        MapMarkerDel.SendUpdate();
                    }
                }
            }


            foreach (var nelico in baseposition)
            {
                Vector3 position = nelico.Value;
                MapMarkerGenericRadius MapMarker = GameManager.server.CreateEntity("assets/prefabs/tools/map/genericradiusmarker.prefab", position) as MapMarkerGenericRadius;
                MapMarker.alpha  = 0.6f;
                MapMarker.color1 = Color.red;
                MapMarker.color2 = Color.black;
                MapMarker.radius = 8;

                baseradius.Remove(nelico.Key);
                baseradius.Add(nelico.Key, MapMarker);

                if (debug == true)
                {
                    Puts($"PATROL MARKER SPAWNED ON MAP");
                }
            }

            foreach (var paire in baseradius)
            {
                paire.Value.Spawn();
                paire.Value.SendUpdate();
            }
        }
Exemplo n.º 13
0
        private void OnPlayerSleepEnded(BasePlayer player)
        {
            if (!permission.UserHasPermission(player.UserIDString, permUse))
            {
                return;
            }
            List <MapMarkerGenericRadius> playerMarkers;

            if (!_mapMarker.TryGetValue(player.userID, out playerMarkers))
            {
                _mapMarker.Add(player.userID, playerMarkers = new List <MapMarkerGenericRadius>());
            }

            foreach (StashContainer stash in _stashes.Where(s => s.OwnerID == player.userID))
            {
                if (stash.IsHidden())
                {
                    MapMarkerGenericRadius marker = GetOrAddMarker(player, stash.transform.position);
                    marker.SendUpdate();
                }
            }
        }