SLASHER
Description
Table structure used for SlashCo.RegisterSlasher.
Every playable Slasher (lua/slashco/slasher/*.lua) defines a local SLASHER table with these fields and callbacks and registers it at the end of the file.
Besides the fields below, a Slasher may define any number of additional fields and functions of its own (e.g. SidRage, ThirstyRage) - those are purely internal to that Slasher and are only ever read by its own file through Player:SlasherValue/Player:SlasherFunction, never by the generic framework.
Parameters
The Slasher's display name. Used as the default registration name in SlashCo.RegisterSlasher, shown in the lobby/picker UI, and used as a fallback for a Document's Name.
The Slasher's SlashCo.SlasherClass. Used to filter the slasher picker/lobby restrictions and by SlashCo.GetRandomSlasher.
The Slasher's DangerLevel. Used to filter the slasher picker/lobby restrictions, by SlashCo.GetRandomSlasher, and to pick the danger announcement sound played when the round starts.
Whether this Slasher can be picked normally - by the slasher picker UI and by SlashCo.GetRandomSlasher. Set to false for internal/legacy entries that should never be spawned directly (e.g. Leuonard, which is additionally hardcoded to be excluded from GetRandomSlasher).
Default: false
Path to the player model used while playing as this Slasher. Read by the player_slasher_base player class when setting the model, and precached automatically by SlashCo.PrecacheSlasher.
Default: models/Humans/Group01/male_07.mdl
A list of alternate name strings for the Slasher (e.g. nicknames used in-universe). Used as a fallback for a Document's %%ELEMENT12%% field when the document doesn't define its own, translated through the language key Alias
Default: {}
Language key for a short gameplay tip. Shown as the round's Slasher hint (SlashCo.LobbyData.SelectedSlasherInfo.TIP) when the Slasher is chosen automatically on the Easy difficulty.
A star-rating string (e.g. "★★☆☆☆") shown in the slasher picker's description to indicate the Slasher's relative speed.
Only required if SLASHER.IsSelectable is true - the picker concatenates this value directly into the description text, so a selectable Slasher without it will error when hovered.
A star-rating string (e.g. "★★★☆☆") shown in the slasher picker's description to indicate the Slasher's relative eyesight/vision. Same requirement as SLASHER.SpeedRating.
A star-rating string shown in the slasher picker's description to indicate the Slasher's relative difficulty to play. Same requirement as SLASHER.SpeedRating.
How many gas cans should be added or removed for the round because this Slasher is in play. Allowed to be negative. Summed across every spawned Slasher when calculating the round's gas can count, and copied onto SlashCo.CurRound.Slashers[steamID64].GasCanMod when the Slasher is selected.
Default: 0
Summed (with a fallback of 0) across every spawned Slasher alongside SLASHER.GasCanMod; if the combined total is 0 or greater, it overrides the round's computed gas can count entirely instead of just modifying it.
Default: 0
The ID of an ITEM that should always be spawned at an extra location for every round this Slasher is in (e.g. Sid spawns "Cookie", Thirsty spawns "MilkJug"). Left unset, no extra forced item is spawned.
How many seconds into an Escape round this Slasher should spawn after, overriding the difficulty-based delay. -1 means no override. If multiple Slashers are in the round, the smallest override wins.
Default: -1
Run/walk speed used while not chasing (outside of InSlasherChaseMode).
Default: 150
Run/walk speed used while actively chasing a Survivor. Has no framework fallback, so every Slasher must set this.
Multiplied by 100 to get the field of view distance used by the per-tick chase-detection scan (Player:FindPlayersInView) and used to scale the Slasher's fog thickness (SlashCo.AddFog). Has no framework fallback, so every Slasher must set this.
This is a separate mechanism from the networked, client-visible "eyesight" value returned by Player:GetEyeSight (which drives the slasher-vision screen brightness effect). By convention every Slasher pushes this field's value into that networked value itself, usually via slasher:SetEyeSight(SLASHER.Eyesight) inside its own SLASHER.OnSpawn/SLASHER.OnTickBehaviour - the generic framework does not copy it there automatically.
Not read by the generic framework directly. By convention every Slasher uses this field as the initial/base value it pushes into the networked Player:GetPerception value itself (usually via slasher:SetPerception(SLASHER.Perception) inside its own SLASHER.OnSpawn/SLASHER.OnTickBehaviour), which in turn is read generically by the framework (e.g. survivor footstep notice range, sc_beerkeg/sc_activecrazyburger stun duration).
Distance (in units) within which a Survivor can be spotted and put into chase. Two different fallbacks are used depending on which internal check reads it.
Default: 600 (chase-detection tick) / 1000 (SlashCo.StartChaseMode)
Cosine of the cone angle used for the Slasher's field-of-view checks (ents.FindInCone) both for spotting and for maintaining a chase.
Default: 0.91
How many seconds a Survivor can be out of sight before the chase ends. Also used to compute the hard failsafe timer for SlashCo.StartChaseMode (ChaseDuration * 10 + 45 seconds).
Default: 10
How many seconds must pass after a chase ends before another one can start.
Default: 3
Sound path played (looping) while this Slasher is chasing. Precached automatically by SlashCo.PrecacheSlasher if set. Has no framework fallback when actually played, so every Slasher must set this.
Maximum distance to a Survivor for SlashCo.Jumpscare to be allowed to trigger (ignored while the target is already being jumpscared).
Default: 135
Sound path played when this Slasher jumpscares a Survivor. Precached automatically by SlashCo.PrecacheSlasher if set. Has no framework fallback when emitted, so every Slasher must set this.
Seconds after a kill before this Slasher is allowed to jumpscare again.
Default: 3
How many seconds the jumpscare freeze/animation lasts before the Survivor actually dies.
Default: 1.5
Anger gained automatically every second regardless of what the Slasher is doing, added on top of whatever SLASHER.OnAngerTick does.
Default: 0
If true for any Slasher in the round, the automatic ambient/anger background music system is skipped entirely, letting the Slasher(s) manage their own background music.
Default: false
Sound path used as the round's background music while this Slasher's anger is above 75.
Sound path used as the round's background music while this Slasher's anger is above 50 (and not above 75).
Sound path used as the round's background music while this Slasher's anger is above 25 (and not above 50).
Forces how many seconds after both generators are activated the escape helicopter arrives. -1 means no override (a randomized default based on difficulty is used instead). If multiple Slashers are in the round, the smallest override wins.
Default: -1
If true for any Slasher in the round, the special helicopter-arrival music is not played.
Default: false
If true, spectators cannot spectate this Slasher (it's excluded from SlashCo.GetSpectatableSet, from spectator right-click targeting, and clientside SLASHER.CanBeSeen always returns false for spectators looking at it).
Default: false
Called with (totalSurvivors, additionalSurvivors) - note that unlike the other callbacks this is called directly on the table (no slasher argument) - whenever the survivor count for the round is known: once when the Slasher spawns, and once for every already-spawned Slasher of this type whenever SlashCo.RegisterSlasher runs again (e.g. on a Lua refresh). Typically used to scale balance fields such as SLASHER.ProwlSpeed based on player count.
Called with no arguments by SlashCo.PrecacheSlasher when a round selects this Slasher, in addition to the automatic precaching of SLASHER.Model, SLASHER.ChaseMusic and SLASHER.KillSound. Use it to precache any extra models/sounds/materials this Slasher needs.
Called with no extra arguments right after this Slasher's player entity spawns, once run/walk speed and anger have been initialized.
Called with no extra arguments every server tick (as long as at least one generator exists), after the generic chase/spotting logic has run for this Slasher.
Called with (target) right before SlashCo.Jumpscare would jumpscare target. Returning a truthy value cancels the jumpscare.
Called with (target) once a jumpscare kill finishes and this Slasher has unfrozen again.
Called with no extra arguments once per second, alongside the automatic SLASHER.AngerPassiveGain gain.
Called with (victim) on every registered Slasher whenever any player dies (hook SlashCo:PlayerDeath), not just this Slasher's own kills.
Called with (beerkeg) on every registered Slasher whenever any sc_beerkeg explodes.
Called with (thrower) when this Slasher is blinded by a PocketSand item thrown by thrower.
Called with no extra arguments when this Slasher gets caught in an active Tesla Coil's final stun burst.
Called with no extra arguments when this Slasher is in range of an exploding beer keg, alongside the automatic SlasherStunDeafen call.
Called with no extra arguments on every registered Slasher once both generators are activated and the escape helicopter is summoned.
Called with (itemCount) (the round's updated SlashCo.CurRound.ItemCount) on every spawned Slasher after regular round items have been spawned, after SLASHER.ItemToSpawn (if set) has been placed.
Called with (ent) whenever this Slasher tries to pick up ent with the use key. Returning a non-nil value overrides whether the pickup is allowed; Slashers cannot pick anything up by default.
Called with (target, trace) (lag-compensated eye trace result) when this Slasher left-clicks.
Called with (target, trace) when this Slasher presses their main ability key.
Called with (target, trace) when this Slasher presses their special ability key.
Called with (velocity) from the CalcMainActivity hook while this Slasher is playing. Return an activity to override the calculated main animation activity.
Called with no extra arguments from the PlayerFootstep hook while this Slasher is playing.
Called with (mv) (the CMoveData) from the Move hook while this Slasher is playing.
Called with (mv) (the CMoveData) from the FinishMove hook while this Slasher is playing.
Called with no extra arguments from Player:CanBeSeen while this Slasher's player entity is being checked. Returning a non-nil value overrides the default Player:GetVisible result.
Called with no extra arguments from Player:CanSeeFlashlights for this Slasher. Returning a non-nil value overrides the default result.
Called with (target) for every Survivor that Player:FindPlayersInView otherwise considers visible to this Slasher. Returning exactly 0 removes that Survivor from the result.
Called with no extra arguments every Think while the local player is this Slasher, alongside the slasher-vision dynamic light/particle effects.
Called with no extra arguments from the PreDrawHalos hook while the local player is this Slasher, after generator/clone halos have been drawn. Use it to add extra halo.Add highlights.
Called with no extra arguments every frame (CalcView) while the local player is this Slasher. Return a truthy value to build a custom third-person camera view this frame; otherwise the default first-person view is used.
Called with no extra arguments before the random ambient sound system considers playing a sound near this Slasher. Must return a truthy value for the sound to play - Slashers that don't define this callback never get random ambient sounds.
Called with (hudPanel) (the slashco_slasher_stockhud panel) whenever the local player's Slasher HUD is (re)created. Use it together with Player:SlasherHudFunc to set up this Slasher's HUD controls/meters.
Called with (hudPanel) (the same panel passed to SLASHER.InitHud) every frame from the SlashCo:DrawHUD hook while the local player is playing as this Slasher. Use it to draw this Slasher's HUD.