Resurrectbutton
Based on game build 714014 | Last updated: 2026-03-08
Overview
Resurrectbutton is a UI widget that renders and manages the resurrection button in the Heads-Up Display (HUD). It integrates with input systems (keyboard and controller) and responds to the current HUD focus state. When activated, it delegates the actual resurrection logic to the playercontroller component's DoResurrectButton() method. It also supports dynamic texture and tooltip updates based on the resurrection method (e.g., standard effigy vs. Wendy's grave).
Usage example
local resurrect_button = AddChild(inst.HUD, CreateWidget(ResurrectButton, player))
resurrect_button:SetType("grave") -- Show grave-specific icon and text
resurrect_button:ToggleHUDFocus(true) -- Enable HUD focus
Dependencies & tags
Components used: playercontroller (accessed via self.owner.components.playercontroller:DoResurrectButton())
Tags: None identified.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
owner | entity | nil | The owner entity (typically the player) for which this button operates. |
hud_focus | boolean | false | Controls whether the button should display controller-specific text. |
button | ImageButton | nil | The clickable button widget used for visual representation and interaction. |
text | Text | nil | The label that displays localized input instructions (e.g., "[A] Resurrect"). |
shown | boolean | nil | Inherited from Widget; determines visibility. |
Main functions
ToggleHUDFocus(focus)
- Description: Updates the HUD focus state and refreshes the button's text visibility.
- Parameters:
focus(boolean) — whether HUD controls should be enabled and displayed. - Returns: Nothing.
- Error states: None.
SetScale(pos, y, z)
- Description: Sets the widget's scale and inversely scales the embedded text to maintain legibility.
- Parameters:
pos(number | vector) — horizontal scale factor, or a vector withx,y,zcomponents.y(number, optional) — vertical scale factor ifposis a number.z(number, optional) — depth scale factor ifposis a number.
- Returns: Nothing.
OnShow()
- Description: Updates the button's text based on HUD focus and controller presence. Shows the text only if HUD is focused and a controller is attached.
- Parameters: None.
- Returns: Nothing.
- Error states: Text is hidden if
hud_focusisfalseor no controller is attached.
CheckControl(control, down)
- Description: Handles controller input for resurrection. Called by
PlayerHud:OnControl. - Parameters:
control(enum) — the control being pressed (e.g.,CONTROL_CONTROLLER_ATTACK).down(boolean) — whether the control is pressed (true) or released (false).
- Returns:
trueif the event was consumed (resurrection triggered); otherwisenil. - Error states: Returns
nilifshownisfalseordownisfalse.
DoResurrect()
- Description: Triggers the resurrection action by calling
playercontroller:DoResurrectButton(). - Parameters: None.
- Returns: Nothing.
- Error states: Early return with no effect if
playercontrollercomponent is missing.
SetType(effigy_type)
- Description: Updates the button’s icon, tooltip, and textures based on the resurrection method.
- Parameters:
effigy_type(string ornil) — either"grave"for Wendy’s resurrection grave, ornilfor standard effigy. - Returns: Nothing.
- Error states: No-op if
effigy_typeis unrecognized (only"grave"andnilare handled explicitly).
Events & listeners
- Listens to:
continuefrompause(onTheWorld) — triggersOnShow()if the button is currently visible, restoring text visibility after resuming from pause.