forked from Exiled-Official/EXILED
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added ``RoomSpawnPoint`` for spawning things in a room with a offset property. * Now Items will be spawned in the MapGenerated event instead of RoundStart avoiding the micro-log for spawning to many pickups in one frame. * YES YAMATO I USE NULLEABLE
- Loading branch information
Showing
5 changed files
with
72 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="RoomSpawnPoint.cs" company="Exiled Team"> | ||
// Copyright (c) Exiled Team. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
namespace Exiled.API.Features.Spawn | ||
{ | ||
using System; | ||
|
||
using Exiled.API.Enums; | ||
|
||
using UnityEngine; | ||
|
||
using YamlDotNet.Serialization; | ||
|
||
/// <summary> | ||
/// Represents a spawn point within a specific room in the game. | ||
/// </summary> | ||
public class RoomSpawnPoint : SpawnPoint | ||
{ | ||
/// <summary> | ||
/// Gets or sets the room type used for this spawn. | ||
/// </summary> | ||
public RoomType Room { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the offset position within the room where the spawn point is located, relative to the room's origin. | ||
/// </summary> | ||
public Vector3? Offset { get; set; } | ||
|
||
/// <inheritdoc/> | ||
public override float Chance { get; set; } | ||
|
||
/// <inheritdoc/> | ||
[YamlIgnore] | ||
public override string Name | ||
{ | ||
get => Room.ToString(); | ||
set => throw new InvalidOperationException("The name of this type of SpawnPoint cannot be changed."); | ||
} | ||
|
||
/// <inheritdoc/> | ||
[YamlIgnore] | ||
public override Vector3 Position | ||
{ | ||
get | ||
{ | ||
Room roomInstance = Features.Room.Get(Room) ?? throw new InvalidOperationException("The room instance could not be found."); | ||
|
||
return Offset.HasValue | ||
? (roomInstance.Type == RoomType.Surface ? Offset.Value : roomInstance.transform.TransformPoint(Offset.Value)) | ||
: roomInstance.Position; | ||
} | ||
set => throw new InvalidOperationException("The position of this type of SpawnPoint cannot be changed."); | ||
} | ||
} | ||
} |
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
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