2748aa91caaffa05177d4a8992e401279e6c9228
- 版本号从 v1.5.31 升级至 v1.5.32 - 启动参数优化:外设等待间隔 0.5s→0.2s、最大重试 40→20、握手重试 20→8、启动重绘时长 20s→3s - handshakeMonitor:移除不必要的 clearOk 严格检查,满足 scale+size 即视为握手成功 - 移除启动阶段阻塞的两次同步 HTTP 请求(站名映射/远程版本),改由后台异步任务执行 - startupRedrawTask:简化为仅启动初重绘 3 次即进入长休眠,避免频繁重绘抢占主循环 - 票卡处理:扫描去重窗口 500ms→200ms、PASS 后回退休眠 0.35s→0.1s - 后台版本检查:VERSION_CHECK_INTERVAL 5s→15s,降低网络占用
FTC Ticketing System (Refactored)
A comprehensive ticketing solution for Minecraft (CC:Tweaked) with a modern Web Control Panel.
Features
- Ticket Machine (Lua): Issue tickets, print receipts, write to floppy disks.
- Gate (Lua): Validate tickets, control redstone doors, track entries/exits.
- Web Console:
- Real-time Dashboard: Live updates of sales and passenger flow via Socket.IO.
- Visual Line Editor: Manage stations and lines with an interactive SVG map.
- Fare Management: Configure fares with a visual fare chart.
- Logs: Track ticket usage and system operations.
- System Settings: Configure API endpoints and promotions.
- File Manager: Upload and manage audio files (
.dfpwm) for devices.
Project Structure
server/: Node.js Backend (Express + Socket.IO).services/: Data and logic handling.routes/: API endpoints.
web/: Frontend (Vue 3 + Socket.IO Client).index.html: The new Control Panel.index.js: Vue 3 logic.
Lua/: CC:Tweaked scripts.
Installation
- Prerequisites: Node.js 16+.
- Install Dependencies:
npm install
Running the Server
Development
npm start
Access the console at http://localhost:23333.
Production (PM2)
This project includes an ecosystem.config.js for PM2.
# Start
pm2 start ecosystem.config.js
# View logs
pm2 logs ticket-machine
# Restart
pm2 restart ticket-machine
Configuration
- Server Port: Default
23333. SetPORTenvironment variable to change. - Data Storage: All data is stored in
web/data/. - CC:Tweaked Devices:
- Run
install_machine.luaorinstall_gate.luaon your turtles/computers. - Point them to your server's IP (e.g.,
http://YOUR_IP:23333/api).
- Run
API
/api: Admin API (Stations, Lines, Fares, Logs)./api/public: Public API for devices (Ticket queries, Orders).- WebSocket: Connect to
/for real-time events (stations:updated,stats:ticket:updated, etc.).
Troubleshooting
Error: bind EADDRINUSE 0.0.0.0:23333
This means the port 23333 is already occupied.
- Stop the PM2 process:
pm2 stop ticket-machine - Find the process holding the port:
lsof -i :23333ornetstat -tunlp | grep 23333 - Kill the process:
kill -9 <PID> - Restart PM2:
pm2 restart ticket-machine
Error: Cannot find module 'express'
Run npm install in the project directory to install dependencies.
License
MIT
Languages
JavaScript
48.4%
HTML
22.6%
Lua
19.6%
CSS
9.4%