SlashCo Wiki

SlashCo

SlashCo

The main library containing almost everything related to the gamemode.

Methods

SlashCo.Abort( string reason )
Aborts the current round due to a technical issue.
Notifies all players, logs the reason with a stack trace, and schedules a return to the lobby.
If the round has already been aborted, additional calls do not create another round-over timer.
SlashCo.AddDangerLevel( DangerLevel dangerLevel, number id = nil )
Registers or overrides a dangerlevel.
SlashCo.AddFog( FogInfo info )
Adds or updates a fog entry in the global fog data and networks the change to all clients.
If an identical fog entry already exists, no update is sent.
SlashCo.AddLateSurvivor( Player ply )
Adds a player to the current round's list of survivors if they are not already present.
SlashCo.AddOffering( OFFERING offering )
Registers or overrides a offering
SlashCo.AddSlasherAnger( Player slasher, number anger )
Adds to the given slasher's anger value, clamped between 0 and 100.
This is intentionally server-only to avoid desync.
SlashCo.AddSlasherClass( SlasherClass slasherClass, number id = nil )
Registers or overrides a slasher class.
SlashCo.AllowSpectatorsToPing( boolean allowed )
Sets whether spectators are allowed to place pings.
Read back using SlashCo.CanSpectatorsPing.
Applies the slasher previously assigned to the player via SlashCo.SelectSlasher, by setting their Slasher networked string.
Does nothing if no slasher was assigned to the player for the current round.
table SlashCo.AssembleWeightedTable( table<Entity> elements, function conditions = SlashCo.DefaultConditions )
Assembles a weighted table for use by the spawning functions.
Each element that passes the supplied conditions is added using its Weight value,
or a default weight of 10 when no weight is specified.
SlashCo.AssignSlasher( string steamid, string forceSlasherID )
Forces a player to become a Slasher for the upcoming round while in the lobby.
Accepts a plain SteamID or a SteamID64. If picking has already finished, the player is immediately asked to pick their Slasher.
This is used internally - although you're able to use it you probably shouldn't.
Checks whether every player expected for the current round (loaded via SlashCo.LoadCurRoundData) is connected.
Once all expected players are present it either starts a new Slasher selection or starts the round, depending on whether a Slasher still needs to be picked.
Does nothing while in the lobby, while less than 2 players are expected, or once SlashCo.CurRound.AntiLoopSpawn is set.
boolean SlashCo.BanSlasher( string name )
Tries to ban the given Slasher
SlashCo.Blur( Panel panel )
Draws a full screen blur effect using the pp/blurscreen material.
Intended to be called from within a panel's Paint function; when a panel is given, the blur is offset to counteract that panel's local coordinate system.
SlashCo.BroadcastAnnouncement( string text, number time = nil, Player or Table target = nil )
Broadcasts an announcement
SlashCo.BroadcastCurrentRoundData( boolean readyGame )
The function may be changed in the future to solve it's inefficient networking Broadcasts the current Round Survivors, Slashers and offerings to everyone.
Additionally broadcasts the SlasherData... which is just the same as above?
SlashCo.BroadcastGlobalData( Player ply )
This is used internally - although you're able to use it you probably shouldn't.
Networks the SCInfo table to the given player, or to everyone if no player is specified.
SlashCo.BroadcastOfferingVote( Player offeror, number offerID )
This is used internally - although you're able to use it you probably shouldn't.
Networks that offeror has proposed the Offering identified by offerID to everyone, so clients can display the ongoing vote.
SlashCo.BustDoor( Player slasher, Entity target, number or Vector force, function callback, any noRecursive )
Opens and then breaks every door entity sharing target's name within 100 units, replacing them with physical sc_broken_door props that get pushed away by force.
The callback is invoked with false if target is invalid, if no matching door was found, or if slasher became invalid while the doors were breaking.
SlashCo.BuyPerk( string perkID )
Requests that the server purchase a perk for the local player.
Does nothing if the player already owns the perk.
The server validates the perk, its price, and the player's level before purchasing it.
Can only be processed while in the lobby.
boolean SlashCo.CanEatPizza( Player ply )
Checks if the player is a Survivor with the "Healthy" perk active.
boolean, string, table SlashCo.CanEquipPerk( Player ply, string checkPerkID )
Checks whether a player is allowed to equip a perk.
The perk must exist, the player must meet its level requirement, and the player must own it.
The perk must also not conflict with any currently active perk.
Returns a failure reason and, for conflicts, the conflicting perk definition.
boolean SlashCo.CanSeePing( number plyTeam, number pingTeam )
Returns whether a player on plyTeam is allowed to see a ping placed by a player on pingTeam.
Spectators can see every ping. Survivors can additionally see pings made by spectators. Otherwise a ping is only visible to players on the same team.
This is shared between client and server to avoid mismatches caused by either side seeing a different team setup.
Returns the value set by SlashCo.AllowSpectatorsToPing.
SlashCo.ChangeMap( string mapName )
Changes the current map.
This function does nothing while g_SlashCoDebug is enabled.
SlashCo.ChangeSurvivorItem( Player ply, string slot, string id, boolean noSound )
Equips the given item into the specified slot (forced to the secondary slot if the item is marked as secondary), calling its ITEM.OnPickUp callback and the previous item's ITEM.OnSwitchFrom callback.
Plays an equip sound unless noSound is true. Passing "none" as id clears the slot instead.
SlashCo.ChatText( any ... )
Prints a translated message to the local chat, following the rules of chat.AddText.
String values are passed through SlashCo.Language before being printed. To pass a translation key that needs formatting arguments, use a table: {key, ...}.
SlashCo.ClearDatabase()
This is used internally - although you're able to use it you probably shouldn't.
Clears the SlashCo database tables used for survivor data, slasher data, and potential slasher data
This function does nothing when executed on the client
Color SlashCo.CopyColor( Color color )
Returns a copy of the given Color allowing you to safely modify it.
Entity SlashCo.CreateDocument( Vector pos, Angle ang )
Spawns a document at the specified position and angle.
Returns nil if the document entity could not be created.
This is used internally - although you're able to use it you probably shouldn't.
Creates the slashco_documents SQLite table used to persist players' collected documents, if it doesn't already exist.
Notifies all connected players in chat when the table has to be created. Called automatically on startup.
Entity SlashCo.CreateGasCan( Vector pos, Angle ang )
Spawns a gas can at the specified position and angle.
Returns nil if the gas can entity could not be created.
Entity SlashCo.CreateHelicopter( Vector pos, Angle ang )
Spawns the helicopter at the specified position and angle.
Returns nil if the helicopter entity could not be created.
Entity SlashCo.CreateItem( string class, Vector pos, Angle ang, Entity owner )
Spawns an item or other entity at the specified position and angle.
If an owner is supplied and is valid, the created entity is assigned to that owner.
Returns nil if the entity could not be created.
number SlashCo.CreateItemStash( Vector pos, Angle ang )
Spawns an item stash at the specified position and angle.
number SlashCo.CreateOfferTable( Vector pos, Angle ang )
Spawns the offering table at the specified position and angle.
number SlashCo.CreateRadio( Vector pos, Angle ang )
Spawns a radio at the specified position and angle.
number or Vector or Angle SlashCo.Dampen( number speed, number or Vector or Angle from, number or Vector or Angle to )
Framerate-independent smoothing helper.
Interpolates from from towards to, moving faster the higher speed is. Meant to be called every frame/think with the previous result passed back in as from.
SlashCo.DangerLevel()
A table containing all defined DangerLevel
Use SlashCo.AddDangerLevel to register a new dangerlevel
You should never modify it directly!
SlashCo.DebugPrint( string msg, any ... )
Prints msg to the server console, prefixed with [SlashCo - Debug].
Unlike some other debug helpers in the codebase, this always prints and is not gated behind any ConVar or debug flag.
Default set of conditions for weighted spawn tables.
An entity passes if it is valid, is not disabled, and does not already have a spawned entity.
Default spawn condition for forced spawn entities.
Requires the entity to pass SlashCo.DefaultConditions
and have its Forced property enabled.
Default spawn condition for non-forced spawn entities.
Requires the entity to pass SlashCo.DefaultConditions
and not have its Forced property enabled.
Reverses SlashCo.EnableAlarmLights: turns off all registered alarm cagelights, turns the non-alarm lights back on, disables every player's dynamic flashlight, and sets GameData.IsBlackout back to false.
Disables the Global Fog
SlashCo.DisablePerk( string perkID )
Requests that the server disable an active perk for the local player.
Does nothing if the player does not currently have the perk active.
Can only be processed while in the lobby.
Disables all env_soundscape entities on the map.
SlashCo.DrawHalo( table<Entity> ents, string or Color color, number passes = 1, boolean noZ = true )
Draws halos around the specified entities.
This function may only be called while SlashCo halo drawing is active.
Invalid, invisible, or dormant entities are removed from the entity list before the halos are drawn.
SlashCo.DropAllItems( Player ply, boolean noEffect )
Drops both of a survivor's item slots by calling SlashCo.DropItem twice.
Clears all of the player's active effects first unless noEffect is true.
SlashCo.DropItem( Player ply, function dropCallback, string ignoreField )
Drops the survivor's currently held item (the secondary slot takes priority unless it's empty or flagged via ignoreField) as a physical entity in the world.
Runs the item's ITEM.PreDrop/ITEM.PreDropSecondary, ITEM.OnDrop, ITEM.OnSwitchFrom and ITEM.ItemDropped callbacks along the way; dropping can be cancelled by ITEM.PreDrop/ITEM.PreDropSecondary.
Does nothing in the lobby, for non-survivors, or while the player is frozen.
SlashCo.EnableAlarmLights( boolean noEffect )
Triggers a map-wide blackout: turns on all registered alarm cagelights (and their linked light entities), and turns off any lights configured via GameData.NonAlarmLightsName.
Unless noEffect is true, also fades every player's screen to black and plays a blackout sound. Sets GameData.IsBlackout to true.
SlashCo.EnableGlobalFog()
Enables the Global Fog
SlashCo.EnablePerk( string perkID )
Requests that the server enable a perk for the local player.
The player must own the perk and satisfy all requirements checked by SlashCo.CanEquipPerk
Can only be processed while in the lobby.
Enables all env_soundscape entities on the map.
SlashCo.EndOfferingVote( Player ply )
This is used internally - although you're able to use it you probably shouldn't.
Networks that the given player has given his choice for the ongoing vote
SlashCo.EndRound()
This is used internally - although you're able to use it you probably shouldn't.
Ends the current round, shows the round-over screen to all players, awards round points and win statistics, and calls the SlashCo:EndRound hook.
After a short delay it removes the round entities, resets the round data and moves the server back to the lobby via SlashCo.GoToLobby.
Does nothing if g_SlashCoDebug is set or if the round has already been ended.
boolean SlashCo.EntityExists( number entIndex )
This is used internally - although you're able to use it you probably shouldn't.

