Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions EXILED/Exiled.API/Enums/PrefabType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace Exiled.API.Enums
/// <summary>
/// Type of prefab.
/// </summary>
/// <seealso cref="Features.PrefabHelper"/>
public enum PrefabType
{
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
Expand Down
18 changes: 17 additions & 1 deletion EXILED/Exiled.API/Features/PrefabHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace Exiled.API.Features

using Exiled.API.Enums;
using Exiled.API.Features.Attributes;

using MapGeneration.Distributors;
using MapGeneration.RoomConnectors;
using Mirror;
using UnityEngine;

Expand Down Expand Up @@ -57,6 +57,11 @@ public static PrefabAttribute GetPrefabAttribute(this PrefabType prefabType)
/// <returns>Returns the <see cref="GameObject"/>.</returns>
public static GameObject GetPrefab(PrefabType prefabType)
{
if (prefabType is PrefabType.HCZOneSided or PrefabType.HCZTwoSided)
{
prefabType = PrefabType.HCZBreakableDoor;
}

if (Prefabs.TryGetValue(prefabType, out (GameObject, Component) prefab))
return prefab.Item1;

Expand Down Expand Up @@ -112,6 +117,17 @@ public static GameObject Spawn(PrefabType prefabType, Vector3 position = default
positionSync.Network_rotationY = (sbyte)Mathf.RoundToInt(rotation.Value.eulerAngles.y / 5.625F);
}

if (prefabType is PrefabType.HCZOneSided or PrefabType.HCZTwoSided or PrefabType.HCZBreakableDoor)
{
newGameObject.GetComponent<WallableSmallNodeRoomConnector>().Network_syncBitmask = prefabType switch
{
PrefabType.HCZTwoSided => 0b00000000,
PrefabType.HCZOneSided => 0b00000001,
PrefabType.HCZBreakableDoor => 0b00000011,
_ => 0
};
}

NetworkServer.Spawn(newGameObject);

return newGameObject;
Expand Down
Loading