コード例 #1
0
        void AddSwitch(AutoTurret aturret)
        {
            ElectricBattery bat = null;

            if (IsBatEnabled())
            {
                bat = AddBattery(aturret.GetParentEntity() as MiniCopter);
            }

            ElectricSwitch aSwitch = aturret.GetComponentInChildren <ElectricSwitch>();

            aSwitch = GameManager.server.CreateEntity(switchPrefab, aturret.transform.position)?.GetComponent <ElectricSwitch>();
            if (aSwitch == null)
            {
                return;
            }
            aSwitch.pickup.enabled = false;
            aSwitch.SetParent(aturret);
            aSwitch.transform.localPosition = new Vector3(0f, -0.65f, 0.325f);
            aSwitch.transform.localRotation = Quaternion.Euler(0, 0, 0);
            DestroyMeshCollider(aSwitch);
            DestroyGroundComp(aSwitch);
            aSwitch.Spawn();
            aSwitch._limitedNetworking = false;
            if (!IsBatEnabled())
            {
                RunWire(aSwitch, 0, aturret, 0, 12);
            }
            else if (bat != null)
            {
                RunWire(bat, 0, aSwitch, 0);
                RunWire(aSwitch, 0, aturret, 0);
            }
        }
コード例 #2
0
        private object CheckTurret(AutoTurret turret)
        {
            CodeLock _lock = turret.GetComponentInChildren <CodeLock>();

            if (!_lock)
            {
                return(null);
            }

            BasePlayer player = FindBasePlayer(turret.transform.position);

            if (player == null)
            {
                return(null);
            }

            if (_lock.code == string.Empty)
            {
                return(null);
            }

            if (_lock.whitelistPlayers.Contains(player.userID))
            {
                return(null);
            }

            player.ChatMessage(msg("Not Allowed", player.UserIDString));
            if (doEffects)
            {
                Effect.server.Run(effectDenied, _lock.transform.position);
            }
            return(true);
        }
コード例 #3
0
        private void RefreshDroneTurret(Drone drone, AutoTurret turret)
        {
            var sphereEntity = turret.GetParentEntity() as SphereEntity;

            if (sphereEntity == null)
            {
                return;
            }

            SetupSphereEntity(sphereEntity);
            SetupDroneTurret(drone, turret, sphereEntity);

            var electricSwitch = turret.GetComponentInChildren <ElectricSwitch>();

            if (electricSwitch != null)
            {
                SetupTurretSwitch(electricSwitch);
            }
        }