The code related to this function is unfinished!

Checks whether the specified entity index is marked as existing in the client-side SlashCo entity tracking table.

Plays an escape voice prompt from one or more survivors
When multiple survivors are present, survivors sufficiently separated from each other may each play a voice prompt
number, number, number SlashCo.ExperienceToLevel( number experience )
Converts a total experience amount into a level.
Each level requires SlashCo.LevelPowMultiplier times more experience than the previous one, starting at SlashCo.FirstLevelBase.
Sets every optional objective that hasn't been completed yet to SlashCo.ObjStatus.FAILED and marks optional objectives as no longer completable for the round.
SlashCo.FillTableWithFogInfo( table infoTbl, Player ply )
Populates a table with the complete fog information applicable to a player.
The table is initialized with the global fog color and default values before player, team, or global fog settings are applied.
Scaled world color values are calculated after the applicable fog settings are merged.
string, table SlashCo.FindItemWithField( string key, any value )
Finds the first registered item whose given field matches a value.
string, string SlashCo.FindMapWorkshopID( string mapName, boolean allowUnmounted )
Shortcut for SlashCo.FindWorkshopID that looks up a map's .bsp file under maps/.
table SlashCo.FindPlayersInRange( Vector origin, number radius, number specificTeam = nil, Entity or table ignoreEntity = nil )
Finds all players in a given radius and checks if their visible from the origin by doing a trace.
This is used internally - although you're able to use it you probably shouldn't.
Rebuilds the list of registered SlashCo workshop addons by scanning every mounted addon for a lua/slashco folder, as well as legacy addons placed in the local addons/ folder.
Also detects the main gamemode's own workshop ID and mount state. Runs the SlashCo:RegisterAddons hook at the end, so other addons can register themselves manually via SlashCo.RegisterAddon.
Called automatically on load and whenever SlashCo.GameContentChanged runs.
string, string SlashCo.FindSlasherWorkshopID( string slasherFile )
Shortcut for SlashCo.FindWorkshopID that looks up a slasher's lua file under lua/.
Entity SlashCo.FindSpawn( Player ply )
Finds a suitable spawn point for a player based on their team.
Survivors and spectators use survivor spawn entities, slashers use slasher spawn entities, and players in the lobby use info_player_start entities.
If all spawn points are occupied, the oldest previously used spawn point is selected.
string, string SlashCo.FindWorkshopID( string fileName, boolean allowUnmounted )
Searches through every addon returned by engine.GetAddons for one that contains the given file.
SlashCo.FlashWindows( Player or table<Player> ply = nil )
Flashes the game window to notify the user that something has happened in-game.
This is used internally - although you're able to use it you probably shouldn't.
Forces a new Slasher to be picked for the current round, used once the SlashCo.SetupExpectedPlayersFailsafe timer runs out because not everyone connected in time.
If a Slasher is already stored in the database the round is force-started instead, otherwise the connected players are asked whether they want to become the Slasher.
Aborts the round if fewer than 2 players are connected.
This is used internally - although you're able to use it you probably shouldn't.
Re-scans workshop addons via SlashCo.FindSlashCoAddons and then runs the SlashCo:GameContentChanged hook.
Called automatically whenever GM:GameContentChanged runs.
SlashCo.GasCansPerGenerator( number amount )
Sets how many gas cans are needed to fully fuel a single generator. Due to a bug, this actually writes to the same networked value as SlashCo.SetGasCansToSpawn instead of the one read by SlashCo.GetGasCansPerGenerator, so calling it has no effect on SlashCo.GetGasCansPerGenerator's return value.
table SlashCo.GetActivePerks( Player ply )
Returns all active perks equipped by a player.
Active perks are identified by a ! prefix in the player's owned perk string.
table SlashCo.GetAddons( )
Returns the table of currently registered SlashCo workshop addons.
Keys are the addon's workshop ID (or a negative placeholder ID for legacy addons found in the local addons/ folder), values are the addon's title.
table SlashCo.GetBannedSlashers( boolean onlyReversed = nil )
Returns a table containing all banned slashers
Color SlashCo.GetClassColor( number class )
Returns the color used to display a slasher class in UI.
Returns the "unknown" color if class is SlashCo.SlasherClass.Unknown, otherwise the regular "known" color.
Returns the duration a consumable's effect should last for the given player, based on their active perks.
Doubles the duration if the "Glutton" perk is active.
number, table SlashCo.GetCurrentFogMultiplier( Player ply, table infoTbl = nil )
Returns the highest-priority fog multiplier currently applicable to a player.
Spectators use the fog settings of the player they are spectating.
If a spectator is not spectating a valid player, a multiplier of 100 is returned.
When infoTbl is provided, applicable fog information is merged into it while searching.
Color SlashCo.GetDangerColor( number or string danger )
Returns the color associated with a SlashCo.DangerLevel, used to display it in UI.
string SlashCo.GetDangerSound( number or string danger )
Returns the sound path associated with a SlashCo.DangerLevel, played on the round end screen.
Returns the default BUTTON_CODE for the given keyboard bind, as defined in SlashCo.KeyboardBinds, ignoring any bindings the player has changed.
Returns the local player's stored rating for the given document, or 0 if it hasn't been collected.
Returns a registered document by its name.
Effect SlashCo.GetEffectTable( string name )
Returns a registered effect by its name.
Returns the healing multiplier that food items should apply for the given player, based on their active perks.
The "Healthy" perk adds 0.5, the "Glutton" perk subtracts 0.5, and the result is never lower than 0.
Returns how many gas cans are needed to fully fuel a single generator. Nothing in the codebase currently sets the value read by this function, so it always returns the default (4) unless another addon networks it manually.
Returns the value set by SlashCo.SetGasCansToSpawn.
A negative value (the default) means no override is set, and SlashCo.SpawnGasCans instead calculates the amount automatically from SlashCo.GetGeneratorsToSpawn and SlashCo.GetGasCansPerGenerator.
Returns the value set by SlashCo.SetGeneratorsNeeded.
Returns the value set by SlashCo.SetGeneratorsToSpawn.
Returns the color set by SlashCo.SetGlobalFogColor. Passing a Vector as object does not work correctly due to a bug - the color is always written into object.r/g/b fields as if object were a Color.
Returns the average anger value across all players on the slasher team.
Returns the highest anger value out of all players on the slasher team.
string SlashCo.GetItemByEntity( string class )
Finds the name of a registered item by its entity class.
Item SlashCo.GetItemTable( string name )
Returns a registered item by its name.
number SlashCo.GetKeyButton( string name )
Looks up the given Bind and returns the BUTTON_CODE
Gets the currently bound button for the bind and translates it using input.GetKeyName and makes the result uppercase.
Useful for UI when wanting to display the key for an action.
Returns the SlashCo.ReadyState of the given player
number SlashCo.GetMapSize( )
Returns the current map's size multiplier, set by SlashCo.SetMapSize based on the map's world bounds.
Used to scale distances such as slasher spawn/range checks depending on how big the map is.
Color SlashCo.GetNameColor( string name )
Returns the color used to display a slasher's name in UI.
Returns the "unknown" color if name is "Unknown", otherwise the regular "known" color.
table SlashCo.GetOwnedPerks( Player ply )
Returns all perks owned by a player.
Active perks are included and have their leading ! removed from the returned IDs.
Perk SlashCo.GetPerk( string perkID )
Returns a registered perk by its ID.
table SlashCo.GetPerks( )
Returns all registered perks.
Only entries containing an ID field are included in the returned sequential table.
Returns the current value of the slashco_playerpingdelay convar.
string SlashCo.GetRandomSlasher( number dangerlevel, number slasherClass )
Returns a random registered slasher name, optionally restricted by danger level and/or slasher class.
Slashers that aren't selectable, and Leuonard, are never picked.
Returns the time the round started at using CurTime
number SlashCo.GetRoundTime( )
Returns how many seconds have passed since the round started, based on SlashCo.GetRoundStartTime.
number SlashCo.GetSlasherAnger( Player slasher )
Returns the current anger value of the given slasher.
Returns the registered SLASHER table for the given slasher name.
Returns the registered SLASHER table for the given slasher ID.
Returns all players and dead bodies that can currently be spectated.
Survivors and dead bodies are always included.
Slashers are included only if their CannotBeSpectated slasher value is not enabled.
number SlashCo.GetWeightedRandom( table table )
Returns a random number within the total weight of a weighted table.
SlashCo.GoToLobby()
This is used internally - although you're able to use it you probably shouldn't.
Changes the current map to the configured SlashCo lobby map
boolean SlashCo.HasDocument( string name )
Returns whether the local player has collected the given document.
This is used internally - although you're able to use it you probably shouldn't.
Sets the helicopter's target position to its spawn position
This is used internally - although you're able to use it you probably shouldn't.
Moves the helicopter toward a position above the selected helicopter landing area
SlashCo.HelicopterLand( Vector pos )
This is used internally - although you're able to use it you probably shouldn't.
Sets the helicopter's target position to the specified landing position and begins the landing sequence
On Hard difficulty, the helicopter may eventually abandon the survivors after a random delay
This is used internally - although you're able to use it you probably shouldn't.
Makes the helicopter leave for the intro sequence
The helicopter is quieted and removed once it reaches its spawn position
This is used internally - although you're able to use it you probably shouldn't.
Plays a random helicopter voiceline from the given type
This is used internally - although you're able to use it you probably shouldn't.
Makes the helicopter take off
This is used internally - although you're able to use it you probably shouldn't.
Makes the helicopter take off during the intro sequence and subsequently leave for the intro
SlashCo.InitMapMesh()
This is used internally - although you're able to use it you probably shouldn't.
Determines map size
This function is responsible for setting SlashCo.MaxVec, SlashCo.MinVec, SlashCo.MapSizeExact & SlashCo.MapSize
boolean SlashCo.IsActivePerk( Player ply, string perkID )
Checks whether a player has a perk currently equipped.
Active perks are stored with a ! prefix.
boolean SlashCo.IsDoorOpen( Entity ent )
Returns whether the door is open or not
Returns whether the global fog was disabled using SlashCo.DisableGlobalFog.
See the Fog system for what disabling it does.
boolean SlashCo.IsKeyPressed( string name, Player ply, BUTTON_CODE button )
Looks up the current BUTTON_CODE for the given bind and compares it against the given button
Returns true if the given player started the current offering
Returns whether the lobby was marked as starting using SlashCo.MarkLobbyStarting.
While true, spectators are bound to the helicopter's camera and suicide is disallowed.
boolean SlashCo.IsPositionLegalForSlashers( Vector pos, boolean noSurvivorCheck, number distFactor = 1 )
Returns whether a position is far enough away from all survivors to be considered a legal spot for a slasher to use, for example when picking a teleport or ability position.
The required distance scales with SlashCo.GetMapSize.
Returns whether the survivors would currently count as having made a quick escape, i.e. the round time (see SlashCo.GetRoundTime) hasn't reached SlashCo.QuickEscapeTime (600 seconds by default) yet.
Checks if the given Slasher is banned
Returns whether the survivors would currently count as having made a slow escape, i.e. the round time (see SlashCo.GetRoundTime) has exceeded SlashCo.SlowEscapeTime (1200 seconds by default).
boolean SlashCo.IsValidDoor( Entity ent )
Checks whether the given entity is a valid SlashCo door, i.e. it is valid and its class is prop_door_rotating or func_door_rotating (see SlashCo.ValidDoors).
boolean SlashCo.ItemPickUp( Player ply, number itemindex, string item )
Attempts to let a survivor pick up the item entity with the given itemindex.
Fails silently if the target slot is occupied, the player recently dropped an item, a slot switch is already in progress, the SlashCoItemPickUp hook blocks it, the entity is flagged DONTPICKUP, or an item ITEM.PrePickUp/ITEM.PrePickUpPrimary/ITEM.PrePickUpSecondary callback blocks it.
On success, equips the item via SlashCo.ChangeSurvivorItem and removes the world entity.
boolean SlashCo.Jumpscare( Player slasher, Entity target )
Tries to make the given slasher jumpscare and kill a target survivor.
Fails silently if the slasher can't currently kill, is on kill delay, the target isn't a valid survivor, or the target is out of the slasher's SLASHER.KillDistance (unless they're already being jumpscared).
On success it freezes both entities, plays the slasher's kill sound, and after SLASHER.JumpscareDuration seconds deals fatal damage to the target and calls the slasher's SLASHER.OnKillPlayer function via Player:SlasherFunction.
This is used internally - although you're able to use it you probably shouldn't.
This function currently discards any unknown bindings!
This will be changed in the next update. Builds a string with all valid bindings to store it somewhere
string SlashCo.Language( string key, any ... )
Returns the localized string associated with the given key.
Additional arguments are passed to string.format when provided.
String arguments are recursively passed through SlashCo.Language before formatting.
SlashCo.LegacySetup()
This is used internally - although you're able to use it you probably shouldn't.
Adds spawning entities from legacy map configuration files if they exist.
Legacy configuration data is converted into the corresponding modern spawn entities.
number SlashCo.LevelToPPs( number level )
Returns the amount of perk points a player should have at the given level, based on SlashCo.StartPP and SlashCo.PPsPerLevel.
This is used internally - although you're able to use it you probably shouldn't.
Loads the Difficulty, Offering, Survivor and Slasher data that was saved by the lobby into SlashCo.CurRound, and builds the list of expected players for the round.
Assigns the loaded Slashers via SlashCo.SelectSlasher and, if the Nightmare offering is active, turns every Survivor into a Slasher instead.
Falls back to SlashCo.SinglePlayerSetup in singleplayer, or calls SlashCo.EndRound if the saved data could not be found.
SlashCo.LoadDocuments()
This is used internally - although you're able to use it you probably shouldn't.
Includes every file in lua/slashco/documents/, running their SlashCo.RegisterDocument calls.
Called automatically on startup and whenever game content changes.
SlashCo.LoadFileFromAddons( string fileName )
Includes a lua file from every folder that matches a wildcard in the given path, e.g. "content//init.lua" includes init.lua from every subfolder of content/.
Every matching file is also added as a client file via AddCSLuaFile before being included.
SlashCo.LoadGamemodeFile( string fileName )
Includes a gamemode lua file.
Currently just a thin wrapper around include, kept separate so gamemode files can later be loaded directly from a workshop-mounted addon instead of the local filesystem.
SlashCo.LoadItemPatches()
This is used internally - although you're able to use it you probably shouldn't.
Includes every file in lua/slashco/patch/effect/ and lua/slashco/patch/item/, which are meant to modify already-registered item/effect tables.
Called automatically on startup and whenever game content changes.
SlashCo.LoadItems()
This is used internally - although you're able to use it you probably shouldn't.
Includes every effect file in lua/slashco/effect/ and item file in lua/slashco/item/, running their SlashCo.RegisterEffect/SlashCo.RegisterItem calls.
Called automatically on startup and whenever game content changes.
This is used internally - although you're able to use it you probably shouldn't.
Loads the bindings if GameData.KeyboardBinds is not yet set and then networks them to the Server
SlashCo.LoadLanguage()
This is used internally - although you're able to use it you probably shouldn't.
Called once initially and every time gmod_language is changed.
This will load & fill SlashCo.LangTable & if missing, set SlashCo.LangTableFallback
It first always loads the gamemode file slashco/lang/[lang].lua and then loads any addon languages by searching slashco/lang/*/[lang].lua using SlashCo.LoadFileFromAddons
And if SlashCo.CurrentLang is outdated (indicating a language change), it will trigger SlashCo:LanguageChanged
SlashCo.LoadMapConfigs( boolean initialCheck = nil )
This is used internally - although you're able to use it you probably shouldn't.
Loads all map configs.
SlashCo.LoadPerks()
This is used internally - although you're able to use it you probably shouldn't.
Loads all perks
This is used internally - although you're able to use it you probably shouldn't.
Includes every file in slashco/patch/slasher/*.lua.
These patch files are intended to modify the code of existing slashers after they've been registered.
Called once automatically when the file is loaded, and again whenever the addon content changes.
SlashCo.LoadSlashers()
This is used internally - although you're able to use it you probably shouldn't.
Includes every slasher file in slashco/slasher/*.lua, causing them to call SlashCo.RegisterSlasher.
Called once automatically when the file is loaded, and again whenever the addon content changes.
number SlashCo.LobbyBanter( )
This is used internally - although you're able to use it you probably shouldn't.
Starts a randomly selected survivor conversation in the lobby
Survivors are assigned to the individual conversation parts and the voice lines are played with their appropriate timing

Returns a delay representing the total duration of the conversation
This is used internally - although you're able to use it you probably shouldn't.
Advances the lobby to SlashCo.LobbyData.LOBBYSTATE 3, shows the Slasher briefing to the players via SlashCo.LobbyPlayerBriefing and opens the elevator exit doors.
This is used internally - although you're able to use it you probably shouldn't.
Networks the ready state of every lobby player to all clients, and if the "all ready" timer is running, also sends the remaining time.
This is used internally - although you're able to use it you probably shouldn't.
Advances the lobby to SlashCo.LobbyData.LOBBYSTATE 2, closes the elevator shutter doors and, after a short delay, opens a random elevator and starts SlashCo.LobbyBriefingTransition.
SlashCo.LobbyFinish()
This is used internally - although you're able to use it you probably shouldn't.
Marks the lobby as finished (SlashCo.LobbyData.LOBBYSTATE 4) and starts the helicopter take-off sequence that leads into the round intro.
Moves the helicopter target position further away over time and, after 15 seconds, plays the game intro, starts the leave timer and disables the lobby background music.
Does nothing if the lobby has already finished.
SlashCo.LobbyLeave()
This is used internally - although you're able to use it you probably shouldn't.
Clears the round database and then saves the current lobby data (Difficulty, Offering, chosen Slashers and Survivor items) into it before changing to the selected round map.
SlashCo.LobbyOpenItems()
This is used internally - although you're able to use it you probably shouldn't.
Opens a random door named door_itembox, revealing the item shop for the Survivors to buy items before the round starts.
This is used internally - although you're able to use it you probably shouldn't.
Broadcasts the selected slasher's info (SlashCo.LobbyData.SelectedSlasherInfo) to everyone, used to brief players before the round starts.
SlashCo.LobbyRoundData()
This is used internally - although you're able to use it you probably shouldn't.
Broadcasts the current Lobby Survivors, Slashers and offerings to everyone.
SlashCo.LobbyRoundSetup()
This is used internally - although you're able to use it you probably shouldn't.
Begins the transition out of the lobby once enough players are ready.
Advances the lobby to SlashCo.LobbyData.LOBBYSTATE 1, opens the elevator shutter doors, forces any not-ready player into the Survivor ready state, resets the Slasher/Survivor selection info, and then runs the difficulty, Offering and team assignment logic that picks the Slashers and Survivors for the upcoming round.
SlashCo.LobbyVendorVoice( Player ply, string item )
This is used internally - although you're able to use it you probably shouldn't.
Plays a voice line on the item vendor that the given player last used, reacting to the item they just bought.
Plays a special line instead if the Nightmare Offering is active. Does nothing if the player has no last used item stash.
Vector SlashCo.LocalizedTraceHullLocator( Entity ent, number minRange, number range = minRange, number offset = 0 )
Get a position near an entity that it can be near.
Internally just calls SlashCo.LocalizedTraceHullLocator
Vector SlashCo.LocalizedTraceHullLocatorAdvanced( Entity ent, number minRange, number range = minRange, number offset = 0 )
We advise against using this. It may be changed or removed in a future update. Use the new version SlashCo.LocalizedTraceHullLocator Alias of SlashCo.LocalizedTraceHullLocator
SlashCo.MapSize()
How big the map is- the larger the value the larger the map
If you need this value on the client use SlashCo.GetMapSize You should never modify it yourself!
SlashCo.MapSizeExact()
The map's size as an unrounded number, calculated by SlashCo.InitMapMesh as SlashCo.MaxVec:Distance(SlashCo.MinVec) / 8500.
Falls back to 2.5 if the map bounds couldn't be determined at all.
Rounded up (via math.ceil) into SlashCo.MapSize, which is what most code should use instead. You should never modify it yourself!
Marks the lobby as starting. Read back using SlashCo.IsLobbyStarting.
While set, spectators are bound to the helicopter's camera and suicide is disallowed.
SlashCo.MaxVec()
The map's maximum world-space corner.
Computed by SlashCo.InitMapMesh from the world's brush surfaces (ignoring nodraw/sky/water surfaces), or from game.GetWorld():GetModelBounds() if the world has no brush surfaces at all. You should never modify it yourself!
SlashCo.MinVec()
The map's minimum world-space corner.
Computed by SlashCo.InitMapMesh from the world's brush surfaces (ignoring nodraw/sky/water surfaces), or from game.GetWorld():GetModelBounds() if the world has no brush surfaces at all. You should never modify it yourself!
SlashCo.NetworkPings( Player or table<Player> ply )
This is used internally - although you're able to use it you probably shouldn't.
Networks all existing pings to the given player
This is expensive and should only be done when needed
SlashCo.OfferingVote( Player ply, boolean agreement )
This is used internally - although you're able to use it you probably shouldn't.
Registers ply's agreement to the currently proposed Offering. Does nothing if agreement is falsy.
Cancels the currently running Offering vote, resetting the voted/selected Offering and clearing the list of Offerors.
Notifies all players that the vote did not succeed.
SlashCo.OfferingVoteFinished( number rarity )
This is used internally - although you're able to use it you probably shouldn't.
Networks that the ongoing vote has ended successfully
Applies the winning Offering vote for the lobby, running the SlashCo:UnselectOffering hook for the previous Offering (if any) and the SlashCo:SelectOffering hook for the new one.
Ends the vote for every player. Does nothing if the given Offering is already the active one.
SlashCo.OnBalanceForPlayers( number totalSurvivors, number additionalSurvivors )
This is used internally - although you're able to use it you probably shouldn't.
Adjusts round spawn requirements based on the number of survivors.
Additional survivors can increase the number of generators and required documents.
Generator values are only modified when the map has not explicitly overridden them.
SlashCo.OnSlasherSpawned( Player ply )
Initializes a slasher's internal state right after they spawn: resets their chase/kill timers, applies SLASHER.OnBalanceForPlayers to their SLASHER table, sets their prowl speed and anger, and calls the slasher's SLASHER.OnSpawn function via Player:SlasherFunction.
SlashCo.OpenKeyboardUI()
Opens (or re-opens) the keybinds menu, listing every entry in SlashCo.KeyboardBinds and letting the player rebind each one by clicking it and pressing a new key.
Bindings are saved via SlashCo.SaveKeyboardBinds once the menu is closed.
Opens a UI panel that lets the player pick one of the available Survivor playermodels.
Selecting a model sets the slashco_cl_playermodel ConVar accordingly.
boolean SlashCo.OwnsPerk( Player ply, string perkID )
Checks whether a player owns a perk.
table SlashCo.ParseKeyboardBinds( string bindData )
This is used internally - although you're able to use it you probably shouldn't.
This function currently discards any unknown bindings!
This will be changed in the next update. Parses the given string into a table with all key bindings
SlashCo.PlayerPickedLobbySlasher( Player ply, string slasherID )
This is used internally - although you're able to use it you probably shouldn't.
Stores the Slasher a player picked in the lobby, both on the player itself and inside SlashCo.LobbyData.AssignedSlashers so it survives a disconnect/reconnect.
Does nothing outside of the lobby.
SlashCo.PlayGlobalSound( string soundPath, number soundLevel, Entity ent, number vol, boolean permanent )
We advise against using this. It may be changed or removed in a future update. This function is soon to be replaced by the SlashCo.AudioSystem Plays a global sound
SlashCo.PrecacheItem( string itemName )
Precaches a registered item's model, view model, holstered world model and world model (whichever are set), and calls the item's own ITEM.Precache function if it has one.
Looks up the item definition from SlashCoItems by name.
SlashCo.PrecacheModel( string modelName )
Precaches a model via util.PrecacheModel and remembers it in an internal table so it isn't precached again, e.g. after an autorefresh.
SlashCo.PrecacheSlasher( string slasherName )
Precaches a registered slasher's model, chase music and kill sound (whichever are set), and calls the slasher's own SLASHER.Precache function if it has one.
Looks up the slasher definition from SlashCoSlashers by name.
SlashCo.PrecacheSound( string soundName )
Precaches a sound and remembers it in an internal table so it isn't precached again, e.g. after an autorefresh. The current implementation internally calls util.PrecacheModel instead of util.PrecacheSound - this looks like a bug in the existing code.
This is used internally - although you're able to use it you probably shouldn't.
Schedules the slasher to spawn after a delay based on the round difficulty, if the gamemode is SlashCo.Gamemode.ESCAPE.
The delay is the smallest value between the difficulty-based delay and any slasher's SLASHER.SpawnDelay value.
SlashCo.QuietHeli()
Quiets the current SlashCo helicopter if it is valid
number SlashCo.RadialTester( Entity ent, number dist, Entity secondary )
Tests directions around an entity to find an unobstructed angle
If an unobstructed direction is found, its angle is returned immediately
If all tested directions are blocked, the angle with the greatest traced distance is returned
Return a random position that something can spawn at
SlashCo.ReadOptional( function readFunc, any optionalArgs )
It's useless to use this function on a boolean / when using net.WriteBool as this will only add overhead.
Unless you want to preserve nil values. Helper networking function that only writes a value if it isn't nil
The sender code must use SlashCo.WriteOptional
You can find a example on SlashCo.WriteOptional
CSoundPatch SlashCo.ReadSound( string fileName )
We advise against using this. It may be changed or removed in a future update. This function will be replaced by SlashCo.AudioSystem Loads and plays a sound using the specified sound file.
Sounds are cached globally so that subsequent calls using the same file can reuse the existing sound object.
SlashCo.RefundSurvivorItems( Player or string ply )
Refunds the points a Survivor spent on their items, used when that Survivor gets turned into a Slasher instead.
Reads the items from the saved round database, refunds their price and removes the Survivor's saved item entry. Does nothing if the player has no saved items or a total refund of 0.
Must only be used in-round, not while in the lobby.
boolean SlashCo.RegisterAddon( string workshopid )
Registers a mounted workshop addon as a SlashCo addon by its workshop ID, adding it to SlashCo.GetAddons and, Server-side, queuing it for client download via resource.AddWorkshop.
This normally isn't required, as any addon containing a lua/slashco folder is auto-detected by SlashCo.FindSlashCoAddons. Addons that don't match that check can call this from the SlashCo:RegisterAddons hook instead.
SlashCo.RegisterDocument( Document table )
Registers a document table, keyed by its Name, and groups it under its Type.
If Type is "Slasher" and no Document.Slasher field is set, it defaults to the document's Name.
Must be called before document loading finishes; calling it afterwards throws an error.
SlashCo.RegisterEffect( Effect table, string name )
Registers an effect table so it can be applied to players and looked up by name.
Must be called before item loading finishes; calling it afterwards throws an error.
SlashCo.RegisterItem( Item table, string name )
Registers an item table so it can be equipped, dropped and looked up by name.
Must be called before item loading finishes; calling it afterwards throws an error.
SlashCo.RegisterPerk( Perk perkTbl, string perkID )
Registers a perk and associates it with its team.
Registration is rejected after perks have finished loading.
Default values are applied for the perk's level and price.
Conflict IDs are also converted into lookup keys within the PERK.Conflicts table.
SlashCo.RegisterSlasher( Slasher table, string name )
Registers a SLASHER table as a playable slasher, assigning it a unique ID.
Can only be called while slashers are being loaded, calling it afterwards raises an error.
This is used internally - although you're able to use it you probably shouldn't.
Removes entities associated with the current round.
This removes generators, attached fueling cans, gas cans, tracked round items, batteries, and entities associated with exposure spawns.
SlashCo.RemoveFog( string name, number or Entity value = nil )
Removes a fog entry and networks the removal to all clients.
If no matching fog entry exists, nothing is done.
Removes the current SlashCo helicopter if it is valid
SlashCo.RemoveItem( Player ply, boolean isSec )
Clears the given item slot without spawning a dropped entity, calling the item's ITEM.OnSwitchFrom callback after a short delay.
SlashCo.RemoveObjective( string name )
Removes the tracked objective with the given name.
Doesn't network the change, call SlashCo.SendObjectives afterwards to update clients.
This is used internally - although you're able to use it you probably shouldn't.
Resets all data associated with the current round to its default state.
SlashCo.ResetLobby()
This is used internally - although you're able to use it you probably shouldn't.
Resets the lobby back to its initial state: clears all lobby timers, resets SlashCo.LobbyData, cleans up the map, and moves any player still on the Survivor or Slasher team back to the lobby team.
Used when a prepared game is interrupted, for example when players leave before the round could start.
SlashCo.ResetLobbyData()
This is used internally - although you're able to use it you probably shouldn't.
Resets the lobby data to its default state.
SlashCo.RoundBeginTimer( boolean instant )
This is used internally - although you're able to use it you probably shouldn't.
Starts the round, either right away or after a short countdown, and marks SlashCo.CurRound.AntiLoopSpawn so the round setup cannot run more than once.
This is used internally - although you're able to use it you probably shouldn't.
Ends the round: stops the helicopter sound, the background music and all SlashCo.AudioSystem.StopSound sounds, awards round points to survivors and slashers based on state, then sends the round-over screen data to everyone.
This is used internally - although you're able to use it you probably shouldn't.
Saves the current GameData.KeyboardBinds and then calls SlashCo.LoadKeyboardBinds so that the bindings are verified & sent to the server.
SlashCo.SelectSlasher( string slasherID, string steamID64 )
Assigns a slasher ID to a player's SteamID64 for the current round, before they've actually spawned as a slasher.
Also precaches the slasher via SlashCo.PrecacheSlasher.
Entity or table, number SlashCo.SelectSpawns( table elements, number amount, function conditionsForced = SlashCo.DefaultConditionsForced, function conditionsNonForced = SlashCo.DefaultConditionsNonForced, boolean forceTable = false )
Selects a number of spawns from a sequential table, prioritizing forced spawn entities.
Forced entries are selected first, followed by non-forced entries if additional selections are required.
Entity or table<Entity>, number SlashCo.SelectSpawnsNoForce( table<Entity> elements, number amount = 1, function conditions = SlashCo.DefaultConditions, boolean forceTable = false )
Selects a number of spawns from a sequential table using weighted random selection.
Selected entries are removed from consideration so the same entry cannot be selected twice.
When amount is 1, a single element is returned unless forceTable is enabled.
When amount is greater than 1, a table of selected elements and the number of missed entries are returned.
SlashCo.SendObjectives()
Networks the current objectives (name, status and progress counts) to every Survivor and Spectator.
SlashCo.SendValue( Player ply, string message, any ... )
On the server it networks any amount of values to the specified client, or broadcasts them to all clients when no player is specified

On the client it networks any amount of values to the server
SlashCo.SendValueOmit( Player ply, string message, any ... )
Networks any amount of values to all clients except the specified player.
SlashCo.SetGasCansToSpawn( number amount )
Overrides the total number of gas cans to spawn for the round.
A negative value (the default) makes SlashCo.SpawnGasCans calculate the amount automatically instead, see SlashCo.GetGasCansToSpawn.
SlashCo.SetGeneratorsNeeded( number amount )
Sets how many generators need to be fully fueled for survivors to be able to escape.
Read back using SlashCo.GetGeneratorsNeeded.
SlashCo.SetGeneratorsToSpawn( number amount )
Sets how many generators are spawned on the map for the round.
Read back using SlashCo.GetGeneratorsToSpawn.
SlashCo.SetGlobalFogColor( Color or Vector color )
Sets the global fog color, used by the Fog system. Read back using SlashCo.GetGlobalFogColor.
On map start this is initialized from the env_fog_controller entity's fog color, if one exists on the map.
This is used internally - although you're able to use it you probably shouldn't.
Sets the helicopter intro and spawn positions for the current round using the map's helicopter entities.
The vertical position is lowered by 70 units to better align with the Hammer models.
Aborts the round if either required helicopter entity is missing.
SlashCo.SetLightStyle( number lightStyle, string lightPattern )
Sets a light style and broadcasts an update to all clients so that their light map is updated.
Sets the SlashCo.ReadyState of the given player
SlashCo.SetMapSize( number size )
Sets the current map's size multiplier. Read back using SlashCo.GetMapSize.
Called serverside after the exact map size has been calculated from the map's world bounds.
SlashCo.SetRoundStartTime( number time = CurTime() )
Sets the time the round started using CurTime
Returns the map's settings entity.
The result is cached after the first successful lookup.
This is used internally - although you're able to use it you probably shouldn't.
Enables the ambient loading music and starts the failsafe timer that forces a new Slasher selection if not all expected players connect within 300 seconds.
Also listens for disconnecting players so they can be marked as disconnected inside SlashCo.CurRound.ExpectedPlayers.
This is used internally - although you're able to use it you probably shouldn't.

Called when a game is hosted with sv_lan 1 to setup proper -multirun support for development and testing

Using sv_lan we can use -multirun and join the game with multiple gmod instances,
but now we have to ensure that they won't use the same steamid's.
Right now we change these function and we add the userid to allow for multiple multirun instances to work without colliding with each other.

  • PLAYER:SteamID()
  • PLAYER:SteamID64()
  • PLAYER:OwnerSteamID64()
  • PLAYER:UniqueID()
SlashCo.SetupPlayers()
This is used internally - although you're able to use it you probably shouldn't.
Sets up players for the current round using the stored survivor and slasher database data.
Handles Nightmare offering behavior, memorized slashers, late joining survivors, spectators, and Covenant selection.
Previously stored survivor items are restored after all survivors have spawned.
This is used internally - although you're able to use it you probably shouldn't.
Prepares a round for singleplayer: enables g_SlashCoDebug, picks a random Difficulty and clears the Survivor gas can modifier and current Offering.
Adds the local player as an expected player and a Survivor as soon as they spawn.
SlashCo.SlasherClass()
A table containing all defined Slasher classes
Use SlashCo.AddSlasherClass to register a new class
You should never modify it directly!
SlashCo.Spawn( table elements, function spawnFunc = nil )
Activates a list of spawn points.
Each entry with a SpawnEnt method is spawned.
An optional callback can be used to modify an entity before it is spawned.
SlashCo.SpawnDocuments()
This is used internally - although you're able to use it you probably shouldn't.
Spawns the required documents for the current round.
The number of documents is based on the required document count plus the map size.
If no document spawn entities are available, document spawning is marked as failed.
SlashCo.SpawnGasCans()
This is used internally - although you're able to use it you probably shouldn't.
Spawns gas cans for the current round.
The number of gas cans is affected by the map size, difficulty, offerings,
slasher modifiers, survivor modifiers, and head-start cans.
Forced gas can counts override the calculated count.
SlashCo.SpawnGenerators()
This is used internally - although you're able to use it you probably shouldn't.
Spawns the generators required for the current round.
Forced generator spawn points receive priority.
Each selected generator also receives a randomly selected battery spawn.
Aborts the round if no generator spawn entities are available.
SlashCo.SpawnItems()
This is used internally - although you're able to use it you probably shouldn't.
Spawns items for the current round.
World props configured to replace items are converted into their corresponding items.
Slasher-specific items, the beacon, and randomly selected items are then spawned.
SlashCo.SpawnPlayerAsSlasher( Player ply, string slasherName )
Used for debugging: forces a player to become and spawn as the given slasher immediately.
If the round hasn't started spawning slashers yet, the player is instead just marked to spawn as that slasher via SlashCo.SelectSlasher.
The slasher name is matched case-insensitively against both the registered name and the slasher's Name field.
SlashCo.SpawnSlasher()
This is used internally - although you're able to use it you probably shouldn't.
Spawns all slashers selected for the current round.
Does nothing if the slasher has already been spawned.
table SlashCo.SQLTableToLuaTable( table data, string keyName )
Converts a sequential SQL result table into a keyed Lua table.
The value of the specified column is used as the key for each row.
SlashCo.StartChaseMode( Player slasher, boolean forceChase )
Starts chase mode for the given slasher.
Unless forceChase is used, this looks for a survivor in the slasher's eye trace or view cone within their SLASHER.ChaseRange, and does nothing if none is found or chasing is disabled for them.
If the slasher is already chasing, this calls SlashCo.StopChase instead.
On success it sets InSlasherChaseMode, switches to SLASHER.ChaseSpeed, plays the chase music, adds the SlasherChase fog, and schedules an automatic SlashCo.StopChase after the chase duration.
SlashCo.StartGameIntro()
This is used internally - although you're able to use it you probably shouldn't.
Quiets the helicopter and disables the background music, then sends the round's map, slasher and Offering info to everyone to show the round intro screen.
SlashCo.StartRound( boolean noSetup = false )
This is used internally - although you're able to use it you probably shouldn't.
Starts the current round.
Prepares the round entities and players, disables soundscapes, fades players out, and begins the main round initialization after a short delay.
Does nothing when the game is currently in the lobby.
SlashCo.State()
This value is currently NOT syncronized between Server and Clients!
This will be fixed in the next update. The currently active state value.
SlashCo.StopChase( Player slasher )
Ends the given slasher's chase mode: resets their speed to SLASHER.ProwlSpeed, stops the chase music, starts their chase cooldown, and clears SurvivorChased on any survivor that was being chased by them.
If no other slasher is currently chasing, the SlasherChase fog is also removed.
Summons the rescue helicopter for the current round
If the helicopter has already been summoned, this returns true
This is used internally - although you're able to use it you probably shouldn't.
Ends the round via SlashCo.EndRound after a fixed delay, used to give a short grace period once the win condition has already been decided.
We advise against using this. It may be changed or removed in a future update. Use the new version SlashCo.RandomPosLocator Alias of SlashCo.RandomPosLocator
string SlashCo.TranslateBind( string name )
Looks up the given Bind and returns the name.
SlashCo.TriggerBlackout()
Spawns a sc_blackout_trollge entity inside the lobby, removing any existing one first.
Does nothing outside of the lobby. Part of an unfinished Blackout lobby event.
boolean SlashCo.UnbanSlasher( string name )
Tries to unban the given Slasher
Updates the target position that the helicopter is seeking
SlashCo.UpdateObjective( string name, SlashCo.ObjStatus status, number count, boolean dontOverrideComplete )
Adds the objective name to the tracked objectives if it isn't tracked yet, or updates its status/progress otherwise.
When status is SlashCo.ObjStatus.PROGRESS and the objective has a count, count (default 1) is added to its progress, capping at the total and auto-completing it once reached.
Fires SlashCo:OnObjectiveComplete when the objective newly becomes complete.
Doesn't network the change, call SlashCo.SendObjectives afterwards to update clients.
SlashCo.UseItem( Player ply )
Uses the survivor's currently held item (the secondary slot takes priority over the primary one) by calling its ITEM.OnUse callback.
The item is removed afterwards unless ITEM.OnUse returns a truthy value, in which case an "item unusable" sound plays instead.
Does nothing in the lobby, for non-survivors, or while the player is frozen.
SlashCo.WriteOptional( any value, function writeFunc, any optionalArgs )
It's useless to use this function on a boolean / when using net.WriteBool as this will only add overhead.
Unless you want to preserve nil values. Helper networking function that only writes a value if it isn't nil
The receiver code must use SlashCo.ReadOptional