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

Commit

Permalink
Role changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesus-QC committed Mar 26, 2023
1 parent 1c6fec1 commit 3a4d15d
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 6 deletions.
41 changes: 38 additions & 3 deletions CursedMod/Features/Wrappers/Player/CursedPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
using CursedMod.Features.Wrappers.Facility;
using CursedMod.Features.Wrappers.Inventory.Items;
using CursedMod.Features.Wrappers.Inventory.Pickups;
using CursedMod.Features.Wrappers.Player.Roles;
using CursedMod.Features.Wrappers.Player.Roles.SCPs;
using CursedMod.Features.Wrappers.Player.VoiceChat;
using CursedMod.Features.Wrappers.Server;
using CustomPlayerEffects;
Expand Down Expand Up @@ -290,11 +292,29 @@ public RoleTypeId Role
set => SetRole(value);
}

public PlayerRoleBase CurrentRole
public PlayerRoleBase RoleBase
{
get => RoleManager.CurrentRole;
set => RoleManager.CurrentRole = value;
}

public CursedRole CurrentRole => CursedRole.Get(RoleBase);

public CursedScp049Role CursedScp049Role => CurrentRole as CursedScp049Role;

public CursedScp079Role CursedScp079Role => CurrentRole as CursedScp079Role;

public CursedScp096Role CursedScp096Role => CurrentRole as CursedScp096Role;

public CursedScp106Role CursedScp106Role => CurrentRole as CursedScp106Role;

public CursedScp173Role CursedScp173Role => CurrentRole as CursedScp173Role;

public CursedScp939Role CursedScp939Role => CurrentRole as CursedScp939Role;

public CursedZombieRole CursedZombieRole => CurrentRole as CursedZombieRole;

public CursedHumanRole CursedHumanRole => CurrentRole as CursedHumanRole;

public bool IsInOverWatch
{
Expand Down Expand Up @@ -425,8 +445,23 @@ public ulong Permissions

// difference: this also returns true if the whitelist is disabled
public bool IsWhitelisted => WhiteList.IsWhitelisted(UserId);

public CursedVoiceChat VoiceChat => CurrentRole is FpcStandardRoleBase role ? new CursedVoiceChat(role.VoiceModule) : null;

public CursedVoiceChat VoiceChat
{
get
{
if (CurrentRole is CursedFpcRole fpcRole)
return new CursedVoiceChat(fpcRole.VoiceModule);

if (CurrentRole is CursedScp079Role scp079Role)
return new CursedVoiceChat(scp079Role.VoiceModule);

if (CurrentRole is CursedNoneRole noneRole)
return new CursedVoiceChat(noneRole.VoiceModule);

return null;
}
}

public bool IsHost => ReferenceHub == ReferenceHub.HostHub;

Expand Down
2 changes: 1 addition & 1 deletion CursedMod/Features/Wrappers/Player/Roles/CursedNoneRole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal CursedNoneRole(NoneRole roleBase)

public NoneRole NoneRoleBase { get; }

public VoiceModuleBase VoiceModuleBase
public VoiceModuleBase VoiceModule
{
get => NoneRoleBase.VoiceModule;
set => NoneRoleBase.VoiceModule = value;
Expand Down
4 changes: 2 additions & 2 deletions CursedMod/Features/Wrappers/Player/Roles/CursedRole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ internal CursedRole(PlayerRoleBase roleBase)

public PlayerRoleBase RoleBase { get; }

public RoleTypeId RoleType => RoleBase.RoleTypeId;
public RoleTypeId RoleTypeId => RoleBase.RoleTypeId;

public Team Team => RoleBase.Team;

public Color Color => RoleBase.RoleColor;
public Color RoleColor => RoleBase.RoleColor;

public string Name => RoleBase.RoleName;

Expand Down

0 comments on commit 3a4d15d

Please sign in to comment.