-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes and more examples of custom modules (#2783)
- Loading branch information
Showing
20 changed files
with
516 additions
and
3 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
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,22 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="CustomEscapeScenarioType.cs" company="Exiled Team"> | ||
// Copyright (c) Exiled Team. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Exiled.Example.TestEscape | ||
{ | ||
using Exiled.CustomModules.API.Enums; | ||
|
||
/// <summary> | ||
/// The custom escape scenario type. | ||
/// </summary> | ||
public class CustomEscapeScenarioType : UUEscapeScenarioType | ||
{ | ||
/// <summary> | ||
/// Initializes a new custom escape scenario id. | ||
/// </summary> | ||
public static readonly CustomEscapeScenarioType CustomScenario = new(); | ||
} | ||
} |
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,22 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="CustomEscapeType.cs" company="Exiled Team"> | ||
// Copyright (c) Exiled Team. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Exiled.Example.TestEscape | ||
{ | ||
using Exiled.CustomModules.API.Enums; | ||
|
||
/// <summary> | ||
/// The custom escape type. | ||
/// </summary> | ||
public class CustomEscapeType : UUCustomEscapeType | ||
{ | ||
/// <summary> | ||
/// Initializes a new custom escape id. | ||
/// </summary> | ||
public static readonly CustomEscapeType TestEscape = new(); | ||
} | ||
} |
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,42 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="TestEscape.cs" company="Exiled Team"> | ||
// Copyright (c) Exiled Team. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Exiled.Example.TestEscape | ||
{ | ||
using System.Collections.Generic; | ||
|
||
using Exiled.API.Features; | ||
using Exiled.CustomModules.API.Features.Attributes; | ||
using Exiled.CustomModules.API.Features.CustomEscapes; | ||
using PlayerRoles; | ||
|
||
/// <inheritdoc /> | ||
[ModuleIdentifier] | ||
public class TestEscape : CustomEscape<TestEscapeBehaviour> | ||
{ | ||
/// <inheritdoc /> | ||
public override uint Id { get; set; } = CustomEscapeType.TestEscape; | ||
|
||
/// <inheritdoc /> | ||
public override string Name { get; set; } = "Test Escape"; | ||
|
||
/// <inheritdoc /> | ||
public override bool IsEnabled { get; set; } = true; | ||
|
||
/// <inheritdoc /> | ||
public override Dictionary<byte, Hint> Scenarios { get; set; } = new() | ||
{ | ||
[1] = new Hint("Test Scenario"), | ||
}; | ||
|
||
/// <inheritdoc /> | ||
public override List<EscapeSettings> Settings { get; set; } = new() | ||
{ | ||
new EscapeSettings(true, RoleTypeId.FacilityGuard), | ||
}; | ||
} | ||
} |
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,32 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="TestEscapeBehaviour.cs" company="Exiled Team"> | ||
// Copyright (c) Exiled Team. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Exiled.Example.TestEscape | ||
{ | ||
using Exiled.API.Features; | ||
using Exiled.CustomModules.API.Enums; | ||
using Exiled.CustomModules.API.Features.CustomEscapes; | ||
using Exiled.CustomModules.Events.EventArgs.CustomEscapes; | ||
|
||
/// <inheritdoc /> | ||
public class TestEscapeBehaviour : EscapeBehaviour | ||
{ | ||
/// <inheritdoc /> | ||
protected override UUEscapeScenarioType CalculateEscapeScenario() | ||
{ | ||
return CustomEscapeScenarioType.CustomScenario; | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void OnEscaping(EscapingEventArgs ev) | ||
{ | ||
base.OnEscaping(ev); | ||
|
||
Log.ErrorWithContext($"Player {ev.Player.Nickname} is escaping"); | ||
} | ||
} | ||
} |
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,26 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="TestEscapeConfig.cs" company="Exiled Team"> | ||
// Copyright (c) Exiled Team. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Exiled.Example.TestEscape | ||
{ | ||
using Exiled.CustomModules.API.Features.Attributes; | ||
using Exiled.CustomModules.API.Features.CustomEscapes; | ||
using Exiled.CustomModules.API.Features.Generic; | ||
|
||
/// <inheritdoc /> | ||
[ModuleIdentifier] | ||
public class TestEscapeConfig : ModulePointer<CustomEscape> | ||
{ | ||
/// <inheritdoc /> | ||
public override uint Id { get; set; } = CustomEscapeType.TestEscape; | ||
|
||
/// <summary> | ||
/// Gets or sets a integer value. | ||
/// </summary> | ||
public int Value { get; set; } = 10; | ||
} | ||
} |
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,22 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="CustomGamemodeType.cs" company="Exiled Team"> | ||
// Copyright (c) Exiled Team. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Exiled.Example.TestGamemode | ||
{ | ||
using Exiled.CustomModules.API.Enums; | ||
|
||
/// <summary> | ||
/// The custom gamemode type. | ||
/// </summary> | ||
public class CustomGamemodeType : UUGameModeType | ||
{ | ||
/// <summary> | ||
/// Initializes a new custom gamemode id. | ||
/// </summary> | ||
public static readonly CustomGamemodeType TestGamemode = new(); | ||
} | ||
} |
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,48 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="TestGamemode.cs" company="Exiled Team"> | ||
// Copyright (c) Exiled Team. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Exiled.Example.TestGamemode | ||
{ | ||
using System; | ||
|
||
using Exiled.CustomModules.API.Features.Attributes; | ||
using Exiled.CustomModules.API.Features.CustomGameModes; | ||
using PlayerRoles; | ||
|
||
/// <inheritdoc /> | ||
[ModuleIdentifier] | ||
public class TestGamemode : CustomGameMode | ||
{ | ||
/// <inheritdoc /> | ||
public override uint Id { get; set; } = CustomGamemodeType.TestGamemode; | ||
|
||
/// <inheritdoc /> | ||
public override string Name { get; set; } = "Test Gamemode"; | ||
|
||
/// <inheritdoc /> | ||
public override bool IsEnabled { get; set; } = true; | ||
|
||
/// <inheritdoc /> | ||
public override Type[] BehaviourComponents { get; } = { typeof(TestGamemodeGameState), typeof(TestGamemodePlayerState) }; | ||
|
||
/// <inheritdoc /> | ||
public override GameModeSettings Settings { get; set; } = new() | ||
{ | ||
Automatic = false, | ||
MinimumPlayers = 1, | ||
MaximumPlayers = 5, | ||
RejectExceedingPlayers = false, | ||
IsRespawnEnabled = false, | ||
IsTeamRespawnEnabled = false, | ||
RestartRoundOnEnd = true, | ||
IsDecontaminationEnabled = false, | ||
IsWarheadEnabled = false, | ||
IsWarheadInteractable = false, | ||
SpawnableRoles = new[] { RoleTypeId.ClassD, RoleTypeId.Scientist }, | ||
}; | ||
} | ||
} |
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,26 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="TestGamemodeConfig.cs" company="Exiled Team"> | ||
// Copyright (c) Exiled Team. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Exiled.Example.TestGamemode | ||
{ | ||
using Exiled.CustomModules.API.Features.Attributes; | ||
using Exiled.CustomModules.API.Features.CustomGameModes; | ||
using Exiled.CustomModules.API.Features.Generic; | ||
|
||
/// <inheritdoc /> | ||
[ModuleIdentifier] | ||
public class TestGamemodeConfig : ModulePointer<CustomGameMode> | ||
{ | ||
/// <inheritdoc /> | ||
public override uint Id { get; set; } = CustomGamemodeType.TestGamemode; | ||
|
||
/// <summary> | ||
/// Gets or sets a integer value. | ||
/// </summary> | ||
public int Value { get; set; } = 10; | ||
} | ||
} |
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,36 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="TestGamemodeGameState.cs" company="Exiled Team"> | ||
// Copyright (c) Exiled Team. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Exiled.Example.TestGamemode | ||
{ | ||
using Exiled.API.Features; | ||
using Exiled.CustomModules.API.Features.CustomGameModes; | ||
|
||
/// <inheritdoc /> | ||
public class TestGamemodeGameState : GameState | ||
{ | ||
/// <inheritdoc /> | ||
public override void Start(bool isForced = false) | ||
{ | ||
Map.Broadcast(5, "Test Gamemode Started"); | ||
base.Start(isForced); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override void End(bool isForced = false) | ||
{ | ||
Map.Broadcast(5, "Test Gamemode Ended"); | ||
base.End(isForced); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override bool EvaluateEndingConditions() | ||
{ | ||
return false; | ||
} | ||
} | ||
} |
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,16 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="TestGamemodePlayerState.cs" company="Exiled Team"> | ||
// Copyright (c) Exiled Team. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Exiled.Example.TestGamemode | ||
{ | ||
using Exiled.CustomModules.API.Features.CustomGameModes; | ||
|
||
/// <inheritdoc /> | ||
public class TestGamemodePlayerState : PlayerState | ||
{ | ||
} | ||
} |
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
Oops, something went wrong.