The Flux gamemode table: the handlers of GMod's gamemode hooks that turn Flux into a gamemode derived from sandbox. The handlers set players up when they join and spawn, check sandbox actions such as spawning props against the Flux permissions, play the animations defined by the Flux.Anim tables, draw the HUD and save the data. While doing so they run Flux's own hooks (PlayerInitialized, PostPlayerSpawn, PlayerThink, LazyTick, FLHUDPaint and so on, listed on the Hooks page), which are what plugins and schemas are meant to implement instead of overriding the GM functions.

Plugin and schema handlers of a hook are called before the handlers added with hook.Add and before the GM handler. The first handler that returns a non-nil value ends the call, so the remaining handlers, including the gamemode's, do not run: only return a value from a handler when the hook's documentation gives it a meaning. Hooks that are run with Plugin.call never reach the GM handlers.

The handlers are split by realm. The shared ones cover initialization, player animations, the noclip and physics gun checks and the timers behind the periodic hooks (LazyTick, HalfSecond, OneSecond, OneMinute); the server and the client ones are in the sv_ and cl_ hook files.

Summary

Hooks

Does nothing, so that the default death notices are never added.
Prevents players from picking entities up with the use key.
Picks the base activity of a player (idle, walking or running), updates their move_yaw pose parameter and plays the landing gesture when they touch the ground.
Prevents players from killing themselves through the console.
Creates the context menu if the local player has the context_menu permission and removes it if they do not.
Plays the attack and reload gestures of the player's hold type, with their crouched variants where the animation table has them, handles the jump and reload cancel events and plays the gestures sent with Player#play_gesture.
Does nothing, which disables the default handling of a player's death.
Does nothing, which removes the default death notices from the HUD.
Collects the target ID lines of a player through the GetDrawPlayerInfo hook and draws them in order of priority, fading out between 500 and 640 units of distance.
Clears the networked variables of the removed entity before passing the event on to the base gamemode.
Runs the PlayerTakeDamage hook when the damaged entity is a player.
Draws the circular action progress indicator in the middle of the screen if a percentage was set with Flux.set_circle_percent.
Saves the config and runs the SaveData hook, then the PostSaveData hook.
Writes the files that get sent to clients (shared data, settings, language phrases and whatever the FLWriteClientFiles handlers add) into lua/_flux/client.
Adds the name of the player to the lines shown in their target ID.
Returns the fall damage of a player: the result of the FLGetFallDamage hook if it returns one, otherwise a value calculated from the fall speed.
Returns the gamemode name shown in the server browser: name_override if it is a string, otherwise 'FL - ' followed by the schema name.
Does nothing, which disables the default ear grab animation while chatting.
Does nothing, which disables the default ammo pickup notification.
Does nothing, which disables the default pickup history on the HUD.
Draws the loading screen with its status text and progress bar while the local player is not initialized yet or the ShouldDrawLoadingScreen hook returns true.
Finds the entity the local player is looking at, or the one closest to the crosshair within a narrow cone, and draws its target ID through the DrawPlayerTargetID hook, the entity's own DrawTargetID method or the DrawEntityTargetID hook.
Does nothing, which disables the default item pickup notification.
Draws the Flux HUD once the local player is initialized: the damage flash, the death screen while dead or the info displays and the top bars while alive (unless FLHUDPaint returns a truthy value), and the white respawn fade.
Draws the red blood overlay behind the death screen.
Hides the default HUD elements that Flux replaces, such as health, armor, ammo, the crosshair and the damage indicators.
Removes unused sandbox hooks and, on the server, imports the configuration from the settings, loads the config, connects to the database and registers the Discord webhooks.
Registers the Flux tools with the tool gun and runs the LoadData and FLInitPostEntity hooks.
Keeps the language setting in step when the language of the client changes for another reason than the setting itself, such as the fl_language console variable.
Does nothing, which disables the default mouth movement while using voice chat.
Applies changes of the walk_speed, run_speed, crouched_speed and jump_power configs to every player.
Runs the FLSaveData hook every data_save_interval seconds, unless FLShouldSaveData returns false.
Lets the base gamemode freeze the entity if the player has the physgun_freeze permission or a PlayerCanPhysgunFreeze handler allows it.
After a Lua refresh, registers the Flux tools with the tool gun again and, in development, reapplies the animation table of every player.
Writes the files that get sent to clients again after a Lua refresh.
Plays the raise or lower gesture of the weapon's hold type when the raised state of the player's weapon changes.
Lets players with the physgun_pickup permission pick entities up with the physics gun, and players without it when a PlayerCanPhysgunPickup handler allows it.
Intercepts the undo bind and blocks it when the SoftUndo hook returns a value.
Stores the time at which the player may respawn, based on the respawn_delay config.
Mutes the default death sound.
Respawns a dead player once their respawn time has passed.
Saves the data of the player unless their should_save_data field is false, tells all clients about the disconnect and logs it.
Decides whether a player may give themselves a weapon.
Marks the player as initialized and, shortly after, runs PlayerInitialized on their client.
Sets up a newly connected player: assigns the flux_player class and the 'user' group, restores their saved data and announces the spawn to all clients.
Assigns the compiled animation table of the new model to the player and, on the client, disables inverse kinematics for them.
Decides whether a player may toggle noclip by asking the plugins through the PlayerEnterNoclip and PlayerExitNoclip hooks.
Runs the PlayerPositionChanged hook if the player has moved since the previous check.
Passes chat messages that start with a command prefix to the command interpreter and hides them from the chat.
Sets the model of a player.
Asks the FLPlayerShouldTakeDamage hook whether a player can be damaged.
Resets the state of a spawning player (model, collisions, visibility and the movement speeds from the config), runs the PostPlayerSpawn hook and creates their hands model.
Decides whether a player may spawn an effect.
Decides whether a player may spawn an NPC.
Decides whether a player may spawn a prop, ragdoll or effect.
Decides whether a player may spawn a prop.
Decides whether a player may spawn a ragdoll.
Decides whether a player may spawn a scripted entity.
Decides whether a player may spawn a weapon.
Decides whether a player may spawn a vehicle.
Lets the PlayerSwitchedFlashlight hook decide whether a player may toggle their flashlight, and leaves the decision to the base gamemode when no handler returns anything.
Notifies the client of the damaged player, which shows the damage flash on their HUD.
Runs the current action of the player, unless it is 'idle' or 'spawning'.
Tells the client of the player to open the interaction menu for the player or entity they pressed the use key on, at most once a second.
Adds every registered Flux tool to the tool list of the spawn menu, then runs the SynchronizeTools hook.
Strips the weapons of the player, gives them the default loadout and selects the first weapon of it, then runs the PlayerLoadoutGiven hook for the weapons that plugins add.
Gives the player their loadout, plus the tool gun and the physics gun if they have the toolgun and physgun permissions, then runs PostPlayerSpawn on their client.
Registers the language setting when the Settings plugin collects the settings, which it does while the schema is being included.
Updates the blurred copy of the screen used by draw.blur_box and draw.blur_panel.
Saves the data of every player before the server restarts.
Does nothing, which disables the default help menu.
Saves everything when the server shuts down or changes the map: runs the FLSaveData hook and saves the data of every player.
Asks the server to undo the last Flux undo entry of the local player.
Removes the sandbox hint timer about saving spawnlists.
Removes the sandbox hint timers and allows the spawn menu to open.
Copies every registered Flux tool into the tool table of the tool gun.
Think()client
Updates the global UI offset from the rotation of the local player's view, so that HUD elements using it sway and settle back.
Tick()shared
Runs the PlayerThink hook for every player eight times a second and the PlayerOneSecond hook once a second.
Translates an activity into the animation that the Flux animation tables define for the player's model, weapon hold type and weapon state.
Keeps the playback rate handling of the base gamemode and, on the server, plays one of the idle fidget gestures of the animation table every once in a while when the player stands still on the ground.

