Skip to content

Animatronic Hooks

Hooks related to general animatronic behavior: jumpscares, the Taser, voice lines.

FH_PlayerShouldJumpscare(ply, ent, target) HOOK SERVER

Called before a jumpscare.

ArgumentTypeDescription
plyPlayerThe animatronic
entEntityThe animatronic's model
targetPlayerThe victim

Return false — cancel the jumpscare.

lua
-- Prevent screaming at admins in noclip
hook.Add("FH_PlayerShouldJumpscare", "MaskProtect", function(ply, ent, target)
    if target:IsAdmin() and target:GetMoveType() == MOVETYPE_NOCLIP then
        return false
    end
end)

FH_HandleTaserHit(ply) HOOK SERVER

Called before a Taser hits a player.

Return false — cancel the Taser's effect.

lua
hook.Add("FH_HandleTaserHit", "AdminTaserImmune", function(ply)
    if ply:IsAdmin() then return false end -- Admins do not get hit by the Taser
end)

FH_AnimatronicJumpscare(ply, ent, target, data) HOOK SERVER

Called after a successful jumpscare.

data structure:

lua
{
    delay = 0.5,		-- time until target dies
    char  = "sfreddy",	-- animatronic name
    dist  = 64.2,		-- distance at jumpscare moment
    wep   = "v_freddy"	-- first-person weapon class
}
lua
hook.Add("FH_AnimatronicJumpscare", "LogScares", function(ply, ent, target, data)
    print(string.format("[FH] %s screamed at %s (dist=%.1f, char=%s)",
        ply:Nick(), target:Nick(), data.dist, data.char))
end)

FH_JumpscareEvent(ply, ent, target, dist) HOOK SERVER

Called before freezing players during a jumpscare.

ArgumentTypeDescription
plyPlayerThe animatronic
entEntityThe animatronic's model
targetEntityThe victim
distfloatDistance

FH_OverrideVoiceline(ply, anim, line) HOOK SERVER

Called before playing an animatronic's voice line. Allows overriding the line.

ArgumentTypeDescription
plyPlayerThe animatronic
animstringThe animatronic's name
linestringThe current voice line

Return a new string to override the voice line.

lua
hook.Add("FH_OverrideVoiceline", "PositiveOnly", function(ply, anim, line)
    if line:match("negative") then
		-- Animatronics no longer say negative voicelines
        return "positive"
    end
end)