How jericofx/advance-mechanic works
Purpose and Runtime
This is a FiveM Lua resource implementing a multi-shop mechanic-job system: vehicle service, diagnostics, degradation, tuning, towing, missions, invoicing, and shop operations. FiveM loads it through fxmanifest.lua; side-specific bootstraps are client/init.lua and server/init.lua. Shared framework/config abstractions live in shared/config.lua and shared/framework.lua.
Client Interaction Layer
Client modules own player-facing interactions, vehicle natives, ox_lib menus/points/cache, and local effects. The mechanic workflow is assembled from inspection, maintenance, diagnostics, parts, shop, garage, and lift modules:
• client/modules/inspection.lua
• client/modules/maintenance.lua
• client/modules/diagnostic.lua
• client/modules/shops.lua
• client/modules/lifts.lua
Client actions must cross to the server for authorization, persistence, inventory/economic mutation, and other authoritative changes.
Shop and Business Domain
Shops are persistent businesses with ownership, employees, configurable zones, storage, and lifts. The server manages business records and access decisions, while clients materialize shop zones and owner/employee UI:
• server/modules/business.lua
• server/modules/shops.lua
• client/modules/shops.lua
• client/modules/employees.lua
• client/modules/garage.lua
Admin-driven shop creation is a client placement flow followed by server validation and database creation. Per-shop zones/lift positions form the boundary between spatial interaction and persisted business state.
Vehicle Service and Customization
Vehicle work is divided by service domain: damage/inspection, fluids and component state, engine replacement, suspension setup, paint/wrap, and performance tuning. Client modules apply visual/native vehicle behavior; matching server modules validate and persist eligible operations:
• client/modules/damage.lua
• client/modules/engine_swap.lua
• client/modules/suspension_setup.lua
• client/modules/paint_booth.lua
• client/modules/tuning.lua
• server/modules/vehicles.lua
• server/modules/validation.lua
Vehicle changes likely use framework vehicle ownership/storage conventions and require server authority before durable updates.
Fluid Degradation and Runtime Effects
Fluid/component degradation is a distinct continuous client-side state/effects subsystem. State tracking and degradation calculations are separated from handling, engine, braking, steering, and visual consequences:
• client/modules/fluid/state.lua
• client/modules/fluid/degradation.lua
• client/modules/fluid/effects.lua
• client/modules/fluid_effects.lua
It relies on FiveM entity state bags and ox_lib vehicle cache behavior for synchronization/monitoring, with server validation intended to prevent client-side fluid manipulation. Persistence is supported by the vehicle data path and SQL migration/schema.
Economy, Inventory, and Activities
Mechanic income and consumption flow through billing, parts inventory/supplier operations, and repair missions. These are paired client/server domains where the server should be the trust boundary for prices, rewards, stock, and invoice state:
• client/modules/billing.lua
• server/modules/billing.lua
• client/modules/inventory.lua
• client/modules/parts.lua
• client/modules/missions.lua
• server/modules/missions.lua
External integrations are ox_inventory for materials and QBCore or ESX for jobs, identities, money, and permissions.
Persistence, Dependencies, and Delivery
Database access is centralized in server/modules/database.lua; schemas are provided in install.sql and sql/schema.sql. MySQL stores shops/lifts and expected vehicle fluid data. Required FiveM ecosystem services are ox_lib, ox_target, ox_inventory, and either QBCore or ESX. Release automation is defined in .github/workflows/release.yml; version_check.lua supports resource version checking.
Main entry points: init.lua Client Bootstrap · billing.lua Billing & Mission Authority · validation.lua Operation Validation · database.lua Database Access
Components 18
FiveM Runtime
- Resource Manifest · Declares resource loading and dependencies.
fxmanifest.lua - Client Bootstrap
client/init.lua - Server Bootstrap
server/init.lua - Framework & Config
shared/framework.lua
Client Systems
- Mechanic Interaction · Player inspection, maintenance, and diagnostics interactions.
client/modules/inspection.lua - Shop Operations UI · Materializes zones, employee UI, garages, and lifts.
client/modules/shops.lua - Vehicle Service UI · Applies native visual and handling changes.
client/modules/damage.lua - Fluid Degradation Effects · Tracks degradation and applies runtime vehicle effects.
client/modules/fluid/state.lua - Billing, Parts & Missions
client/modules/billing.lua
Server Authority
- Business Access & Shops · Owns shop records, employees, zones, storage, and lifts.
server/modules/business.lua - Vehicle Persistence · Authorizes and persists durable vehicle work.
server/modules/vehicles.lua - Operation Validation · Validates client-requested authoritative changes.
server/modules/validation.lua - Billing & Mission Authority · Controls invoices, rewards, prices, and stock mutations.
server/modules/billing.lua
Persistence & Integrations
- Database Access · Centralizes MySQL persistence.
server/modules/database.lua - SQL Schema · Defines shops, lifts, and vehicle-fluid persistence.
sql/schema.sql - QBCore or ESX · Provides jobs, identity, money, and permissions.
- ox Services · ox_lib, ox_target, and ox_inventory.
- Release Automation
.github/workflows/release.yml
Connections 25
- Resource Manifest → Client Bootstrap: loads client
- Resource Manifest → Server Bootstrap: loads server
- Client Bootstrap → Framework & Config: uses
- Server Bootstrap → Framework & Config: uses
- Client Bootstrap → Mechanic Interaction: starts
- Client Bootstrap → Shop Operations UI: starts
- Client Bootstrap → Vehicle Service UI: starts
- Client Bootstrap → Fluid Degradation Effects: starts
- Client Bootstrap → Billing, Parts & Missions: starts
- Mechanic Interaction → Operation Validation: requests authority
- Shop Operations UI → Business Access & Shops: shop actions
- Vehicle Service UI → Operation Validation: service requests
- Fluid Degradation Effects → Operation Validation: state validation
- Billing, Parts & Missions → Billing & Mission Authority: billing and activities
- Operation Validation → Vehicle Persistence: permits updates
- Business Access & Shops → Database Access: persists shops
- Vehicle Persistence → Database Access: persists vehicle data
- Billing & Mission Authority → Database Access: persists invoices and stock
- Database Access → SQL Schema: uses schema
- Business Access & Shops → QBCore or ESX: jobs and permissions
- Billing & Mission Authority → QBCore or ESX: money and identity
- Mechanic Interaction → ox Services: menus and targeting
- Fluid Degradation Effects → ox Services: vehicle cache
- Billing & Mission Authority → ox Services: inventory mutation
- Release Automation → Resource Manifest: releases resource