Hooks

GM:AddDeathNotice()

client packages/flow/hooks/cl_hooks.lua:114

Does nothing, so that the default death notices are never added.

GM:AllowPlayerPickup(_actor, _entity)

server packages/flow/hooks/sv_hooks.lua:770

Prevents players from picking entities up with the use key.

Parameters

  • _actor Player
  • _entity Entity

Returns

  • Boolean always false

GM:CalcMainActivity(actor, velocity)

shared packages/flow/hooks/sh_hooks.lua:149

Picks the base activity of a player (idle, walking or running), updates their move_yaw pose parameter and plays the landing gesture when they touch the ground. An animation forced with Player#set_animation takes priority. The run threshold comes from the animation table and has a small hysteresis so that the animation does not flicker when moving at about that speed.

Parameters

  • actor Player
  • velocity Vector velocity of the player

Returns

  • Number activity (ACT_ enum, or -1 for a forced animation)
  • Number sequence to play instead of the activity, or -1 for none

GM:CanPlayerSuicide(_actor)

server packages/flow/hooks/sv_hooks.lua:34

Prevents players from killing themselves through the console.

Parameters

  • _actor Player

Returns

  • Boolean always false

GM:ContextMenuOpen()

client packages/flow/hooks/cl_hooks.lua:615

Creates the context menu if the local player has the context_menu permission and removes it if they do not.

