Exiled-Team / EXILED

A high-level plugin framework for SCP: Secret Laboratory servers. It offers an event system for developers to hook in order to manipulate or change game code, or implement their own functions.
https://www.exiled.to/
Other
273 stars 180 forks source link

[BUG] Issues with Inventory Assignment, Spawn Flags, and Configuration in Exiled API 9.0-beta-2 #2777

Open iomatix opened 3 weeks ago

iomatix commented 3 weeks ago

Exiled 9.0.0 Beta 2

EXILED Version ("latest" is not a version): 9.0-beta-2

Repo

My repo with the code base:

Results of pluginmanager show command in console:

[2024-08-23 14:17:00.557 +02:00] >>> pluginmanager show
[2024-08-23 14:17:00.588 +02:00] Total number of plugins: 9
                                 Enabled plugins: 9
                                 Disabled plugins: 0

                                 Exiled.Events:
                                        - Author: Exiled Team
                                        - Version: 9.0.0.0
                                        - Required Exiled Version: 9.0.0.0
                                        - Prefix: exiled_events
                                        - Priority: Highest
                                 DoorRestartSystem:
                                        - Author: GameKuchen & iomatix
                                        - Version: 6.3.1
                                        - Required Exiled Version: 9.0.0
                                        - Prefix: DRS
                                        - Priority: Medium
                                 Exiled.CreditTags:
                                        - Author: Babyboucher20 & iRebbok & Exiled Team
                                        - Version: 9.0.0.0
                                        - Required Exiled Version: 9.0.0.0
                                        - Prefix: exiled_credits
                                        - Priority: Medium
                                 SCP-575:
                                        - Author: Joker119 & iomatix
                                        - Version: 6.2.3
                                        - Required Exiled Version: 9.0.0
                                        - Prefix: SCP575
                                        - Priority: Medium
                                 BetterOmegaWarhead:
                                        - Author: ClaudioPanConQueso & iomatix
                                        - Version: 6.3.3
                                        - Required Exiled Version: 9.0.0
                                        - Prefix: BetterOmegaWarhead
                                        - Priority: Medium
                                 SerpentHand:
                                        - Author: iomatix
                                        - Version: 0.1.0
                                        - Required Exiled Version: 9.0.0
                                        - Prefix: SerpentHand
                                        - Priority: Medium
                                 BetterSinkholes:
                                        - Author: Yamato & Gamers-Workshop & iomatix
                                        - Version: 6.0.0
                                        - Required Exiled Version: 9.0.0
                                        - Prefix: BetterSinkholes
                                        - Priority: Medium
                                 Exiled.Permissions:
                                        - Author: Exiled Team
                                        - Version: 9.0.0.0
                                        - Required Exiled Version: 9.0.0.0
                                        - Prefix: exiled_permissions
                                        - Priority: Medium
                                 Exiled.CustomModules:
                                        - Author: Exiled Team
                                        - Version: 9.0.0.0
                                        - Required Exiled Version: 9.0.0.0
                                        - Prefix: exiled_custom_modules
                                        - Priority: Lowest

Logs

Additional Context

The Description

While testing the Exiled API 9.0-beta-2 with a custom setup, I encountered several issues

1. Inventory Not Assigned on Spawn:

The inventory specified in the InventoryManager configuration is not being assigned upon player spawn. Below is the configuration used:

public InventoryManager Inventory { get; set; } = new InventoryManager(
    new List<ItemType> {
        ItemType.ArmorCombat,
        ItemType.GunCOM18,
        ItemType.GunFRMG0,
        ItemType.SCP500,
        ItemType.Adrenaline,
        ItemType.KeycardChaosInsurgency,
    },
    new List<object> { },
    new Dictionary<AmmoType, ushort> {
        { AmmoType.Nato556, 164 },
        { AmmoType.Nato9, 48 },
    },
    new Dictionary<uint, ushort> { }
);

Despite this configuration, the custom role does not receive the specified inventory items upon spawning. Furthermore, when forcing the role (replacing the scientist via config so the scientist always spawns as a custom class at the round start), the inventory does not appear, and spawn flags are not triggered. With the current configuration, the spawn does not even occur.

2. Spawn Flags and Properties Not Working

The following spawn flags and properties are not functioning as expected:

SpawnReason = RoleChangeReason.RemoteAdmin,
SpawnFlags = RoleSpawnFlags.All,
SpawnProperties =
{
    StaticSpawnPoints = { },
    DynamicSpawnPoints =
    {
        new DynamicSpawnPoint { Location = SpawnLocationType.InsideServersBottom, Chance = 1.0f },
    },
    RoleSpawnPoints =
    {
        new RoleSpawnPoint { Role = RoleTypeId.ChaosRifleman, Chance = 1.0f },
    },
}

In testing, a custom scientist class was assigned a broadcast "You've spawned as " as intended, but it did not receive the custom equipment and spawned at the default location instead of the specified spawn points.

3. Configuration Issues with Separate Files

When moving the configuration to a separate file using the following pattern, the assigned values in the config file are not recognized:

/// <inheritdoc />
[ModuleIdentifier]
public class SerpentHandRoleCommanderConfig : ModulePointer<CustomRole>
{
    /// <inheritdoc />
    public override uint Id { get; set; } = CustomRoleTypes.SerpentHandCommander;
}

4. Severe Lag and Server Instability with Multiple Players

When testing custom spawns with another player, the server experienced significant lag spikes after the second player joined. The server mostly stopped functioning correctly, with only the Nuke controls via Remote Admin working (for reasons unknown). Other commands, such as teleportation, map control, and noclip, did not work. Eventually, the server stopped sending heartbeat signals altogether. I couldn't reproduce this currently but I'll try and add paste bins to this thread later on.

Guides I've used

I followed the implementation guide closely, as outlined in this article, but these issues persist. Any insights or fixes would be greatly appreciated. I also tried doing things more like in the custom role guide but received similar results.

NaoUnderscore commented 4 days ago

Fixed in #2779