private object OnSwitchToggle(ElectricSwitch eswitch, BasePlayer player)
        {
            if (IsBatEnabled())
            {
                return(null);
            }
            BaseEntity parent = eswitch.GetParentEntity();

            if (parent != null && parent.PrefabName.Equals(autoturretPrefab))
            {
                AutoTurret turret = parent as AutoTurret;
                if (turret == null)
                {
                    return(null);
                }
                if (!eswitch.IsOn())
                {
                    PowerTurretOn(turret);
                }
                else
                {
                    PowerTurretOff(turret);
                }
            }
            return(null);
        }
예제 #2
0
        private void OnSwitchToggled(ElectricSwitch electricSwitch)
        {
            var autoTurret = GetParentTurret(electricSwitch);

            if (autoTurret == null)
            {
                return;
            }

            var drone = GetParentDrone(autoTurret);

            if (drone == null)
            {
                return;
            }

            if (electricSwitch.IsOn())
            {
                autoTurret.InitiateStartup();
            }
            else
            {
                autoTurret.InitiateShutdown();
            }

            return;
        }