Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
3 changes: 3 additions & 0 deletions EXILED/Exiled.API/Features/Spawn/RoomSpawnPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public override Vector3 Position
{
Room roomInstance = Features.Room.Get(Room) ?? throw new InvalidOperationException("The room instance could not be found.");

if (roomInstance.Type == RoomType.Surface)
return Offset != Vector3.zero ? Offset : roomInstance.Position;

return Offset != Vector3.zero ? roomInstance.transform.TransformPoint(Offset) : roomInstance.Position;
}
set => throw new InvalidOperationException("The position of this type of SpawnPoint cannot be changed.");
Expand Down
4 changes: 2 additions & 2 deletions EXILED/Exiled.CustomItems/CustomItems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public override void OnEnabled()
roundHandler = new MapHandler();
playerHandler = new PlayerHandler();

Exiled.Events.Handlers.Map.Generated += roundHandler.OnMapGenerated;
Exiled.Events.Handlers.Server.WaitingForPlayers += roundHandler.OnWaitingForPlayers;

Exiled.Events.Handlers.Player.ChangingItem += playerHandler.OnChangingItem;

Expand All @@ -50,7 +50,7 @@ public override void OnEnabled()
/// <inheritdoc />
public override void OnDisabled()
{
Exiled.Events.Handlers.Map.Generated -= roundHandler!.OnMapGenerated;
Exiled.Events.Handlers.Server.WaitingForPlayers -= roundHandler!.OnWaitingForPlayers;

Exiled.Events.Handlers.Player.ChangingItem -= playerHandler!.OnChangingItem;

Expand Down
11 changes: 4 additions & 7 deletions EXILED/Exiled.CustomItems/Events/MapHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ namespace Exiled.CustomItems.Events
/// </summary>
internal sealed class MapHandler
{
/// <inheritdoc cref="Exiled.Events.Handlers.Map.Generated"/>
public void OnMapGenerated()
/// <inheritdoc cref="Exiled.Events.Handlers.Server.WaitingForPlayers"/>
public void OnWaitingForPlayers()
{
Timing.CallDelayed(0.5f, () => // Delay its necessary for the spawnpoints of lockers and rooms to be generated.
{
foreach (CustomItem customItem in CustomItem.Registered)
customItem?.SpawnAll();
});
foreach (CustomItem customItem in CustomItem.Registered)
customItem?.SpawnAll();
}
}
}