Skip to main content

Weedplantpage

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

Overview

WeedPlantPage is a UI widget that displays detailed information for a specific weed plant type in the Plant Registry. It inherits from PlantPageWidget and handles rendering dynamic UI elements for plant growth stages, water and nutrient consumption, product output, and effects — all gated by the player’s research progress (via ThePlantRegistry). It also manages keyboard/controller focus navigation between UI elements.

Usage example

local WeedPlantPage = require "widgets/redux/weedplantpage"

-- Assuming `plantspage` (parent) and `data` (plant-specific data) are defined:
local page = WeedPlantPage(plantspage, {
plant = "weeds",
plant_def = prefabs.weeds,
info = {
{ text = "SEED", bank = "weeds", anim = "seed", grow_anim = "grow" },
{ text = "SAPLING", bank = "weeds", anim = "sapling", grow_anim = "grow" },
{ text = "MATURE", bank = "weeds", anim = "mature", grow_anim = "grow" }
}
})

-- The widget automatically renders and handles focus.

Dependencies & tags

Components used: None (pure UI widget, no entity components). Tags: None identified.

Properties

PropertyTypeDefault ValueDescription
known_percentnumberThePlantRegistry:GetPlantPercent(...)Current research progress level (0–1) for the plant.
cursorImage widgetnilFocus cursor for UI navigation.
plant_nameText widgetnilDisplays the plant’s name or "MYSTERY_PLANT".
water, nutrients, product, effectsText widgetsnilSection headers for respective categories.
water_icons, nutrients_iconsarray of Image widgetsnilIcon groups indicating consumption/restoration direction/magnitude.
plant_gridarray of plant-stage widgets{}Grid of growth-stage cells showing animation and lock state.
plant_grid_rootWidgetnilContainer for the growth-stage grid.

Main functions

_DoFocusHookups()

  • Description: Configures directional focus navigation (MOVE_UP/DOWN/LEFT/RIGHT) between plant-grid cells and detail-section elements (nutrients, product, etc.).
  • Parameters: None.
  • Returns: Nothing.

BuildPlantGrid()

  • Description: Dynamically builds and positions the grid of plant growth stages (e.g., seed → sapling → mature), showing locked/unlocked visuals and animating stages based on research progress.
  • Parameters: None.
  • Returns: Nothing.

Events & listeners

  • Listens to: None (no inst:ListenForEvent calls).
  • Pushes: None (no inst:PushEvent calls).