Returns

  • Boolean always true

GM:DoAnimationEvent(actor, event, data)

shared packages/flow/hooks/sh_hooks.lua:304

Plays the attack and reload gestures of the player's hold type, with their crouched variants where the animation table has them, handles the jump and reload cancel events and plays the gestures sent with Player#play_gesture. Models without an animation table use the default player gestures.

Parameters

  • actor Player
  • event Number animation event, PLAYERANIMEVENT_ enum
  • data Number data of the event; the activity or sequence of a custom gesture

Returns

  • Number activity for the view model or ACT_INVALID; nil for unhandled events

GM:DoPlayerDeath(_victim, _attacker, _damage_info)

server packages/flow/hooks/sv_hooks.lua:21

Does nothing, which disables the default handling of a player's death.

Parameters

  • _victim Player the player who died
  • _attacker Entity
  • _damage_info CTakeDamageInfo

GM:DrawDeathNotice()

client packages/flow/hooks/cl_hooks.lua:110

Does nothing, which removes the default death notices from the HUD.

GM:DrawPlayerTargetID(target, x, y, distance)

client packages/flow/hooks/cl_hooks.lua:375

Implements hook DrawPlayerTargetID

Collects the target ID lines of a player through the GetDrawPlayerInfo hook and draws them in order of priority, fading out between 500 and 640 units of distance. Nothing is drawn if the PreDrawPlayerInfo hook returns false.

Parameters

  • target Player the player being looked at
  • x Number screen x of the horizontal center of the text
  • y Number screen y of the first line
  • distance Number distance to the player in units

GM:EntityRemoved(entity)

server packages/flow/hooks/sv_hooks.lua:234

Clears the networked variables of the removed entity before passing the event on to the base gamemode.

Parameters

  • entity Entity

GM:EntityTakeDamage(ent, damage_info)

server packages/flow/hooks/sv_hooks.lua:540

Runs the PlayerTakeDamage hook when the damaged entity is a player.

Parameters

  • ent Entity the entity taking damage
  • damage_info CTakeDamageInfo

GM:FLHUDPaint(_cur_time, _scrw, _scrh)

client packages/flow/hooks/cl_hooks.lua:249

Implements hook FLHUDPaint

Draws the circular action progress indicator in the middle of the screen if a percentage was set with Flux.set_circle_percent.

Parameters

  • _cur_time Number current CurTime()
  • _scrw Number screen width
  • _scrh Number screen height

GM:FLSaveData()

server packages/flow/hooks/sv_hooks.lua:681

Implements hook FLSaveData

Saves the config and runs the SaveData hook, then the PostSaveData hook.

GM:FluxPackageLoaded()

server packages/flow/hooks/sv_hooks.lua:672

Implements hook FluxPackageLoaded

Writes the files that get sent to clients (shared data, settings, language phrases and whatever the FLWriteClientFiles handlers add) into lua/_flux/client.

GM:GetDrawPlayerInfo(target, _x, _y, _distance, lines)

client packages/flow/hooks/cl_hooks.lua:359

Implements hook GetDrawPlayerInfo

Adds the name of the player to the lines shown in their target ID.

