Functions Reference
Godot 4 · GDScript · Players
set_invitability
Sets whether other players are allowed to send this player friend invites.
Asynchronous (result via signal)
Signature
set_invitability(is_invitable: bool) -> voidWhat it does
Sets THIS player's own is_invitable flag. The write verb is PATCH (PATCH /players/invitability, session-auth). On failure success is false and is_invitable echoes the requested value, not the persisted one. On no active session it emits invitability_changed(false, is_invitable) immediately.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| is_invitable | bool | required | true to allow others to send friend invitations to this player, false to stop receiving them. |
How to call it
Connect invitability_changed first, then call set_invitability().
Result signal: invitability_changed(success: bool, is_invitable: bool)
Example
Gamdato.invitability_changed.connect(_on_invitability_set)
Gamdato.set_invitability(false)
func _on_invitability_set(success: bool, is_invitable: bool) -> void:
if success: print("now invitable: %s" % is_invitable)
else: print("could not update invitability")Use cases
- Let the player turn friend invitations on or off in a privacy setting.
- Disable incoming invites while the player wants to be left alone.