Skip to content
Back to top
View this page

# `frameimportant_variant`

Module for `FrameImportantVariant`.

FrameImportant

  Terraria blocks can be FrameImportant or not.

  FrameImportant blocks have different attributes depending on the specific animation frame they currently are in.

  Information about their current animation frame is saved in the world file itself.

  This mechanism is used for various purposes:

  - storing what kind of weed is growing on grass, and changing its name and color if it’s a Mushroom

  - storing the on-off state of `lihzahrd.terraria.data.classmembers.blocks.Torch`, and using it to determine whether it emits light

  - storing the kind of `lihzahrd.terraria.data.classmembers.blocks.Torch`, and using it to determine its color

  - …

class lihzahrd.terraria.data.frameimportant_variant.FrameImportantVariant(*, eq_u: Real | None = None, eq_v: Real | None = None, min_u: Real | None = None, min_v: Real | None = None, max_u: Real | None = None, max_v: Real | None = None, name: str | None = None, color: ColorRGB | None = None, solid: bool | None = None, blend: bool | None = None, merge: bool | None = None, transparent: bool | None = None, is_stone: bool | None = None, is_grass: bool | None = None, emit_light_color: ColorRGB | None = None)

  A variant of a FrameImportant block.

  An instance of this class represents a specific variant of a block, that means, the properties a block acquires if it’s in a certain animation frame, and the conditions for them to apply.

  `eq_u`, `eq_v`, `min_u`, `min_v`, `max_u`, `max_v` represent conditions which must be fulfilled; the not-`None` ones are AND-ed together by `evaluate()`.

  `name`, `color`, `solid`, `blend`, `merge`, `transparent`, `is_stone`, `is_grass`, and `emit_light_color` are properties, and if they are not `None`, they are applied to the block containing this variant.

  eq_u: Real | None

    The exact value `u` can have for this variant to apply, or `None` to skip this check.

  eq_v: Real | None

    The exact value `u` can have for this variant to apply, or `None` to skip this check.

  min_u: Real | None

    The minimum value `u` can have for this variant to apply, or `None` to skip this check.

  min_v: Real | None

    The minimum value `v` can have for this variant to apply, or `None` to skip this check.

  max_u: Real | None

    The maximum value `u` can have for this variant to apply, or `None` to skip this check.

  max_v: Real | None

    The maximum value `v` can have for this variant to apply, or `None` to skip this check.

  name: str | None

    The name that the tile should take if this variant applies, or `None` to not alter it.

  color: ColorRGB | None

    The color that the tile should take if this variant applies, or `None` to not alter it.

  solid: bool | None

    The solidity that the tile should take if this variant applies, or `None` to not alter it.

  blend: bool | None

    Unknown.

  merge: bool | None

    Unknown.

  transparent: bool | None

    The transparency (letting light through) that the tile should take if this variant applies, or `None` to not alter it.

  is_stone: bool | None

    Whether this tile should count as stone if this variant applies, or `None` to not alter it.

  is_grass: bool | None

    Whether this tile should count as grass if this variant applies, or `None` to not alter it.

  emit_light_color: ColorRGB | None

    The color that the tile should take if this variant applies, or `None` to not alter it.

  evaluate(u: Real | None = None, v: Real | None = None) → bool

    Determine whether this variant should be applied or not.

    Parameters:

      - u – The u parameter of the block.

      - v – The v parameter of the block.

    Returns:

      Whether this variant should be applied or not.