Parameters

  • target Player the player being looked at
  • _x Number screen x of the target ID
  • _y Number screen y of the target ID
  • _distance Number distance to the player in units
  • lines Map lines to draw, keyed by ID. Each one is a table with the text and priority fields, and optionally font, color, offset_x and offset_y

GM:GetFallDamage(actor, speed)

server packages/flow/hooks/sv_hooks.lua:245

Returns the fall damage of a player: the result of the FLGetFallDamage hook if it returns one, otherwise a value calculated from the fall speed.

Parameters

  • actor Player
  • speed Number fall speed

Returns

  • Number damage to deal

GM:GetGameDescription()

shared packages/flow/hooks/sh_hooks.lua:68

Returns the gamemode name shown in the server browser: name_override if it is a string, otherwise 'FL - ' followed by the schema name.

Returns

  • String

GM:GrabEarAnimation()

shared packages/flow/hooks/sh_hooks.lua:74

Does nothing, which disables the default ear grab animation while chatting.

GM:HUDAmmoPickedUp(_item_name, _amount)

client packages/flow/hooks/cl_hooks.lua:452

Does nothing, which disables the default ammo pickup notification.

Parameters

  • _item_name String
  • _amount Number

GM:HUDDrawPickupHistory()

client packages/flow/hooks/cl_hooks.lua:456

Does nothing, which disables the default pickup history on the HUD.

GM:HUDDrawScoreBoard()

client packages/flow/hooks/cl_hooks.lua:119

Draws the loading screen with its status text and progress bar while the local player is not initialized yet or the ShouldDrawLoadingScreen hook returns true.

GM:HUDDrawTargetID()

client packages/flow/hooks/cl_hooks.lua:278

Finds the entity the local player is looking at, or the one closest to the crosshair within a narrow cone, and draws its target ID through the DrawPlayerTargetID hook, the entity's own DrawTargetID method or the DrawEntityTargetID hook. The local player is never a target, even when the camera of the third person view sees them.

GM:HUDItemPickedUp(_item_name)

client packages/flow/hooks/cl_hooks.lua:446

Does nothing, which disables the default item pickup notification.

Parameters

  • _item_name String

Draws the Flux HUD once the local player is initialized: the damage flash, the death screen while dead or the info displays and the top bars while alive (unless FLHUDPaint returns a truthy value), and the white respawn fade. Skipped when the ShouldHUDPaint hook returns false.

GM:HUDPaintDeathBackground(_cur_time, w, h)

client packages/flow/hooks/cl_hooks.lua:270

Implements hook HUDPaintDeathBackground

Draws the red blood overlay behind the death screen.

Parameters

  • _cur_time Number current CurTime()
  • w Number screen width
  • h Number screen height

GM:HUDShouldDraw(element)

client packages/flow/hooks/cl_hooks.lua:696

Hides the default HUD elements that Flux replaces, such as health, armor, ammo, the crosshair and the damage indicators.

Parameters

  • element String name of the HUD element

Returns

  • Boolean false for the hidden elements, true for everything else

GM:Initialize()

shared packages/flow/hooks/sh_hooks.lua:24

Removes unused sandbox hooks and, on the server, imports the configuration from the settings, loads the config, connects to the database and registers the Discord webhooks. Runs the FLInitialize hook when done.

GM:InitPostEntity()

shared packages/flow/hooks/sv_hooks.lua:39

On the server

Registers the Flux tools with the tool gun and runs the LoadData and FLInitPostEntity hooks.

On the client

Stores the local player in the PLAYER global, sends the client's language to the server, reports to the server that the player has been created and runs the client-side loading hooks (PlayerModelChanged for every player, SynchronizeTools, LoadData, FLInitPostEntity).

Defined in

GM:LanguageChanged(_new_lang, _old_lang)

client packages/flow/hooks/cl_hooks.lua:581

Implements hook LanguageChanged

Keeps the language setting in step when the language of the client changes for another reason than the setting itself, such as the fl_language console variable.

Parameters

  • _new_lang String new language code
  • _old_lang String previous language code

GM:MouthMoveAnimation()

shared packages/flow/hooks/sh_hooks.lua:78

