-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added medic and vcuff + changed cuffing mechanics
- Loading branch information
1 parent
9251481
commit 20a3b8f
Showing
7 changed files
with
195 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using System; | ||
using CommandSystem; | ||
using Exiled.API.Features; | ||
using UnityEngine; | ||
|
||
namespace VeryUsualDay.Commands | ||
{ | ||
[CommandHandler(typeof(ClientCommandHandler))] | ||
public class Cuff : ICommand | ||
{ | ||
public string Command => "vcuff"; | ||
public string[] Aliases => new string[] { }; | ||
public string Description => "Связывает человека. Для Foundation-X."; | ||
|
||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
if (!VeryUsualDay.Instance.IsEnabledInRound) | ||
{ | ||
response = "Режим FX не включён!"; | ||
return false; | ||
} | ||
|
||
var playerSender = Player.Get(sender); | ||
if (playerSender.CustomName == null || (!playerSender.CustomName.Contains("ОВБ") && | ||
!playerSender.CustomName.Contains("ГОР") && | ||
!playerSender.CustomName.Contains("Глава Охраны"))) | ||
{ | ||
response = "У вас нет прав использовать эту команду!"; | ||
return false; | ||
} | ||
|
||
if (!playerSender.CurrentItem.IsWeapon) | ||
{ | ||
response = "Вы не держите в руках оружие!"; | ||
return false; | ||
} | ||
|
||
var layerMask = 1 << 8; | ||
if (!Physics.Raycast(new Ray(playerSender.CameraTransform.position + playerSender.CameraTransform.forward, playerSender.CameraTransform.forward), out RaycastHit raycastHit, maxDistance: 3f, layerMask: ~layerMask)) | ||
{ | ||
response = "Вы не смотрите ни на кого, либо вы недостаточно близко."; | ||
return false; | ||
} | ||
|
||
Player cuffed = null; | ||
var hub = raycastHit.transform?.GetComponentInParent<ReferenceHub>(); | ||
if (hub == null || !Player.TryGet(hub, out cuffed) || cuffed == playerSender) | ||
{ | ||
response = "Не получилось связать никого, попробуйте подойти ближе / отойти дальше!"; | ||
return false; | ||
} | ||
|
||
var cuffer = ""; | ||
if (playerSender.CustomName.Contains("ОВБ")) | ||
{ | ||
cuffer = "<color=#e34234>Агентом ОВБ</color>"; | ||
} | ||
else if (playerSender.CustomName.Contains("ГОР")) | ||
{ | ||
cuffer = "<color=#42aaff>Бойцом ГОР</color>"; | ||
} | ||
else if (playerSender.CustomName.Contains("Глава Охраны")) | ||
{ | ||
cuffer = "<color=#979aaa>Главой Охраны</color>"; | ||
} | ||
|
||
if (cuffed.IsCuffed) | ||
{ | ||
response = "Игрок уже связан!"; | ||
return false; | ||
} | ||
cuffed.Handcuff(); | ||
cuffed.Broadcast(7, $"<b>Вы были связаны {cuffer}</b>"); | ||
response = "Игрок успешно связан!"; | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
using System; | ||
using System.Linq; | ||
using CommandSystem; | ||
using Exiled.API.Enums; | ||
using Exiled.API.Features; | ||
using Exiled.CustomItems.API.Features; | ||
using MEC; | ||
using PlayerRoles; | ||
using UnityEngine; | ||
|
||
namespace VeryUsualDay.Commands | ||
{ | ||
[CommandHandler(typeof(RemoteAdminCommandHandler))] | ||
public class VudMedic : ICommand | ||
{ | ||
public string Command => "vudmedic"; | ||
public string[] Aliases => new string[] { }; | ||
public string Description => "Спавнит Медика Реагирования. Для Foundation-X."; | ||
|
||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
if (!VeryUsualDay.Instance.IsEnabledInRound) | ||
{ | ||
response = "Режим FX не включён!"; | ||
return false; | ||
} | ||
if (arguments.Count < 1) | ||
{ | ||
response = "Формат команды: vudmedic <id через пробел>."; | ||
return false; | ||
} | ||
|
||
foreach (var id in arguments.ToArray()) | ||
{ | ||
if (Player.TryGet(id, out var medic)) | ||
{ | ||
medic.Role.Set(RoleTypeId.FacilityGuard, reason: SpawnReason.ForceClass, spawnFlags: RoleSpawnFlags.AssignInventory); | ||
Timing.CallDelayed(2f, () => | ||
{ | ||
medic.MaxHealth = 200f; | ||
medic.Health = 200f; | ||
medic.Scale = new Vector3(1.03f, 1.03f, 1.03f); | ||
medic.ClearInventory(); | ||
medic.AddItem(ItemType.GunCrossvec); | ||
medic.AddItem(ItemType.KeycardGuard); | ||
medic.AddItem(ItemType.ArmorCombat); | ||
medic.AddItem(ItemType.Radio); | ||
medic.AddItem(ItemType.Painkillers); | ||
medic.AddItem(ItemType.Painkillers); | ||
medic.AddAmmo(AmmoType.Nato9, 60); | ||
CustomItem.TryGive(medic, "MG-119"); | ||
medic.EnableEffect(EffectType.BodyshotReduction, 10); | ||
medic.EnableEffect(EffectType.DamageReduction, 10); | ||
medic.EnableEffect(EffectType.MovementBoost, 2); | ||
medic.CustomInfo = "<b><color=#4DFFB8>Медик Реагирования</color></b>"; | ||
medic.Broadcast(10, "<b>Вы стали <color=#727472>медиком СБ</color>! Вы прошли обучение в мед. центре <color=#120a8f>Фонда</color>, и теперь готовы защищать сотрудников от <color=#ffa000>аномалий</color>."); | ||
}); | ||
} | ||
else | ||
{ | ||
response = "Не удалось найти игрока с таким ID!"; | ||
return false; | ||
} | ||
} | ||
response = "Игроки заспавнены."; | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters