Shared definition of the cw_book entity, a non-spawnable anim entity with a networked index int that holds the
index of its book item.
Summary
Methods
Draw()client
Draws the book's model.
Explode()server
Plays the effect and sound of the book being destroyed.
Draws the book's name and weight when looked at.
Initialize()server
Sets up the book's physics and gives it 25 health.
OnTakeDamage(damageInfo)server
Subtracts the damage from the book's health and destroys it at 0.
SetBook(book)server
Sets which book item the entity is, taking the item's model and skin.
SetupDataTables()shared
Sets up the networked int 0 (
index), the index of the book's item.UpdateTransmitState()server
Returns
TRANSMIT_ALWAYS, so the book is networked to every client.Methods
Draws the book's model.
Plays the effect and sound of the book being destroyed.
ENT:HUDPaintTargetID(x, y, alpha)
client gamemodes/cwhl2rp/plugins/books/plugin/entities/entities/cw_book/cl_init.lua:7Draws the book's name and weight when looked at.
Parameters
- x
- y
- alpha
ENT:Initialize()
server gamemodes/cwhl2rp/plugins/books/plugin/entities/entities/cw_book/init.lua:12Sets up the book's physics and gives it 25 health.
ENT:OnTakeDamage(damageInfo)
server gamemodes/cwhl2rp/plugins/books/plugin/entities/entities/cw_book/init.lua:48Subtracts the damage from the book's health and destroys it at 0.
Parameters
- damageInfo
ENT:SetBook(book)
server gamemodes/cwhl2rp/plugins/books/plugin/entities/entities/cw_book/init.lua:62Sets which book item the entity is, taking the item's model and skin.
Networks the item's index in the int 0 data table variable. Does nothing when no item matches.
Parameters
- book String The book item's unique ID
ENT:SetupDataTables()
shared gamemodes/cwhl2rp/plugins/books/plugin/entities/entities/cw_book/shared.lua:13Sets up the networked int 0 (index), the index of the book's item.
ENT:UpdateTransmitState()
server gamemodes/cwhl2rp/plugins/books/plugin/entities/entities/cw_book/init.lua:30Returns TRANSMIT_ALWAYS, so the book is networked to every client.
Returns
- Number
TRANSMIT_ALWAYS