ff_miniturret is the powerful ceiling-mounted gun that protects spawn rooms. Their behavior can be customized through lua. However, basic team-oriented turrets can be defined by placing the turret entity and naming it appropriately.
The code for this functionality is located in includes/base_respawnturret.lua. Insert this line into your lua file:
Turrets are typically embedded into a ceiling, with just the bottom cap sticking out. Unlike TFC's turrets, they cannot be floor-mounted.
Respawn turrets will target players, sentries, and dispensers. Use this to define what is a valid target. Returning true makes the turret shoot at the entity in question. Within the scope of this callback, the keyword entity refers to the turret.
-- Note: IsTeam1AlliedToTeam2 will return true if team1 is allied to team2 or -- if team1 is the same as team2 function base_respawnturret:validtarget( target_entity ) --local entity = GetEntity(ent_id) return (AreTeamsAllied(self.team, target_entity:GetTeamId()) == false) end
When a turret finds a valid target, it deploys after a two second delay. Use this callback to change this response time. Within the scope of this callback, the keyword entity refers to the turret.
-- Turrets, by default, have a 2 second delay after they -- spot a target and before they're deployed (opened) function base_respawnturret:deploydelay( target_entity ) return 2.0 end