Summary

Hooks

Downloads an advert's image and stores it as a material on the advert.
Called after Catwork has loaded all of its entities; loads the map's saved adverts.
Loads the current map's adverts from the schema data into cwDynamicAdverts.storedList.
Called when a player's data stream info should be sent; sends them every advert.
Called after translucent renderables are drawn; draws every advert whose material has loaded.
Saves cwDynamicAdverts.storedList to the schema data for the current map.

Hooks

cwDynamicAdverts:CacheMaterial(data)

client gamemodes/catwork/plugins/dynamicadverts/plugin/cl_plugin.lua:45

Downloads an advert's image and stores it as a material on the advert.

The image is cached under data/catwork/schemas/<schema>/plugins/adverts/<map>/ by the CRC of its URL and reused from there when present. Only png and jpg/jpeg URLs are supported; other extensions, and adverts that already have a material, are left alone. The download is asynchronous, so data.material is set some time after the call. A response that is not a png or jpg image is not cached.

Parameters

  • data Map The advert: url is read, material (an IMaterial) is set once loaded

cwDynamicAdverts:ClockworkInitPostEntity()

server gamemodes/catwork/plugins/dynamicadverts/plugin/sv_hooks.lua:5

Implements hook ClockworkInitPostEntity

Called after Catwork has loaded all of its entities; loads the map's saved adverts.

cwDynamicAdverts:LoadDynamicAdverts()

server gamemodes/catwork/plugins/dynamicadverts/plugin/sv_plugin.lua:7

Loads the current map's adverts from the schema data into cwDynamicAdverts.storedList.

cwDynamicAdverts:PlayerSendDataStreamInfo(player)

server gamemodes/catwork/plugins/dynamicadverts/plugin/sv_hooks.lua:10

Implements hook PlayerSendDataStreamInfo

Called when a player's data stream info should be sent; sends them every advert.

Parameters

  • player Player The player receiving the data

cwDynamicAdverts:PostDrawTranslucentRenderables(bDrawingDepth, bDrawingSkybox, bDrawing3DSkybox)

client gamemodes/catwork/plugins/dynamicadverts/plugin/cl_hooks.lua:11

Called after translucent renderables are drawn; draws every advert whose material has loaded.

Skips the depth and 3D skybox passes.

Parameters

  • bDrawingDepth Boolean Whether this is the depth pass
  • bDrawingSkybox Boolean Whether the skybox is being drawn
  • bDrawing3DSkybox Boolean Whether the 3D skybox is being drawn

cwDynamicAdverts:SaveDynamicAdverts()

server gamemodes/catwork/plugins/dynamicadverts/plugin/sv_plugin.lua:12

Saves cwDynamicAdverts.storedList to the schema data for the current map.

Defined in