Goal Description
I suggest changing the Player::SetRole method to return the resulting PlayerRoleBase instead of void.
Currently:
public void SetRole(RoleTypeId newRole, RoleChangeReason reason = RoleChangeReason.RemoteAdmin, RoleSpawnFlags flags = RoleSpawnFlags.All)
{
ReferenceHub.roleManager.ServerSetRole(newRole, reason, flags);
}
ev.Player.SetRole(RoleTypeId.Tutorial);
PlayerRoleBase roleBase = ev.Player.RoleBase;
It could be changed to:
public PlayerRoleBase SetRole(RoleTypeId newRole, RoleChangeReason reason = RoleChangeReason.RemoteAdmin, RoleSpawnFlags flags = RoleSpawnFlags.All)
{
PlayerRoleManager manager = ReferenceHub.roleManager.ServerSetRole(newRole, reason, flags);
return manager._curRole;
}
This would allow developers to immediately access the role that was assigned by SetRole, without having to retrieve it separately afterward.
Alternatively, SetRole could return the PlayerRoleManager itself if that is considered more useful for the API.
Notes
No response
Goal Description
I suggest changing the
Player::SetRolemethod to return the resultingPlayerRoleBaseinstead ofvoid.Currently:
It could be changed to:
This would allow developers to immediately access the role that was assigned by
SetRole, without having to retrieve it separately afterward.Alternatively,
SetRolecould return thePlayerRoleManageritself if that is considered more useful for the API.Notes
No response