Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
iomatix opened this issue Aug 23, 2024 · 8 comments
Assignees
Labels
requires-testing Things need to be verified by an Exiled Developer/Contributor

Comments

@iomatix
Copy link

iomatix commented Aug 23, 2024

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

  • Console log: https://pastebin.com/Sdmxwjb7
  • RA log: https://pastebin.com/eXHRF2Jr
  • Server log: https://pastebin.com/7JXgHv8t

Additional Context

  • Custom Modules Config: https://pastebin.com/a0tfE9pd
  • Generated Team Config -> Serpent`s Hand.yml: https://pastebin.com/dPFu2H55
  • Generated Role Config -> Serpent`s Commander.yml: https://pastebin.com/JFvvbA7e (Settings from the Config class ain't replicated here)
  • Generated Team Config -> Serpents Commander-Ptr.yml: --- (Literally this is the context of this file -> "---". It is missing stuff declared within the Config class in C#.)
  • Generated Team Config -> Serpent`s Hand-Ptr.yml: --- (Same as above)

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.

@iomatix iomatix added the requires-testing Things need to be verified by an Exiled Developer/Contributor label Aug 23, 2024
@NaoUnderscore
Copy link
Collaborator

Fixed in #2779

@NaoUnderscore NaoUnderscore self-assigned this Sep 13, 2024
@iomatix
Copy link
Author

iomatix commented Oct 3, 2024

The inventory manager and spawn locations (tested with dynamic and role) aren’t working in 9.0.0 beta-5. It seems that the RoleID (e.g., Scientist) is overriding these settings.

Currently, roles can be assigned (tested with the command crs g). However, there’s a minor issue with the team spawning command (cts s 1), as it doesn’t seem to recognize the ID correctly, even though cts i 1 worked.

Settings within the pointers are not working, seems like the settings are overridden anyway by settings spawned by default inside the main file.

I'll provide more details e.g. trace soon.

@iomatix
Copy link
Author

iomatix commented Oct 4, 2024

As I promised there is the trace:

[2024-10-04 13:09:52.399 +02:00] -
[2024-10-04 13:09:52.415 +02:00] Serpent`s Hand
[2024-10-04 13:09:52.430 +02:00] (1)
[2024-10-04 13:09:52.446 +02:00] - Is Enabled:
                                 True- Probability:
                                 100- Display Color:
                                 magenta- Size:
                                 7
[2024-10-04 13:09:55.709 +02:00] >>> cts s 1
[2024-10-04 13:09:55.739 +02:00] [ERROR] [Exiled.CustomModules] System.Collections.Generic.KeyNotFoundException: The given key '1' was not present in the dictionary.
                                   at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x0001e] in <75633565436c42f0a6426b33f0132ade>:0
                                   at Exiled.CustomModules.API.Features.CustomRoles.CustomTeam.Get (System.String name) [0x00000] in <af7a120203864ec48fb95cc3e564d0d1>:0
                                   at Exiled.CustomModules.API.Features.CustomRoles.CustomTeam.TryGet (System.String name, Exiled.CustomModules.API.Features.CustomRoles.CustomTeam& customTeam) [0x00000] in <af7a120203864ec48fb95cc3e564d0d1>:0
                                   at Exiled.CustomModules.API.Commands.CustomTeams.Spawn.Execute (System.ArraySegment`1[T] arguments, CommandSystem.ICommandSender sender, System.String& response) [0x0003a] in <af7a120203864ec48fb95cc3e564d0d1>:0
[2024-10-04 13:09:55.755 +02:00] An error occurred when executing the command, check server console for more details.```

@NaoUnderscore
Copy link
Collaborator

NaoUnderscore commented Oct 7, 2024

Will take a look right now

@NaoUnderscore
Copy link
Collaborator

Check with beta.6 👍🏼

@iomatix
Copy link
Author

iomatix commented Oct 7, 2024

[Beta-6]
Okay reviewed some things,
First of all thank you for your work on the new API!

Command cts s 1 is working correctly.
Config files seems right currently, main file and -PTR works but still there are duplicates within both of the files. e.g. can_use_elevators: true
The inventory has been assigned on respawn.

The issue I am facing now is with SpawnProperties which seems to do nothing, the custom class is spawned at the default location of e.g. scientist/scp-173 etc..
All of the settings within the RoleSettings seems to be duplicated in both original and -PTR config files.
The part of the code for config class within the RoleSettings attr:

 UniqueRole = RoleTypeId.Scientist,
 SpawnReason = RoleChangeReason.Respawn,
 SpawnFlags = RoleSpawnFlags.All,
 SpawnProperties =
 {
     Limit = 1,
     StaticSpawnPoints =
     {

     },
     DynamicSpawnPoints =
     {
         new DynamicSpawnPoint { Location = SpawnLocationType.InsideServersBottom, Chance = 100.0f },

     },
     RoleSpawnPoints =
     {
         new RoleSpawnPoint { Role = RoleTypeId.ChaosRifleman, Chance = 100.0f },
     },
 },```
Changing  SpawnFlags to exclude `UseSpawnpoint` will spawn the class in the void of darkness where the pawn will fall down and die.

@iomatix
Copy link
Author

iomatix commented Oct 7, 2024

There's image of the spawned custom class. Small next thing - It still says it's a scientist.
image

@xNexusACS
Copy link
Member

xNexusACS commented Oct 28, 2024

The spawn properties should be fixed in the mentioned PR (A.k.a beta-7)

Also make sure to set the Spawn Flags to None if you're gonna use Custom Inventories and Custom Spawn Positions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires-testing Things need to be verified by an Exiled Developer/Contributor
Projects
None yet
Development

No branches or pull requests

3 participants