Does nothing, which disables the default mouth movement while using voice chat.

GM:OnConfigSet(key, _old_value, new_value)

server packages/flow/hooks/sv_hooks.lua:803

Implements hook OnConfigSet

Applies changes of the walk_speed, run_speed, crouched_speed and jump_power configs to every player.

Parameters

  • key String key of the config that has changed
  • _old_value Any
  • new_value Any

GM:OneSecond()

server packages/flow/hooks/sv_hooks.lua:562

Implements hook OneSecond

Runs the FLSaveData hook every data_save_interval seconds, unless FLShouldSaveData returns false. Also checks every half an hour whether the server is empty and reloads the map if it is, unless ShouldServerAutoRestart returns false.

GM:OnPhysgunFreeze(weapon, phys_obj, entity, actor)

server packages/flow/hooks/sv_hooks.lua:523

Lets the base gamemode freeze the entity if the player has the physgun_freeze permission or a PlayerCanPhysgunFreeze handler allows it. Plugins that want to refuse a freeze return false from OnPhysgunFreeze before this handler runs.

Parameters

  • weapon Weapon the physics gun
  • phys_obj PhysObj the physics object being frozen
  • entity Entity the entity the physics object belongs to
  • actor Player the player trying to freeze it

Returns

  • Boolean false if the entity has been frozen, nil otherwise

GM:OnReloaded()

shared packages/flow/hooks/sh_hooks.lua:533

After a Lua refresh, registers the Flux tools with the tool gun again and, in development, reapplies the animation table of every player.

hook.Add id: FLWriteClientFiles

Writes the files that get sent to clients again after a Lua refresh.

GM:OnWeaponRaised(actor, weapon, raised)

shared packages/flow/hooks/sh_hooks.lua:413

Implements hook OnWeaponRaised

Plays the raise or lower gesture of the weapon's hold type when the raised state of the player's weapon changes. Only runs on the server, where the state is changed.

Parameters

  • actor Player
  • weapon Weapon weapon that was raised or lowered
  • raised Boolean new state

GM:PhysgunPickup(actor, entity)

shared packages/flow/hooks/sh_hooks.lua:497

Lets players with the physgun_pickup permission pick entities up with the physics gun, and players without it when a PlayerCanPhysgunPickup handler allows it. Plugins that want to refuse a pickup return false from PhysgunPickup; they do not return true from it, as that would keep the other handlers from refusing.

Parameters

  • actor Player
  • entity Entity the entity being picked up

Returns

  • Boolean true if the player may pick the entity up, nil otherwise

GM:PlayerBindPress(client, bind, pressed)

client packages/flow/hooks/cl_hooks.lua:598

Intercepts the undo bind and blocks it when the SoftUndo hook returns a value.

Parameters

  • client Player
  • bind String the bind that was triggered
  • pressed Boolean whether the key was pressed rather than released

Returns

  • Boolean true to block the bind, nil otherwise

GM:PlayerDeath(victim, _inflictor, _attacker)

server packages/flow/hooks/sv_hooks.lua:201

Stores the time at which the player may respawn, based on the respawn_delay config.

Parameters

  • victim Player the player who died
  • _inflictor Entity
  • _attacker Entity

GM:PlayerDeathSound(_victim)

server packages/flow/hooks/sv_hooks.lua:27

Mutes the default death sound.

Parameters

  • _victim Player

Returns

  • Boolean always true

GM:PlayerDeathThink(actor)

server packages/flow/hooks/sv_hooks.lua:208

Implements hook PlayerDeathThink

Respawns a dead player once their respawn time has passed.

Parameters

  • actor Player

Returns

  • Boolean always false

GM:PlayerDisconnected(actor)

server packages/flow/hooks/sv_hooks.lua:221

Implements hook PlayerDisconnected

Saves the data of the player unless their should_save_data field is false, tells all clients about the disconnect and logs it.

Parameters

  • actor Player

GM:PlayerGiveSWEP(actor, weapon, swep)

server packages/flow/hooks/sv_hooks.lua:495

Decides whether a player may give themselves a weapon. Requires the spawn_sweps permission and that the FLPlayerGiveSWEP hook does not return false. Invalid players are always allowed.

