Recognize gives every character a list of the characters it recognizes and the names it knows them by. A character is a stranger to everyone until they introduce themselves, under their real name or a false one, to the player they look at or to everyone within whisper, talk or yell range: from the menu on the ShowTeam key (F2 by default) or from the menu that opens when another player is used. A player sees the name they know a character by on the target ID, in in-character chat messages, on the scoreboard and in the typing bubbles; strangers are shown as a stranger or by the start of their physical description. A character can forget someone again from the menu that opens when that player is used or from the menu of their scoreboard card, and staff make characters forget with the CharForget and CharClearRecognition commands.

The recog_enabled config turns the whole system off, which makes everyone recognize everyone. recog_must_see makes introductions need a clear line of sight, and recog_forget_on_death and recog_forgotten_on_death decide what a death erases.

Player:recognizes, Player:knows_real_name and Player:get_recognize read the recognitions on both realms; Player:add_recognize, Player:remove_recognize and Player:clear_recognizes change them on the server. The PlayerRecognizeTarget hook makes a player recognize another regardless of what is stored, and PlayerCanRecognize and PlayerCanForget can refuse what players ask for.

The plugin also keeps the completion of player arguments of commands from giving names away: players without the 'staff' permission are only offered the real names of the characters they know by that name and of their own (see Recognizes.complete_player).

Summary

Hooks

Adds a recognize submenu to introduce yourself to a player by real name, a new fake name or a recent one, and to forget the player if the character of the local player has them stored.
Adds the option to forget a player to the menu of their scoreboard card, if the character of the local player has them stored.
Puts a character on the access list of a door under the name that the player who gives the access knows it by, so that the list does not give away a real name.
Returns the name the local player knows a player by, or the start of their physical description.
Hides the character card of players the local player does not recognize.
Takes the networked recognitions of a character away from the player who drops it.
Deletes the recognitions of a character that is about to be deleted, and makes every other character forget it.
Opens the recognize menu when the show team key is pressed, unless the recognition system is off.
Prevents players from recognizing themselves or, if recog_must_see is set, players they cannot see.
Erases recognitions when a character dies, as the configs ask for: the character forgets everyone (recog_forget_on_death), and everyone who knew the character by its real name forgets it (recog_forgotten_on_death).
Networks the names a character recognizes others by once it is loaded.
Replaces the name above players the local player does not recognize with a stranger label.
Moves players the local player does not recognize out of their faction into a players online category.
Shows real names in out of character messages.

Functions

Completes arguments of the 'player' type, wrapping the completer that was registered for that type before.

Methods

Checks whether a player may ask to introduce themselves or to forget someone right now: the recognition system is on, their last request is at least half a second old, and they are alive and have a character.
Turns the name a player has asked to be known by into one that can be stored: control characters become spaces, the name is trimmed and cut to Recognizes.max_name_length characters.
Removes every stored recognition from a character that is loaded, with a single query.
Makes every character forget a character: the characters of connected players, active or not, and those in the database.
Returns the name a player knows another player by, or what strangers are called if they do not recognize them.
Returns the distance at which characters hear normal speech: the talk_radius config of the RP Commands plugin, which introductions to a range of characters are measured by.
Returns what a player is called by those who do not recognize them: the start of their physical description in square brackets.
Introduces a player to the player they look at or to everyone within a range, which makes those characters know the player by the given name.
Checks whether the recognition system is on (the recog_enabled config).
Makes the character of a player forget the character of another player because the player has asked for it, and tells them so.
Removes stored recognitions from a character that is loaded.
Networks the recognitions that the active character of a player has stored to that player alone, as the private 'fl_recognizes' variable of the player.

Hooks

Recognizes:CreatePlayerInteractions(menu, target)

client plugins/recognize/plugin/cl_hooks.lua:64

Implements hook CreatePlayerInteractions

Adds a recognize submenu to introduce yourself to a player by real name, a new fake name or a recent one, and to forget the player if the character of the local player has them stored. Nothing is added while the recognition system is off.

Parameters

  • menu Panel interaction menu
  • target Player player the menu was opened for

Recognizes:CreateScoreboardPlayerMenu(menu, target, _card)

client plugins/recognize/plugin/cl_hooks.lua:123

Implements hook CreateScoreboardPlayerMenu

Adds the option to forget a player to the menu of their scoreboard card, if the character of the local player has them stored.

Parameters

  • menu Panel the DermaMenu being filled
  • target Player the player the card shows
  • _card Panel the fl_scoreboard_player card that was clicked

Recognizes:GetDoorAccessName(actor, target, _entity)

server plugins/recognize/plugin/sv_hooks.lua:71

Implements hook GetDoorAccessName

