Nightvisionfruitover
Based on game build 714014 | Last updated: 2026-03-08
Overview
Nightvisionfruitover is a UI widget that displays a visual overlay and plays sound when the player has the nightvision_fruit status effect active. It extends UIAnim and listens for changes to the player’s condition table (via the ccoverrides event) to toggle the overlay on or off. It also responds to the onremove event to ensure cleanup when the widget is removed.
Usage example
-- Typically instantiated internally by the game when the player enters night vision mode
local overlay = NightVisionFruitOver(player)
-- Automatic toggling via event listeners handles show/hide; no manual calls needed
Dependencies & tags
Components used: playervision (via GetCCTable())
Tags: None identified.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
owner | ent | nil | The player entity this overlay belongs to. |
shown | boolean | false | Tracks whether the overlay is currently visible. |
hidetask | task | nil | Delayed task used to hide the overlay after the post-animation plays. |
Main functions
Toggle(show)
- Description: Shows or hides the overlay based on the
showboolean. Ensures transitions only occur when state changes. - Parameters:
show(boolean) — iftrue, enables the overlay; otherwise, disables it. - Returns: Nothing.
Enable()
- Description: Makes the overlay visible, plays the entry animation (
over_prefollowed byover_idleloop), and starts the sound effect. - Parameters: None.
- Returns: Nothing.
- Error states: Cancels any pending
hidetaskto prevent premature hiding.
Disable()
- Description: Initiates the exit animation (
over_pst) and schedules hiding after the animation completes. Also stops the sound effect. - Parameters: None.
- Returns: Nothing.
- Error states: Cancels any existing
hidetaskbefore scheduling a new one.
Events & listeners
- Listens to:
ccoverrides(onowner) — triggersToggle()when condition table changes; checks forcctable.nightvision_fruit.onremove(onself.inst) — callsToggle(false)to clean up overlay state.
- Pushes: None.