Skip to main content

Battery

A light part that contains 400 energy and is prefilled. Cannot be recharged.

It is a craftable and spawnable flammable solid.

It cannot be resized.

At its default size (2x1x1) it has a durability of 1.

By default, its colour is #383637.

It requires 1 Sulfur and 1 Wire to be crafted.

Methods


GetResource() → resource

Gets the name of the resource contained, will return the string "nil" if nothing is stored, rather than actually returning nil.

The resource return can be any of the following types:

  • string
  • "nil"

GetResourceAmount() → amount

Gives you the total amount of objects in the container.

The amount return is a number.


GetAmount() → amount

warning

This method is deprecated. Use :GetResourceAmount() instead.

Gives you the total amount of objects in the container.

The amount return is a number.

Events


ContainerChanged(resourceType, resourceAmount)

Fires when the amount of the resource in the container changes.

The parameters for ContainerChanged are as follows:

  • The resourceType parameter is a string that can be Power, Solid, or Fluid
  • The resourceAmount parameter is a number.