Parameters

  • actor Player
  • weapon String class of the weapon
  • swep Map information about the weapon from the weapon list

Returns

  • Boolean whether giving the weapon is allowed

GM:PlayerInitialized(actor)

shared packages/flow/hooks/sv_hooks.lua:189

Implements hook PlayerInitialized

On the server

Marks the player as initialized and, shortly after, runs PlayerInitialized on their client.

Parameters

  • actor Player

On the client

Rebuilds the spawn menu and the tool menu once the server has initialized the local player.

Parameters

  • actor

Defined in

GM:PlayerInitialSpawn(actor)

server packages/flow/hooks/sv_hooks.lua:57

Implements hook PlayerInitialSpawn

Sets up a newly connected player: assigns the flux_player class and the 'user' group, restores their saved data and announces the spawn to all clients. Bots are marked as initialized right away instead.

Parameters

  • actor Player

GM:PlayerModelChanged(target, new_model, _old_model)

shared packages/flow/hooks/sh_hooks.lua:439

Implements hook PlayerModelChanged

Assigns the compiled animation table of the new model to the player and, on the client, disables inverse kinematics for them. Does nothing if no new model is given.

Parameters

  • target Player
  • new_model String path of the new model
  • _old_model String path of the previous model

GM:PlayerNoClip(actor, state)

shared packages/flow/hooks/sh_hooks.lua:459

Decides whether a player may toggle noclip by asking the plugins through the PlayerEnterNoclip and PlayerExitNoclip hooks. If no plugin returns a value, leaving noclip is allowed and entering it requires the 'noclip' permission.

Parameters

  • actor Player
  • state Boolean true when entering noclip, false when leaving it

Returns

  • Boolean whether the change is allowed

GM:PlayerOneSecond(actor, cur_time)

server packages/flow/hooks/sv_hooks.lua:710

Implements hook PlayerOneSecond

Runs the PlayerPositionChanged hook if the player has moved since the previous check.

Parameters

  • actor Player
  • cur_time Number current CurTime()

GM:PlayerSay(actor, text, _team_chat)

server packages/flow/hooks/sv_hooks.lua:744

Implements hook PlayerSay

Passes chat messages that start with a command prefix to the command interpreter and hides them from the chat.

Parameters

  • actor Player
  • text String the chat message
  • _team_chat Boolean whether the message was sent to the team chat

Returns

  • String an empty string if the message was a command, nil otherwise

GM:PlayerSetModel(actor)

server packages/flow/hooks/sv_hooks.lua:165

Implements hook PlayerSetModel

Sets the model of a player. A string returned by the PrePlayerSetModel hook is used as the model, and false defers to the base gamemode. Otherwise bots and initialized players get the model from their 'model' networked variable (a citizen model if it is not set), and anyone else is left to the base gamemode.

Parameters

  • actor Player

GM:PlayerShouldTakeDamage(victim, attacker)

server packages/flow/hooks/sv_hooks.lua:268

Asks the FLPlayerShouldTakeDamage hook whether a player can be damaged. The damage is only blocked when the hook returns false.

Parameters

  • victim Player
  • attacker Entity

Returns

  • Boolean false if the hook has returned false, true otherwise

GM:PlayerSpawn(actor)

server packages/flow/hooks/sv_hooks.lua:75

Resets the state of a spawning player (model, collisions, visibility and the movement speeds from the config), runs the PostPlayerSpawn hook and creates their hands model.

Parameters

  • actor Player

GM:PlayerSpawnEffect(actor, model)

server packages/flow/hooks/sv_hooks.lua:363

Decides whether a player may spawn an effect. Requires the spawn_entities permission and that the FLPlayerSpawnEffect hook does not return false. Invalid players are always allowed.

Parameters

  • actor Player
  • model String model of the effect

Returns

  • Boolean whether spawning is allowed

GM:PlayerSpawnNPC(actor, npc, weapon)

server packages/flow/hooks/sv_hooks.lua:337

Decides whether a player may spawn an NPC. Requires the spawn_npcs permission and that the FLPlayerSpawnNPC hook does not return false. Invalid players are always allowed.

