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
SalesmanTargetID hook returns a true value.cw_chatbubble entity parented to the salesman, 90 units above it.Methods
ENT:GetChatBubble()
server gamemodes/catwork/plugins/salesmen/plugin/entities/entities/cw_salesman/init.lua:95Returns the salesman's chat bubble.
Returns
- Entity The
cw_chatbubbleentity, ornilif the salesman has none
ENT:HUDPaintTargetID(x, y, alpha)
client gamemodes/catwork/plugins/salesmen/plugin/entities/entities/cw_salesman/cl_init.lua:7Draws the salesman's name and physical description when the SalesmanTargetID hook returns a true value.
Parameters
- x
- y
- alpha
ENT:Initialize()
shared gamemodes/catwork/plugins/salesmen/plugin/entities/entities/cw_salesman/init.lua:13On 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
ENT:MakeChatBubble()
server gamemodes/catwork/plugins/salesmen/plugin/entities/entities/cw_salesman/init.lua:82Spawns a cw_chatbubble entity parented to the salesman, 90 units above it.
ENT:OnRemove()
shared gamemodes/catwork/plugins/salesmen/plugin/entities/entities/cw_salesman/shared.lua:12Removes the salesman's chat bubble on the server.
ENT:SetupAnimation(animation)
server gamemodes/catwork/plugins/salesmen/plugin/entities/entities/cw_salesman/init.lua:73Plays an animation sequence on the salesman.
Parameters
- animation Number Sequence to play;
nilor-1plays sequence 4
ENT:SetupSalesman(name, physDesc, animation, bShowChatBubble)
server gamemodes/catwork/plugins/salesmen/plugin/entities/entities/cw_salesman/init.lua:36Sets 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;
nilor-1plays sequence 4 - bShowChatBubble Boolean Whether to spawn a chat bubble above the salesman
ENT:TalkToPlayer(player, text, default)
server gamemodes/catwork/plugins/salesmen/plugin/entities/entities/cw_salesman/init.lua:53Sends 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,soundandbHideNamekeys;nilsays the default line - default String Line to say when the response has no
text
ENT:Think()
client gamemodes/catwork/plugins/salesmen/plugin/entities/entities/cw_salesman/cl_init.lua:28Advances the salesman's animation every frame.
ENT:Use(activator, caller)
server gamemodes/catwork/plugins/salesmen/plugin/entities/entities/cw_salesman/init.lua:102Opens 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