Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions EXILED/Exiled.Events/EventArgs/Map/GeneratingEventArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// -----------------------------------------------------------------------
// <copyright file="GeneratingEventArgs.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Events.EventArgs.Map
{
using Exiled.API.Enums;
using Exiled.Events.EventArgs.Interfaces;
using UnityEngine;

/// <summary>
/// Contains all information after the server generates a seed, but before the map is generated.
/// </summary>
public class GeneratingEventArgs : IDeniableEvent
{
/// <summary>
/// Initializes a new instance of the <see cref="GeneratingEventArgs"/> class.
/// </summary>
/// <param name="seed"><inheritdoc cref="Seed"/></param>
/// <param name="lcz"><inheritdoc cref="TargetLczLayout"/></param>
/// <param name="hcz"><inheritdoc cref="TargetHczLayout"/></param>
/// <param name="ez"><inheritdoc cref="TargetEzLayout"/></param>
public GeneratingEventArgs(int seed, LczFacilityLayout lcz, HczFacilityLayout hcz, EzFacilityLayout ez)
{
LczLayout = lcz;
HczLayout = hcz;
EzLayout = ez;

TargetLczLayout = LczFacilityLayout.Unknown;
TargetHczLayout = HczFacilityLayout.Unknown;
TargetEzLayout = EzFacilityLayout.Unknown;

Seed = seed;
IsAllowed = true;
}

/// <summary>
/// Gets the lcz layout generated by <see cref="Seed"/>.
/// </summary>
public LczFacilityLayout LczLayout { get; }

/// <summary>
/// Gets the hcz layout generated by <see cref="Seed"/>.
/// </summary>
public HczFacilityLayout HczLayout { get; }

/// <summary>
/// Gets the ez layout generated by <see cref="Seed"/>.
/// </summary>
public EzFacilityLayout EzLayout { get; }

/// <summary>
/// Gets or sets the lcz layout Exiled will attempt to generate a seed for.
/// </summary>
/// <remarks>The default value, <see cref="LczFacilityLayout.Unknown"/>, indicates any layout is valid.</remarks>
public LczFacilityLayout TargetLczLayout { get; set; }

/// <summary>
/// Gets or sets the hcz layout Exiled will attempt to generate a seed for.
/// </summary>
/// <remarks>The default value, <see cref="HczFacilityLayout.Unknown"/>, indicates any layout is valid.</remarks>
public HczFacilityLayout TargetHczLayout { get; set; }

/// <summary>
/// Gets or sets the ez layout Exiled will attempt to generate a seed for.
/// </summary>
/// <remarks>The default value, <see cref="EzFacilityLayout.Unknown"/>, indicates any layout is valid.</remarks>
public EzFacilityLayout TargetEzLayout { get; set; }

/// <summary>
/// Gets or sets the seed of the map.
/// </summary>
/// <remarks>This property overrides any changes in <see cref="TargetLczLayout"/>, <see cref="TargetHczLayout"/>, or <see cref="TargetEzLayout"/>.</remarks>
public int Seed { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the map can be generated.
/// </summary>
/// <remarks>This property overrides any changes in <see cref="Seed"/>.</remarks>
public bool IsAllowed { get; set; }
}
}
11 changes: 11 additions & 0 deletions EXILED/Exiled.Events/Handlers/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ public static class Map
/// </summary>
public static Event<PlacingPickupIntoPocketDimensionEventArgs> PlacingPickupIntoPocketDimension { get; set; } = new();

/// <summary>
/// Invoked after a map seed has been chosen, but before it is used.
/// </summary>
public static Event<GeneratingEventArgs> Generating { get; set; } = new();

/// <summary>
/// Called before placing a decal.
/// </summary>
Expand Down Expand Up @@ -249,5 +254,11 @@ public static class Map
/// </summary>
/// <param name="ev">The <see cref="PlacingPickupIntoPocketDimensionEventArgs"/> instnace.</param>
public static void OnPlacingPickupIntoPocketDimension(PlacingPickupIntoPocketDimensionEventArgs ev) => PlacingPickupIntoPocketDimension.InvokeSafely(ev);

/// <summary>
/// Called after a map seed has been chosen, but before it is used.
/// </summary>
/// <param name="ev">The <see cref="GeneratingEventArgs"/> instnace.</param>
public static void OnGenerating(GeneratingEventArgs ev) => Generating.InvokeSafely(ev);
}
}
Loading
Loading