예제 #1
0
        public void OnConsoleCommand_playse(NotificationCenter.Notification n)
        {
            float si = float.Parse((string)n.data[0]);

            Player.mainObject.transform.localScale = new Vector3(si, si, si);
            ErrorMessage.AddDebug("Warning!!!! This feature may cause you to be unable to move and other issues");
        }
예제 #2
0
 public void OnConsoleCommand_size(NotificationCenter.Notification n)
 {
     x = 1f;
     y = 1f;
     z = 1f;
     if (n.data.Count == 1)
     {
         x = float.Parse((string)n.data[0]);
         y = float.Parse((string)n.data[0]);
         z = float.Parse((string)n.data[0]);
     }
     if (n.data.Count == 2)
     {
         x = float.Parse((string)n.data[0]);
         y = float.Parse((string)n.data[1]);
         z = float.Parse((string)n.data[1]);
     }
     if (n.data.Count == 3)
     {
         x = float.Parse((string)n.data[0]);
         y = float.Parse((string)n.data[1]);
         z = float.Parse((string)n.data[2]);
     }
     if (Gettarget(out GameObject target))
     {
         string name = target.GetFullName();
         target.transform.localScale = new Vector3(x, y, z);
         ErrorMessage.AddDebug(name + " Size changed complete");
     }
     else
     {
         ErrorMessage.AddDebug("Target not found");
     }
 }
예제 #3
0
        public void OnConsoleCommand_mplayer(NotificationCenter.Notification n)
        {
            //This could be cleaned up. Honestly, I see this as a hack to deal with other unimplemented features. I'd rather just patch this boat until we can let it sink...
            NitroxServiceLocator.BeginNewLifetimeScope();
            multiplayerSession = NitroxServiceLocator.LocateService <IMultiplayerSession>();

            if (multiplayerSession.CurrentState.CurrentStage == MultiplayerSessionConnectionStage.SessionJoined)
            {
                Log.InGame("Уже подключен к серверу");
            }
            else if (n?.data?.Count > 0)
            {
                Log.InGame("Консоль мультиплеерской сессии подключения игроков загружена...");
                StartMultiplayerClient();
                int    serverPort = 11000;
                string ipAddress  = n.data.Count >= 2 ? (string)n.data[1] : DEFAULT_IP_ADDRESS;
                userName = (string)n.data[0];
                string seperator = ":";
                if (ipAddress.Contains(seperator))
                {
                    char     splitter = ':';
                    string[] splitIP  = ipAddress.Split(splitter);
                    ipAddress  = splitIP[0];
                    serverPort = int.Parse(splitIP[1]);
                }
                multiplayerSession.Connect(ipAddress, serverPort);
            }
            else
            {
                Log.InGame("Синтаксис команды: mplayer USERNAME [SERVERIP]");
            }
        }
 public void OnConsoleCommand_disconnect(NotificationCenter.Notification n)
 {
     if (n != null)
     {
         StopMultiplayer(); // TODO: More than just disconnect (clean up injections or something)
     }
 }
예제 #5
0
        private void OnConsoleCommand_powerglideforce(NotificationCenter.Notification n)
        {
            float force;
            float rate;

            if (n != null && n.data != null)
            {
                if (n.data.Count == 1)
                {
                    if (DevConsole.ParseFloat(n, 0, out force, 0f))
                    {
                        powerGlideForce = force;
                        powerLerpRate   = force * 0.2f;
                    }
                }
                else if (n.data.Count == 2)
                {
                    if (DevConsole.ParseFloat(n, 0, out force, 0f) && DevConsole.ParseFloat(n, 1, out rate, 0f))
                    {
                        powerGlideForce = force;
                        powerLerpRate   = rate;
                    }
                }
            }
        }
        public void OnConsoleCommand_mplayer(NotificationCenter.Notification n)
        {
            if (client.IsConnected())
            {
                ClientLogger.IngameMessage("Already connected to a server");
            }
            else if (n?.data?.Count > 0)
            {
                PacketSender.PlayerId = (string)n.data[0];

                String ip = DEFAULT_IP_ADDRESS;

                if (n.data.Count >= 2)
                {
                    ip = (string)n.data[1];
                }

                StartMultiplayer(ip);
                InitMonoBehaviours();
            }
            else
            {
                ClientLogger.IngameMessage("Command syntax: mplayer USERNAME [SERVERIP]");
            }
        }
