Emplacement Gun entity
Entity defined in plugin/entities/entities/cw_emplacementgun
Part of Emplacement Gun
Summary
Methods
Methods
ENT:Abandon()
server gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/init.lua:320Releases the gun's controller, or the player it is starting up for, and retracts the gun.
Tells the player's client with ZAR3_S to restore their controls, stops shooting and
centres the barrel.
ENT:AimBarrelAt(parentTarget)
server gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/init.lua:537Returns the barrel angles that aim the offset barrel at a local position.
A port of CFuncTank::AimBarrelAt from the Source SDK, with the barrel offset taken from
a map file.
Parameters
- parentTarget Vector The target, local to the gun
Returns
- Angle The local barrel angles
ENT:AimBarrelAtPlayerCrosshair()
server gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/init.lua:520Returns the barrel angles that aim at the controller's crosshair.
A port of CFuncTank::AimBarrelAtPlayerCrosshair from the Source SDK.
Returns
- Angle The local barrel angles
ENT:CalcPlayerCrosshairTarget()
server gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/init.lua:481Returns the position the controller's crosshair points at, up to 8192 units away.
A port of CFuncTank::CalcPlayerCrosshairTarget from the Source SDK.
Returns
- Vector The hit position
ENT:CanTool(ply, tr, mode)
shared gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/shared.lua:28Allows only the remover, colour, material and no-collide tools on the gun.
Parameters
- ply
- tr
- mode
Returns
- Boolean Whether the tool may be used
ENT:CreateFlashlight()
server gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/init.lua:402Creates the gun's spotlight, switched off, if it does not exist.
Searches for the spotlight's cone entity afterwards so it can be removed with the gun.
ENT:DisableFlashlight()
server gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/init.lua:436Turns the gun's spotlight off and removes its projected texture.
ENT:Draw()
client gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/cl_init.lua:98Draws the gun's model.
ENT:EnableFlashlight()
server gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/init.lua:349Turns the gun's spotlight on, creating it and its projected texture if needed.
ENT:Initialize()
server gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/init.lua:130Sets the bunker gun model and shadow physics, centres the barrel and starts the motion controller.
ENT:OnRemove()
server gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/init.lua:708Removes the gun's spotlight and cone and releases its controller.
ENT:PhysicsSimulate()
server gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/init.lua:672Turns the barrel towards the controller's view, a few degrees per tick.
The pose parameters are set here because the Source func_tank does the same in its
physics simulation. Yaw is limited to 60 degrees each way and pitch to -35 to 50.
Returns
- Number
SIM_NOTHING
ENT:RotateTankToAngles(angles)
server gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/init.lua:601Sets the gun's stored angular velocity towards the given angles, within its turn range.
A port of CFuncTank::RotateTankToAngles from the Source SDK. Unused.
Parameters
- angles Angle The angles to turn to
Returns
- Boolean Whether the angles were clamped to the gun's range
ENT:SpawnFunction(ply, tr)
server gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/init.lua:80Spawns a gun on the barricade the player is looking at, or on a new frozen barricade.
Refuses, with a chat message, when the barricade already has a gun.
Parameters
- ply Player The player spawning the gun
- tr Map The player's eye trace;
tr.Entityis replaced by a new barricade if needed
Returns
- Entity The new barricade when one was created, otherwise the gun;
nilon failure
ENT:SpawnProp()
server gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/init.lua:57Spawns a frozen Combine barricade under the gun and parents the gun to it.
Removing the barricade removes the gun. Used when restoring saved guns.
ENT:TakeOver(ply)
server gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/init.lua:230Makes a player the gun's controller.
Plays the activate sequence, turns the player's flashlight off and tells their client with
the ZAR3_S net message to hide the view model and send attacks to the gun. The player
becomes the controller once the sequence ends, and is the gun's PendingController until
then. Does nothing when the gun is in use or starting up, or the player already controls a gun.
Parameters
- ply Player The player taking over
ENT:Think()
server gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/init.lua:171Fires the gun while its controller holds attack and releases it when they die, fall over, walk away or leave.
Shoots an AR2 tracer bullet for 26 damage every 0.05 seconds, credited to the controller. Thinks every frame.
Returns
- Boolean
true, so the next think time is used
ENT:TrackTarget()
server gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/init.lua:451Turns the stored barrel angles up to 5 degrees towards the controller's crosshair.
A port of CFuncTank::TrackTarget from the Source SDK. Unused: its call in ENT:Think
is commented out because the crosshair aiming does not work.
ENT:Use(activator, caller)
server gamemodes/cwhl2rp/plugins/emplacementgun/plugin/entities/entities/cw_emplacementgun/init.lua:287Lets a Combine player take over the gun, or leave it when they already control it.
Non-Combine players are told the gun will not move.
Parameters
- activator
- caller