Skip to main content

Mindcontrolover

Based on game build 714014 | Last updated: 2026-03-08

Overview

MindControlOver is a UI widget that displays the visual overlay for mind control effects. It inherits from UIAnim and reacts to mindcontrollevel events from its owner entity to animate transitions between states: empty (inactive), in-progress (level rising), loop (fully active), and out (fading out). It uses animated states (empty, in, out, loop) from the mind_control_overlay asset bank to provide feedback during mind control activation and decay.

Usage example

local owner = GetPlayer()
local overlay = require("widgets/mindcontrolover")
local mindcontrol_over = overlay(owner)
owner:AddComponent("mindcontroller")
-- When mind control level changes via:
owner:PushEvent("mindcontrollevel", { level = 0.75 })

Dependencies & tags

Components used: None identified
Tags: None identified

Properties

PropertyTypeDefault ValueDescription
ownerentity or nilnilThe entity this overlay is attached to; used to listen for mindcontrollevel events.
levelnumber0Current internal level of the overlay animation (0.0 to 1.0).
targetlevelnumber0Target level being approached; used to defer animation updates.
tasktask or nilnilDelayed task handle used to decay the overlay after PushLevel.

Main functions

PushLevel(level)

  • Description: Updates the overlay animation to reflect a new mind control level. Handles transitions between idle, fade-in, loop, and fade-out animations based on the level value.
  • Parameters: level (number) — A value clamped to [0, 1]. Levels 1 trigger a looping animation; levels > 0 and < 1 trigger an "in" animation; level 0 triggers "out" or returns to "empty".
  • Returns: Nothing.
  • Error states: No side effects if level is unchanged from current; does not cancel itself unless a decay task is pending.

OnUpdate(dt)

  • Description: Called every frame (when not paused and server is not paused) to smoothly decay the overlay level when active. Handles animation progress and transition to "empty" state when decay completes.
  • Parameters: dt (number) — Delta time in seconds since last frame.
  • Returns: Nothing.
  • Error states: Exits early if TheNet:IsServerPaused() is true; decays at rate 1 / IN_TIME per second.

Events & listeners

  • Listens to: mindcontrollevel — Fired by the owner entity when its mind control level changes; passes the new level value.
  • Pushes: None identified