예제 #7
0
        public void OnConsoleCommand_mplayer(NotificationCenter.Notification n)
        {
            //This could be cleaned up. Honestly, I see this as a hack to deal with other unimplemented features. I'd rather just patch this boat until we can let it sink...
            NitroxServiceLocator.BeginNewLifetimeScope();
            multiplayerSession = NitroxServiceLocator.LocateService <IMultiplayerSession>();

            if (multiplayerSession.CurrentState.CurrentStage == MultiplayerSessionConnectionStage.SessionJoined)
            {
                Log.InGame("Already connected to a server");
            }
            else if (n?.data?.Count > 0)
            {
                Log.InGame("Console Multiplayer Session Join Client Loaded...");
                StartMultiplayerClient();

                string ipAddress = n.data.Count >= 2 ? (string)n.data[1] : DEFAULT_IP_ADDRESS;
                userName = (string)n.data[0];

                multiplayerSession.Connect(ipAddress);
            }
            else
            {
                Log.InGame("Command syntax: mplayer USERNAME [SERVERIP]");
            }
        }
예제 #8
0
        private void OnConsoleCommand_execute(NotificationCenter.Notification n)
        {
            string[] args = new string[n.data.Values.Count];
            n.data.Values.CopyTo(args, 0);

            NitroxServiceLocator.LocateService <IPacketSender>().Send(new ServerCommand(args));
        }
예제 #9
0
        public void OnConsoleCommand_manta(NotificationCenter.Notification n)
        {
            Console.WriteLine("[MantaMod] manta command triggered, creating new manta gameobject");
            ErrorMessage.AddMessage("[MantaMod] Creating sub w/ command");
            Vector3 pos = Player.main.transform.position + (Player.main.camRoot.GetAimingTransform().forward * 30f);

            GameObject clone = Utils.SpawnPrefabAt(obj, null, pos);
        }
 void OnConsoleCommand_setcfgvar(NotificationCenter.Notification n)
 {
     if (n.getArgCount() == 2)
     {
         $"setcfgvar: '{n.getArg(0)}' '{n.getArg(1)}'".logDbg();
         setFieldValue(n.getArg(0), n.getArg(1));
     }
 }
예제 #11
0
    void EnemyKilled(NotificationCenter.Notification note)     //event fired when enemy is killed
    {
        Hashtable data    = note.data;
        int       howMuch = (int)data["value"];//enemy specific score value

        GameManager.Instance.totalScore += howMuch;
        updateUI();
    }
 void OnConsoleCommand_dumptarget(NotificationCenter.Notification _)
 {
     if (Player.main?.GetComponent <GUIHand>().activeTarget is GameObject go)
     {
         $"Target dump: {go.name}".onScreen();
         go.dump();
     }
 }
예제 #13
0
 public void OnConsoleCommand_disconnect(NotificationCenter.Notification n)
 {
     if (n != null)
     {
         Multiplayer.Main.StopCurrentSession();
         StopMultiplayerClient();
     }
 }
