public sealed class PlayerGroupA party, a squad or a team: the volatile membership and everything that changes it.
Remarks
Volatile, and doc 28 says the durable copy is a grain — party and squad state outlives any one shard and drives doc 27's placement. This is the logic; keeping it is ISocialStore's, for the same reason IPityStore exists.
⚠ A non-empty group always has exactly one leader, and that is the invariant everything else is arranged around. A leaderless group cannot invite, cannot kick and cannot be disbanded — it is a group that has to be cleaned up by an operator. So leadership passes on a leader leaving or being removed, and it passes to the longest-standing remaining member rather than to whoever a dictionary enumerated first: the rule has to be one a client can predict and two servers agree on.
Fields and properties (7)
public GroupId IdIts id.
public GroupPolicy PolicyHow big it is and who may do what.
public PlayerId LeaderWho leads it, or None when it is empty.
public IReadOnlyList<GroupMember> MembersIts members, in the order they joined.
public int CountHow many are in it.
public bool IsEmptyWhether nobody is left.
public IReadOnlyList<GroupInvite> InvitesThe invites standing right now.
Events (1)
public Action<PlayerGroup>? ChangedRaised whenever the membership changes.
Methods (14)
public PlayerGroup(GroupPolicy policy, PlayerId founder, GroupId id = default(GroupId))Makes a group with one member, who leads it.
public bool Contains(PlayerId player)Whether somebody is in it.
public GroupMember? Find(PlayerId player)One member.
public GroupRefusal Invite(PlayerId from, PlayerId to, float now, SocialGraph? graph = null)Invites somebody.
public GroupRefusal Accept(PlayerId player, float now)Takes an invite up.
public bool Decline(PlayerId player)Turns an invite down, or lets a leader withdraw one.
public int Expire(float now)Forgets the invites that have run out.
public GroupRefusal Leave(PlayerId player)Leaves.
public GroupRefusal Kick(PlayerId by, PlayerId player)Throws somebody out.
public GroupRefusal Promote(PlayerId by, PlayerId player)Hands leadership over.
public GroupRefusal SetRole(PlayerId player, GameplayTag role)Sets what somebody signed up as.
public GroupRefusal MoveTo(PlayerId by, PlayerId player, int subgroup)Moves somebody to another subgroup.
public int Occupancy(int subgroup)How many are in a subgroup.
public GroupRefusal Disband(PlayerId by)Empties it.
Used by (1)
- GroupTestsVixen.Gameplay.Social.Tests