Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Added DoorType.cs and edited CursedDoor.cs #9

Merged
merged 5 commits into from
Jan 14, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
.vs

# NuGet Packages
*.nupkg

# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*

# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
1 change: 1 addition & 0 deletions CursedMod/CursedMod.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
<Compile Include="EntryPoint.cs" />
<Compile Include="Events\Handlers\MapGenerationEventHandler.cs" />
<Compile Include="Features\Enums\AuthenticationType.cs" />
<Compile Include="Features\Enums\DoorType.cs" />
<Compile Include="Features\Wrappers\AdminToys\CursedAdminToy.cs" />
<Compile Include="Features\Wrappers\AdminToys\CursedLightSource.cs" />
<Compile Include="Features\Wrappers\AdminToys\CursedPrimitiveObject.cs" />
Expand Down
8 changes: 8 additions & 0 deletions CursedMod/Features/Enums/DoorType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace CursedMod.Features.Enums;

public enum DoorType
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this, FacilityZone exists

{
LCZ,
HCZ,
EZ
}
26 changes: 25 additions & 1 deletion CursedMod/Features/Wrappers/Facility/Rooms/CursedDoor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
using Interactables.Interobjects;
using CursedMod.Features.Enums;
using Interactables.Interobjects;
using Interactables.Interobjects.DoorUtils;
using MapGeneration;
using Mirror;
using System.Linq;
using UnityEngine;
using Object = UnityEngine.Object;

namespace CursedMod.Features.Wrappers.Facility.Rooms;

Expand Down Expand Up @@ -84,5 +89,24 @@ public bool DestroyDoor(DoorDamageType type = DoorDamageType.ServerCommand)
return false;
}

public static CursedDoor Create(DoorType doorType, Vector3 Position, Vector3 Rotation, Vector3 Scale, bool spawn = false)
{
DoorSpawnpoint prefab = Object.FindObjectsOfType<DoorSpawnpoint>().First(x => x.TargetPrefab.name.Contains(doorType.ToString()));

var door = Object.Instantiate(prefab.TargetPrefab, Position, Quaternion.Euler(Rotation));

door.transform.localScale = Scale;

if (spawn) NetworkServer.Spawn(door.gameObject);

return new CursedDoor(door);
}

public GameObject Spawn()
{
NetworkServer.Spawn(GameObject);
return GameObject;
}

public override string ToString() => $"{nameof(CursedDoor)}: Opened: {IsOpened} | Position: {Position} | Rotation: {Rotation} | Scale: {Scale} | Permissions: {RequiredPermissions} | DoorId: {DoorId}";
}