Puts a character on the access list of a door under the name that the player who gives the access knows it by, so that the list does not give away a real name. A stranger is listed by the start of their physical description.

Parameters

  • actor Player the player who gives the access
  • target Player the player whose active character receives it
  • _entity Entity the door, or the main door of its group

Returns

  • String the name to list the character under, nil while the recognition system is off

Recognizes:GetPlayerName(target)

client plugins/recognize/plugin/cl_hooks.lua:33

Implements hook GetPlayerName

Returns the name the local player knows a player by, or the start of their physical description.

Parameters

  • target Player player to get the name of

Returns

  • String displayed name

Recognizes:IsCharacterCardVisible(_card, target)

client plugins/recognize/plugin/cl_hooks.lua:53

Implements hook IsCharacterCardVisible

Hides the character card of players the local player does not recognize.

Parameters

  • _card Panel character card
  • target Player player the card belongs to

Returns

  • Boolean false if the player is not recognized, nil otherwise

Recognizes:OnActiveCharacterCleared(owner, _character)

server plugins/recognize/plugin/sv_hooks.lua:15

Implements hook OnActiveCharacterCleared

Takes the networked recognitions of a character away from the player who drops it.

Parameters

  • owner Player player the character belongs to
  • _character Character the character that is being dropped

Recognizes:OnCharacterDelete(_actor, id, character)

server plugins/recognize/plugin/sv_hooks.lua:58

Implements hook OnCharacterDelete

Deletes the recognitions of a character that is about to be deleted, and makes every other character forget it. The foreign keys of the recognizes table delete its rows with the character as well; this also takes them off the characters that are loaded.

Parameters

  • _actor Player player who deletes the character
  • id Number ID of the character
  • character Character the character that is about to be deleted

Recognizes:PlayerBindPress(_client, bind, _pressed)

client plugins/recognize/plugin/cl_hooks.lua:10

Opens the recognize menu when the show team key is pressed, unless the recognition system is off.

Parameters

  • _client Player local player
  • bind String bind that was pressed
  • _pressed Boolean whether the key was pressed or released

Recognizes:PlayerCanRecognize(actor, target)

server plugins/recognize/plugin/sv_hooks.lua:23

Implements hook PlayerCanRecognize

Prevents players from recognizing themselves or, if recog_must_see is set, players they cannot see.

Parameters

  • actor Player player introducing themselves
  • target Player player that would recognize them

Returns

  • Boolean false to prevent recognizing, nil otherwise

Recognizes:PlayerDeath(victim, _inflictor, _attacker)

server plugins/recognize/plugin/sv_hooks.lua:40

Erases recognitions when a character dies, as the configs ask for: the character forgets everyone (recog_forget_on_death), and everyone who knew the character by its real name forgets it (recog_forgotten_on_death). Nothing happens while the recognition system is off.

Parameters

  • victim Player
  • _inflictor Entity
  • _attacker Entity

Recognizes:PostCharacterLoaded(owner, _character)

server plugins/recognize/plugin/sv_hooks.lua:8

Implements hook PostCharacterLoaded

Networks the names a character recognizes others by once it is loaded.

Parameters

  • owner Player player the character belongs to
  • _character Character loaded character

Recognizes:PreDrawPlayerInfo(target, _x, _y, _distance, lines)

client plugins/recognize/plugin/cl_hooks.lua:24

Implements hook PreDrawPlayerInfo

Replaces the name above players the local player does not recognize with a stranger label.

Parameters

  • target Player player whose info is drawn
  • _x Number x position of the info
  • _y Number y position of the info
  • _distance Number distance to the player
  • lines Table info lines to draw, keyed by line ID

Recognizes:PreRebuildFactionCategories(players_table)

client plugins/recognize/plugin/cl_hooks.lua:135

Implements hook PreRebuildFactionCategories

Moves players the local player does not recognize out of their faction into a players online category.

Parameters

  • players_table Table lists of players keyed by faction category

Recognizes:ShouldProcessPlayerName(_target, message_data)

client plugins/recognize/plugin/cl_hooks.lua:43

Implements hook ShouldProcessPlayerName

Shows real names in out of character messages.

Parameters

  • _target Player player whose name is processed
  • message_data Table chat message data

Returns

  • Boolean false for non-IC messages, nil otherwise

Functions

Recognizes.complete_player(actor, partial, args, cmd)

shared plugins/recognize/plugin/sh_plugin.lua:87

Completes arguments of the 'player' type, wrapping the completer that was registered for that type before. Staff and the server console get all of its suggestions. Other players are not offered the real name of a character they do not know by that name: they get the names of their own character and of the characters they know by their real names, along with Steam names and SteamIDs; the Steam name of a character they do not know is offered whenever it contains the typed text.

