Skip to content

Commit

Permalink
First wave code changes for 14.0 👀
Browse files Browse the repository at this point in the history
  • Loading branch information
xNexusACS committed Dec 3, 2024
1 parent bf45b62 commit 6049d94
Show file tree
Hide file tree
Showing 28 changed files with 298 additions and 252 deletions.
5 changes: 5 additions & 0 deletions Exiled.API/Enums/AdminToyType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,10 @@ public enum AdminToyType
/// ShootingTarget toy.
/// </summary>
ShootingTarget,

/// <summary>
/// Speaker toy.
/// </summary>
Speaker,
}
}
14 changes: 9 additions & 5 deletions Exiled.API/Enums/DoorType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

namespace Exiled.API.Enums
{
using Exiled.API.Features.Doors;

using static Interactables.Interobjects.ElevatorManager;
using Features.Doors;
using Interactables.Interobjects;

/// <summary>
/// Unique identifier for the different types of doors.
Expand Down Expand Up @@ -269,9 +268,14 @@ public enum DoorType
ElevatorGateB,

/// <summary>
/// Represents the Elevator door for <see cref="ElevatorGroup.Nuke"/>.
/// Represents the Elevator door for <see cref="ElevatorGroup.Nuke01"/>.
/// </summary>
ElevatorNuke1,

/// <summary>
/// Represents the Elevator door for <see cref="ElevatorGroup.Nuke02"/>.
/// </summary>
ElevatorNuke,
ElevatorNuke2,

/// <summary>
/// Represents the Elevator door for <see cref="ElevatorGroup.Scp049"/>.
Expand Down
22 changes: 21 additions & 1 deletion Exiled.API/Enums/EffectType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Exiled.API.Enums
{
using System;

using Exiled.API.Extensions;
using Extensions;

/// <summary>
/// Status effects as enum.
Expand Down Expand Up @@ -239,5 +239,25 @@ public enum EffectType
/// <see cref="CustomPlayerEffects.Slowness"/>.
/// </summary>
Slowness,

/// <summary>
/// <see cref="CustomPlayerEffects.Scp1344"/>.
/// </summary>
Scp1344,

/// <summary>
/// <see cref="CustomPlayerEffects.SeveredEyes"/>.
/// </summary>
SeveredEyes,

/// <summary>
/// <see cref="CustomPlayerEffects.PitDeath"/>.
/// </summary>
PitDeath,

/// <summary>
/// <see cref="CustomPlayerEffects.Blurred"/>.
/// </summary>
Blurred,
}
}
9 changes: 7 additions & 2 deletions Exiled.API/Enums/ElevatorType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ public enum ElevatorType : byte
GateB,

/// <summary>
/// Heavy Containment Zone Nuke elevator.
/// Heavy Containment Zone Nuke 1 elevator.
/// </summary>
Nuke,
Nuke1,

/// <summary>
/// Heavy Containment Zone Nuke 2 elevator.
/// </summary>
Nuke2,

/// <summary>
/// Heavy Containment Zone SCP-049 elevator.
Expand Down
2 changes: 1 addition & 1 deletion Exiled.API/Extensions/DoorTypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public static bool IsGate(this DoorType door) => door is DoorType.GateA or DoorT
/// <param name="door">The door to be checked.</param>
/// <returns>Returns whether the <see cref="DoorType"/> is an elevator or not.</returns>
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;
}
}
10 changes: 7 additions & 3 deletions Exiled.API/Extensions/EffectTypeExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) },
Expand Down Expand Up @@ -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) },
});

/// <summary>
Expand Down Expand Up @@ -147,7 +151,7 @@ or EffectType.Corroding or EffectType.Decontaminating or EffectType.Hemorrhage o
/// <param name="effect">The <see cref="EffectType"/>.</param>
/// <returns>Whether or not the effect heals.</returns>
/// <seealso cref="IsHarmful(EffectType)"/>
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);

/// <summary>
/// Returns whether or not the provided <paramref name="effect"/> is a negative effect.
Expand Down
7 changes: 4 additions & 3 deletions Exiled.API/Extensions/ItemExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -125,10 +125,11 @@ public static T GetItemBase<T>(this ItemType type)
/// </summary>
/// <param name="type">The <see cref="FirearmType">weapon</see> that you want to get maximum of.</param>
/// <returns>Returns the maximum.</returns>
public static byte GetMaxAmmo(this FirearmType type)
public static int GetMaxAmmo(this FirearmType type)
{
InventorySystem.Items.Firearms.Firearm firearm = GetItemBase<InventorySystem.Items.Firearms.Firearm>(type.GetItemType());
return firearm is null ? (byte)0 : firearm.AmmoManagerModule.MaxAmmo;
IAmmoContainerModule ammoModule = firearm.Modules.OfType<IAmmoContainerModule>().FirstOrDefault();
return ammoModule?.AmmoMax ?? 0;
}

/// <summary>
Expand Down
11 changes: 0 additions & 11 deletions Exiled.API/Extensions/MirrorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
/// A set of extensions for <see cref="Mirror"/> Networking.
Expand Down
6 changes: 3 additions & 3 deletions Exiled.API/Features/DamageHandlers/CustomDamageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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 });
}

/// <summary>
Expand Down
12 changes: 7 additions & 5 deletions Exiled.API/Features/DamageHandlers/GenericDamageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Scp096Role>();
Expand Down Expand Up @@ -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 };
}
}
}
5 changes: 2 additions & 3 deletions Exiled.API/Features/Doors/Door.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
23 changes: 13 additions & 10 deletions Exiled.API/Features/Doors/ElevatorDoor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
/// Represents an elevator door.
Expand All @@ -28,6 +29,7 @@ internal ElevatorDoor(Interactables.Interobjects.ElevatorDoor door, List<Room> r
{
Base = door;
Lift = Lift.Get(x => x.Group == Group).FirstOrDefault();
Panel = Object.FindObjectsOfType<ElevatorPanel>().FirstOrDefault(x => x._door == door);
}

/// <summary>
Expand All @@ -36,28 +38,29 @@ internal ElevatorDoor(Interactables.Interobjects.ElevatorDoor door, List<Room> r
public new Interactables.Interobjects.ElevatorDoor Base { get; }

/// <summary>
/// Gets the <see cref="ElevatorManager.ElevatorGroup"/> that this door's <see cref="Lift"/> belongs to.
/// Gets the <see cref="ElevatorGroup"/> that this door's <see cref="Lift"/> belongs to.
/// </summary>
public ElevatorManager.ElevatorGroup Group => Base.Group;
public ElevatorGroup Group => Base.Group;

/// <summary>
/// Gets the type according to <see cref="Group"/>.
/// </summary>
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,
};

/// <summary>
/// Gets the target panel for this lift.
/// </summary>
public ElevatorPanel Panel => Base.TargetPanel;
public ElevatorPanel Panel { get; }

/// <summary>
/// Gets the <see cref="Lift"/> associated with this elevator door.
Expand Down
Loading

0 comments on commit 6049d94

Please sign in to comment.