Skip to content

FCTostin-team/linked-belt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

telegram:FCTostin FCT Linked-Belt Generator GitHub

Factorio: 2.0+

Platform: Web Frontend: Vanilla JS Styles: CSS3 Markup: HTML5 Status: Active Coverage: Manual i18n

Important

This tool generates console commands (/c) for Factorio. It does not patch saves or mods directly.

Table of Contents

Features

  • Lua command generation for linked belts Generates /c commands to spawn linked-belt entities at player-relative coordinates.

  • Tag-driven pairing workflow Lets you define custom tags for source and destination belts so you can wire pairs predictably.

  • Auto-generated link command Builds a combined command using game.get_entity_by_tag(...), sets linked_belt_type (input/output), then calls connect_linked_belts(...).

  • Copy-to-clipboard UX One-click copy buttons for each generated command block with instant visual feedback.

  • Built-in localization layer Supports multiple UI languages via profile-based locale scripts and persists selection in localStorage.

  • Factorio-themed frontend Pixel-ish dark style tuned to match the in-game visual vibe.

Technology Stack

  • Languages: HTML5, CSS3, vanilla JavaScript (ES6+)
  • Runtime model: Static client-side web app (no backend, no build step)
  • Localization: Dynamic script loading from profiles/*.js
  • Persistence: Browser localStorage for language preference
  • Target domain: Factorio linked-belt command authoring

Technical Notes

Project Structure

.
β”œβ”€β”€ index.html           # App markup and UI layout
β”œβ”€β”€ style.css            # Factorio-inspired styling and animations
β”œβ”€β”€ script.js            # Core command generation, localization, clipboard logic
β”œβ”€β”€ profiles/            # Locale dictionaries loaded at runtime
β”‚   β”œβ”€β”€ en.js
β”‚   β”œβ”€β”€ ru.js
β”‚   └── ...other locales
β”œβ”€β”€ README.md
β”œβ”€β”€ CONTRIBUTING.md
β”œβ”€β”€ CODE_OF_CONDUCT.md
└── LICENSE

Key Design Decisions

  1. No framework, no bundler The project stays framework-free to keep startup overhead near-zero and make contribution friction minimal.

  2. Deterministic command templates Command templates are stored as static string literals and patched only at tag placeholders, making generated output predictable.

  3. Lazy locale loading Locale files are loaded only when needed, so the default initial load remains lightweight.

  4. Graceful i18n fallback If a locale cannot be loaded, the app automatically falls back to Russian to avoid a broken UI.

Tip

If you are shipping this tool on a static host, keep the profiles/ directory intact; locale loading is path-based.

Getting Started

Prerequisites

You only need:

  • A modern browser (Chrome, Edge, Firefox, Safari)
  • Factorio client (for actually executing generated console commands)

Optional but useful for contributors:

  • Git
  • Any local static server (for example python -m http.server)

Installation

# 1) Clone the repo
git clone https://github.com/OstinUA/linked-belt.git

# 2) Enter the project folder
cd linked-belt

# 3) Run locally (option A: open directly)
# Open index.html in your browser

# 4) Run locally (option B: local static server, recommended)
python -m http.server 8080
# then open http://localhost:8080

Note

Direct file-open mode works, but using a local server is more robust for testing locale script loading and browser behavior consistency.

Testing

This repository currently has no formal automated test suite, but you can run pragmatic quality checks:

# Validate JS syntax
node --check script.js

# Quick static smoke test with a local server
python -m http.server 8080
# open http://localhost:8080 and verify:
# - tag inputs update all command blocks
# - copy buttons work
# - language switching updates labels and persists after reload

Manual functional checklist:

  1. Enter two distinct tags.
  2. Confirm both belt commands use the correct tags.
  3. Confirm combined command references both tags and links entities.
  4. Paste commands into Factorio console and validate behavior in-game.

Deployment

This is a static web app, so deployment is straightforward.

Static Hosting

  • GitHub Pages
  • Netlify
  • Vercel (static mode)
  • Any CDN/object storage static site hosting

Minimal Deployment Flow

# Push main branch and publish root as static content
git push origin main

Warning

If you deploy under a subpath, ensure relative paths like profiles/<lang>.js remain resolvable.

Usage

1) Open the app in browser.
2) Set tag for loading belt (input), e.g. iron_bus_in.
3) Set tag for unloading belt (output), e.g. iron_bus_out.
4) Copy command #1 and execute in Factorio console.
5) Copy command #2 and execute in Factorio console.
6) Copy combined command and execute it to link both entities.

Example generated linking snippet:

/c
local i = game.get_entity_by_tag('iron_bus_in')
local o = game.get_entity_by_tag('iron_bus_out')
i.linked_belt_type = 'input'
o.linked_belt_type = 'output'
i.connect_linked_belts(o)

Caution

Tags must be unique and exact. If either tag points to the wrong entity (or no entity), linking will fail.

Configuration

There is no .env or server-side config in this project.

Current configurable behavior:

  • Language selection is persisted in localStorage under key: linked-belt-lang.
  • Supported locales are defined by files in profiles/ and options in the language dropdown.
  • Default fallback locale is Russian (ru) when a selected locale fails to load.

License

Distributed under the Apache License 2.0. See LICENSE for details.

Community and Support

Project created with the support of the FCTostin community.

YouTube Telegram Steam

Support the Development

Patreon Boosty

Contacts