Parameters

  • actor Player
  • npc String type of the NPC
  • weapon String class of the weapon given to the NPC

Returns

  • Boolean whether spawning is allowed

GM:PlayerSpawnObject(actor, model, skin)

server packages/flow/hooks/sv_hooks.lua:310

Decides whether a player may spawn a prop, ragdoll or effect. Requires the spawn_entities permission and that the FLPlayerSpawnObject hook does not return false. Invalid players are always allowed.

Parameters

  • actor Player
  • model String model of the object
  • skin Number skin of the object

Returns

  • Boolean whether spawning is allowed

GM:PlayerSpawnProp(actor, model)

server packages/flow/hooks/sv_hooks.lua:284

Decides whether a player may spawn a prop. Requires the spawn_props permission and that the FLPlayerSpawnProp hook does not return false. Invalid players are always allowed.

Parameters

  • actor Player
  • model String model of the prop

Returns

  • Boolean whether spawning is allowed

GM:PlayerSpawnRagdoll(actor, model)

server packages/flow/hooks/sv_hooks.lua:469

Decides whether a player may spawn a ragdoll. Requires the spawn_ragdolls permission and that the FLPlayerSpawnRagdoll hook does not return false. Invalid players are always allowed.

Parameters

  • actor Player
  • model String model of the ragdoll

Returns

  • Boolean whether spawning is allowed

GM:PlayerSpawnSENT(actor, class)

server packages/flow/hooks/sv_hooks.lua:444

Decides whether a player may spawn a scripted entity. Requires the spawn_entities permission and that the FLPlayerSpawnSENT hook does not return false. Invalid players are always allowed.

Parameters

  • actor Player
  • class String class of the entity

Returns

  • Boolean whether spawning is allowed

GM:PlayerSpawnSWEP(actor, weapon, swep)

server packages/flow/hooks/sv_hooks.lua:418

Decides whether a player may spawn a weapon. Requires the spawn_sweps permission and that the FLPlayerSpawnSWEP hook does not return false. Invalid players are always allowed.

Parameters

  • actor Player
  • weapon String class of the weapon
  • swep Map information about the weapon from the weapon list

Returns

  • Boolean whether spawning is allowed

GM:PlayerSpawnVehicle(actor, model, name, tab)

server packages/flow/hooks/sv_hooks.lua:390

Decides whether a player may spawn a vehicle. Requires the spawn_vehicles permission and that the FLPlayerSpawnVehicle hook does not return false. Invalid players are always allowed.

Parameters

  • actor Player
  • model String model of the vehicle
  • name String name of the vehicle in the vehicle list
  • tab Map vehicle table from the vehicle list

Returns

  • Boolean whether spawning is allowed

GM:PlayerSwitchFlashlight(actor, on)

server packages/flow/hooks/sv_hooks.lua:781

Lets the PlayerSwitchedFlashlight hook decide whether a player may toggle their flashlight, and leaves the decision to the base gamemode when no handler returns anything. Plugin and schema handlers of PlayerSwitchFlashlight run before this one and replace it when they return a value.

Parameters

  • actor Player
  • on Boolean whether the flashlight is being turned on

Returns

  • Boolean whether the flashlight may be toggled

GM:PlayerTakeDamage(victim, _damage_info)

server packages/flow/hooks/sv_hooks.lua:555

Implements hook PlayerTakeDamage

Notifies the client of the damaged player, which shows the damage flash on their HUD.

Parameters

  • victim Player
  • _damage_info CTakeDamageInfo

GM:PlayerThink(actor, _cur_time)

server packages/flow/hooks/sv_hooks.lua:730

Implements hook PlayerThink

Runs the current action of the player, unless it is 'idle' or 'spawning'.

Parameters

  • actor Player
  • _cur_time Number current CurTime()

GM:PlayerUse(activator, target)

server packages/flow/hooks/sv_hooks.lua:852

Tells the client of the player to open the interaction menu for the player or entity they pressed the use key on, at most once a second.

Parameters

  • activator Player
  • target Entity the entity being used

GM:PopulateToolMenu()

client packages/flow/hooks/cl_hooks.lua:461

Implements hook PopulateToolMenu

