Beispiel #1
0
    // <summary>
    /// Performs bluespace activity (teleports randomly) on player if they have slipped on an object
    /// with bluespace activity or are hit by an object with bluespace acivity and
    /// has Liquid Contents.
    /// Assumes max potency if none is given.
    /// </summary>
    ///
    public void ServerBluespaceActivity(int potency = 100)
    {
        int maxRange        = 11;
        int potencyStrength = (int)Math.Round((potency * .01f) * maxRange, 0);

        TeleportUtils.ServerTeleportRandom(playerScript.gameObject, 0, potencyStrength, false, true);
    }
Beispiel #2
0
 public void Orbit()
 {
     TeleportWindow.SetWindowTitle("Orbit a Mob");
     TeleportWindow.OrbitOnTeleport = true;
     TeleportWindow.gameObject.SetActive(true);
     TeleportWindow.GenerateButtons(TeleportUtils.GetMobDestinations());
 }
        public override void CallActionClient()
        {
            // TODO: Have action button sprite static until clicked.
            // Animation then begins until destination selected. Cooldown begins.
            TeleportWindow.SetWindowTitle("Teleport to Place");
            TeleportWindow.gameObject.SetActive(true);
            TeleportWindow.GenerateButtons(TeleportUtils.GetSpawnDestinations());

            TeleportWindow.onTeleportRequested += ClientTeleportDestinationSelected;
            TeleportWindow.onTeleportToVector  += ClientTeleportDestinationSelected;
        }
    public override void DoEffectAura()
    {
        base.DoEffectAura();

        // get effect shape around artifact
        var objCenter = gameObject.AssumedWorldPosServer().RoundToInt();
        var shape     = EffectShape.CreateEffectShape(effectShapeType, objCenter, teleportAuraRadius);

        foreach (var pos in shape)
        {
            // check if tile has any alive player
            var players = MatrixManager.GetAt <PlayerScript>(pos, true).Distinct();
            foreach (var player in players)
            {
                if (!player.IsDeadOrGhost)
                {
                    // teleport player
                    TeleportUtils.ServerTeleportRandom(player.gameObject, minTeleportDistance, maxTeleportDistance, avoidSpace, avoidImpassable);
                }
            }
        }
    }
Beispiel #5
0
 public void Teleport()
 {
     TeleportWindow.SetWindowTitle("Jump to Place");
     TeleportWindow.gameObject.SetActive(true);
     TeleportWindow.GenerateButtons(TeleportUtils.GetSpawnDestinations());
 }
Beispiel #6
0
 public void JumpToMob()
 {
     TeleportWindow.SetWindowTitle("Jump To Mob");
     TeleportWindow.gameObject.SetActive(true);
     TeleportWindow.GenerateButtons(TeleportUtils.GetMobDestinations());
 }
 public override void DoEffectTouch(HandApply touchSource)
 {
     base.DoEffectTouch(touchSource);
     TeleportUtils.ServerTeleportRandom(touchSource.Performer, minTeleportDistance, maxTeleportDistance, avoidSpace, avoidImpassable);
 }
Beispiel #8
0
 public void OpenTrackPlayerScreen()
 {
     teleportWindow.SetWindowTitle("Track Lifeforms");
     teleportWindow.gameObject.SetActive(true);
     teleportWindow.GenerateButtons(TeleportUtils.GetCameraTrackPlayerDestinations());
 }
Beispiel #9
0
 public void OpenCameraTeleportScreen()
 {
     teleportWindow.SetWindowTitle("Move Camera");
     teleportWindow.gameObject.SetActive(true);
     teleportWindow.GenerateButtons(TeleportUtils.GetCameraDestinations());
 }
