Shared definition of the cw_salesman entity, a non-spawnable base_anim entity named Salesman that removes its chat bubble when it is removed.

Summary

Methods

Returns the salesman's chat bubble.
Draws the salesman's name and physical description when the SalesmanTargetID hook returns a true value.
Gives the salesman a solid bounding box and makes it usable with a single press.
Spawns a cw_chatbubble entity parented to the salesman, 90 units above it.
Removes the salesman's chat bubble on the server.
Plays an animation sequence on the salesman.
Sets the salesman's networked name and physical description, starts its animation and optionally spawns its chat bubble.
Sends one of the salesman's responses to a player as a notification and plays its sound.
Think()client
Advances the salesman's animation every frame.
Opens trade with a player who uses the salesman from within 196 units.

Methods

Returns the salesman's chat bubble.

Returns

Draws the salesman's name and physical description when the SalesmanTargetID hook returns a true value.

Parameters

  • x
  • y
  • alpha

On the server

Gives the salesman a solid bounding box and makes it usable with a single press.

On the client

Enables automatic frame advance so the salesman's animation plays.

Defined in

Spawns a cw_chatbubble entity parented to the salesman, 90 units above it.

Removes the salesman's chat bubble on the server.

Plays an animation sequence on the salesman.

Parameters

  • animation Number Sequence to play; nil or -1 plays sequence 4

ENT:SetupSalesman(name, physDesc, animation, bShowChatBubble)

server gamemodes/catwork/plugins/salesmen/plugin/entities/entities/cw_salesman/init.lua:36

Sets the salesman's networked name and physical description, starts its animation and optionally spawns its chat bubble.

Parameters

  • name String Name shown in the target ID and in the salesman's lines
  • physDesc String Physical description shown in the target ID
  • animation Number Sequence to play; nil or -1 plays sequence 4
  • bShowChatBubble Boolean Whether to spawn a chat bubble above the salesman

Sends one of the salesman's responses to a player as a notification and plays its sound.

The line is prefixed with the salesman's name unless text.bHideName is true. A response whose text is an empty string is not shown, but its sound still plays.

Parameters

  • player Player The player to talk to
  • text Map The response, with text, sound and bHideName keys; nil says the default line
  • default String Line to say when the response has no text

Advances the salesman's animation every frame.

Opens trade with a player who uses the salesman from within 196 units.

Runs the PlayerCanUseSalesman hook and then PlayerUseSalesman unless it returned false.

Parameters

  • activator
  • caller

Defined in