2016-08-18 16:37:38 +00:00
|
|
|
---
|
|
|
|
layout: wiki
|
|
|
|
title: Refuel Framework
|
|
|
|
description: Explains how to set-up refueling of objects with the ACE3 refuel system.
|
|
|
|
group: framework
|
|
|
|
order: 5
|
|
|
|
parent: wiki
|
2016-08-30 13:49:04 +00:00
|
|
|
mod: ace
|
|
|
|
version:
|
|
|
|
major: 3
|
|
|
|
minor: 4
|
|
|
|
patch: 0
|
2016-08-18 16:37:38 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
## 1. Config Values
|
|
|
|
|
2017-10-24 16:14:25 +00:00
|
|
|
{% raw %}
|
2016-08-18 16:37:38 +00:00
|
|
|
```cpp
|
|
|
|
class CfgVehicles {
|
2017-10-24 13:39:32 +00:00
|
|
|
class MyFuelTruck {
|
2023-03-06 00:12:38 +00:00
|
|
|
ace_refuel_fuelCargo = 3000; // Maximum fuel cargo amount (in liters)
|
2017-10-24 13:39:32 +00:00
|
|
|
ace_refuel_hooks[] = {{0.38,-3.17,-.7},{-0.41,-3.17,-.7}}; // Nozzle hooks positions
|
|
|
|
};
|
|
|
|
class MyCar {
|
2023-03-06 00:12:38 +00:00
|
|
|
ace_refuel_fuelCapacity = 100; // Fuel tank volume (in liters)
|
2017-10-24 13:39:32 +00:00
|
|
|
};
|
|
|
|
class MyElectricCar {
|
|
|
|
ace_refuel_canReceive = 0; // For vehicles which can't be refueled
|
2016-08-18 16:37:38 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
```
|
2017-10-24 16:14:25 +00:00
|
|
|
{% endraw %}
|
2016-08-18 16:37:38 +00:00
|
|
|
|
|
|
|
<div class="panel callout">
|
|
|
|
<h5>Note:</h5>
|
|
|
|
<p>ace_refuel_fuelCapacity is only needed if you aren't inheriting from any of BI base classes or if your vehicle has a different fuel tank size.</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
## 2. Functions
|
|
|
|
|
2023-03-06 00:12:38 +00:00
|
|
|
### 2.1 Make an object into a refuel source
|
|
|
|
*Added in ACE3 3.11.0*
|
2016-08-18 16:37:38 +00:00
|
|
|
|
2023-03-06 00:12:38 +00:00
|
|
|
Meant to be called on server only.
|
|
|
|
|
|
|
|
`ace_refuel_fnc_makeSource`
|
2016-08-18 16:37:38 +00:00
|
|
|
|
2024-04-19 20:53:33 +00:00
|
|
|
| | Arguments | Type | Optional (default value) |
|
|
|
|
|----| --------- | ---- | ------------------------ |
|
|
|
|
| 0 | Fuel Source | Object | Required |
|
|
|
|
| 1 | Amount (in liters) | Number | Optional (default: `0`) |
|
|
|
|
| 2 | Hooks positions | Array | Optional (default: `[[0,0,0]]`) |
|
|
|
|
| **R** | None | None | Return value |
|
2016-08-18 16:37:38 +00:00
|
|
|
|
|
|
|
#### 2.1.1 Example
|
|
|
|
|
2023-03-06 00:12:38 +00:00
|
|
|
`[cursorObject, 100] call ace_refuel_fnc_makeSource`
|
2016-08-18 16:37:38 +00:00
|
|
|
|
2024-04-19 20:53:33 +00:00
|
|
|
| | Arguments | Explanation |
|
|
|
|
|----| --------- | ----------- |
|
|
|
|
| 0 | `cursorObject` | Fuel source object |
|
|
|
|
| 1 | `100` | Fuel amount (in liters) |
|
2016-08-18 16:37:38 +00:00
|
|
|
|
2023-03-06 00:12:38 +00:00
|
|
|
### 2.2 Getting the fuel supply
|
2016-08-18 16:37:38 +00:00
|
|
|
|
2023-03-06 00:12:38 +00:00
|
|
|
`ace_refuel_fnc_getFuel`
|
2016-08-18 16:37:38 +00:00
|
|
|
|
2024-04-19 20:53:33 +00:00
|
|
|
| | Arguments | Type | Optional (default value) |
|
|
|
|
|----| --------- | ---- | ------------------------ |
|
|
|
|
| 0 | Fuel Truck | Object | Required |
|
|
|
|
| **R** | Fuel amount left (in liters) | Number | Return value |
|
2016-08-18 16:37:38 +00:00
|
|
|
|
2023-03-06 00:12:38 +00:00
|
|
|
#### 2.2.1 Example
|
2016-08-18 16:37:38 +00:00
|
|
|
|
2023-03-06 00:12:38 +00:00
|
|
|
`[fuelTruck] call ace_refuel_fnc_getFuel;`
|
2016-08-18 16:37:38 +00:00
|
|
|
|
2024-04-19 20:53:33 +00:00
|
|
|
| | Arguments | Explanation |
|
|
|
|
|----| --------- | ----------- |
|
|
|
|
| 0 | `fuelTruck` | My fuel truck object |
|
2016-08-18 16:37:38 +00:00
|
|
|
|
2017-09-10 19:43:03 +00:00
|
|
|
### 2.3 Setting the fuel supply
|
2016-08-18 16:37:38 +00:00
|
|
|
|
|
|
|
`ace_refuel_fnc_setFuel`
|
|
|
|
|
2024-04-19 20:53:33 +00:00
|
|
|
| | Arguments | Type | Optional (default value) |
|
|
|
|
| ---| --------- | ---- | ------------------------ |
|
|
|
|
| 0 | Fuel Truck | Object | Required |
|
|
|
|
| 1 | Amount (in liters) | Number | Required |
|
|
|
|
| **R** | None | None | Return value |
|
2016-08-18 16:37:38 +00:00
|
|
|
|
2017-09-10 19:43:03 +00:00
|
|
|
#### 2.3.1 Example
|
2016-08-18 16:37:38 +00:00
|
|
|
|
|
|
|
`[fuelTruck, 428] call ace_refuel_fnc_setFuel;`
|
|
|
|
|
2024-04-19 20:53:33 +00:00
|
|
|
| | Arguments | Explanation |
|
|
|
|
|----| --------- | ----------- |
|
|
|
|
| 0 | `fuelTruck` | Fuel truck object |
|
|
|
|
| 1 | `428` | New fuel amount (in liters) |
|
2017-10-24 13:39:32 +00:00
|
|
|
|
2023-03-06 00:12:38 +00:00
|
|
|
### 2.4 Make a jerry can
|
2017-10-24 13:39:32 +00:00
|
|
|
|
2023-03-06 00:12:38 +00:00
|
|
|
Meant to be run on all clients and server.
|
|
|
|
|
|
|
|
`ace_refuel_fnc_makeJerryCan`
|
2017-10-24 13:39:32 +00:00
|
|
|
|
2024-04-19 20:53:33 +00:00
|
|
|
| | Arguments | Type | Optional (default value) |
|
|
|
|
|----| --------- | ---- | ------------------------ |
|
|
|
|
| 0 | Jerry Can | Object | Required |
|
|
|
|
| 1 | Amount (in liters) | Number | Optional (default: `20`) |
|
|
|
|
| **R** | None | None | Return value |
|
2017-10-24 13:39:32 +00:00
|
|
|
|
2023-03-06 00:12:38 +00:00
|
|
|
#### 2.4.1 Example 1
|
2017-10-24 13:39:32 +00:00
|
|
|
|
2023-03-06 00:12:38 +00:00
|
|
|
`[can] call ace_refuel_fnc_makeJerryCan;`
|
2017-10-24 13:39:32 +00:00
|
|
|
|
2024-04-19 20:53:33 +00:00
|
|
|
| | Arguments | Explanation |
|
|
|
|
|----| --------- | ----------- |
|
|
|
|
| 0 | `can` | Jerry can object |
|
2023-03-06 00:12:38 +00:00
|
|
|
|
|
|
|
The jerry can will have the default 20 liters volume.
|
|
|
|
|
|
|
|
#### 2.4.2 Example 2
|
|
|
|
|
|
|
|
`[can, 200] call ace_refuel_fnc_makeJerryCan;`
|
|
|
|
|
2024-04-19 20:53:33 +00:00
|
|
|
| | Arguments | Explanation |
|
|
|
|
|----| --------- | ----------- |
|
|
|
|
| 0 | `can` | Jerry can object |
|
|
|
|
| 1 | `200` | Amount (in liters) |
|
2023-03-06 00:12:38 +00:00
|
|
|
|
|
|
|
The jerry can will now have a volume of 200 liters.
|
2023-02-18 02:49:57 +00:00
|
|
|
|
|
|
|
## 3. Events
|
|
|
|
|
|
|
|
| Name | Arguments | Global? | Added in |
|
2024-04-19 20:53:33 +00:00
|
|
|
| ------------- | ------------- | ----- | ------------- |
|
2024-05-23 19:47:19 +00:00
|
|
|
| ace_refuel_sourceInitialized | Fuel source (OBJECT) | Yes | 3.16.0 |
|
2023-02-18 02:49:57 +00:00
|
|
|
| ace_refuel_jerryCanInitalized | Jerry can (OBJECT) | Yes | 3.16.0 |
|