예제 #14
0
 public static bool OnConsoleCommand_spawn_Prefix(NotificationCenter.Notification n)
 {
     if (n != null && n.data != null && n.data.Count > 0)
     {
         string text = (string)n.data[0];
         if (UWE.Utils.TryParseEnum <TechType>(text, out TechType techType) && techType != TechType.None)
         {
             if (CraftData.IsAllowed(techType))
             {
                 foreach (IDecorationItem item in DecorationsMod.DecorationItems)
                 {
                     // If item being spawned is one of our decoration items.
                     if (techType == item.TechType)
                     {
                         // If item being spawned is one of our new flora.
                         if (!string.IsNullOrEmpty(item.ClassID) && CustomFlora.AllPlants.Contains(item.ClassID))
                         {
                             GameObject prefabForTechType = CraftData.GetPrefabForTechType(techType, true);
                             if (prefabForTechType != null)
                             {
                                 int num = 1;
                                 int num2;
                                 if (n.data.Count > 1 && int.TryParse((string)n.data[1], out num2))
                                 {
                                     num = num2;
                                 }
                                 float maxDist = 12f;
                                 if (n.data.Count > 2)
                                 {
                                     maxDist = float.Parse((string)n.data[2]);
                                 }
                                 Debug.LogFormat("Spawning {0} {1}", new object[] { num, techType });
                                 for (int i = 0; i < num; i++)
                                 {
                                     GameObject gameObject = global::Utils.CreatePrefab(prefabForTechType, maxDist, i > 0);
                                     LargeWorldEntity.Register(gameObject);
                                     CrafterLogic.NotifyCraftEnd(gameObject, techType);
                                     gameObject.SendMessage("StartConstruction", SendMessageOptions.DontRequireReceiver);
                                     // Hide plant, show seed and enable pickupable
                                     PrefabsHelper.HidePlantAndShowSeed(gameObject.transform, item.ClassID);
                                 }
                             }
                             else
                             {
                                 ErrorMessage.AddDebug("Could not find prefab for TechType = " + techType);
                             }
                             // Dont call original function if item being spawned is one of our new flora.
                             return(false);
                         }
                         break;
                     }
                 }
             }
         }
     }
     // Give back execution to original function.
     return(true);
 }
            void OnConsoleCommand_dumpresource(NotificationCenter.Notification n)
            {
                if (n.getArgCount() == 0)
                {
                    return;
                }

                Resources.Load <GameObject>(n.getArg(0))?.dump();
            }
