This repository has been archived by the owner on Aug 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from SynapseSL/development
Development
- Loading branch information
Showing
16 changed files
with
190 additions
and
119 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 |
---|---|---|
@@ -1,55 +1,90 @@ | ||
using UnityEngine; | ||
using System.Linq; | ||
using Interactables.Interobjects.DoorUtils; | ||
using vDoor = Interactables.Interobjects.DoorUtils.DoorVariant; | ||
using Interactables.Interobjects; | ||
|
||
namespace Synapse.Api | ||
{ | ||
public class Door | ||
{ | ||
internal Door(vDoor vanilladoor) => door = vanilladoor; | ||
internal Door(vDoor vanilladoor) | ||
{ | ||
VDoor = vanilladoor; | ||
if (VDoor.TryGetComponent<DoorNametagExtension>(out var nametag)) | ||
Name = nametag.GetName; | ||
} | ||
|
||
internal vDoor door; | ||
public vDoor VDoor { get; internal set; } | ||
|
||
public GameObject GameObject => door.gameObject; | ||
public GameObject GameObject => VDoor.gameObject; | ||
|
||
public string Name => string.IsNullOrWhiteSpace(door.name) ? GameObject.name : door.name; | ||
private string name; | ||
public string Name | ||
{ | ||
get | ||
{ | ||
if (string.IsNullOrEmpty(name)) return GameObject.name; | ||
return name; | ||
} | ||
set => name = value; | ||
} | ||
|
||
public Vector3 Position => GameObject.transform.position; | ||
|
||
public DoorPermissions DoorPermissions { get => door.RequiredPermissions; set => door.RequiredPermissions = value; } | ||
public DoorPermissions DoorPermissions { get => VDoor.RequiredPermissions; set => VDoor.RequiredPermissions = value; } | ||
|
||
private Enum.DoorType doorType; | ||
public Enum.DoorType DoorType | ||
{ | ||
get | ||
{ | ||
if (door != null) | ||
return doorType; | ||
|
||
foreach(var type in (Enum.DoorType[])System.Enum.GetValues(typeof(Enum.DoorType))) | ||
foreach (var type in (Enum.DoorType[])System.Enum.GetValues(typeof(Enum.DoorType))) | ||
{ | ||
if (type.ToString().ToUpper().Contains(Name.ToUpper())) | ||
{ | ||
doorType = type; | ||
return doorType; | ||
} | ||
} | ||
|
||
//if (Name.Contains("Airlocks")) doorType = Enum.DoorType.Airlock; | ||
if (Name.Contains("EZ BreakableDoor")) doorType = Enum.DoorType.EZ_Door; | ||
else if (Name.Contains("LCZ BreakableDoor")) doorType = Enum.DoorType.LCZ_Door; | ||
else if (Name.Contains("HCZ BreakableDoor")) doorType = Enum.DoorType.HCZ_Door; | ||
else if (Name.Contains("Prison BreakableDoor")) doorType = Enum.DoorType.PrisonDoor; | ||
else if (Name.Contains("LCZ PortallessBreakableDoor")) doorType = Enum.DoorType.Airlock; | ||
else if (Name.Contains("Unsecured Pryable GateDoor")) doorType = Enum.DoorType.HCZ_049_Gate; | ||
else doorType = Enum.DoorType.Other; | ||
|
||
if (Name.Contains("Airlocks")) doorType = Enum.DoorType.Airlock; | ||
|
||
else if (Name.Contains("EntrDoor")) doorType = Enum.DoorType.EZ_Door; | ||
|
||
else if (Name.Contains("LightContainmentDoor")) doorType = Enum.DoorType.LCZ_Door; | ||
|
||
else if (Name.Contains("HeavyContainmentDoor")) doorType = Enum.DoorType.HCZ_Door; | ||
|
||
else if (Name.Contains("PrisonDoor")) doorType = Enum.DoorType.PrisonDoor; | ||
return doorType; | ||
} | ||
} | ||
|
||
//else if (Name.Contains("ContDoor")) doorType = Enum.DoorType.ContDoor; | ||
public bool IsBreakable => VDoor is BreakableDoor; | ||
|
||
else doorType = Enum.DoorType.Other; | ||
public bool IsOpen { get => VDoor.IsConsideredOpen(); } | ||
|
||
return doorType; | ||
public bool TryBreakDoor() | ||
{ | ||
if (VDoor is BreakableDoor damageableDoor) | ||
{ | ||
damageableDoor.IsDestroyed = true; | ||
return true; | ||
} | ||
else | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
public bool TryPry() | ||
{ | ||
if (VDoor is PryableDoor pry) | ||
return pry.TryPryGate(); | ||
else | ||
return false; | ||
} | ||
|
||
public override string ToString() => Name; | ||
} | ||
} |
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
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
Oops, something went wrong.