Fuelmaster
Based on game build 714014 | Last updated: 2026-03-03
Overview
Fuelmaster provides a mechanism to dynamically adjust the fuel efficiency multiplier for an entity. It is designed to be attached to entities that burn fuel (e.g., campfires, lanterns, beefalo ovens) and allows external systems (e.g., upgrades, environment effects, or character modifiers) to modify how long fuel lasts or how efficiently it burns. The component supports a static multiplier (bonusmult) and a dynamic callback function (bonusfn) that can compute per-item adjustments.
Usage example
local inst = CreateEntity()
inst:AddComponent("fuelmaster")
inst.components.fuelmaster:SetBonusMult(1.5)
inst.components.fuelmaster:SetBonusFn(function(inst, item, target) return item.bonus or 1 end)
local multiplier = inst.components.fuelmaster:GetBonusMult(item, target)
Dependencies & tags
Components used: None identified
Tags: None identified
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
bonusmult | number | 1 | A constant multiplier applied to all fuel consumption/burn calculations. |
bonusfn | function or nil | nil | An optional callback function that computes per-item bonuses. |
Main functions
SetBonusMult(mult)
- Description: Sets the constant bonus multiplier applied to fuel usage calculations.
- Parameters:
mult(number) — the multiplier to apply (e.g.,1.5for +50% fuel efficiency). - Returns: Nothing.
SetBonusFn(fn)
- Description: Sets the optional callback function used to compute item-specific bonuses. The function can override or adjust the base
bonusmultdynamically based on the item being used and the target entity. - Parameters:
fn(function) — a function of the formfn(inst, item, target), expected to return a numeric multiplier. - Returns: Nothing.
GetBonusMult(item, target)
- Description: Computes and returns the final fuel multiplier, combining the
bonusfnresult (if present) andbonusmult. Used by other systems (e.g., fuel components) to determine how fuel should be consumed. - Parameters:
item(any) — the fuel item being consumed (e.g., a torch, log, or bulb).target(any) — the entity consuming the fuel (typicallyself.inst).
- Returns: number — the effective multiplier. Defaults to
1ifbonusfnisnil. - Error states: No explicit error handling; returns
bonusmultalone ifbonusfnisnil. Behavior depends on the correctness ofbonusfn's return value.
Events & listeners
None identified