Skip to content

Shop

Buys from and sells to Earth. Use get_component("shop") to automate surplus sales or purchases when a threshold is reached. The same catalogue and prices are used by the Shop UI.

Access: get_component("shop") · Like every component, exposes .id and .name.

Sell a positive whole-number quantity of item_id, defaulting to 1. The complete quantity is removed from the lowest-indexed matching Inventory slots in one transaction; if Inventory contains fewer units, nothing is sold. Battery products refund their charge percentage, with a 50% minimum; fully charged batteries refund their full normal value. Use the Inventory page when you need to choose one exact battery instance.

Returns: SaleResult (.status, .message; payload .item_id, .units, .credits)

StatusKindMeaning
"ok"successSale completed: .item_id × .units; received .credits cr
"not_sellable"rejectionThe requested item cannot be sold
"no_stock"rejectionInventory does not contain the requested quantity

Raises: TypeError (quantity must be a finite whole number), ValueError (quantity must be greater than zero), OverflowError (quantity outside the supported range)

Sell every unit of item_id currently in Inventory in one transaction. There is no per-unit cooldown. Each battery product is valued from its own retained charge, with a 50% minimum and full normal value at full charge.

Returns: SaleResult · Outcomes: "ok" / "not_sellable" / "no_stock"

Buy a positive whole-number quantity of item_id, defaulting to 1. The complete quantity must be affordable and fit in base Inventory; otherwise nothing is charged or delivered. Purchases are placed in base Inventory, not delivered directly to a machine or remote outpost.

Returns: ActionResult

StatusKindMeaning
"ok"successPurchase completed
"not_found"rejectionNo such catalogue item
"locked"rejectionThe required feature, recipe, or operation is locked
"insufficient_credits"rejectionAvailable credits are below the total cost
"inventory_full"rejectionInventory has no capacity for the result

Raises: TypeError / ValueError / OverflowError for malformed quantities

Every available catalogue entry as a list of {id, name, cost} objects. Use to pick a target dynamically or to show a filtered picker in a script. The Earth shop never runs out of catalogue items; entries hidden by tech gates don’t appear.

Returns: List of ShopItem {id, name, cost}