parent
8ab1d8d06c
commit
fdd34928e8
7 changed files with 62 additions and 7 deletions
@ -0,0 +1,11 @@ |
|||||||
|
public partial class Workshop : Area3D |
||||||
|
{ |
||||||
|
/// <summary> Returns whether this workshop is owned by the local player. </summary> |
||||||
|
public bool IsLocal => this.IsAuthority(); |
||||||
|
|
||||||
|
/// <summary> Gets the peer ID of the player owning this workshop. </summary> |
||||||
|
public int PeerId => GetMultiplayerAuthority(); |
||||||
|
|
||||||
|
/// <summary> Gets the player that owns this workshop. </summary> |
||||||
|
public Player Player => Game.Players.ByPeerId(PeerId); |
||||||
|
} |
@ -0,0 +1,15 @@ |
|||||||
|
public partial class Workshops : Node |
||||||
|
, IReadOnlyCollection<Workshop> |
||||||
|
{ |
||||||
|
public Workshop ByPeerId(int peerId) |
||||||
|
=> this.GetNodeOrThrow<Workshop>(peerId.ToString()); |
||||||
|
|
||||||
|
// IReadOnlyCollection implementation |
||||||
|
|
||||||
|
public int Count |
||||||
|
=> GetChildCount(); |
||||||
|
public IEnumerator<Workshop> GetEnumerator() |
||||||
|
=> GetChildren().Cast<Workshop>().GetEnumerator(); |
||||||
|
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() |
||||||
|
=> GetEnumerator(); |
||||||
|
} |
Loading…
Reference in new issue