Parameters

  • actor Player the player who is typing, nil for the server console
  • partial String the text typed for the argument so far
  • args List<String> the arguments typed before it
  • cmd Command the command or subcommand the argument belongs to

Returns

  • List<String> the names to suggest

Methods

Recognizes:accept_request(actor)

server plugins/recognize/plugin/sv_plugin.lua:214

Checks whether a player may ask to introduce themselves or to forget someone right now: the recognition system is on, their last request is at least half a second old, and they are alive and have a character. A player who is dead or has no character is told that they cannot do it now.

Parameters

  • actor Player

Returns

  • Boolean

Recognizes:clean_name(name)

server plugins/recognize/plugin/sv_plugin.lua:192

Turns the name a player has asked to be known by into one that can be stored: control characters become spaces, the name is trimmed and cut to Recognizes.max_name_length characters.

Parameters

  • name String

Returns

  • String the name, or nil if nothing is left of it or it is not valid UTF-8

Recognizes:clear_records(character)

server plugins/recognize/plugin/sv_plugin.lua:116

Removes every stored recognition from a character that is loaded, with a single query. The networked variable of its player is not updated: call Recognizes:sync afterwards if the character is active.

Parameters

  • character Character

Returns

  • Number how many recognitions were removed

Recognizes:forget_character(character_id, name)

server plugins/recognize/plugin/sv_plugin.lua:143

Makes every character forget a character: the characters of connected players, active or not, and those in the database.

-- Everyone who knows the character by its real name forgets it.
Recognizes:forget_character(target:get_character_id(), target:name(true))

Parameters

  • character_id Number ID of the character to forget
  • name String optional, defaults to nil only those who know the character by this name forget it

Returns

  • Number how many characters of connected players have forgotten it

Recognizes:get_known_name(viewer, target)

shared plugins/recognize/plugin/sh_plugin.lua:62

Returns the name a player knows another player by, or what strangers are called if they do not recognize them. On the client only the recognitions of the local player are meaningful.

Parameters

  • viewer Player player whose knowledge is asked about
  • target Player player to name

Returns

  • String the name, nil if the target is not a valid player

See also

Recognizes:get_talk_radius()

server plugins/recognize/plugin/sv_plugin.lua:63

Returns the distance at which characters hear normal speech: the talk_radius config of the RP Commands plugin, which introductions to a range of characters are measured by.

Returns

  • Number distance in units

Recognizes:get_unrecognized_name(target)

shared plugins/recognize/plugin/sh_plugin.lua:45

Returns what a player is called by those who do not recognize them: the start of their physical description in square brackets.

Parameters

  • target Player

Returns

  • String

Recognizes:introduce(actor, kind, name, target)

server plugins/recognize/plugin/sv_plugin.lua:247

Introduces a player to the player they look at or to everyone within a range, which makes those characters know the player by the given name. Everyone involved is notified. An introduction can be refused for each listener by the PlayerCanRecognize hook, and players who have no character loaded learn nothing.

Parameters

  • actor Player player who introduces themselves
  • kind String 'target' for a single player, or 'whisper', 'talk' or 'yell' for everyone within that range
  • name String optional, defaults to nil name to be known by, the real name of the character if it is not a string
  • target Player optional, defaults to nil player to introduce to when the kind is 'target'; the player the actor looks at if it is nil or false. A target that is no longer valid gets no introduction

Returns

  • Boolean false if the request was not valid

Recognizes:is_enabled()

shared plugins/recognize/plugin/sh_plugin.lua:37

Checks whether the recognition system is on (the recog_enabled config). While it is off everyone recognizes everyone and nobody can introduce themselves or forget anyone; the stored recognitions are kept.

Returns

  • Boolean

Recognizes:player_forget(actor, target)

server plugins/recognize/plugin/sv_plugin.lua:332

Makes the character of a player forget the character of another player because the player has asked for it, and tells them so. The PlayerCanForget hook can refuse it.

Parameters

  • actor Player player who wants to forget
  • target Player player to forget

Returns

  • Boolean whether the target was forgotten

Recognizes:remove_records(character, target_id, name)

server plugins/recognize/plugin/sv_plugin.lua:89

Removes stored recognitions from a character that is loaded. The networked variable of its player is not updated: call Recognizes:sync afterwards if the character is active.

Parameters

  • character Character
  • target_id Number optional, defaults to nil ID of the character to forget; nil forgets every character
  • name String optional, defaults to nil only forget characters that are known by this name

Returns

  • Number how many recognitions were removed

Recognizes:sync(owner)

server plugins/recognize/plugin/sv_plugin.lua:70

Networks the recognitions that the active character of a player has stored to that player alone, as the private 'fl_recognizes' variable of the player.

Parameters

  • owner Player

Defined in