Summary
Methods
ShieldTouch sound.Mode) and entity 0 (Dummy, the far post).Methods
ENT:Draw()
client gamemodes/cwhl2rp/plugins/forcefields/plugin/entities/entities/cw_forcefield/cl_init.lua:35Draws the post and the shield on both sides of the field, sized to reach the far post.
ENT:DrawShield(vertex)
client gamemodes/cwhl2rp/plugins/forcefields/plugin/entities/entities/cw_forcefield/cl_init.lua:68Draws one side of the shield as a textured quad up to the far post, unless the field is off.
Based on how Chessnut draws his forcefields.
Parameters
- vertex Vector The far post's position, local to this post
ENT:EndTouch(ent)
server gamemodes/cwhl2rp/plugins/forcefields/plugin/entities/entities/cw_forcefield/init.lua:172Fades the touch sound out when a player stops touching the field.
Also when the field has been switched off in the meantime, or the sound would play on.
Parameters
- ent
ENT:Initialize()
shared gamemodes/cwhl2rp/plugins/forcefields/plugin/entities/entities/cw_forcefield/init.lua:40On the server
Sets up the post, spawns the far post at the nearest wall and builds the field's collision mesh.
Unless noCorrect is set, snaps the post to the floor first. Starts in mode 1 and switched
on unless ENT:RestoreMode set otherwise; mode 4 starts switched off. Saves the
forcefields afterwards, unless the field is one being restored from that save.
On the client
Builds the field's collision mesh between this post and the wall up to 600 units to its side.
Defined in
ENT:OnRemove()
server gamemodes/cwhl2rp/plugins/forcefields/plugin/entities/entities/cw_forcefield/init.lua:259Stops and clears the humming loop and the field's ShieldTouch sound.
Touch sounds are stored on the touching players, so the field's own ShieldTouch is
normally nil.
ENT:RestoreMode(mode, bIsOn)
server gamemodes/cwhl2rp/plugins/forcefields/plugin/entities/entities/cw_forcefield/init.lua:204Sets the field's mode and power state before it spawns, when restoring saved fields.
Parameters
- mode Number The mode, 1 to 4, as in
cwForceField.modes - bIsOn Boolean Whether the field is powered
ENT:SetupDataTables()
server gamemodes/cwhl2rp/plugins/forcefields/plugin/entities/entities/cw_forcefield/init.lua:30Sets up the networked int 0 (Mode) and entity 0 (Dummy, the far post).
ENT:SpawnFunction(player, trace)
server gamemodes/cwhl2rp/plugins/forcefields/plugin/entities/entities/cw_forcefield/init.lua:16Spawns a forcefield where the player is looking, facing along the hit surface.
Parameters
- player
- trace
Returns
- Entity The new forcefield, or
nilwhen the trace hit nothing
ENT:StartTouch(ent)
server gamemodes/cwhl2rp/plugins/forcefields/plugin/entities/entities/cw_forcefield/init.lua:139Starts the shield touch sound on a non-Combine player touching the powered field.
Parameters
- ent
ENT:Think()
server gamemodes/cwhl2rp/plugins/forcefields/plugin/entities/entities/cw_forcefield/init.lua:181Plays the shield's humming loop while it is powered and keeps the field frozen, once a second.
Returns
- Boolean
true, so the next think time is used
ENT:Touch(ent)
server gamemodes/cwhl2rp/plugins/forcefields/plugin/entities/entities/cw_forcefield/init.lua:157Keeps the touch sound's volume up while a non-Combine player touches the powered field.
Parameters
- ent
ENT:Use(act, call, type, val)
server gamemodes/cwhl2rp/plugins/forcefields/plugin/entities/entities/cw_forcefield/init.lua:213Cycles a Combine player's forcefield to the next mode, at most once a second.
Mode 4 switches the field off and lets everything through. Tells the player the new mode and saves the forcefields.
Parameters
- act
- call
- type
- val