How zoxe-scripts/zoxe-dispatch works
Project Type and Purpose
• Project Type: A Lua-based advanced dispatch system tailored for emergency services in a game server environment. It integrates with various roleplay frameworks like ESX, LGF, Qbox, and QB.
• Purpose: To manage multiple emergency calls, provide real-time location tracking, prioritize dispatches, customize notifications, and log call history. It interfaces with game server configurations and external dependencies (OX LIB, OX TARGET, OX INVENTORY).
File Structure
• Top-Level Directory (Zoxe-Dispatch) contains key components:
• /client: Client-side scripts that handle in-game events, commands, and events (modules, commands, and functions).
• The subdirectory “bridge” provides framework-specific implementations (esx.lua, qb.lua, qbox.lua) to bridge between the script’s logic and various game frameworks.
• /server: Server-side scripts mirror the client's architecture with bridges and modules, coordinating server-side events and communications.
• /shared: Contains common functions, shared logic, and utilities that are accessible by both client and server components.
• /nui: Holds assets for the web user interface (HTML, CSS, JavaScript, and sound files) which the client might use to display alerts and notifications.
• /locales: Contains localization files (e.g., en.json) for multi-language support.
• fxmanifest.lua: Defines resource metadata, ensuring proper integration within the game server’s resource framework.
• Additional files include the LICENSE, README.md, and a few configuration-related files (.editorconfig).
README for Additional Insights
• The README details the features (advanced call management, real-time tracking, customizable notifications) and provides configuration instructions.
• It lists dependencies (OX LIB, OX TARGET, OX INVENTORY) which help pinpoint integration points and external interactions.
• Specific sections regarding configuration, multiple core and notify systems, and how alerts are exported or triggered indicate a layered and modular design.
a. Main Components:
• Client Component:
• Contains Client Modules (commands, events, functions, main entry point).
• Client Bridge(s) that abstract away framework-specific details (ESX, QB, QBox).
• NUI Layer: A web-based interface (index.html, script.js, style.css, and event.js) for displaying alerts and interacting with the dispatch system.
• Server Component:
• Server Modules: Main server logic, functions, and bridging to different frameworks.
• Server Bridge(s) similar to the client for ESX, QB, QBox integration.
• Shared Component:
• Common functions, utilities, and shared logic residing in shared/ (shared.lua, function.lua, utils.lua).
• External Dependencies:
• Integration with OX LIB, OX TARGET, and OX INVENTORY.
• Localization Component:
• Locales folder for managing language translations.
• Configuration:
• Settings defined in script files (shared.lua in configuration context; information for server.cfg adjustments mentioned in the README).
b. Relationships and Interactions:
• The client interacts with the NUI layer to present the user interface for dispatch alerts.
• The client code uses bridges to communicate with different roleplay frameworks, then sends information to the server through defined exports or events (e.g., TriggerServerEvent("Zoxe_Dispatch:Post")).
• The server processes incoming events, forwards them as needed, and may use its own bridges to send back responses or trigger actions across the system.
• Both client and server share common logic from the shared module to maintain consistency.
• External dependencies ensure proper functionality (e.g., OX LIB for additional client or server utility functions).
• Localization is applied across the system’s user-facing components (client UI, console outputs, etc.).
c. Important Architectural Patterns or Design Principles:
• Modularity: Components are clearly separated into client, server, and shared parts.
• Layered Architecture: Presentation (NUI/UI), application logic (modules and bridges), and data/configuration layers (shared logic and configuration files) are distinct.
• Integration Abstraction: The use of bridge files for different frameworks (ESX, QB, QBox) emphasizes a pluggable design.
• Loose Coupling: Communication via exports and events, with clear separation of client and server responsibilities.
d. Relevant Technologies, Frameworks, and Libraries:
• Technologies: Lua as the primary programming language; HTML/CSS/JavaScript for the NUI layer.
• Frameworks/Libraries: OX LIB, OX TARGET, OX INVENTORY; Built-in bridging for popular game server frameworks (ESX, LGF, QB, QBox).