//Enact cooldowns (true value indicates first ability, false is the second) void Update() { for (int key = 0; key < _available.Count; key++) { if (selectedElement.Value == key) { if (_available[key][0].Value == true) { ChangeAttack(1f); } else { ChangeAttack(0.6f); cooldown.StartCooldown(selectedElement.Value, PlayerAttack.cooldowns[selectedElement.Value].attackEffects[0].cooldown, true); } if (_available[key][1].Value == true) { ChangeOther(1f); } else { ChangeOther(0.6f); cooldown.StartCooldown(selectedElement.Value, PlayerAttack.cooldowns[selectedElement.Value].otherEffects[0].cooldown, false); } } } }
public void FixShipPlayerLookAt() { IMyPlayer player = Context.Player; long playerId; if (player == null) { Context.Respond("Console has no Grids so cannot use this command. Use !fixshipmod <Gridname> instead!"); return; } else { playerId = player.IdentityId; } IMyCharacter character = player.Character; if (character == null) { Context.Respond("You have no Character currently. Make sure to spawn and be out of cockpit!"); return; } CooldownManager cooldownManager = Plugin.CommandCooldownManager; var steamId = new SteamIdCooldownKey(PlayerUtils.GetSteamId(Context.Player)); if (!cooldownManager.CheckCooldown(steamId, null, out long remainingSeconds)) { Log.Info("Cooldown for Player " + player.DisplayName + " still running! " + remainingSeconds + " seconds remaining!"); Context.Respond("Command is still on cooldown for " + remainingSeconds + " seconds."); return; } if (!CheckConformation(steamId, playerId, "nogrid", character)) { return; } try { var result = Plugin.FixShip(character, playerId); WriteResponse(result); if (result == CheckResult.SHIP_FIXED) { Log.Info("Cooldown for Player " + player.DisplayName + " started!"); cooldownManager.StartCooldown(steamId, null, Plugin.Cooldown); } } catch (Exception e) { Log.Error(e, "Error on fixing ship"); } }
public void FixedUpdate() { if (!isLocalPlayer) { return; } if (Input.GetKeyDown(KeyCode.LeftShift) && abilityTwoCharge >= abilityTwoCooldown) { abilityTwoCharge = 0; //make another ability here where commented out code is below GetComponent <CharacterBase>().speedMultiplier = GetComponent <CharacterBase>().speedMultiplier * 2; abilityTwo.StartCooldown(abilityTwoCooldown); icon.GetComponent <Image>().color = Color.green; } if (abilityTwoCharge >= (abilityTwoCooldown / 2)) { icon.GetComponent <Image>().color = Color.white; GetComponent <CharacterBase>().speedMultiplier = 1; } if (abilityTwoCharge < abilityTwoCooldown) { abilityTwoCharge += Time.deltaTime; } if (Input.GetKeyDown(KeyCode.Space) && abilityOneCharge >= abilityOneCooldown) { icon2.GetComponent <Image>().color = Color.green; CmdInvisible(false); //_characterBase.speedMultiplier /= 2; invisActive = true; abilityOneCharge = 0; postProcesser.enabled = true; abilityOne.StartCooldown(abilityOneCooldown); } if (abilityOneCharge >= abilityOneCooldown / invisDurationMult && invisActive) { icon2.GetComponent <Image>().color = Color.white; CmdInvisible(true); //_characterBase.speedMultiplier = speed; invisActive = false; postProcesser.enabled = false; } abilityOneCharge += Time.deltaTime; _renderer.enabled = false; }
private void FixedUpdate() { if (!isLocalPlayer) { return; } if (abilityOneCharge >= decoyLight.GetComponent <Decoy>().life) { icon2.GetComponent <Image>().color = Color.white; CmdDecoyLight(true); } if (Input.GetKeyDown(KeyCode.Space) && abilityOneCharge >= abilityOneCooldown) { abilityOneCharge = 0; CmdDecoyLight(false); abilityOne.StartCooldown(abilityOneCooldown); icon2.GetComponent <Image>().color = Color.green; } if (abilityOneCharge < abilityOneCooldown) { abilityOneCharge += Time.deltaTime; } //dhjcbdc if (Input.GetKeyDown(KeyCode.LeftShift) && abilityTwoCharge >= abilityTwoCooldown) { abilityTwoCharge = 0; //make another ability here where commented out code is below GetComponent <CharacterBase>().speedMultiplier = GetComponent <CharacterBase>().speedMultiplier * 2; abilityTwo.StartCooldown(abilityTwoCooldown); icon.GetComponent <Image>().color = Color.green; } if (abilityTwoCharge >= (abilityTwoCooldown / 2)) { GetComponent <CharacterBase>().speedMultiplier = baseSpeed; icon.GetComponent <Image>().color = Color.white; } if (abilityTwoCharge < abilityTwoCooldown) { abilityTwoCharge += Time.deltaTime; } }
public void FixShipPlayerGridName(string gridName) { IMyPlayer player = Context.Player; long playerId; if (player == null) { Context.Respond("Console has no Grids so cannot use this command. Use !fixshipmod <Gridname> instead!"); return; } else { playerId = player.IdentityId; } CooldownManager cooldownManager = Plugin.CommandCooldownManager; var steamId = new SteamIdCooldownKey(PlayerUtils.GetSteamId(Context.Player)); if (!cooldownManager.CheckCooldown(steamId, null, out long remainingSeconds)) { Log.Info("Cooldown for Player " + player.DisplayName + " still running! " + remainingSeconds + " seconds remaining!"); Context.Respond("Command is still on cooldown for " + remainingSeconds + " seconds."); return; } if (!CheckConformation(steamId, playerId, gridName, null)) { return; } try { var result = ShipFixerCore.Instance.FixShip(playerId, gridName); WriteResponse(result); if (result == CheckResult.SHIP_FIXED) { Log.Info("Cooldown for Player " + player.DisplayName + " started!"); cooldownManager.StartCooldown(steamId, null, Plugin.Cooldown); } } catch (Exception e) { Log.Error(e, "Error on fixing ship"); } }