From 6049d941c7a33109eee98470e25780016447e503 Mon Sep 17 00:00:00 2001 From: xNexusACS <83370388+xNexusACS@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:46:18 +0100 Subject: [PATCH] =?UTF-8?q?First=20wave=20code=20changes=20for=2014.0=20?= =?UTF-8?q?=F0=9F=91=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Exiled.API/Enums/AdminToyType.cs | 5 + Exiled.API/Enums/DoorType.cs | 14 +- Exiled.API/Enums/EffectType.cs | 22 ++- Exiled.API/Enums/ElevatorType.cs | 9 +- Exiled.API/Extensions/DoorTypeExtensions.cs | 2 +- Exiled.API/Extensions/EffectTypeExtension.cs | 10 +- Exiled.API/Extensions/ItemExtensions.cs | 7 +- Exiled.API/Extensions/MirrorExtensions.cs | 11 -- .../DamageHandlers/CustomDamageHandler.cs | 6 +- .../DamageHandlers/GenericDamageHandler.cs | 12 +- Exiled.API/Features/Doors/Door.cs | 5 +- Exiled.API/Features/Doors/ElevatorDoor.cs | 23 +-- Exiled.API/Features/Items/Firearm.cs | 144 +++++++----------- Exiled.API/Features/Items/Item.cs | 11 +- Exiled.API/Features/Lift.cs | 21 ++- Exiled.API/Features/Map.cs | 11 +- Exiled.API/Features/Pickups/FirearmPickup.cs | 13 +- Exiled.API/Features/Ragdoll.cs | 15 +- Exiled.API/Features/Roles/Scp079Role.cs | 2 +- Exiled.API/Features/Roles/Scp106Role.cs | 44 ++---- Exiled.API/Features/Round.cs | 16 +- .../Scp914Processors/FirearmProcessor.cs | 9 -- .../Scp914Processors/Scp914Processor.cs | 7 +- Exiled.API/Features/Toys/AdminToy.cs | 2 +- Exiled.API/Features/Toys/Light.cs | 81 +++++++--- Exiled.API/Features/Toys/Speaker.cs | 31 ++++ Exiled.API/Features/Warhead.cs | 2 +- Exiled.API/Features/Window.cs | 15 +- 28 files changed, 298 insertions(+), 252 deletions(-) create mode 100644 Exiled.API/Features/Toys/Speaker.cs diff --git a/Exiled.API/Enums/AdminToyType.cs b/Exiled.API/Enums/AdminToyType.cs index 6a4f1324a4..0eb3e1884f 100644 --- a/Exiled.API/Enums/AdminToyType.cs +++ b/Exiled.API/Enums/AdminToyType.cs @@ -27,5 +27,10 @@ public enum AdminToyType /// ShootingTarget toy. /// ShootingTarget, + + /// + /// Speaker toy. + /// + Speaker, } } \ No newline at end of file diff --git a/Exiled.API/Enums/DoorType.cs b/Exiled.API/Enums/DoorType.cs index 0feb0ffa7f..8b71fbc342 100644 --- a/Exiled.API/Enums/DoorType.cs +++ b/Exiled.API/Enums/DoorType.cs @@ -7,9 +7,8 @@ namespace Exiled.API.Enums { - using Exiled.API.Features.Doors; - - using static Interactables.Interobjects.ElevatorManager; + using Features.Doors; + using Interactables.Interobjects; /// /// Unique identifier for the different types of doors. @@ -269,9 +268,14 @@ public enum DoorType ElevatorGateB, /// - /// Represents the Elevator door for . + /// Represents the Elevator door for . + /// + ElevatorNuke1, + + /// + /// Represents the Elevator door for . /// - ElevatorNuke, + ElevatorNuke2, /// /// Represents the Elevator door for . diff --git a/Exiled.API/Enums/EffectType.cs b/Exiled.API/Enums/EffectType.cs index bfd2278d2a..858d535c27 100644 --- a/Exiled.API/Enums/EffectType.cs +++ b/Exiled.API/Enums/EffectType.cs @@ -9,7 +9,7 @@ namespace Exiled.API.Enums { using System; - using Exiled.API.Extensions; + using Extensions; /// /// Status effects as enum. @@ -239,5 +239,25 @@ public enum EffectType /// . /// Slowness, + + /// + /// . + /// + Scp1344, + + /// + /// . + /// + SeveredEyes, + + /// + /// . + /// + PitDeath, + + /// + /// . + /// + Blurred, } } diff --git a/Exiled.API/Enums/ElevatorType.cs b/Exiled.API/Enums/ElevatorType.cs index 3c2518ea69..b257a23304 100644 --- a/Exiled.API/Enums/ElevatorType.cs +++ b/Exiled.API/Enums/ElevatorType.cs @@ -30,9 +30,14 @@ public enum ElevatorType : byte GateB, /// - /// Heavy Containment Zone Nuke elevator. + /// Heavy Containment Zone Nuke 1 elevator. /// - Nuke, + Nuke1, + + /// + /// Heavy Containment Zone Nuke 2 elevator. + /// + Nuke2, /// /// Heavy Containment Zone SCP-049 elevator. diff --git a/Exiled.API/Extensions/DoorTypeExtensions.cs b/Exiled.API/Extensions/DoorTypeExtensions.cs index c4b512dd13..be863707a8 100644 --- a/Exiled.API/Extensions/DoorTypeExtensions.cs +++ b/Exiled.API/Extensions/DoorTypeExtensions.cs @@ -35,6 +35,6 @@ public static bool IsGate(this DoorType door) => door is DoorType.GateA or DoorT /// The door to be checked. /// Returns whether the is an elevator or not. public static bool IsElevator(this DoorType door) => door is DoorType.ElevatorGateA or DoorType.ElevatorGateB - or DoorType.ElevatorLczA or DoorType.ElevatorLczB or DoorType.ElevatorNuke or DoorType.ElevatorScp049; + or DoorType.ElevatorLczA or DoorType.ElevatorLczB or DoorType.ElevatorNuke1 or DoorType.ElevatorNuke2 or DoorType.ElevatorScp049; } } \ No newline at end of file diff --git a/Exiled.API/Extensions/EffectTypeExtension.cs b/Exiled.API/Extensions/EffectTypeExtension.cs index bb9d1d00a9..58ec69610e 100644 --- a/Exiled.API/Extensions/EffectTypeExtension.cs +++ b/Exiled.API/Extensions/EffectTypeExtension.cs @@ -15,7 +15,7 @@ namespace Exiled.API.Extensions using CustomPlayerEffects; using CustomRendering; using Enums; - using Exiled.API.Features; + using Features; using InventorySystem.Items.MarshmallowMan; using InventorySystem.Items.Usables.Scp244.Hypothermia; using PlayerRoles.FirstPersonControl; @@ -34,7 +34,7 @@ public static class EffectTypeExtension { EffectType.AmnesiaVision, typeof(AmnesiaVision) }, { EffectType.Asphyxiated, typeof(Asphyxiated) }, { EffectType.Bleeding, typeof(Bleeding) }, - { EffectType.Blinded, typeof(Blinded) }, + { EffectType.Blinded, typeof(Blindness) }, { EffectType.BodyshotReduction, typeof(BodyshotReduction) }, { EffectType.Burned, typeof(Burned) }, { EffectType.CardiacArrest, typeof(CardiacArrest) }, @@ -75,6 +75,10 @@ public static class EffectTypeExtension { EffectType.Ghostly, typeof(Ghostly) }, { EffectType.FogControl, typeof(FogControl) }, { EffectType.Slowness, typeof(Slowness) }, + { EffectType.Scp1344, typeof(Scp1344) }, + { EffectType.SeveredEyes, typeof(SeveredEyes) }, + { EffectType.PitDeath, typeof(PitDeath) }, + { EffectType.Blurred, typeof(Blurred) }, }); /// @@ -147,7 +151,7 @@ or EffectType.Corroding or EffectType.Decontaminating or EffectType.Hemorrhage o /// The . /// Whether or not the effect heals. /// - public static bool IsHealing(this EffectType effect) => effect.TryGetType(out Type type) && typeof(IHealablePlayerEffect).IsAssignableFrom(type); + public static bool IsHealing(this EffectType effect) => effect.TryGetType(out Type type) && typeof(IHealableEffect).IsAssignableFrom(type); /// /// Returns whether or not the provided is a negative effect. diff --git a/Exiled.API/Extensions/ItemExtensions.cs b/Exiled.API/Extensions/ItemExtensions.cs index ef96fe510b..0e7f7af1f1 100644 --- a/Exiled.API/Extensions/ItemExtensions.cs +++ b/Exiled.API/Extensions/ItemExtensions.cs @@ -15,8 +15,8 @@ namespace Exiled.API.Extensions using Features.Items; using InventorySystem; using InventorySystem.Items; - using InventorySystem.Items.Firearms; using InventorySystem.Items.Firearms.Attachments; + using InventorySystem.Items.Firearms.Modules; using InventorySystem.Items.Pickups; using InventorySystem.Items.ThrowableProjectiles; using Structs; @@ -125,10 +125,11 @@ public static T GetItemBase(this ItemType type) /// /// The weapon that you want to get maximum of. /// Returns the maximum. - public static byte GetMaxAmmo(this FirearmType type) + public static int GetMaxAmmo(this FirearmType type) { InventorySystem.Items.Firearms.Firearm firearm = GetItemBase(type.GetItemType()); - return firearm is null ? (byte)0 : firearm.AmmoManagerModule.MaxAmmo; + IAmmoContainerModule ammoModule = firearm.Modules.OfType().FirstOrDefault(); + return ammoModule?.AmmoMax ?? 0; } /// diff --git a/Exiled.API/Extensions/MirrorExtensions.cs b/Exiled.API/Extensions/MirrorExtensions.cs index aa38b362e9..a4c5eced93 100644 --- a/Exiled.API/Extensions/MirrorExtensions.cs +++ b/Exiled.API/Extensions/MirrorExtensions.cs @@ -13,22 +13,11 @@ namespace Exiled.API.Extensions using System.Linq; using System.Reflection; using System.Reflection.Emit; - using System.Text; using Features; - using Features.Core.Generic.Pools; - using InventorySystem.Items.Firearms; using Mirror; using PlayerRoles; - using PlayerRoles.FirstPersonControl; - using PlayerRoles.PlayableScps.Scp049.Zombies; using PlayerRoles.Subroutines; - using PlayerRoles.Voice; - using RelativePositioning; - using Respawning; - using UnityEngine; - - using EIntercom = Exiled.API.Features.Intercom; /// /// A set of extensions for Networking. diff --git a/Exiled.API/Features/DamageHandlers/CustomDamageHandler.cs b/Exiled.API/Features/DamageHandlers/CustomDamageHandler.cs index cf7e5c5e2e..374e47c8b5 100644 --- a/Exiled.API/Features/DamageHandlers/CustomDamageHandler.cs +++ b/Exiled.API/Features/DamageHandlers/CustomDamageHandler.cs @@ -11,7 +11,7 @@ namespace Exiled.API.Features.DamageHandlers using CustomPlayerEffects; using Enums; - using Exiled.API.Extensions; + using Extensions; using Items; using PlayerStatsSystem; using UnityEngine; @@ -102,7 +102,7 @@ public CustomDamageHandler(Player target, Player attacker, float damage, DamageT Base = { Owner = attacker.ReferenceHub }, }; - CustomBase = new FirearmDamageHandler(firearm, target, new BaseFirearmHandler(firearm.Base, damage)); + CustomBase = new FirearmDamageHandler(firearm, target, new BaseFirearmHandler { Firearm = firearm.Base, Damage = damage }); return; } @@ -126,7 +126,7 @@ public CustomDamageHandler(Player target, Player attacker, float damage, Firearm if (firearm.Owner != attacker) firearm.ChangeOwner(firearm.Owner, attacker); - CustomBase = new FirearmDamageHandler(firearm, target, new BaseFirearmHandler(firearm.Base, damage)); + CustomBase = new FirearmDamageHandler(firearm, target, new BaseFirearmHandler { Firearm = firearm.Base, Damage = damage }); } /// diff --git a/Exiled.API/Features/DamageHandlers/GenericDamageHandler.cs b/Exiled.API/Features/DamageHandlers/GenericDamageHandler.cs index 027365a174..5903ab2277 100644 --- a/Exiled.API/Features/DamageHandlers/GenericDamageHandler.cs +++ b/Exiled.API/Features/DamageHandlers/GenericDamageHandler.cs @@ -10,11 +10,13 @@ namespace Exiled.API.Features.DamageHandlers using System.Collections.Generic; using Enums; - using Exiled.API.Extensions; - using Exiled.API.Features.Pickups; + using Extensions; using Footprinting; + using InventorySystem.Items.Firearms.Modules; + using InventorySystem.Items.Firearms.ShotEvents; using InventorySystem.Items.MicroHID; using Items; + using Pickups; using PlayerRoles.PlayableScps.Scp096; using PlayerRoles.PlayableScps.Scp3114; using PlayerRoles.PlayableScps.Scp939; @@ -133,10 +135,10 @@ public GenericDamageHandler(Player player, Player attacker, float damage, Damage Base = new MicroHidDamageHandler(microHidOwner, damage); break; case DamageType.Explosion: - Base = new ExplosionDamageHandler(attacker.Footprint, UnityEngine.Vector3.zero, damage, 0); + Base = new ExplosionDamageHandler(attacker.Footprint, Vector3.zero, damage, 0, ExplosionType.Grenade); break; case DamageType.ParticleDisruptor: - Base = new DisruptorDamageHandler(Attacker, damage); + Base = new DisruptorDamageHandler(new DisruptorShotEvent(Item.Create(ItemType.ParticleDisruptor, attacker).Base as InventorySystem.Items.Firearms.Firearm, DisruptorActionModule.FiringState.FiringSingle), Vector3.up, damage); break; case DamageType.Scp096: Scp096Role curr096 = attacker.Role.Is(out Roles.Scp096Role scp096) ? scp096.Base : new GameObject().AddComponent(); @@ -222,7 +224,7 @@ private void GenericFirearm(Player player, Player attacker, float amount, Damage Owner = attacker.ReferenceHub, }, }; - Base = new PlayerStatsSystem.FirearmDamageHandler(firearm.Base, amount); + Base = new PlayerStatsSystem.FirearmDamageHandler { Firearm = firearm.Base, Damage = amount }; } } } diff --git a/Exiled.API/Features/Doors/Door.cs b/Exiled.API/Features/Doors/Door.cs index a411925ff4..857aa7dd6c 100644 --- a/Exiled.API/Features/Doors/Door.cs +++ b/Exiled.API/Features/Doors/Door.cs @@ -20,8 +20,6 @@ namespace Exiled.API.Features.Doors using Mirror; using UnityEngine; - using static Interactables.Interobjects.ElevatorManager; - using BaseBreakableDoor = Interactables.Interobjects.BreakableDoor; using BaseKeycardPermissions = Interactables.Interobjects.DoorUtils.KeycardPermissions; using Breakable = BreakableDoor; @@ -717,7 +715,8 @@ private DoorType GetDoorType() }, "Elevator" => (Base as Interactables.Interobjects.ElevatorDoor) switch { - { Group: ElevatorGroup.Nuke } => DoorType.ElevatorNuke, + { Group: ElevatorGroup.Nuke01 } => DoorType.ElevatorNuke1, + { Group: ElevatorGroup.Nuke02 } => DoorType.ElevatorNuke2, { Group: ElevatorGroup.Scp049 } => DoorType.ElevatorScp049, { Group: ElevatorGroup.GateB } => DoorType.ElevatorGateB, { Group: ElevatorGroup.GateA } => DoorType.ElevatorGateA, diff --git a/Exiled.API/Features/Doors/ElevatorDoor.cs b/Exiled.API/Features/Doors/ElevatorDoor.cs index d5d303d103..404cb3058d 100644 --- a/Exiled.API/Features/Doors/ElevatorDoor.cs +++ b/Exiled.API/Features/Doors/ElevatorDoor.cs @@ -10,8 +10,9 @@ namespace Exiled.API.Features.Doors using System.Collections.Generic; using System.Linq; - using Exiled.API.Enums; + using Enums; using Interactables.Interobjects; + using UnityEngine; /// /// Represents an elevator door. @@ -28,6 +29,7 @@ internal ElevatorDoor(Interactables.Interobjects.ElevatorDoor door, List r { Base = door; Lift = Lift.Get(x => x.Group == Group).FirstOrDefault(); + Panel = Object.FindObjectsOfType().FirstOrDefault(x => x._door == door); } /// @@ -36,28 +38,29 @@ internal ElevatorDoor(Interactables.Interobjects.ElevatorDoor door, List r public new Interactables.Interobjects.ElevatorDoor Base { get; } /// - /// Gets the that this door's belongs to. + /// Gets the that this door's belongs to. /// - public ElevatorManager.ElevatorGroup Group => Base.Group; + public ElevatorGroup Group => Base.Group; /// /// Gets the type according to . /// public ElevatorType ElevatorType => Group switch { - ElevatorManager.ElevatorGroup.Scp049 => ElevatorType.Scp049, - ElevatorManager.ElevatorGroup.GateA => ElevatorType.GateA, - ElevatorManager.ElevatorGroup.GateB => ElevatorType.GateB, - ElevatorManager.ElevatorGroup.LczA01 or ElevatorManager.ElevatorGroup.LczA02 => ElevatorType.LczA, - ElevatorManager.ElevatorGroup.LczB01 or ElevatorManager.ElevatorGroup.LczB02 => ElevatorType.LczB, - ElevatorManager.ElevatorGroup.Nuke => ElevatorType.Nuke, + ElevatorGroup.Scp049 => ElevatorType.Scp049, + ElevatorGroup.GateA => ElevatorType.GateA, + ElevatorGroup.GateB => ElevatorType.GateB, + ElevatorGroup.LczA01 or ElevatorGroup.LczA02 => ElevatorType.LczA, + ElevatorGroup.LczB01 or ElevatorGroup.LczB02 => ElevatorType.LczB, + ElevatorGroup.Nuke01 => ElevatorType.Nuke1, + ElevatorGroup.Nuke02 => ElevatorType.Nuke2, _ => ElevatorType.Unknown, }; /// /// Gets the target panel for this lift. /// - public ElevatorPanel Panel => Base.TargetPanel; + public ElevatorPanel Panel { get; } /// /// Gets the associated with this elevator door. diff --git a/Exiled.API/Features/Items/Firearm.cs b/Exiled.API/Features/Items/Firearm.cs index 41a48341a1..8706ca5cb4 100644 --- a/Exiled.API/Features/Items/Firearm.cs +++ b/Exiled.API/Features/Items/Firearm.cs @@ -7,7 +7,6 @@ namespace Exiled.API.Features.Items { - using System; using System.Collections.Generic; using System.Linq; @@ -18,12 +17,11 @@ namespace Exiled.API.Features.Items using Exiled.API.Interfaces; using Exiled.API.Structs; using Extensions; + using InventorySystem.Items; using InventorySystem.Items.Firearms; using InventorySystem.Items.Firearms.Attachments; using InventorySystem.Items.Firearms.Attachments.Components; - using InventorySystem.Items.Firearms.BasicMessages; using InventorySystem.Items.Firearms.Modules; - using UnityEngine; using BaseFirearm = InventorySystem.Items.Firearms.Firearm; @@ -52,13 +50,12 @@ public Firearm(BaseFirearm itemBase) /// /// The of the firearm. internal Firearm(ItemType type) - : this((BaseFirearm)Server.Host.Inventory.CreateItemInstance(new(type, 0), false)) + : this((BaseFirearm)Server.Host.Inventory.CreateItemInstance(new ItemIdentifier(type, 0), false)) { - FirearmStatusFlags firearmStatusFlags = FirearmStatusFlags.MagazineInserted; - if (Base.HasAdvantageFlag(AttachmentDescriptiveAdvantages.Flashlight)) - firearmStatusFlags = firearmStatusFlags.AddFlags(FirearmStatusFlags.FlashlightEnabled); + FlashlightAttachment flashlightAttachment = Attachments.OfType().FirstOrDefault(); - Base.Status = new(MaxAmmo, firearmStatusFlags, Base.GetCurrentAttachmentsCode()); + if (flashlightAttachment is not null && flashlightAttachment.IsEnabled) + flashlightAttachment.ServerSendStatus(true); } /// . @@ -95,14 +92,19 @@ public static IReadOnlyDictionary public new BaseFirearm Base { get; } + /// + /// Gets the modules associated with this firearm. + /// + public IEnumerable Modules => Base.Modules; + /// /// Gets or sets the amount of ammo in the firearm. /// [EProperty(category: nameof(Firearm))] - public byte Ammo + public int Ammo { - get => Base.Status.Ammo; - set => Base.Status = new FirearmStatus(value, Base.Status.Flags, Base.Status.Attachments); + get => (Modules.FirstOrDefault(module => module is MagazineModule) as MagazineModule)?.AmmoStored ?? 0; + set => ((MagazineModule)Modules.FirstOrDefault(module => module is MagazineModule))!.AmmoStored = value; } /// @@ -110,27 +112,10 @@ public byte Ammo /// /// Disruptor can't be used for MaxAmmo. [EProperty(category: nameof(Firearm))] - public byte MaxAmmo + public int MaxAmmo { - get => Base.AmmoManagerModule?.MaxAmmo ?? 0; - set - { - switch (Base.AmmoManagerModule) - { - case TubularMagazineAmmoManager tubularMagazineAmmoManager: - tubularMagazineAmmoManager.MaxAmmo = (byte)(value - Base.AttachmentsValue(AttachmentParam.MagazineCapacityModifier) - (Base.Status.Flags.HasFlagFast(FirearmStatusFlags.Cocked) ? tubularMagazineAmmoManager.ChamberedRounds : 0)); - break; - case ClipLoadedInternalMagAmmoManager clipLoadedInternalMagAmmoManager: - clipLoadedInternalMagAmmoManager.MaxAmmo = (byte)(value - Base.AttachmentsValue(AttachmentParam.MagazineCapacityModifier)); - break; - case AutomaticAmmoManager automaticAmmoManager: - automaticAmmoManager.MaxAmmo = (byte)(value - Base.AttachmentsValue(AttachmentParam.MagazineCapacityModifier) - automaticAmmoManager.ChamberedAmount); - break; - default: - Log.Warn($"MaxAmmo can't be used for this Item: {Type} ({Base.AmmoManagerModule})"); - return; - } - } + get => (Modules.FirstOrDefault(module => module is MagazineModule) as MagazineModule)?.AmmoMax ?? 0; + set => ((MagazineModule)Modules.FirstOrDefault(module => module is MagazineModule))!._defaultCapacity = value; } /// @@ -140,24 +125,16 @@ public byte MaxAmmo public FirearmType FirearmType => Type.GetFirearmType(); /// - /// Gets or sets the of the firearm. + /// Gets the of the firearm. /// [EProperty(category: nameof(Firearm))] - public AmmoType AmmoType - { - get => Base.AmmoType.GetAmmoType(); - set - { - if (Base is AutomaticFirearm automaticFirearm) - automaticFirearm._ammoType = value.GetItemType(); - } - } + public AmmoType AmmoType => (Modules.OfType().FirstOrDefault()?.AmmoType ?? ItemType.None).GetAmmoType(); /// /// Gets a value indicating whether the firearm is being aimed. /// [EProperty(readOnly: true, category: nameof(Firearm))] - public bool Aiming => Base.AdsModule.ServerAds; + public bool Aiming => Modules.OfType().FirstOrDefault()?.AdsTarget ?? false; /// /// Gets a value indicating whether the firearm Flashlight. @@ -169,7 +146,7 @@ public AmmoType AmmoType /// Gets a value indicating whether the firearm's flashlight module is enabled. /// [EProperty(readOnly: true, category: nameof(Firearm))] - public bool FlashlightEnabled => Base.Status.Flags.HasFlagFast(FirearmStatusFlags.FlashlightEnabled); + public bool FlashlightEnabled => Base.IsEmittingLight; /// /// Gets a value indicating whether the firearm's NightVision is being used. @@ -187,7 +164,7 @@ public AmmoType AmmoType /// Gets a value indicating whether or not the firearm is automatic. /// [EProperty(readOnly: true, category: nameof(Firearm))] - public bool IsAutomatic => Base is AutomaticFirearm; + public bool IsAutomatic => Modules.Any(module => module is AutomaticActionModule); /// /// Gets the s of the firearm. @@ -214,11 +191,23 @@ public IEnumerable AttachmentIdentifiers public uint BaseCode => BaseCodesValue[FirearmType]; /// - /// Gets the fire rate of the firearm, if it is an automatic weapon. + /// Gets or sets the fire rate of the firearm, if it is an automatic weapon. /// /// [EProperty(readOnly: true, category: nameof(Firearm))] - public float FireRate => Base is AutomaticFirearm auto ? auto._fireRate : 1f; + public float FireRate + { + get => Modules.OfType().FirstOrDefault()?.BaseFireRate ?? 0f; + set + { + AutomaticActionModule module = Modules.OfType().FirstOrDefault(); + + if (module is null) + return; + + module.BaseFireRate = value; + } + } /// /// Gets or sets the recoil settings of the firearm, if it's an automatic weapon. @@ -228,39 +217,19 @@ public IEnumerable AttachmentIdentifiers [EProperty(category: nameof(Firearm))] public RecoilSettings Recoil { - get => Base is AutomaticFirearm auto ? auto._recoil : default; + get => Base.Modules.OfType().FirstOrDefault()?.BaseRecoil ?? default; set { - if (Base is not AutomaticFirearm auto) + RecoilPatternModule module = Base.Modules.OfType().FirstOrDefault(); + + if (module is null) return; - auto.ActionModule = new AutomaticAction( - Base, - auto._semiAutomatic, - auto._boltTravelTime, - 1f / auto._fireRate, - auto._dryfireClipId, - auto._triggerClipId, - auto._gunshotPitchRandomization, - value, - auto._recoilPattern, - false, - Mathf.Max(1, auto._chamberSize)); + module.BaseRecoil = value; } } - /// - /// Gets the firearm's . Will be for non-automatic weapons. - /// - [EProperty(readOnly: true, category: nameof(Firearm))] - public FirearmRecoilPattern RecoilPattern => Base is AutomaticFirearm auto ? auto._recoilPattern : null; - - /// - /// Gets the . - /// - [EProperty(readOnly: true, category: nameof(Firearm))] - public FirearmBaseStats Stats => Base.BaseStats; - + /* TODO /// /// Gets the base damage. /// @@ -272,6 +241,7 @@ public RecoilSettings Recoil /// [EProperty(readOnly: true, category: nameof(Firearm))] public float MaxRange => Stats.MaxDistance(); + */ /// /// Gets a of and [] which contains all available attachments for all firearms. @@ -473,7 +443,9 @@ public void AddAttachment(AttachmentIdentifier identifier) : identifier.Code; Base.ApplyAttachmentsCode((Base.GetCurrentAttachmentsCode() & ~toRemove) | newCode, true); - Base.Status = new FirearmStatus(Math.Min(Ammo, MaxAmmo), Base.Status.Flags, Base.GetCurrentAttachmentsCode()); + + // TODO + // Base.Status = new FirearmStatus(Math.Min(Ammo, MaxAmmo), Base.Status.Flags, Base.GetCurrentAttachmentsCode()); } /// @@ -515,10 +487,12 @@ public void RemoveAttachment(AttachmentIdentifier identifier) Base.ApplyAttachmentsCode(Base.GetCurrentAttachmentsCode() & ~code, true); + /* TODO if (identifier.Name == AttachmentName.Flashlight) Base.Status = new FirearmStatus(Math.Min(Ammo, MaxAmmo), Base.Status.Flags & ~FirearmStatusFlags.FlashlightEnabled, Base.GetCurrentAttachmentsCode()); else Base.Status = new FirearmStatus(Math.Min(Ammo, MaxAmmo), Base.Status.Flags, Base.GetCurrentAttachmentsCode()); + */ } /// @@ -531,10 +505,12 @@ public void RemoveAttachment(AttachmentName attachmentName) Base.ApplyAttachmentsCode(Base.GetCurrentAttachmentsCode() & ~code, true); + /* TODO if (attachmentName == AttachmentName.Flashlight) Base.Status = new FirearmStatus(Math.Min(Ammo, MaxAmmo), Base.Status.Flags & ~FirearmStatusFlags.FlashlightEnabled, Base.GetCurrentAttachmentsCode()); else Base.Status = new FirearmStatus(Math.Min(Ammo, MaxAmmo), Base.Status.Flags, Base.GetCurrentAttachmentsCode()); + */ } /// @@ -552,10 +528,12 @@ public void RemoveAttachment(AttachmentSlot attachmentSlot) Base.ApplyAttachmentsCode(Base.GetCurrentAttachmentsCode() & ~code, true); + /* TODO if (firearmAttachment.Name == AttachmentName.Flashlight) Base.Status = new FirearmStatus(Math.Min(Ammo, MaxAmmo), Base.Status.Flags & ~FirearmStatusFlags.FlashlightEnabled, Base.GetCurrentAttachmentsCode()); else Base.Status = new FirearmStatus(Math.Min(Ammo, MaxAmmo), Base.Status.Flags, Base.GetCurrentAttachmentsCode()); + */ } /// @@ -636,12 +614,14 @@ public bool TryGetAttachment(AttachmentName attachmentName, out Attachment firea return true; } + /* TODO /// /// Gets the damage based on the specified distance. /// /// The distance to evaluate. /// The corresponding damage based on the specified distance. public float GetDamageAtDistance(float distance) => Stats.DamageAtDistance(Base, distance); + */ /// /// Clones current object. @@ -668,22 +648,7 @@ public override Item Clone() internal override void ChangeOwner(Player oldOwner, Player newOwner) { Base.Owner = newOwner.ReferenceHub; - - Base.HitregModule = Base switch - { - AutomaticFirearm automaticFirearm => - new SingleBulletHitreg(automaticFirearm, automaticFirearm.Owner, automaticFirearm._recoilPattern), - Shotgun shotgun => - new BuckshotHitreg(shotgun, shotgun.Owner, shotgun.GetBuckshotPattern), - ParticleDisruptor particleDisruptor => - new DisruptorHitreg(particleDisruptor, particleDisruptor.Owner, particleDisruptor._explosionSettings), - Revolver revolver => - new SingleBulletHitreg(revolver, revolver.Owner), - _ => throw new NotImplementedException("Should never happend"), - }; - - Base._sendStatusNextFrame = true; - Base._footprintValid = false; + Base._footprintCacheSet = false; } /// @@ -695,7 +660,6 @@ internal override void ReadPickupInfo(Pickup pickup) return; Base.OnAdded(firearm.Base); - AmmoType = firearm.AmmoType; if (Base is not ParticleDisruptor) MaxAmmo = firearm.MaxAmmo; diff --git a/Exiled.API/Features/Items/Item.cs b/Exiled.API/Features/Items/Item.cs index d21666d07f..f881654b49 100644 --- a/Exiled.API/Features/Items/Item.cs +++ b/Exiled.API/Features/Items/Item.cs @@ -7,7 +7,6 @@ namespace Exiled.API.Features.Items { - using System; using System.Collections.Generic; using System.Linq; @@ -199,6 +198,16 @@ public ushort Serial /// public Player Owner => Player.Get(Base.Owner) ?? Server.Host; + /// + /// Gets or sets a reason for adding this item to the inventory. + /// + [EProperty(category: nameof(Item))] + public ItemAddReason AddReason + { + get => Base.ServerAddReason; + set => Base.ServerAddReason = value; + } + /// /// Gets an existing or creates a new instance of one. /// diff --git a/Exiled.API/Features/Lift.cs b/Exiled.API/Features/Lift.cs index df6ed6f8fd..3a0938a2f2 100644 --- a/Exiled.API/Features/Lift.cs +++ b/Exiled.API/Features/Lift.cs @@ -22,7 +22,6 @@ namespace Exiled.API.Features using UnityEngine; using static Interactables.Interobjects.ElevatorChamber; - using static Interactables.Interobjects.ElevatorManager; using BaseElevatorDoor = Interactables.Interobjects.ElevatorDoor; using ElevatorDoor = Doors.ElevatorDoor; @@ -94,8 +93,8 @@ internal Lift(ElevatorChamber elevator) [EProperty(category: nameof(Lift))] public ElevatorSequence Status { - get => Base._curSequence; - set => Base._curSequence = value; + get => Base.CurSequence; + set => Base.CurSequence = value; } /// @@ -115,7 +114,8 @@ public ElevatorSequence Status ElevatorGroup.GateB => ElevatorType.GateB, ElevatorGroup.LczA01 or ElevatorGroup.LczA02 => ElevatorType.LczA, ElevatorGroup.LczB01 or ElevatorGroup.LczB02 => ElevatorType.LczB, - ElevatorGroup.Nuke => ElevatorType.Nuke, + ElevatorGroup.Nuke01 => ElevatorType.Nuke1, + ElevatorGroup.Nuke02 => ElevatorType.Nuke2, _ => ElevatorType.Unknown, }; @@ -141,7 +141,7 @@ public ElevatorSequence Status /// Gets a value indicating whether the lift is locked. /// [EProperty(readOnly: true, category: nameof(Lift))] - public bool IsLocked => Base.ActiveLocks > 0; + public bool IsLocked => Base.ActiveLocksAllDoors > 0; /// /// Gets or sets the . @@ -178,15 +178,15 @@ public float AnimationTime public float MoveTime => AnimationTime + RotationTime + DoorOpenTime + DoorCloseTime; /// - /// Gets the . + /// Gets the . /// [EProperty(readOnly: true, category: nameof(Lift))] - public int CurrentLevel => Base.CurrentLevel; + public int NextLevel => Base.NextLevel; /// /// Gets the . /// - public ElevatorDoor CurrentDestination => Door.Get(Base.CurrentDestination).As(); + public ElevatorDoor CurrentDestination => Door.Get(Base.DestinationDoor).As(); /// /// Gets the base . @@ -338,8 +338,7 @@ public float AnimationTime /// /// The destination level. /// Indicates whether the start will be forced or not. - /// if the lift was started successfully; otherwise, . - public bool TryStart(int level, bool isForced = false) => TrySetDestination(Group, level, isForced); + public void Start(int level, bool isForced = false) => Base.ServerSetDestination(level, isForced); /// /// Locks the lift. @@ -388,6 +387,6 @@ public void Lock(DoorLockType lockReason = DoorLockType.Isolation) /// Returns the Lift in a human-readable format. /// /// A string containing Lift-related data. - public override string ToString() => $"{Type} {Status} [{CurrentLevel}] *{IsLocked}*"; + public override string ToString() => $"{Type} {Status} [{NextLevel}] *{IsLocked}*"; } } \ No newline at end of file diff --git a/Exiled.API/Features/Map.cs b/Exiled.API/Features/Map.cs index 22be75d24c..a0a2e4911b 100644 --- a/Exiled.API/Features/Map.cs +++ b/Exiled.API/Features/Map.cs @@ -91,14 +91,14 @@ public static int Seed set { if (!SeedSynchronizer.MapGenerated) - SeedSynchronizer._singleton.Network_syncSeed = value; + SeedSynchronizer.Seed = value; } } /// /// Gets the . /// - public static AmbientSoundPlayer AmbientSoundPlayer => ambientSoundPlayer ??= ReferenceHub.HostHub.GetComponent(); + public static AmbientSoundPlayer AmbientSoundPlayer => ambientSoundPlayer ??= ReferenceHub._hostHub.GetComponent(); /// /// Gets the . @@ -274,6 +274,7 @@ public static void CleanAllRagdolls(IEnumerable ragDolls) ragDoll.Destroy(); } + /* TODO /// /// Places a decal. /// @@ -288,6 +289,7 @@ public static void CleanAllRagdolls(IEnumerable ragDolls) /// The position of the blood decal. /// The direction of the blood decal. public static void PlaceBlood(Vector3 position, Vector3 direction) => PlaceDecal(position, direction, DecalPoolType.Blood); + */ /// /// Gets all the near cameras. @@ -348,7 +350,8 @@ public static void ExplodeEffect(Vector3 position, ProjectileType projectileType /// The audio clip ID to play. public static void PlayGunSound(Vector3 position, ItemType firearmType, byte maxDistance = 45, byte audioClipId = 0) { - GunAudioMessage msg = new() + // TODO + /*GunAudioMessage msg = new() { Weapon = firearmType, AudioClipId = audioClipId, @@ -356,7 +359,7 @@ public static void PlayGunSound(Vector3 position, ItemType firearmType, byte max ShooterHub = ReferenceHub.HostHub, ShooterPosition = new RelativePosition(position), }; - msg.SendToAuthenticated(); + msg.SendToAuthenticated();*/ } /// diff --git a/Exiled.API/Features/Pickups/FirearmPickup.cs b/Exiled.API/Features/Pickups/FirearmPickup.cs index 8068abd422..75ee808b3a 100644 --- a/Exiled.API/Features/Pickups/FirearmPickup.cs +++ b/Exiled.API/Features/Pickups/FirearmPickup.cs @@ -13,7 +13,6 @@ namespace Exiled.API.Features.Pickups using Exiled.API.Features.Items; using Exiled.API.Interfaces; using InventorySystem.Items; - using InventorySystem.Items.Firearms; using BaseFirearm = InventorySystem.Items.Firearms.FirearmPickup; using FirearmItem = InventorySystem.Items.Firearms.Firearm; @@ -41,7 +40,7 @@ internal FirearmPickup(ItemType type) : base(type) { Base = (BaseFirearm)((Pickup)this).Base; - IsDistributed = true; + Base.OnDistributed(); if (type is ItemType.ParticleDisruptor && Status.Ammo <= 0) Status = new FirearmStatus(5, FirearmStatusFlags.MagazineInserted, 0); @@ -64,16 +63,6 @@ internal FirearmPickup(ItemType type) [EProperty(category: nameof(FirearmPickup))] public AmmoType AmmoType { get; set; } - /// - /// Gets or sets a value indicating whether the pickup is already distributed. - /// - [EProperty(category: nameof(FirearmPickup))] - public bool IsDistributed - { - get => Base.Distributed; - set => Base.Distributed = value; - } - /// /// Gets or sets the . /// diff --git a/Exiled.API/Features/Ragdoll.cs b/Exiled.API/Features/Ragdoll.cs index 11c852c667..bb80aa2cd1 100644 --- a/Exiled.API/Features/Ragdoll.cs +++ b/Exiled.API/Features/Ragdoll.cs @@ -110,10 +110,14 @@ public DamageHandlerBase DamageHandler public DeathAnimation[] DeathAnimations => Base.AllDeathAnimations; /// - /// Gets a value indicating whether or not the ragdoll has been already cleaned up. + /// Gets or sets a value indicating whether or not the ragdoll has freeze or not. /// - [EProperty(readOnly: true, category: nameof(Ragdoll))] - public bool IsFrozen => Base._frozen; + [EProperty(category: nameof(Ragdoll))] + public bool IsFrozen + { + get => Base.Frozen; + set => Base.Frozen = value; + } /// /// Gets or sets a value indicating whether or not the ragdoll can be cleaned up. @@ -420,6 +424,11 @@ public static Ragdoll Get(BasicRagdoll ragdoll) => ragdoll == null ? null : /// public void UnSpawn() => NetworkServer.UnSpawn(GameObject); + /// + /// Freeze the ragdoll. + /// + public void Freeze() => Base.FreezeRagdoll(); + /// /// Returns the Ragdoll in a human-readable format. /// diff --git a/Exiled.API/Features/Roles/Scp079Role.cs b/Exiled.API/Features/Roles/Scp079Role.cs index ee81c6c801..b18d344267 100644 --- a/Exiled.API/Features/Roles/Scp079Role.cs +++ b/Exiled.API/Features/Roles/Scp079Role.cs @@ -716,7 +716,7 @@ public void ActivateTesla(bool consumeEnergy = true) Scp079Camera cam = CurrentCameraSync.CurrentCamera; RewardManager.MarkRoom(cam.Room); - if (!TeslaGateController.Singleton.TeslaGates.TryGetFirst(x => RoomIdUtils.IsTheSameRoom(cam.Position, x.transform.position), out global::TeslaGate teslaGate)) + if (!global::TeslaGate.AllGates.TryGetFirst(x => RoomIdUtils.IsTheSameRoom(cam.Position, x.transform.position), out global::TeslaGate teslaGate)) return; if (consumeEnergy) diff --git a/Exiled.API/Features/Roles/Scp106Role.cs b/Exiled.API/Features/Roles/Scp106Role.cs index 6e5797bbba..c101c73c74 100644 --- a/Exiled.API/Features/Roles/Scp106Role.cs +++ b/Exiled.API/Features/Roles/Scp106Role.cs @@ -33,7 +33,7 @@ public class Scp106Role : FpcRole, ISubroutinedScpRole, IHumeShieldRole, ISpawna private readonly ConstProperty corrodingTime = new(Scp106Attack.CorrodingTime, new[] { typeof(Scp106Attack) }); private readonly ConstProperty vigorCaptureReward = new(Scp106Attack.VigorCaptureReward, new[] { typeof(Scp106Attack) }); private readonly ConstProperty cooldownReductionReward = new(Scp106Attack.CooldownReductionReward, new[] { typeof(Scp106Attack) }); - private readonly ConstProperty sinkholeCooldownDuration = new(Scp106SinkholeController.CooldownDuration, new[] { typeof(Scp106SinkholeController) }); + private readonly ConstProperty sinkholeCooldownDuration = new(Scp106SinkholeController.EmergeCooldownDuration, new[] { typeof(Scp106SinkholeController) }); private readonly ConstProperty huntersAtlasCostPerMeter = new(Scp106HuntersAtlasAbility.CostPerMeter, new[] { typeof(Scp106HuntersAtlasAbility) }); /// @@ -137,8 +137,12 @@ public float Vigor [EProperty(category: nameof(Scp106Role))] public bool IsSubmerged { - get => Base.IsSubmerged; - set => HuntersAtlasAbility.SetSubmerged(value); + get => HuntersAtlasAbility._syncSubmerged; + set + { + HuntersAtlasAbility._syncSubmerged = value; + HuntersAtlasAbility.ServerSendRpc(true); + } } /// @@ -165,12 +169,6 @@ public bool IsSubmerged [EProperty(readOnly: true, category: nameof(Scp106Role))] public float SinkholeCurrentTime => SinkholeController.ElapsedToggle; - /// - /// Gets a value indicating the normalized state of the sinkhole. - /// - [EProperty(readOnly: true, category: nameof(Scp106Role))] - public float SinkholeNormalizedState => SinkholeController.NormalizedState; - /// /// Gets a value indicating whether or not SCP-106 is currently in the middle of an animation. /// @@ -183,26 +181,11 @@ public bool IsSubmerged [EProperty(readOnly: true, category: nameof(Scp106Role))] public bool IsSinkholeHidden => SinkholeController.IsHidden; - /// - /// Gets or sets a value indicating whether the current sinkhole state. - /// - [EProperty(category: nameof(Scp106Role))] - public bool SinkholeState - { - get => SinkholeController.State; - set => SinkholeController.State = value; - } - /// /// Gets the sinkhole target duration. /// [EProperty(readOnly: true, category: nameof(Scp106Role))] - public float SinkholeTargetDuration => SinkholeController.TargetDuration; - - /// - /// Gets the speed multiplier of the sinkhole. - /// - public float SinkholeSpeedMultiplier => SinkholeController.SpeedMultiplier; + public float SinkholeTargetDuration => SinkholeController.TargetTransitionDuration; /// /// Gets or sets how mush cost the Ability Stalk will cost per tick when being stationary. @@ -306,10 +289,10 @@ public float CaptureCooldown [EProperty(category: nameof(Scp106Role))] public float RemainingSinkholeCooldown { - get => SinkholeController.Cooldown.Remaining; + get => SinkholeController._submergeCooldown.Remaining; set { - SinkholeController.Cooldown.Remaining = value; + SinkholeController._submergeCooldown.Remaining = value; SinkholeController.ServerSendRpc(true); } } @@ -320,8 +303,8 @@ public float RemainingSinkholeCooldown [EProperty(category: nameof(Scp106Role))] public bool IsStalking { - get => StalkAbility.IsActive; - set => StalkAbility.IsActive = value; + get => StalkAbility.StalkActive; + set => StalkAbility.ServerSetStalk(value); } /// @@ -347,7 +330,7 @@ public bool UsePortal(Vector3 position, float cost = 0f) return false; HuntersAtlasAbility._estimatedCost = cost; - HuntersAtlasAbility.SetSubmerged(true); + HuntersAtlasAbility._syncSubmerged = true; return true; } @@ -361,6 +344,7 @@ public bool CapturePlayer(Player player) { if (player is null) return false; + Attack._targetHub = player.ReferenceHub; DamageHandlerBase handler = new ScpDamageHandler(Attack.Owner, AttackDamage, DeathTranslations.PocketDecay); diff --git a/Exiled.API/Features/Round.cs b/Exiled.API/Features/Round.cs index 071625019b..42022555ad 100644 --- a/Exiled.API/Features/Round.cs +++ b/Exiled.API/Features/Round.cs @@ -11,7 +11,7 @@ namespace Exiled.API.Features using System.Collections.Generic; using Enums; - using Exiled.API.Extensions; + using Extensions; using GameCore; using PlayerRoles; @@ -46,12 +46,12 @@ public static class Round /// /// Gets a value indicating whether the round is started or not. /// - public static bool IsStarted => ReferenceHub.LocalHub && ReferenceHub.LocalHub.characterClassManager.RoundStarted; + public static bool IsStarted => ReferenceHub._localHub != null && ReferenceHub._localHub.characterClassManager.RoundStarted; /// /// Gets a value indicating whether the round in progress or not. /// - public static bool InProgress => ReferenceHub.LocalHub != null && RoundSummary.RoundInProgress(); + public static bool InProgress => ReferenceHub._localHub != null && RoundSummary.RoundInProgress(); /// /// Gets a value indicating whether the round is ended or not. @@ -64,12 +64,12 @@ public static class Round public static bool IsLobby => !(IsEnded || IsStarted); /// - /// Gets or sets a value indicating the amount of Chaos Targets remaining. + /// Gets or sets a value indicating the amount of Extra Targets remaining. /// - public static int ChaosTargetCount + public static int ExtraTargetsCount { - get => RoundSummary.singleton.Network_chaosTargetCount; - set => RoundSummary.singleton.Network_chaosTargetCount = value; + get => RoundSummary.singleton.Network_extraTargets; + set => RoundSummary.singleton.Network_extraTargets = value; } /// @@ -196,7 +196,7 @@ public static int TargetOffset targetOffset = value; foreach (Player player in Player.List) { - player.SendFakeSyncVar(RoundSummary.singleton.netIdentity, typeof(RoundSummary), nameof(RoundSummary.Network_chaosTargetCount), RoundSummary.singleton._chaosTargetCount + TargetOffset); + player.SendFakeSyncVar(RoundSummary.singleton.netIdentity, typeof(RoundSummary), nameof(RoundSummary.Network_extraTargets), RoundSummary.singleton._extraTargets + TargetOffset); } } } diff --git a/Exiled.API/Features/Scp914Processors/FirearmProcessor.cs b/Exiled.API/Features/Scp914Processors/FirearmProcessor.cs index 58d71f9dd1..56b82e87e2 100644 --- a/Exiled.API/Features/Scp914Processors/FirearmProcessor.cs +++ b/Exiled.API/Features/Scp914Processors/FirearmProcessor.cs @@ -33,15 +33,6 @@ public FirearmProcessor(FirearmItemProcessor scp914ItemProcessor) /// public new FirearmItemProcessor Base { get; } - /// - /// Gets or sets a value indicating whether or not magazine should be refilled. - /// - public bool RefillAmmo - { - get => Base._refillAmmo; - set => Base._refillAmmo = value; - } - /// /// Gets or sets a list of items that replace upgrading item when is . /// diff --git a/Exiled.API/Features/Scp914Processors/Scp914Processor.cs b/Exiled.API/Features/Scp914Processors/Scp914Processor.cs index f6c7dea43b..f3964b461c 100644 --- a/Exiled.API/Features/Scp914Processors/Scp914Processor.cs +++ b/Exiled.API/Features/Scp914Processors/Scp914Processor.cs @@ -57,19 +57,18 @@ public Scp914Processor(Scp914ItemProcessor scp914ItemProcessor) /// /// Upgrades an item from player's inventory. /// - /// Player from whose inventory item will be chosen. /// Item to update. /// Setting to use. /// A new upgraded item. - public Item UpgradeInventoryItem(Player player, Item item, Scp914KnobSetting scp914KnobSetting) => Item.Get(Base.OnInventoryItemUpgraded(scp914KnobSetting, player.ReferenceHub, item.Serial)); + public Scp914Result UpgradeInventoryItem(Item item, Scp914KnobSetting scp914KnobSetting) => Base.UpgradeInventoryItem(scp914KnobSetting, item.Base); /// - /// Upgrades an pickup from player's inventory. + /// Upgrades a pickup from player's inventory. /// /// Pickup to update. /// Setting to use. /// A new upgraded pickup. - public Pickup UpgradePickup(Pickup pickup, Scp914KnobSetting scp914KnobSetting) => Pickup.Get(Base.OnPickupUpgraded(scp914KnobSetting, pickup.Base, Scp914.MovingVector)); + public Scp914Result UpgradePickup(Pickup pickup, Scp914KnobSetting scp914KnobSetting) => Base.UpgradePickup(scp914KnobSetting, pickup.Base); /// /// Gets a random output item. diff --git a/Exiled.API/Features/Toys/AdminToy.cs b/Exiled.API/Features/Toys/AdminToy.cs index df20f5544e..ce6b79ff50 100644 --- a/Exiled.API/Features/Toys/AdminToy.cs +++ b/Exiled.API/Features/Toys/AdminToy.cs @@ -98,7 +98,7 @@ public Quaternion Rotation set { Transform.rotation = value; - AdminToyBase.NetworkRotation = new(value); + AdminToyBase.NetworkRotation = value; } } diff --git a/Exiled.API/Features/Toys/Light.cs b/Exiled.API/Features/Toys/Light.cs index e0e8e7215b..da3fe37abc 100644 --- a/Exiled.API/Features/Toys/Light.cs +++ b/Exiled.API/Features/Toys/Light.cs @@ -12,7 +12,7 @@ namespace Exiled.API.Features.Toys using AdminToys; using Enums; - using Exiled.API.Interfaces; + using Exiled.API.Interfaces; using Exiled.API.Structs; using UnityEngine; @@ -62,7 +62,7 @@ public float Range } /// - /// Gets or sets the color of the primitive. + /// Gets or sets the color of the light. /// public Color Color { @@ -73,24 +73,69 @@ public Color Color /// /// Gets or sets a value indicating whether the light should cause shadows from other objects. /// - public bool ShadowEmission + public LightShadows Shadow { - get => Base.NetworkLightShadows; - set => Base.NetworkLightShadows = value; - } - + get => Base.NetworkShadowType; + set => Base.NetworkShadowType = value; + } + + /// + /// Gets or sets the light shape. + /// + public LightShape Shape + { + get => Base.NetworkLightShape; + set => Base.NetworkLightShape = value; + } + + /// + /// Gets or sets the shadow strength. + /// + public float ShadowStrength + { + get => Base.NetworkShadowStrength; + set => Base.NetworkShadowStrength = value; + } + + /// + /// Gets or sets the Light Type of this light. + /// + public LightType LightType + { + get => Base.NetworkLightType; + set => Base.NetworkLightType = value; + } + + /// + /// Gets or sets the spot angle of this light. + /// + public float SpotAngle + { + get => Base.NetworkSpotAngle; + set => Base.NetworkSpotAngle = value; + } + + /// + /// Gets or sets the inner spot angle of this light. + /// + public float InnerSpotAngle + { + get => Base.NetworkInnerSpotAngle; + set => Base.NetworkInnerSpotAngle = value; + } + /// /// Creates a new . /// /// The position of the . /// The rotation of the . - /// The scale of the . - /// The color of the . + /// The scale of the . + /// The color of the . /// Whether or not the should be initially spawned. /// The newly created . - public static Light Create(Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, Color? color = null, bool spawn = true) - => Create(new(position, rotation, scale, color, spawn)); - + public static Light Create(Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, Color? color = null, bool spawn = true) + => Create(new(position, rotation, scale, color, spawn)); + /// /// Creates a new . /// @@ -98,12 +143,12 @@ public static Light Create(Vector3? position = null, Quaternion? rotation = null /// The new . public static Light Create(LightSettings lightSettings) { - Light light = new(Object.Instantiate(PrefabObject.GetComponent())) - { - Position = lightSettings.Position, - Rotation = lightSettings.Rotation, - Scale = lightSettings.Scale, - Color = lightSettings.Color, + Light light = new(Object.Instantiate(PrefabObject.GetComponent())) + { + Position = lightSettings.Position, + Rotation = lightSettings.Rotation, + Scale = lightSettings.Scale, + Color = lightSettings.Color, }; if (lightSettings.ShouldSpawn) diff --git a/Exiled.API/Features/Toys/Speaker.cs b/Exiled.API/Features/Toys/Speaker.cs new file mode 100644 index 0000000000..ff9065d586 --- /dev/null +++ b/Exiled.API/Features/Toys/Speaker.cs @@ -0,0 +1,31 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Toys +{ + using AdminToys; + using Exiled.API.Enums; + using Exiled.API.Interfaces; + + /// + /// A wrapper class for . + /// + public class Speaker : AdminToy, IWrapper + { + /// + /// Initializes a new instance of the class. + /// + /// The of the toy. + internal Speaker(SpeakerToy speakerToy) + : base(speakerToy, AdminToyType.Speaker) => Base = speakerToy; + + /// + /// Gets the base . + /// + public SpeakerToy Base { get; } + } +} \ No newline at end of file diff --git a/Exiled.API/Features/Warhead.cs b/Exiled.API/Features/Warhead.cs index 2438f223a7..44222d833b 100644 --- a/Exiled.API/Features/Warhead.cs +++ b/Exiled.API/Features/Warhead.cs @@ -122,7 +122,7 @@ public static WarheadStatus Status /// /// Gets a value indicating whether or not the warhead has already been detonated. /// - public static bool IsDetonated => Controller._alreadyDetonated; + public static bool IsDetonated => Controller.AlreadyDetonated; /// /// Gets a value indicating whether or not the warhead detonation is in progress. diff --git a/Exiled.API/Features/Window.cs b/Exiled.API/Features/Window.cs index 896de4e148..6a3718ebe7 100644 --- a/Exiled.API/Features/Window.cs +++ b/Exiled.API/Features/Window.cs @@ -86,15 +86,15 @@ internal Window(BreakableWindow window, Room room) /// /// Gets a value indicating whether or not this window is breakable. /// - public bool IsBreakable => !Base.isBroken; + public bool IsBreakable => !Base.NetworkisBroken; /// /// Gets or sets a value indicating whether or not this window is broken. /// public bool IsBroken { - get => Base.isBroken; - set => Base.isBroken = value; + get => Base.NetworkisBroken; + set => Base.NetworkisBroken = value; } /// @@ -115,15 +115,6 @@ public bool DisableScpDamage set => Base._preventScpDamage = value; } - /// - /// Gets or sets a value indicating whether or not this window is broken. - /// - public BreakableWindow.BreakableWindowStatus SyncStatus - { - get => Base.NetworksyncStatus; - set => Base.NetworksyncStatus = value; - } - /// /// Gets or sets a value indicating who is the LastAttacker. ///