Docs · Engineering reference
Fuel
docs/features/fuel.mdEdit on GitHub
Design context: addons/LifeFramework/Scripts/Game/Feature/Fuel/Feature.md.
LF_FuelStockRules — Feature/Fuel/LF_FuelStockRules.c (#3327, framework #788)
- ✅ Pure station-stock rules, no world (merged, in-dev). A station (
LF_FuelStock) holds litres up to a capacity.PlanSaleclamps the litres by stock first, then by what the buyer can pay, and charges only for the litres that move; an empty station (under the minimum stock to sell) refuses with EMPTY, cash that cannot buy one litre with NO_MONEY, price 0 is the kill switch (OFF).PlanDeliverylands only the room left and pays only for the litres that landed; a full station refuses with FULL. Prices are hundredths of a cash unit per litre; the fractional part rides inLF_FuelChargeLedger(per key, unsaved by design), so ten litres at 0.30 cost exactly 3. Plans do not change the station;ApplySale/ApplyDeliverydo. Int maths throughLF_Utils. Tests:fuel/fuel-stock-rules(LOGIC).
LF_FuelConfig — Feature/Fuel/LF_FuelConfig.c, Configs/Fuel/LF_Fuel.conf (#3327)
- ✅ One table:
m_bEnabled(0 in the core),m_iPricePerLitre,m_iDeliveryPayPerLitre,m_iCapacity,m_iStartLitres,m_iLitresPerDelivery,m_iMinStockToSell.Sanitizeswitches an unusable table off withLF_Debug.Error("Fuel", ...). No pump, station component or save yet: later cards. Testfuel/fuel-stock-rules(LOGIC).
The 1989 fuel numbers — Configs/Fuel/LF_Fuel_Everon1989.conf (pack, #3331)
- 🔧 Pack overlay of
LF_FuelConfig(listed in the mission header;LF_FuelConfig.ApplyLayersreads it, an overlay sets only the fields it writes). New core fields:m_iWholesalePerLitre(the depot's price per litre, core 60),m_TankerPrefab(empty in the core),m_aStations(LF_FuelStationRow: id, capacity, starting litres; an overlay's list replaces the earlier one;NewStationFor(id)makes a stock from its row, else the table values). The pack turns fuel on, wholesale 0.90, delivery pay 1.35 a litre, a 1000 l tanker load (vanillaUral4320_tanker_CIV_orange.et), stationssaint-philippe3000 l (900 at start),saint-pierre2500 (700),morton2000 (500). A full haul costs $900 at the depot, pays $1350, margin $450 (a third of the pay), about $450/h at an assumed hour a haul: above the garbage round's ~$400/h, 2x under police patrol pay; the only route job you can lose money on. Testeveron/fuel-haul(pack leg).
LF_FuelStationComponent, LF_FuelBuyAction — Feature/Fuel/LF_FuelStationComponent.c, LF_FuelBuyAction.c, Prefabs/Props/Fuel/LF_FuelPump.et (#3328, framework #788)
- 🔧 A pump that sells from its station's stock (merged, in-dev). Put
LF_FuelStationComponent(station id attribute) on a pump withLF_FuelBuyAction;Prefabs/Props/Fuel/LF_FuelPump.etis the vanilla tank pistol with both. While the fuel config is on, "Fill the tank" finds the vehicle at the pump (server, 6 m) andSellworks out everything itself: litres = the tank's free room cut by the station's stock (LF_FuelStock, one per station id, shared by its pumps, made from the config row) and by the buyer's cash (LF_FuelStockRules.PlanSaleFor); it takes the cash, fills the tank, then takes the litres from the station. A client sends no litres and no price. An empty station refuses with "The tanks are dry. The depot truck is due."; no cash, a full tank and no vehicle each have a line; a dead, downed or cuffed buyer is refused; a refusal changes nothing. The vanilla free refuel is off at that pump (SCR_FuelSupportStationComponent.IsValidis modded), only while the config is on; the core ships it off, so a pump behaves as vanilla until a server opts in. Not yet: the pack's pumps still use the vanilla prefab with no station id, so no pump in the world sells yet: a later card. The stock is saved (next entry). Testfuel/station-stock(WORLD).
LF_FuelStockSavePayload — Feature/Fuel/LF_FuelStockSave.c, save section fuelstock (#3329, framework #788)
- 🔧 Each station's litres survive a restart (merged, in-dev). A save section (v1) of
LF_FuelStockRow(station id, litres), one per station opened so far, sorted by id; the capacity is never saved, the config owns it. A load replaces every stock: litres cut to the capacity, an empty id, a negative count and a duplicate id dropped with a log line, and (when the config lists its stations) an id with no config row dropped as a retired station; a config with no rows keeps any id (table values). A save from before the section has nothing to load (a station opens at its starting litres on first use, and an unrelated store load leaves open stations alone). A dry station is still dry after a restart and a delivery is still there.LF_FuelStationComponentgainedStocks()andForgetStocks()for it. Locktools/validation/record-shapes/fuelstock.json. Testfuel/fuel-stock-restart(PERSISTENCE, with thewt e2erestart check).
The Saint-Philippe forecourt sells from stock — tools/town/kits/fuel.json, Place_saint-philippe_fuel.layer, LF_FuelStationComponent.SellingPumpCovers (#3337, framework #788)
- 🔧 The island station (b107) has two
LF_FuelPumprows (pump-a,pump-b; station idsaint-philippe, the 3000 l stock of the 1989 pack) placed bytown fit saint-philippe fuel --refit, each on the exact spot of a vanilla pump under the canopy (merged, in-dev). A layer cannot delete the map's own pump, soReplacesVanillaalso returns true for a vanilla pump with a selling LF pump within 0.6 m (COVER_M, a sphere query on the vanilla pump's ownIsValid): the free refuel under it is off while the fuel config is on, and unchanged while it is off. The depot run now has a customer, and an emptied station shows "The tanks are dry". Testfuel/pump-cover(WORLD). - Pack test
everon/fuel-pump-station(LF_Test_EveronFuelPumpStation): the forecourt pump station id (saint-philippe) has a row in the pack fuel overlay, so its saved litres survive a load.
The tanker haul — Feature/Fuel/LF_FuelHaul.c, LF_FuelDepotComponent.c, Prefabs/Props/Fuel/LF_FuelDepot.et, grid cell fuel-haul (#3330, framework #788)
- 🔧 Buy a load at the depot, pump it into a station, get paid for what arrived (merged, in-dev).
LF_FuelDepotComponentplusLF_FuelDepotLoadAction("Load the tanker") onLF_FuelDepot.et: the server finds the tanker within 12 m (a vehicle with a fuel-storage node, the vanilla Ural tanker's cistern, never its engine tank) andLF_FuelHaul.Buyloads the configured litres per delivery, cut by the cargo tank's room and the hauler's cash, charged atm_iWholesalePerLitrefor the litres that went in (cash first, then the tank; a refusal changes nothing; no cash at all buys nothing).LF_FuelHaulPumpAction("Pump into the station tanks", added toLF_FuelPump.et) callsLF_FuelHaul.PumpIn: only the station's free room lands (PlanDelivery), the litres are taken out of the tanker first, the hauler is paidm_iDeliveryPayPerLitrefor the litres that landed and the rest stays in the tanker; a full station (STATION_FULL) and an empty tanker refuse. Only litres bought at a depot are paid:LF_FuelHaulkeeps the bought litres per tanker (unsaved, like vehicle fuel), and a pump-in offers the smaller of the cargo and that count, so the vanilla Ural's 900 l spawn fill and a free vanilla refill earn nothing (NOT_BOUGHT, "That fuel was not bought at the depot."). The same checks as a pump sale: fuel stock on, a hauler alive, not downed or cuffed. A client sends no litres and no price; the stock is the saved per-station stock. Grid cellfuel-haul(c17r3, GridWorld) holds a depot and a pump (station idgrid-haul). Testfuel/haul(WORLD): 500 l bought, 300 l of room: stock +300, paid for 300, 200 l left in the tanker. The Montignac depot kit (tools/town/kits/fuel-depot.json) has adepot-loadrow for it; the layerPlace_montignac_depot.layergets the barrel when atown-pass runstown fit montignac depot --refit(refused outsidews/town-draft-montignac-depot). The tanker comes from outside the cell (grid cells do not place vehicles).
The Montignac fuel depot yard — Worlds/MainWorld/MainWorld_Layers/Place_montignac_depot.layer, tools/town/kits/fuel-depot.json (#3336)
- 🔧 Dark until state 2c (merged, in-dev). The depot slot fitted on barn b95: two fuel tanks and a pump tank, a parked orange Ural tanker, drums, pallets, an attendant hut, a
fuel_depotpole sign (pack sign defLF_Signs_FuelDepot.conf), a price board and a net-fence ring with a gate gap, all base-game props. There is noLF_FuelDepotComponenton main, so no row carries a buy action yet; the place kindFuelDepotis in no system catalogue yet. The depot is a map POI: the pack rowFuelDepotinLF_MapPois_Everon1989.conf(work,poi_Fuel, public, labelLF-MapPoi_FuelDepot) shows theLF_PlaceComponentofFit_montignac_depot_Place. The baseline pass (2026-11-21) refitted the slot on the probed ground: thedepot-loadbarrel is in the layer, the pallet box is off the base-map fence, drum-base-2 carries a 1.2 cmlift, and the price board is allowlisted foraction-off-mesh(its panel is built at runtime).
The Saint-Philippe fuel kiosk: attendant, goods and pumps seated — tools/town/kits/fuel.json, Place_saint-philippe_fuel.layer, LF_ShopStock_FuelKiosk.conf, FuelKiosk_Display.et (fix, framework #788)
- 🔧 Merged, in-dev. The attendant (
LF_Npc_FuelClerk_1) and the night-shiftcounteranchor now stand behind the counter and the register (building-local z -1.45, counter back edge -1.17), turned to the customers; before, the day clerk stood at the counter's end on the customer side, facing the door wall. The kit rows are the source, so a refit keeps it. - 🔧 The kiosk sells what the clerk says. Pack stock
fuel_kiosk(own overlay file, listed in the mission header): the tourist map of Everon $25, water $4, soda $4, chocolate bar $4, crackers $5, sold at the counter throughkiosk-shop(a replicated shop entity withLF_ShopAction).kiosk-displaystands one model of each on the building's own wooden shelf unit, meshes only: nothing can be taken, the till sells. The clerk's line (re-recorded,tools/assets/dialogue/fuel_clerk) says "maps and snacks"; there is no motor oil item in the base game, so it no longer promises oil. Proof:agent-box/proofs/fuel-kiosk-proof.mjsbuys the map ($25 off $1,000,[LFDebug:Shop] bought item=...LF_TouristMap). Testeveron/village-stocklists the stock. - 🔧 The two
LF_FuelPumprows moved onto the vanilla pump spots (the pump pair ofFuelStation_E_01_V1in the building frame: local x 11.355 and 0.709, z 4.141 and 4.015) and onto the platform's measured top (18.8215, a ray from under the canopy at each spot; the pump prefab's origin is its base, y 0.000 to 1.910). They had stood 1.8 to 1.9 m off those spots and 21 to 27 cm below the platform top, becausefreerows are left as typed and the placement audit only flags what its traces can see (a pump's bottom face reads NO SUPPORT, a note, not a finding). The fuel slot's footprint margin went from 6 to 8 m for the true pump spot (6.5 m off the shop).