Adds every registered Flux tool to the tool list of the spawn menu, then runs the SynchronizeTools hook.

GM:PostPlayerLoadout(actor, default_loadout)

server packages/flow/hooks/sv_hooks.lua:829

Implements hook PostPlayerLoadout

Strips the weapons of the player, gives them the default loadout and selects the first weapon of it, then runs the PlayerLoadoutGiven hook for the weapons that plugins add.

Parameters

  • actor Player
  • default_loadout List<String> weapon classes to give

GM:PostPlayerSpawn(actor)

server packages/flow/hooks/sv_hooks.lua:146

Implements hook PostPlayerSpawn

Gives the player their loadout, plus the tool gun and the physics gun if they have the toolgun and physgun permissions, then runs PostPlayerSpawn on their client.

Parameters

  • actor Player

RegisterClientSettings()

client packages/flow/hooks/cl_hooks.lua:575

Implements hook RegisterClientSettings ยท hook.Add id: FLLanguageSetting

Registers the language setting when the Settings plugin collects the settings, which it does while the schema is being included. On the first load the gamemode is not registered yet at that point and a GM method would not be called, which is why the handler is added with hook.Add instead.

GM:RenderScreenspaceEffects()

client packages/flow/hooks/cl_hooks.lua:484

Updates the blurred copy of the screen used by draw.blur_box and draw.blur_panel. Only does so while something has requested the blur, and no more often than the blur update interval unless Flux.blur_update_fps is 0.

GM:ServerRestart()

server packages/flow/hooks/sv_hooks.lua:760

Implements hook ServerRestart

Saves the data of every player before the server restarts.

GM:ShowHelp(_actor)

server packages/flow/hooks/sv_hooks.lua:756

Does nothing, which disables the default help menu.

Parameters

  • _actor Player

Saves everything when the server shuts down or changes the map: runs the FLSaveData hook and saves the data of every player. Flux.shutting_down is true from the start, so that the save handlers and the code which runs while the map unloads (an entity's OnRemove, for example) can tell.

GM:SoftUndo(_client)

client packages/flow/hooks/cl_hooks.lua:644

Implements hook SoftUndo

Asks the server to undo the last Flux undo entry of the local player.

Parameters

  • _client Player unused, the local player is always used

Returns

  • Boolean true if the local player has entries in their undo queue, nil otherwise

GM:SpawnlistContentChanged()

client packages/flow/hooks/cl_hooks.lua:637

Removes the sandbox hint timer about saving spawnlists.

GM:SpawnMenuOpen()

client packages/flow/hooks/cl_hooks.lua:629

Removes the sandbox hint timers and allows the spawn menu to open.

Returns

  • Boolean always true

GM:SynchronizeTools()

shared packages/flow/hooks/sh_hooks.lua:523

Implements hook SynchronizeTools

Copies every registered Flux tool into the tool table of the tool gun.

Updates the global UI offset from the rotation of the local player's view, so that HUD elements using it sway and settle back. Skipped while the player is frozen.

On the server

Runs the PlayerThink hook for every player eight times a second and the PlayerOneSecond hook once a second.

On the client

Checks once a second whether the screen resolution has changed and runs the OnResolutionChanged hook if it has.

Defined in

GM:TranslateActivity(actor, act)

shared packages/flow/hooks/sh_hooks.lua:213

Translates an activity into the animation that the Flux animation tables define for the player's model, weapon hold type and weapon state. On the ground this is the lowered or raised movement animation, in the air the jump, glide, swim or noclip animation and in a vehicle the sitting animation. Models without an animation table are handled by the base gamemode.

Parameters

  • actor Player
  • act Number activity to translate, ACT_ enum

Returns

  • Number translated activity or sequence ID, or nil if the tables have no match

GM:UpdateAnimation(actor, velocity, max_seq_ground_speed)

shared packages/flow/hooks/sh_hooks.lua:379

Keeps the playback rate handling of the base gamemode and, on the server, plays one of the idle fidget gestures of the animation table every once in a while when the player stands still on the ground. Does nothing for tables without fidgets.

Parameters

  • actor Player
  • velocity Vector velocity of the player
  • max_seq_ground_speed Number ground speed of the current sequence

Defined in