Beispiel #10
0
        public override bool CastSpellServer(ConnectedPlayer caster)
        {
            TeleportUtils.ServerTeleportRandom(caster.GameObject, 8, 16, true, true);

            return(true);
        }
        public void ServerPerformInteraction(HandApply interaction)
        {
            GameObject target    = interaction.TargetObject;
            GameObject performer = interaction.Performer;

            // Direction for lerp
            Vector2 dir = (target.transform.position - performer.transform.position).normalized;

            WeaponNetworkActions wna = performer.GetComponent <WeaponNetworkActions>();
            ToggleableEffect     toggleableEffect = gameObject.GetComponent <ToggleableEffect>();

            // If we're on harm intent we deal damage!
            // Note: this has to be done before the teleport, otherwise the target may be moved out of range.
            if (interaction.Intent == Intent.Harm &&
                (toggleableEffect.CurrentWeaponState == ToggleableEffect.WeaponState.Off ||
                 toggleableEffect.CurrentWeaponState == ToggleableEffect.WeaponState.NoCell))
            {
                // Direction of attack towards the attack target.
                wna.ServerPerformMeleeAttack(target, dir, interaction.TargetBodyPart, LayerType.None);
                return;                 //Only do damage to the target, do not do anything afterwards.
            }
            //If the thing is off on any intent, tell the player that it won't do anything.
            else if (toggleableEffect.CurrentWeaponState == ToggleableEffect.WeaponState.Off ||
                     toggleableEffect.CurrentWeaponState == ToggleableEffect.WeaponState.NoCell)
            {
                Chat.AddActionMsgToChat(interaction.Performer,
                                        $"You attempt to prod {interaction.TargetObject.ExpensiveName()} but the {gameObject.ExpensiveName()} was off!",
                                        $"{interaction.Performer.ExpensiveName()} prods {interaction.TargetObject.ExpensiveName()}, luckily the {gameObject.ExpensiveName()} was off!");
                SoundManager.PlayNetworkedAtPos(CommonSounds.Instance.Tap, gameObject.RegisterTile().WorldPosition);
                return;
            }

            if (canEffect && hasBattery)
            {
                if (Battery.Watts >= chargeUsage)
                {
                    Battery.Watts -= chargeUsage;
                }
                else
                {
                    if (toggleableEffect != null)
                    {
                        toggleableEffect.TurnOff();
                    }

                    timer     = cooldown;
                    canEffect = false;
                }
            }

            RegisterPlayer registerPlayerVictim = target.GetComponent <RegisterPlayer>();

            // Teleport and stun the victim (if needed). We check if there is a cooldown preventing the attacker from effecting the victim.
            if (registerPlayerVictim && canEffect)
            {
                // deactivates the weapon and makes you wait.
                if (cooldown != 0)
                {
                    canEffect = false;
                    timer     = cooldown;
                }

                if (canStun)
                {
                    registerPlayerVictim.ServerStun(stunTime);
                }

                if (canTeleport)
                {
                    TeleportUtils.ServerTeleportRandom(target, minTeleportDistance, maxTeleportDistance, avoidSpace, avoidImpassable);
                }

                SoundManager.PlayNetworkedAtPos(useSound, target.transform.position, sourceObj: target.gameObject);

                // Special case: If we're off harm intent (only teleporting and/or stunning), we should still show the lerp (unless we're hitting ourselves).
                if (interaction.Intent != Intent.Harm && performer != target)
                {
                    wna.RpcMeleeAttackLerp(dir, gameObject);
                }
            }
            else if (!canEffect)
            {
                if (coolDownMessage)
                {
                    return;
                }
                coolDownMessage = true;
                if (hasBattery)
                {
                    if (Battery.Watts >= chargeUsage)
                    {
                        Chat.AddExamineMsg(performer, $"{gameObject.ExpensiveName()} is on cooldown.");
                    }
                    else
                    {
                        Chat.AddExamineMsg(performer, $"{gameObject.ExpensiveName()} is out of power.");
                    }
                }
                else
                {
                    Chat.AddExamineMsg(performer, $"{gameObject.ExpensiveName()} is on cooldown.");
                }
            }
        }