The vendor entity (fl_vendor): an NPC merchant that stands in place, plays an idle animation and opens the trade panel for the player who uses it. Its settings are kept on the server in the vendor_data field (see the server side of the Vendors plugin) and are changed with Vendors:apply; the name and the description are networked to the clients, which draw them when the vendor is looked at. Vendors are created with Vendors:create or with the Vendor Tool rather than spawned directly.

Summary

Methods

Draw()client
Draws the model of the vendor.
Returns the description of the vendor.
Returns the name of the vendor.
Makes the vendor usable with a single press of the use key and solid.
set_vendor_data(data)server internal
Stores the settings of the vendor and applies those that show: the model, the networked name and description, and the animation.
Gives the vendor a solid, motionless bounding box that fits its current model.
Think()server
Thinks every tick, which is what keeps the animation of the vendor advancing.
Plays the idle animation of the vendor: the sequence named in its settings if its model has it, otherwise the idle activity of the model, otherwise the first sequence with 'idle' in its name.
Starts trading with the player who has used the vendor.

Methods

Draws the model of the vendor.

ENT:get_vendor_description()

shared plugins/vendors/plugin/entities/entities/fl_vendor.lua:27

Returns the description of the vendor.

Returns

  • String the description, or an empty string if the vendor has none

Returns the name of the vendor.

Returns

  • String the name, or an empty string if it has not been networked yet

Makes the vendor usable with a single press of the use key and solid. A vendor that was spawned without settings gets the default ones.

ENT:set_vendor_data(data)

server internal plugins/vendors/plugin/entities/entities/fl_vendor.lua:94

Internal

This function is internal. It is not part of the public API and may change without notice.

Use Vendors:apply to change the settings of a vendor.

Stores the settings of the vendor and applies those that show: the model, the networked name and description, and the animation. The settings are not checked here.

Parameters

  • data Map vendor settings that went through Vendors:sanitize

Gives the vendor a solid, motionless bounding box that fits its current model.

Thinks every tick, which is what keeps the animation of the vendor advancing.

Returns

  • Boolean always true, so that the next think time set here is used

Plays the idle animation of the vendor: the sequence named in its settings if its model has it, otherwise the idle activity of the model, otherwise the first sequence with 'idle' in its name.

ENT:Use(activator, _caller, _use_type, _value)

server plugins/vendors/plugin/entities/entities/fl_vendor.lua:112

Starts trading with the player who has used the vendor.

Parameters

  • activator Entity the entity that pressed the use key, normally a Player
  • _caller Entity
  • _use_type Number USE_ enumerator
  • _value Number

Defined in