# Forge Service Module

## Overview
The Service module provides a comprehensive vehicle service system for the Forge client. It includes features for vehicle repair, refueling, rearming, and general maintenance, with integration into the organization system for cost management.

## Dependencies
- forge_client_main

## Authors
- J. Schmidt
- Creedcoder
- IDSolutions

## Features

### Service System
1. **Service Initialization** (`fnc_initService.sqf`)
   - Initializes the service system
   - Sets up service points and triggers
   - Configures fuel pump locations
   - Manages service area detection

2. **Vehicle Maintenance**
   - **Repair** (`fnc_repair.sqf`)
     - Handles vehicle repair operations
     - Calculates repair costs based on damage
     - Manages labor hours and parts costs
     - Provides repair progress feedback
     - Integrates with organization funds

   - **Refuel** (`fnc_refuel.sqf`)
     - Manages vehicle refueling
     - Calculates fuel costs
     - Provides real-time refueling progress
     - Handles fuel pump interactions
     - Integrates with organization funds

   - **Rearm** (`fnc_rearm.sqf`)
     - Handles vehicle rearming
     - Manages magazine reloading
     - Processes turret systems
     - Calculates rearm costs
     - Integrates with organization funds

3. **Vehicle Service** (`fnc_vehicle.sqf`)
   - Comprehensive vehicle service management
   - Coordinates different service operations
   - Handles cost calculations
   - Manages service notifications
   - Integrates with organization system

### Cost Management
1. **Cost Calculation**
   - Repair costs (labor and parts)
   - Fuel costs (based on amount needed)
   - Rearm costs (per magazine)
   - Total service costs
   - Organization fund integration

2. **Organization Integration**
   - Fund verification
   - Cost deduction
   - Transaction logging
   - Balance updates
   - Service authorization

### Service Points
1. **Fuel Stations**
   - Automatic detection
   - Service area setup
   - Trigger management
   - Vehicle detection
   - Service activation

2. **Service Areas**
   - Area definition
   - Trigger configuration
   - Vehicle validation
   - Service coordination
   - Status monitoring

## Event Handlers
The module uses several event handlers for initialization and execution:
- `XEH_preInit.sqf`: Pre-initialization setup
- `XEH_postInit.sqf`: Post-initialization tasks
- `XEH_preStart.sqf`: Pre-start configuration

## Usage
To use the service module:
```sqf
// Initialize service system
[] call forge_client_service_fnc_initService;

// Service a vehicle
[vehicle, "LAND"] call forge_client_service_fnc_vehicle;

// Repair a vehicle
[vehicle, "B_APC_Tracked_01_CRV_F"] call forge_client_service_fnc_repair;

// Refuel a vehicle
[vehicle, "B_APC_Tracked_01_CRV_F"] call forge_client_service_fnc_refuel;

// Rearm a vehicle
[vehicle, "B_APC_Tracked_01_CRV_F"] call forge_client_service_fnc_rearm;
```

## Integration
The service module integrates with other Forge client systems:
1. **Organization System**
   - Fund management
   - Cost tracking
   - Transaction processing
   - Service authorization
   - Balance updates

2. **Vehicle System**
   - Vehicle state tracking
   - Damage monitoring
   - Fuel management
   - Armament status
   - Service history

3. **Notification System**
   - Service progress updates
   - Cost notifications
   - Status messages
   - Error reporting
   - Completion alerts

## Debugging
Debug mode can be enabled by uncommenting the following in `script_component.hpp`:
```cpp
#define DEBUG_MODE_FULL
```

## Version Information
Version information is managed through the main Forge client system configuration.

## Technical Details
- Real-time service processing
- Cost calculation system
- Organization fund integration
- Service point management
- Vehicle state tracking
- Progress monitoring
- Error handling
- Transaction logging
- Service validation
- Resource management
- Cross-module integration
- Event system integration 