예제 #16
0
    void HitAlert(NotificationCenter.Notification note)     //event fired when hero collides with enemy or enemy bullet
    {
        if (!hasGameStarted)
        {
            return;
        }
        Hashtable  data = note.data;
        GameObject who  = (GameObject)data["who"];

        animationManager.CheckAndRemoveEnemy(who);        //check for defenders life status?
    }
            void OnConsoleCommand_pinpatches(NotificationCenter.Notification n)
            {
                const float refreshSecs = 0.5f;

                StopAllCoroutines();
                GameUtils.clearScreenMessages();

                if (n.getArgCount() > 0)
                {
                    StartCoroutine(_printPatches(n.getArg(0), n.getArg <bool>(1)));
                }
예제 #18
0
        private void OnConsoleCommand_powerglideforce(NotificationCenter.Notification n)
        {
            float force;
            float rate;

            if (n != null && n.data != null)
            {
                if (n.data.Count == 1)
                {
                    string text = (string)n.data[0];
#if SUBNAUTICA_STABLE
                    if (float.TryParse(text, out force))
#elif BELOWZERO
                    if (DevConsole.ParseFloat(n, 0, out force, 0f))
#endif
                    {
                        powerGlideForce = force;
                        powerLerpRate   = force * 0.2f;
                    }
                    else
                    {
                        ErrorMessage.AddError($"Could not parse '{n.data[0]}' as number");
                    }
                }
                else if (n.data.Count == 2)
                {
                    string text  = (string)n.data[0];
                    string text2 = (string)n.data[1];
#if SUBNAUTICA_STABLE
                    bool try0 = float.TryParse(text, out force);
                    bool try1 = float.TryParse(text2, out rate);
#elif BELOWZERO
                    bool try0 = DevConsole.ParseFloat(n, 0, out force, 0f);
                    bool try1 = DevConsole.ParseFloat(n, 1, out rate, 0f);
#endif
                    if (try0 && try1)
                    {
                        powerGlideForce = force;
                        powerLerpRate   = rate;
                    }
                    else
                    {
                        if (!try0)
                        {
                            ErrorMessage.AddError($"Could not parse '{text}' as number");
                        }
                        if (!try1)
                        {
                            ErrorMessage.AddError($"Could not parse '{text2}' as number");
                        }
                    }
                }
            }
        }
예제 #19
0
 public void OnConsoleCommand_zhelper(NotificationCenter.Notification n)
 {
     if (!guiRoot)
     {
         guiRoot = new GameObject("IGUI_Test", typeof(Zhelper));
     }
     else
     {
         guiRoot.GetComponent <GUI_ROOT>().GuiBase.ShowMainWindow();
     }
 }
예제 #20
0
    void BulletHitAlert(NotificationCenter.Notification note)     //event fired when bullet hits enemy or enemy bullet
    {
        if (!hasGameStarted)
        {
            return;
        }
        Hashtable  data = note.data;
        GameObject who  = (GameObject)data["who"];

        animationManager.CheckAndRemoveEnemyAndBullet(who, note.sender.gameObject);
    }
예제 #21
0
    void NonProximityAlert(NotificationCenter.Notification note)     //event fired when enemy or enemy bullet exits hero zone
    {
        if (!hasGameStarted)
        {
            return;
        }
        Hashtable  data = note.data;
        GameObject who  = (GameObject)data["who"];

        animationManager.InformProximity(who, false);        //sent roam alert
    }
            void OnConsoleCommand_findtech(NotificationCenter.Notification n)
            {
                if (n.getArgCount() == 0)
                {
                    return;
                }

                var matched = techtypeCache.find(n.getArg(0));

                L10n.str("ids_findEntries").format(matched.Count).onScreen();
                showMessages(matched, L10n.str("ids_techType"));
            }
예제 #23
0
        // Token: 0x0600000A RID: 10 RVA: 0x0000285C File Offset: 0x00000A5C
        public void OnConsoleCommand_suse(NotificationCenter.Notification n)
        {
            string text = (string)n.data[0];
            bool   flag = text != null && text != string.Empty;

            if (flag)
            {
                this.x = 1f;
                this.y = 1f;
                this.z = 1f;
                int  num   = 6;
                bool flag2 = n.data.Count > 1;
                if (flag2)
                {
                    this.x = float.Parse((string)n.data[1]);
                }
                bool flag3 = n.data.Count > 2;
                if (flag3)
                {
                    this.y = float.Parse((string)n.data[2]);
                }
                bool flag4 = n.data.Count > 3;
                if (flag4)
                {
                    this.z = float.Parse((string)n.data[3]);
                }
                bool flag5 = n.data.Count > 4;
                if (flag5)
                {
                    num = int.Parse((string)n.data[4]);
                }
                bool flag6 = n.data.Count == 2;
                if (flag6)
                {
                    this.y = float.Parse((string)n.data[1]);
                    this.z = float.Parse((string)n.data[1]);
                }
                bool flag7 = n.data.Count == 3;
                if (flag7)
                {
                    this.z = float.Parse((string)n.data[2]);
                }
                Transform transform = MainCamera.camera.transform;
                this.spawnPosition = transform.position + (float)num * transform.forward;
                this.spawnRotation = Quaternion.LookRotation(MainCamera.camera.transform.right);
                LightmappedPrefabs.main.RequestScenePrefab(text, new LightmappedPrefabs.OnPrefabLoaded(this.OnSubPrefabLoaded));
            }
            else
            {
                ErrorMessage.AddDebug("Must specify name (cyclops beetle aurora)");
            }
        }
 public void OnConsoleCommand_warpto(NotificationCenter.Notification n)
 {
     if (n?.data?.Count > 0)
     {
         string otherPlayerId = (string)n.data[0];
         var    opPlayer      = remotePlayerManager.Find(otherPlayerId);
         if (opPlayer.IsPresent())
         {
             Player.main.SetPosition(opPlayer.Get().body.transform.position);
             Player.main.OnPlayerPositionCheat();
         }
     }
 }
예제 #25
0
 void LifeLoss(NotificationCenter.Notification note)     //event fired when life is lost
 {
     if (GameManager.cheatEnabled)
     {
         return;
     }
     GameManager.Instance.life--;
     updateUI();
     if (GameManager.Instance.life <= 0)
     {
         GameOver();
     }
 }
예제 #26
0
 public void OnConsoleCommand_warpto(NotificationCenter.Notification n)
 {
     if (n?.data?.Count > 0)
     {
         string otherPlayerId = (string)n.data[0];
         var    otherPlayer   = playerGameObjectManager.FindPlayerGameObject(otherPlayerId);
         if (otherPlayer != null)
         {
             Player.main.SetPosition(otherPlayer.transform.position);
             Player.main.OnPlayerPositionCheat();
         }
     }
 }
예제 #27
0
    // call when agent is in position
    void AgentInPosition(NotificationCenter.Notification note)
    {
        notificationCount++;
        if (notificationCount == FormationManager.current.agentsNum - 1)
        {
            Debug.Log("All in position.");

            if (isLeader)
            {
                fsm.ChangeState(States.goLeader);
            }
        }
    }
예제 #28
0
 public void OnConsoleCommand_warpto(NotificationCenter.Notification n) // Shouldnt this be handled on the server?
 {
     if (n?.data?.Count > 0)
     {
         string                  otherPlayerName     = (string)n.data[0];
         PlayerManager           remotePlayerManager = NitroxServiceLocator.LocateService <PlayerManager>();
         Optional <RemotePlayer> opPlayer            = remotePlayerManager.FindByName(otherPlayerName);
         if (opPlayer.HasValue)
         {
             Player.main.SetPosition(opPlayer.Value.Body.transform.position);
             Player.main.OnPlayerPositionCheat();
         }
     }
 }
예제 #29
0
 public static bool OnConsoleCommand_item_Prefix(NotificationCenter.Notification n)
 {
     if (n != null && n.data != null && n.data.Count > 0)
     {
         string text = (string)n.data[0];
         if (UWE.Utils.TryParseEnum <TechType>(text, out TechType techType) && techType != TechType.None)
         {
             if (CraftData.IsAllowed(techType))
             {
                 foreach (IDecorationItem item in DecorationsMod.DecorationItems)
                 {
                     // If item being spawned is one of our decoration items.
                     if (techType == item.TechType)
                     {
                         // If item being spawned is one of our new flora.
                         if (!string.IsNullOrEmpty(item.ClassID) && CustomFlora.AllPlants.Contains(item.ClassID))
                         {
                             int num = 1;
                             if (n.data.Count > 1 && int.TryParse((string)n.data[1], out int num2))
                             {
                                 num = num2;
                             }
                             for (int i = 0; i < num; i++)
                             {
                                 GameObject gameObject = CraftData.InstantiateFromPrefab(techType, false);
                                 if (gameObject != null)
                                 {
                                     gameObject.transform.position = MainCamera.camera.transform.position + MainCamera.camera.transform.forward * 3f;
                                     CrafterLogic.NotifyCraftEnd(gameObject, techType);
                                     Pickupable component = gameObject.GetComponent <Pickupable>();
                                     if (component != null && !Inventory.main.Pickup(component, false))
                                     {
                                         ErrorMessage.AddError(Language.main.Get("InventoryFull"));
                                         // Hide plant, show seed and enable pickupable
                                         PrefabsHelper.HidePlantAndShowSeed(gameObject.transform, item.ClassID);
                                     }
                                 }
                             }
                             // Dont call original function if item being spawned is one of our new flora.
                             return(false);
                         }
                         break;
                     }
                 }
             }
         }
     }
     // Give back execution to original function.
     return(true);
 }
예제 #30
0
 public void OnConsoleCommand_warpto(NotificationCenter.Notification n)
 {
     if (n?.data?.Count > 0)
     {
         string                  otherPlayerName     = (string)n.data[0];
         PlayerManager           remotePlayerManager = NitroxServiceLocator.LocateService <PlayerManager>();
         Optional <RemotePlayer> opPlayer            = remotePlayerManager.FindByName(otherPlayerName);
         if (opPlayer.IsPresent())
         {
             Player.main.SetPosition(opPlayer.Get().Body.transform.position);
             Player.main.OnPlayerPositionCheat();
         }
     }
 }