Merge branch 'master' into translation/15bn/alef

This commit is contained in:
Alessandro Foresi 2016-01-03 12:23:27 +01:00
commit c16d97cad0
1254 changed files with 20970 additions and 14357 deletions

View File

@ -1,14 +1,29 @@
branches: branches:
only: only:
- master - master
- release
language: python language: python
python: python:
- "3.4" - '3.4'
before_script: before_script:
- pip install pygithub - if [ -n "${GH_TOKEN}" ] && [ "${TRAVIS_BRANCH}" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
- pip install pygithub3 pip install pygithub;
pip install pygithub3;
fi
script: script:
- python3 tools/deploy.py - python3 tools/sqf_validator.py
- if [ -n "${GH_TOKEN}" ] && [ "${TRAVIS_BRANCH}" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
python3 tools/deploy.py;
fi
env: env:
global: global:
- secure: "KcJQbknBOdC5lA4nFGKPXVRVIGLDXDRzC8XkHuXJCE9pIR/wbxbkvx8fHKcC6SC9eHgzneC3+o4m4+CjIbVvIwDgslRbJ8Y59i90ncONmdoRx1HUYHwuYWVZm9HJFjCsIbrEqhSyyKS+PB3WZVOLbErtNHsgS8f43PTh5Ujg7Vg=" - secure: KcJQbknBOdC5lA4nFGKPXVRVIGLDXDRzC8XkHuXJCE9pIR/wbxbkvx8fHKcC6SC9eHgzneC3+o4m4+CjIbVvIwDgslRbJ8Y59i90ncONmdoRx1HUYHwuYWVZm9HJFjCsIbrEqhSyyKS+PB3WZVOLbErtNHsgS8f43PTh5Ujg7Vg=
notifications:
slack:
rooms:
- secure: byZMNBl8PMlgjT9NA1WmhgCdGfX4b3g1kA0vEiwfm+IFNlx7BiM4J/5rp6zV/jV470xl/epAejx2tsa5SdTyFbO87NH63ILJSt5QnjUZjRuGKSutFs9WE671DtZkPRSJXHS4N6x802PRkyBz/84/lsc34FWvHvjwOuYAtOcJRFk=
- secure: V22TNaLWV+yUNWqR7c6HVvIxkRDz7Dyz9xqa43FY8iFgvNL4Q/X69h5DYHU/ILNFM00tx8OBjtPRbcjWQ+F6eY8Sje/A2axJAU+qNurAvoyiTahXUprdUUpPdkgXWuSRTZ9kALxOq5e11RC8XUietghoMcl8zPcqdrZCOOKgoEM=
on_success: change
email:
on_success: never
on_failure: change

View File

@ -1,4 +1,4 @@
# ACE3 CONTRIBUTOR LIST # ACE3 CONTRIBUTOR LIST
# If you contributed, but are not listed here, contact me: # If you contributed, but are not listed here, contact me:
# koffeinflummi@gmail.com # koffeinflummi@gmail.com
# #
@ -37,6 +37,7 @@ alef <alefor@gmail.com>
Aleksey EpMAK Yermakov <epmak777@gmail.com> Aleksey EpMAK Yermakov <epmak777@gmail.com>
Alganthe <alganthe@live.fr> Alganthe <alganthe@live.fr>
Anthariel <Contact@storm-simulation.com> Anthariel <Contact@storm-simulation.com>
Arkhir <wonsz666@gmail.com >
Asgar Serran <piechottaf@web.de> Asgar Serran <piechottaf@web.de>
Bamse <bamsis@gmail.com> Bamse <bamsis@gmail.com>
Bla1337 Bla1337
@ -44,6 +45,7 @@ BlackPixxel <blackpixxel96@gmail.com>
BlackQwar BlackQwar
Brakoviejo Brakoviejo
Brisse <brisse@outlook.com> Brisse <brisse@outlook.com>
Brostrom.A | Evul <andreas.brostrom.ce@gmail.com>
BullHorn <bullhorn7@gmail.com> BullHorn <bullhorn7@gmail.com>
Clon1998 <ps.patti1998@gmail.com> Clon1998 <ps.patti1998@gmail.com>
Codingboy Codingboy
@ -52,7 +54,8 @@ Crusty
Dharma Bellamkonda <dharma.bellamkonda@gmail.com> Dharma Bellamkonda <dharma.bellamkonda@gmail.com>
Dimaslg <dimaslg@telecable.es> Dimaslg <dimaslg@telecable.es>
Drill <drill87@gmail.com> Drill <drill87@gmail.com>
Dudakov <dudakov.s@gmail.com> Dudakov aka [OMCB]Kaban <dudakov.s@gmail.com>
Dslyecxi <dslyecxi@gmail.com>
eRazeri eRazeri
evromalarkey <evromalarkey@gmail.com> evromalarkey <evromalarkey@gmail.com>
F3 Project <alanr@ferstaberinde.com> F3 Project <alanr@ferstaberinde.com>
@ -106,6 +109,7 @@ Toaster <jonathan.pereira@gmail.com>
Tonic Tonic
Tourorist <tourorist@gmail.com> Tourorist <tourorist@gmail.com>
Valentin Torikian <valentin.torikian@gmail.com> Valentin Torikian <valentin.torikian@gmail.com>
voiper
VyMajoris(W-Cephei)<vycanismajoriscsa@gmail.com> VyMajoris(W-Cephei)<vycanismajoriscsa@gmail.com>
Winter <simon@agius-muscat.net> Winter <simon@agius-muscat.net>
zGuba zGuba

64
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,64 @@
# Reporting an issue
## Before reporting
If you have found an issue with ACE3 please make sure that ACE3 is really the cause of the problem. To do this try to reproduce the issue with using only `@CBA_A3` and `@ace` on a newly created mission.
Indicate if the issue appears on stable or development version. In case it is the development version, please also include the commit SHA-1 hash.
<div class="panel callout">
<h5>Please note:</h5>
<p>It's not a valid to simply remove <code>@ace</code> from the mod list to confirm that ACE3 is the culprit.</p>
<p>If the error happens when using a <b>third-party mod</b> contact the author of the appropriate mod and report the issue there.</p>
</div>
## Reporting the issue
Head over to the [ACE3 GitHub issue tracker](https://github.com/acemod/ACE3/issues) and press the [New issue](https://github.com/acemod/ACE3/issues/new) button in the top right corner. Add a descriptive title and copy the following issue template in to the text area:
```
ACE3 Version: 3.x.x
(indicate if stable or dev, if dev indicate the commit the version is based on)
**Mods:**
* `@CBA_A3`
* `@ace`
**Placed ACE3 Modules:**
* *Add the list of modules you have placed on the map. Use 'None' if the error occurs without using any modules.*
* You can also press the `Debug to` button in the ACE3 option menu (escape -> ACE3 options -> Debug to) and add a link (pastebin.com) to the results.
**Description:**
* Add a detailed description of the error. This makes it easier for us to fix the issue.*
**Steps to reproduce:**
* *Add the steps needed to reproduce the issue.*
**Where did the issue occur?**
* A possible answer might be "Multiplayer", "Editor" or "Singleplayer"*
**RPT log file:**
* Add a link (pastebin.com) to the client or server RPT file.*
```
A video of the issue might be helpful in resolving it faster.
GitHub uses [Markdown](http://daringfireball.net/projects/markdown/syntax) to style the output. If you want to know more about it (e.g. how to [turn text bold](https://help.github.com/articles/markdown-basics/#styling-text), how to denote [code blocks](https://help.github.com/articles/markdown-basics/#inline-formats) or [inline code](https://help.github.com/articles/markdown-basics/#multiple-lines)) have a look at the [GitHub Markdown Documentation](https://help.github.com/articles/github-flavored-markdown).
# Feature Requests
## Background
ACE2, AGM and CSE had a lot of features implemented or planned. All of them are or have been evaluated for inclusion in ACE3 itself, and we'd like to port the majority of them eventually. However, due to time constraints, we have managed to finish only a fraction of the job so far.
Please refrain from making requests for any planned or existing features from either ACE2, AGM or CSE. Most of them are already being or have been considered for porting or a rewrite.
## Requesting a feature
In order to avoid duplicates and keep the issue tracker organized, we have created a common issue for [ACE3 Feature requests](https://github.com/acemod/ACE3/issues/414). Any and all relevant requests should be submitted there, where they will also get discussed and evaluated. Before adding a new one, make sure to check the previous entries from the thread and do a quick search for similar suggestions; please don't reiterate requests for features that had already been accepted for inclusion, or those which were disregarded earlier.
Following their approval, feature requests may be moved by moderators to a separate issue for further discussion.
# Regarding Pull Requests (PRs)
- You want to help but don't know where to start? Check the wiki entry for [setting up the development environment](http://ace3mod.com/wiki/development/setting-up-the-development-environment.html)
- [Make sure to respect the file structure](http://ace3mod.com/wiki/development/modularity-and-pbo-structure.html)
- [Make sure to respect the coding guidelines](http://ace3mod.com/wiki/development/coding-guidelines.html)

View File

@ -22,13 +22,13 @@ source code of the individual modules.
When publishing a derivative of this product you may not use a name that When publishing a derivative of this product you may not use a name that
might create the impression that your version is an official release. might create the impression that your version is an official release.
Some folders of this project may contain a seperate LICENSE file. Should Some folders of this project may contain a separate LICENSE file. Should
that be the case, everything in that folder and all subfolders is subject that be the case, everything in that folder and all subfolders is subject
to that license instead. to that license instead.
============================================================================ ============================================================================
Full Gnu General Public License Text Full GNU General Public License Text
============================================================================ ============================================================================

View File

@ -1,27 +1,35 @@
<p align="center"> <p align="center">
<img src="https://github.com/acemod/ACE3/blob/master/extras/assets/logo/black/ACE3-Logo.jpg" width="480"> <img src="https://github.com/acemod/ACE3/blob/master/extras/assets/logo/black/ACE3-Logo.jpg" width="480">
</p> </p>
<p align="center"> <p align="center">
<a href="https://github.com/acemod/ACE3/releases"> <a href="https://github.com/acemod/ACE3/releases">
<img src="https://img.shields.io/badge/Version-3.3.0-blue.svg" alt="ACE3 Version"> <img src="https://img.shields.io/badge/Version-3.4.1-blue.svg?style=flat-square" alt="ACE3 Version">
</a> </a>
<a href="https://github.com/acemod/ACE3/releases/download/v3.3.0/ace3_3.3.0.zip"> <a href="https://github.com/acemod/ACE3/releases/download/v3.4.1/ace3_3.4.1.zip">
<img src="http://img.shields.io/badge/Download-56.5_MB-green.svg" alt="ACE3 Download"> <img src="https://img.shields.io/badge/Download-72.6_MB-green.svg?style=flat-square" alt="ACE3 Download">
</a> </a>
<a href="https://github.com/acemod/ACE3/issues"> <a href="https://github.com/acemod/ACE3/issues">
<img src="http://img.shields.io/github/issues-raw/acemod/ACE3.svg?label=Issues" alt="ACE3 Issues"> <img src="https://img.shields.io/github/issues-raw/acemod/ACE3.svg?style=flat-square&label=Issues" alt="ACE3 Issues">
</a> </a>
<a href="https://forums.bistudio.com/topic/181341-ace3-a-collaborative-merger-between-agm-cse-and-ace/?p=2859670"> <a href="https://forums.bistudio.com/topic/181341-ace3-a-collaborative-merger-between-agm-cse-and-ace/?p=2859670">
<img src="https://img.shields.io/badge/BIF-Thread-lightgrey.svg" alt="BIF Thread"> <img src="https://img.shields.io/badge/BIF-Thread-lightgrey.svg?style=flat-square" alt="BIF Thread">
</a> </a>
<a href="https://github.com/acemod/ACE3/blob/master/LICENSE"> <a href="https://github.com/acemod/ACE3/blob/master/LICENSE">
<img src="http://img.shields.io/badge/License-GPLv2-red.svg" alt="ACE3 License"> <img src="https://img.shields.io/badge/License-GPLv2-red.svg?style=flat-square" alt="ACE3 License">
</a> </a>
<a href="http://slackin.koffeinflummi.de"> <a href="http://slackin.ace3mod.com/">
<img src="http://slackin.koffeinflummi.de/badge.svg" alt="ACE3 Slack"> <img src="http://slackin.ace3mod.com/badge.svg?style=flat-square&label=Slack" alt="ACE3 Slack">
</a>
<a href="https://travis-ci.org/acemod/ACE3">
<img src="https://img.shields.io/travis/acemod/ACE3.svg?style=flat-square&label=Build" alt="ACE3 Build Status">
</a> </a>
</p> </p>
<p align="center"><sup><strong>Requires the latest version of <a href="https://github.com/CBATeam/CBA_A3/releases">CBA A3</a>. Visit us on <a href="https://www.facebook.com/ACE3Mod">Facebook</a> | <a href="https://www.youtube.com/c/ACE3Mod">YouTube</a> | <a href="https://twitter.com/ACE3Mod">Twitter</a> | <a href="http://www.reddit.com/r/arma/search?q=ACE&restrict_sr=on&sort=new&t=all">Reddit</a></strong></sup></p>
<p align="center">
<sup><strong>Requires the latest version of <a href="https://github.com/CBATeam/CBA_A3/releases">CBA A3</a>.<br/>
Visit us on <a href="https://twitter.com/ACE3Mod">Twitter</a> | <a href="https://www.facebook.com/ACE3Mod">Facebook</a> | <a href="https://www.youtube.com/c/ACE3Mod">YouTube</a> | <a href="http://www.reddit.com/r/arma/search?q=ACE&restrict_sr=on&sort=new&t=all">Reddit</a></strong></sup>
</p>
**ACE3** is a joint effort by the teams behind **ACE2**, **AGM** and **CSE** to improve the realism and authenticity of Arma 3. **ACE3** is a joint effort by the teams behind **ACE2**, **AGM** and **CSE** to improve the realism and authenticity of Arma 3.
@ -40,6 +48,7 @@ The mod is **built modularly**, so almost any included PBO can be easily removed
- Captivity system - Captivity system
- Explosives system, including different trigger types - Explosives system, including different trigger types
- Map screen improvements marker placement and map tools - Map screen improvements marker placement and map tools
- Logistics
- Advanced missile guidance and laser designation - Advanced missile guidance and laser designation
#### Additional features #### Additional features
@ -66,7 +75,8 @@ The mod is **built modularly**, so almost any included PBO can be easily removed
### Guides & how-tos ### Guides & how-tos
If you installed ACE3 but have trouble understanding how it all works, or where to start, read this first: If you installed ACE3 but have trouble understanding how it all works, or where to start, read this first:
- [Getting started](http://ace3mod.com/wiki/user/getting-started.html) - [Installation guide](http://ace3mod.com/wiki/user/installation-guide.html)
- [Information center](http://ace3mod.com/wiki/user/information-center.html)
#### Contributing #### Contributing
You can help out with the ongoing development by looking for potential bugs in our code base, or by contributing new features. To contribute something to ACE3, simply fork this repository and submit your pull requests for review by other collaborators. Remember to add yourself to the author array of any PBO you will be editing and the [`AUTHORS.txt`](https://github.com/acemod/ACE3/blob/master/AUTHORS.txt) file; including a valid email address. You can help out with the ongoing development by looking for potential bugs in our code base, or by contributing new features. To contribute something to ACE3, simply fork this repository and submit your pull requests for review by other collaborators. Remember to add yourself to the author array of any PBO you will be editing and the [`AUTHORS.txt`](https://github.com/acemod/ACE3/blob/master/AUTHORS.txt) file; including a valid email address.

Binary file not shown.

View File

@ -18,7 +18,8 @@ private ["_muzzleVelocityShiftTableUpperLimit", "_temperatureIndexFunction",
"_temperatureIndexA", "_temperatureIndexB", "_interpolationRatio"]; "_temperatureIndexA", "_temperatureIndexB", "_interpolationRatio"];
params["_muzzleVelocityShiftTable", "_temperature"]; params["_muzzleVelocityShiftTable", "_temperature"];
// Check if muzzleVelocityShiftTable is Larger Than 11 Entrys // Check if muzzleVelocityShiftTable is Less Than 11 Entrys
if ((count _muzzleVelocityShiftTable) < 11) exitWith {0};
_muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10; _muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10;
if (isNil "_muzzleVelocityShiftTableUpperLimit") exitWith { 0 }; if (isNil "_muzzleVelocityShiftTableUpperLimit") exitWith { 0 };

View File

@ -36,7 +36,7 @@ GVAR(Protractor) = true;
if !(GVAR(Protractor) && !(weaponLowered ACE_player) && currentWeapon ACE_player == primaryWeapon ACE_player) exitWith { if !(GVAR(Protractor) && !(weaponLowered ACE_player) && currentWeapon ACE_player == primaryWeapon ACE_player) exitWith {
GVAR(Protractor) = false; GVAR(Protractor) = false;
1 cutText ["", "PLAIN"]; 1 cutText ["", "PLAIN"];
[_idPFH] call cba_fnc_removePerFrameHandler; [_idPFH] call CBA_fnc_removePerFrameHandler;
}; };
1 cutRsc ["RscProtractor", "PLAIN", 1, false]; 1 cutRsc ["RscProtractor", "PLAIN", 1, false];

View File

@ -12,11 +12,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private "_deleted"; private _aceTimeSecond = floor ACE_time;
_deleted = 0;
{ {
private ["_bulletVelocity", "_bulletPosition", "_bulletSpeed"]; private ["_bulletVelocity", "_bulletPosition", "_bulletSpeed"];
@ -26,20 +22,19 @@ _deleted = 0;
_bulletSpeed = vectorMagnitude _bulletVelocity; _bulletSpeed = vectorMagnitude _bulletVelocity;
if (!alive _bullet || _bulletSpeed < 100) exitWith { if (!alive _bullet || _bulletSpeed < 100) then {
GVAR(allBullets) deleteAt (_forEachIndex - _deleted); GVAR(allBullets) deleteAt (GVAR(allBullets) find _x);
_deleted = _deleted + 1; } else {
};
_bulletPosition = getPosASL _bullet; _bulletPosition = getPosASL _bullet;
if (_bulletTraceVisible && _bulletSpeed > 500) then { if (_bulletTraceVisible && _bulletSpeed > 500) then {
drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""]; drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""];
}; };
_aceTimeSecond = floor ACE_time;
call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, _aceTimeSecond, ACE_time - _aceTimeSecond]); call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, _aceTimeSecond, ACE_time - _aceTimeSecond]);
} forEach GVAR(allBullets); };
nil
} count +GVAR(allBullets);
if (GVAR(allBullets) isEqualTo []) then { if (GVAR(allBullets) isEqualTo []) then {
[_this select 1] call CBA_fnc_removePerFrameHandler; [_this select 1] call CBA_fnc_removePerFrameHandler;

View File

@ -24,12 +24,12 @@ if (!hasInterface) exitWith {};
if (!GVAR(enabled)) exitWith {}; if (!GVAR(enabled)) exitWith {};
// Parameterization // Parameterization
private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"]; private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletLength", "_barrelTwist", "_stabilityFactor", "_aceTimeSecond", "_barrelVelocityShift", "_ammoTemperatureVelocityShift"];
params ["_unit", "_weapon", "", "_mode", "_ammo", "_magazine", "_bullet"]; params ["_unit", "_weapon", "", "_mode", "_ammo", "_magazine", "_bullet"];
_abort = false; _abort = false;
if (!(_ammo isKindOf "BulletBase")) exitWith {}; if (!(_ammo isKindOf "BulletBase")) exitWith {};
if (!alive _bullet) exitWith {}; if (!alive _bullet) exitWith {};
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {}; if (!([_unit] call EFUNC(common,isPlayer))) exitWith {};
@ -53,7 +53,9 @@ if (!GVAR(simulateForEveryone) && !(local _unit)) then {
if (GVAR(disabledInFullAutoMode) && getNumber(configFile >> "CfgWeapons" >> _weapon >> _mode >> "autoFire") == 1) then { _abort = true; }; if (GVAR(disabledInFullAutoMode) && getNumber(configFile >> "CfgWeapons" >> _weapon >> _mode >> "autoFire") == 1) then { _abort = true; };
if (_abort || !(GVAR(extensionAvailable))) exitWith { if (_abort || !(GVAR(extensionAvailable))) exitWith {
[_bullet, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")] call EFUNC(winddeflection,updateTrajectoryPFH); if (missionNamespace getVariable [QEGVAR(windDeflection,enabled), false]) then {
EGVAR(windDeflection,trackedBullets) pushBack [_bullet, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")];
};
}; };
// Get Weapon and Ammo Configurations // Get Weapon and Ammo Configurations
@ -73,22 +75,22 @@ _WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"];
_bulletVelocity = velocity _bullet; _bulletVelocity = velocity _bullet;
_muzzleVelocity = vectorMagnitude _bulletVelocity; _muzzleVelocity = vectorMagnitude _bulletVelocity;
_barrelVelocityShift = 0;
if (GVAR(barrelLengthInfluenceEnabled)) then { if (GVAR(barrelLengthInfluenceEnabled)) then {
_barrelVelocityShift = uiNamespace getVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],nil];
if (isNil "_barrelVelocityShift") then {
_barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); _barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift);
uiNamespace setVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],_muzzleVelocityShift];
};
}; };
_ammoTemperatureVelocityShift = 0;
if (GVAR(ammoTemperatureEnabled)) then { if (GVAR(ammoTemperatureEnabled)) then {
_temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight);
_temperatureVelocityShift = ([_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift)); _ammoTemperatureVelocityShift = ([_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift));
}; };
if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then { if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then {
_muzzleVelocityShift = _barrelVelocityShift + _ammoTemperatureVelocityShift;
TRACE_4("shift",_muzzleVelocity,_muzzleVelocityShift, _barrelVelocityShift, _ammoTemperatureVelocityShift);
if (_muzzleVelocityShift != 0) then { if (_muzzleVelocityShift != 0) then {
_muzzleVelocity = _muzzleVelocity + (_barrelVelocityShift + _ammoTemperatureVelocityShift); _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
_bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift));
_bullet setVelocity _bulletVelocity; _bullet setVelocity _bulletVelocity;
}; };

View File

@ -40,7 +40,7 @@ GVAR(currentGrid) = 0;
#ifdef DEBUG_MODE_FULL #ifdef DEBUG_MODE_FULL
systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", ceil(ACE_time - _initStartTime)]; systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", ceil(ACE_time - _initStartTime)];
#endif #endif
[_idPFH] call cba_fnc_removePerFrameHandler; [_idPFH] call CBA_fnc_removePerFrameHandler;
}; };
for "_i" from 1 to 50 do { for "_i" from 1 to 50 do {

View File

@ -20,10 +20,12 @@ _weaponConfig = (configFile >> "CfgWeapons" >> _this);
_barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist"); _barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist");
_twistDirection = 1; _twistDirection = 1;
if (isNumber (_weaponConfig >> "ACE_twistDirection")) then {
_twistDirection = getNumber (_weaponConfig >> "ACE_twistDirection"); _twistDirection = getNumber (_weaponConfig >> "ACE_twistDirection");
if !(_twistDirection in [-1, 0, 1]) then { if !(_twistDirection in [-1, 0, 1]) then {
_twistDirection = 1; _twistDirection = 1;
}; };
};
_barrelLength = getNumber(_weaponConfig >> "ACE_barrelLength"); _barrelLength = getNumber(_weaponConfig >> "ACE_barrelLength");

View File

@ -309,6 +309,7 @@
<French>Ce module active la simulation de balistique avancée - ie les projectiles sont influencé par des varibles comme le vent, la température, la pression atmosphérique, l'humidité, la gravité, le type de munition et l'arme avec laquelles ils sont tirés</French> <French>Ce module active la simulation de balistique avancée - ie les projectiles sont influencé par des varibles comme le vent, la température, la pression atmosphérique, l'humidité, la gravité, le type de munition et l'arme avec laquelles ils sont tirés</French>
<Hungarian>Ez a modul engedélyezi a fejlett ballisztikai szimulációt - a lövedékek röppályáját befolyásolni fogja a levegő hőmérséklete, légnyomás, páratartalom, gravitáció, a lövedék fajtája, valamint a fegyver, amiből kilőtték a lövedéket.</Hungarian> <Hungarian>Ez a modul engedélyezi a fejlett ballisztikai szimulációt - a lövedékek röppályáját befolyásolni fogja a levegő hőmérséklete, légnyomás, páratartalom, gravitáció, a lövedék fajtája, valamint a fegyver, amiből kilőtték a lövedéket.</Hungarian>
<Russian>Этот модуль включает симуляцию продвинутой баллистики - при этом на траекторию полета снаряда влияют различные параметры, такие как температура воздуха, атмосферное давление, влажность, гравитация, тип боеприпаса и оружия, из которого произвели выстрел.</Russian> <Russian>Этот модуль включает симуляцию продвинутой баллистики - при этом на траекторию полета снаряда влияют различные параметры, такие как температура воздуха, атмосферное давление, влажность, гравитация, тип боеприпаса и оружия, из которого произвели выстрел.</Russian>
<Spanish>Este módulo permite la simulación balística avanzada - es decir, la trayectoria de los proyectiles está influenciada por variables como la temperatura del aire, la presión atmosférica, la humedad, la gravedad, el tipo de municiones y el arma desde el que fue disparada.</Spanish>
<Italian>Questo modulo abilita la simulazione di balistica avanzata - significa che la traiettoria del proiettile viene infulenzata da variabili come la temperatura dell'aria, pressione atmosferica, umitidà, gravità, il tipo di munizioni e l'arma dalla quale vengono sparate.</Italian> <Italian>Questo modulo abilita la simulazione di balistica avanzata - significa che la traiettoria del proiettile viene infulenzata da variabili come la temperatura dell'aria, pressione atmosferica, umitidà, gravità, il tipo di munizioni e l'arma dalla quale vengono sparate.</Italian>
</Key> </Key>
</Package> </Package>

View File

@ -54,7 +54,7 @@ GVAR(active) = true;
GVAR(DialogPFH) = [{ GVAR(DialogPFH) = [{
if (!GVAR(active)) exitWith { if (!GVAR(active)) exitWith {
[_this select 1] call cba_fnc_removePerFrameHandler; [_this select 1] call CBA_fnc_removePerFrameHandler;
}; };
__ctrlBackground ctrlSetText format [QUOTE(PATHTOF(UI\ATRAG_%1.paa)), ["N", "D"] select (call EFUNC(common,ambientBrightness))]; __ctrlBackground ctrlSetText format [QUOTE(PATHTOF(UI\ATRAG_%1.paa)), ["N", "D"] select (call EFUNC(common,ambientBrightness))];
}, 60, []] call CBA_fnc_addPerFrameHandler; }, 60, []] call CBA_fnc_addPerFrameHandler;

View File

@ -2,4 +2,4 @@
uiNamespace setVariable ['ATragMX_Display', nil]; uiNamespace setVariable ['ATragMX_Display', nil];
GVAR(active) = false; GVAR(active) = false;
[GVAR(DialogPFH)] call cba_fnc_removePerFrameHandler; [GVAR(DialogPFH)] call CBA_fnc_removePerFrameHandler;

View File

@ -37,7 +37,7 @@ if !(ctrlVisible 9000) then {
false call FUNC(show_target_speed_assist_timer); false call FUNC(show_target_speed_assist_timer);
true call FUNC(show_target_speed_assist); true call FUNC(show_target_speed_assist);
[_this select 1] call cba_fnc_removePerFrameHandler; [_this select 1] call CBA_fnc_removePerFrameHandler;
}; };
ctrlSetText [9001, Str(Round((ACE_time - _startTime) * 10) / 10)]; ctrlSetText [9001, Str(Round((ACE_time - _startTime) * 10) / 10)];

View File

@ -61,7 +61,6 @@ class CfgVehicles {
showDisabled = 0; showDisabled = 0;
priority = 5; priority = 5;
icon = PATHTOF(UI\attach_ca.paa); icon = PATHTOF(UI\attach_ca.paa);
// hotkey = "T";
}; };
class GVAR(Detach) { class GVAR(Detach) {
displayName = CSTRING(Detach); displayName = CSTRING(Detach);
@ -71,7 +70,6 @@ class CfgVehicles {
showDisabled = 0; showDisabled = 0;
priority = 5; priority = 5;
icon = PATHTOF(UI\detach_ca.paa); icon = PATHTOF(UI\detach_ca.paa);
hotkey = "T";
}; };
}; };
}; };

View File

@ -19,6 +19,8 @@
params ["_attachToVehicle", "_unit"]; params ["_attachToVehicle", "_unit"];
TRACE_2("params",_attachToVehicle,_unit); TRACE_2("params",_attachToVehicle,_unit);
if ((vehicle _unit) != _unit) exitWith {false};
_attachedList = _attachToVehicle getVariable [QGVAR(attached), []]; _attachedList = _attachToVehicle getVariable [QGVAR(attached), []];
if ((count _attachedList) == 0) exitWith {false}; if ((count _attachedList) == 0) exitWith {false};

View File

@ -17,11 +17,11 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
if (!isServer) exitWith {};
params ["", "", "_unit"]; params ["", "", "_unit"];
TRACE_1("params",_unit); TRACE_1("params",_unit);
if (!local _unit) exitWith {};
private ["_attachedList"]; private ["_attachedList"];
_attachedList = _unit getVariable [QGVAR(attached), []]; _attachedList = _unit getVariable [QGVAR(attached), []];
@ -29,9 +29,14 @@ if ((count _attachedList) == 0) exitWith {};
(_attachedList select 0) params ["_xObject"]; (_attachedList select 0) params ["_xObject"];
if (!isNull _xObject) then { if (!isNull _xObject) then {
TRACE_1("detaching and moving attached light",_xObject);
detach _xObject; detach _xObject;
_xObject setPos ((getPos _unit) vectorAdd [0, 0, -1000]); _xObject setPos ((getPos _unit) vectorAdd [0, 0, -1000]);
[{deleteVehicle (_this select 0)}, [_xObject], 2] call EFUNC(common,waitAndExecute); [{
params ["_detachedLight"];
TRACE_1("delayed delete",_detachedLight);
deleteVehicle _detachedLight;
}, [_xObject], 2] call EFUNC(common,waitAndExecute);
(_attachedList select 0) set [0, objNull]; (_attachedList select 0) set [0, objNull];
}; };

View File

@ -17,11 +17,11 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
if (!isServer) exitWith {};
params ["", "", "_unit"]; params ["", "", "_unit"];
TRACE_1("params",_unit); TRACE_1("params",_unit);
if (!local _unit) exitWith {};
private ["_attachedList"]; private ["_attachedList"];
_attachedList = _unit getVariable [QGVAR(attached), []]; _attachedList = _unit getVariable [QGVAR(attached), []];

View File

@ -10,7 +10,7 @@
* Arguments: * Arguments:
* 0: Unit (player) <OBJECT> * 0: Unit (player) <OBJECT>
* 1: attachToVehicle <OBJECT> * 1: attachToVehicle <OBJECT>
* 2: Item Classname (cfgWeapon/cfgMagazine) <STRING> * 2: Item Classname (CfgWeapon/CfgMagazine) <STRING>
* 3: Light Vehicle Classname <STRING> * 3: Light Vehicle Classname <STRING>
* 4: On Attach Text <STRING> * 4: On Attach Text <STRING>
* 5: Starting Pos of dummy item <ARRAY> * 5: Starting Pos of dummy item <ARRAY>

View File

@ -1,3 +1,3 @@
#include "script_component.hpp" #include "script_component.hpp"
["backpackOpened", DFUNC(backpackOpened)] call EFUNC(common,addEventHandler); ["backpackOpened", {_this call FUNC(backpackOpened)}] call EFUNC(common,addEventHandler);

View File

@ -1,18 +1,19 @@
/* /*
* Author: commy2 * Author: commy2
* Someone opened your backpack. Play sound and camshake. Execute locally.
* *
* Someone opened your backpack. Execute locally. * Arguments:
*
* Argument:
* 0: Who accessed your inventory? (Object) * 0: Who accessed your inventory? (Object)
* 1: Unit that wields the backpack (Object) * 1: Unit that wields the backpack (Object)
* 2: The backpack object (Object) * 2: The backpack object (Object)
* *
* Return value: * Return Value:
* None. * None
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_sounds", "_position"];
params ["_target", "_backpack"]; params ["_target", "_backpack"];
// do cam shake if the target is the player // do cam shake if the target is the player
@ -20,7 +21,8 @@ if ([_target] call EFUNC(common,isPlayer)) then {
addCamShake [4, 0.5, 5]; addCamShake [4, 0.5, 5];
}; };
// play a rustling sound // play a zipper sound effect
private ["_sounds", "_position"];
_sounds = [ _sounds = [
/*"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss", /*"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss",
@ -32,8 +34,7 @@ _sounds = [
QUOTE(PATHTO_R(sounds\zip_out.wav)) QUOTE(PATHTO_R(sounds\zip_out.wav))
]; ];
_position = _target modelToWorldVisual (_target selectionPosition "Spine3"); _position = AGLToASL (_target modelToWorldVisual (_target selectionPosition "Spine3"));
_position = _position call EFUNC(common,positionToASL);
playSound3D [ playSound3D [
_sounds select floor random count _sounds, _sounds select floor random count _sounds,

View File

@ -1,23 +1,24 @@
/* /*
* Author: commy2 * Author: commy2
* Check if the given backpack is an actual backpack that can store items. Parachute, static weapon packs, etc. will return false.
* *
* Check if the given backpack is an actual backpack that can store items. Parachute backpacks will return false for example. * Arguments:
* 0: Backpack <OBJECT, STRING>
* *
* Argument: * Return Value:
* 0: A backpack (Object or String) * Boolean <BOOL>
* *
* Return value: * Public: Yes
* Boolean (Bool)
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_config"];
params ["_backpack"]; params ["_backpack"];
if (typeName _backpack == "OBJECT") then { if (_backpack isEqualType objNull) then {
_backpack = typeOf _backpack; _backpack = typeOf _backpack;
}; };
private "_config";
_config = configFile >> "CfgVehicles" >> _backpack; _config = configFile >> "CfgVehicles" >> _backpack;
getText (_config >> "vehicleClass") == "backpacks" && {getNumber (_config >> "maximumLoad") > 0} getText (_config >> "vehicleClass") == "backpacks" && {getNumber (_config >> "maximumLoad") > 0} // return

View File

@ -1,13 +1,15 @@
/* /*
* Author: commy2 * Author: commy2
* Handle the open inventory event. Camshake and sound on target client.
* *
* Handle the open inventory event. Display message on target client. * Arguments:
* 0: Unit <OBJECT>
* 1: Backpack <OBJECT>
* *
* Argument: * Return Value:
* Input from "InventoryOpened" eventhandler
*
* Return value:
* false. Always open the inventory dialog. (Bool) * false. Always open the inventory dialog. (Bool)
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -25,14 +25,6 @@ class Extended_GetOut_EventHandlers {
}; };
}; };
}; };
//reset captivity and escorting status when getting killed
class Extended_Killed_EventHandlers {
class CAManBase {
class GVAR(AutoDetachCaptive) {
killed = QUOTE(_this call FUNC(handleKilled));
};
};
};
//mission start //mission start
class Extended_InitPost_EventHandlers { class Extended_InitPost_EventHandlers {
class CAManBase { class CAManBase {

View File

@ -32,7 +32,6 @@ class CfgVehicles {
showDisabled = 0; showDisabled = 0;
icon = QUOTE(PATHTOF(UI\captive_ca.paa)); icon = QUOTE(PATHTOF(UI\captive_ca.paa));
priority = 2.3; priority = 2.3;
hotkey = "E";
}; };
class ACE_StopEscorting { class ACE_StopEscorting {
displayName = CSTRING(StopEscorting); displayName = CSTRING(StopEscorting);
@ -43,7 +42,6 @@ class CfgVehicles {
showDisabled = 0; showDisabled = 0;
icon = QUOTE(PATHTOF(UI\captive_ca.paa)); icon = QUOTE(PATHTOF(UI\captive_ca.paa));
priority = 2.3; priority = 2.3;
hotkey = "E";
}; };
class ACE_LoadCaptive { class ACE_LoadCaptive {
displayName = CSTRING(LoadCaptive); displayName = CSTRING(LoadCaptive);
@ -54,7 +52,6 @@ class CfgVehicles {
showDisabled = 0; showDisabled = 0;
icon = QUOTE(PATHTOF(UI\captive_ca.paa)); icon = QUOTE(PATHTOF(UI\captive_ca.paa));
priority = 2.2; priority = 2.2;
hotkey = "L";
}; };
class GVAR(UnloadCaptive) { class GVAR(UnloadCaptive) {
displayName = CSTRING(UnloadCaptive); displayName = CSTRING(UnloadCaptive);
@ -74,7 +71,6 @@ class CfgVehicles {
exceptions[] = {"isNotEscorting"}; exceptions[] = {"isNotEscorting"};
showDisabled = 0; showDisabled = 0;
priority = 2.3; priority = 2.3;
hotkey = "C";
}; };
class ACE_StartSurrenderingSelf { class ACE_StartSurrenderingSelf {
displayName = CSTRING(StartSurrendering); displayName = CSTRING(StartSurrendering);
@ -153,16 +149,32 @@ class CfgVehicles {
class GVAR(ModuleSurrender): Module_F { class GVAR(ModuleSurrender): Module_F {
author = ECSTRING(common,ACETeam); author = ECSTRING(common,ACETeam);
category = "ACE"; category = "ACE";
displayName = CSTRING(ModuleSurrender_DisplayName); //Make Unit Surrender displayName = CSTRING(ModuleSurrender_DisplayName);
function = QFUNC(moduleSurrender); function = QFUNC(moduleSurrender);
scope = 2; //show in editor scope = 2; //show in editor
isGlobal = 1; //run global isGlobal = 0; //run on server
isTriggerActivated = 1; //Wait for triggers isTriggerActivated = 1; //Wait for triggers
icon = QUOTE(PATHTOF(UI\Icon_Module_Make_Unit_Surrender_ca.paa)); icon = QUOTE(PATHTOF(UI\Icon_Module_Make_Unit_Surrender_ca.paa));
functionPriority = 0; functionPriority = 0;
class Arguments {}; class Arguments {};
class ModuleDescription: ModuleDescription { class ModuleDescription: ModuleDescription {
description = CSTRING(ModuleSurrender_Description); //Sync a unit to make them surrender.<br/>Source: ace_captives description = CSTRING(ModuleSurrender_Description);
sync[] = {"AnyAI"};
};
};
class GVAR(ModuleHandcuffed): Module_F {
author = ECSTRING(common,ACETeam);
category = "ACE";
displayName = CSTRING(ModuleHandcuffed_DisplayName);
function = QFUNC(moduleHandcuffed);
scope = 2; //show in editor
isGlobal = 0; //run on server
isTriggerActivated = 1; //Wait for triggers
icon = QUOTE(PATHTOF(UI\Icon_Module_Make_Unit_Handcuffed_ca.paa));
functionPriority = 0;
class Arguments {};
class ModuleDescription: ModuleDescription {
description = CSTRING(ModuleHandcuffed_Description);
sync[] = {"AnyAI"}; sync[] = {"AnyAI"};
}; };
}; };
@ -176,6 +188,7 @@ class CfgVehicles {
scope = 2; scope = 2;
icon = QUOTE(PATHTOF(UI\Icon_Module_settings_ca.paa)); icon = QUOTE(PATHTOF(UI\Icon_Module_settings_ca.paa));
isGlobal = 1; isGlobal = 1;
isSingular = 1;
class Arguments { class Arguments {
class allowHandcuffOwnSide { class allowHandcuffOwnSide {
displayName = CSTRING(ModuleSettings_handcuffSide_name); displayName = CSTRING(ModuleSettings_handcuffSide_name);

View File

@ -18,7 +18,6 @@ if (isServer) then {
}]; }];
}; };
["playerVehicleChanged", {_this call FUNC(handleVehicleChanged)}] call EFUNC(common,addEventHandler);
["zeusDisplayChanged", {_this call FUNC(handleZeusDisplayChanged)}] call EFUNC(common,addEventHandler); ["zeusDisplayChanged", {_this call FUNC(handleZeusDisplayChanged)}] call EFUNC(common,addEventHandler);
["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); ["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler);
["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); ["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler);
@ -27,7 +26,7 @@ if (isServer) then {
["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler); ["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler);
["SetSurrendered", {_this call FUNC(setSurrendered)}] call EFUNC(common,addEventHandler); ["SetSurrendered", {_this call FUNC(setSurrendered)}] call EFUNC(common,addEventHandler);
//Medical Integration Events??? //Medical Integration Events
["medical_onUnconscious", {_this call ACE_Captives_fnc_handleOnUnconscious}] call EFUNC(common,addEventHandler); ["medical_onUnconscious", {_this call ACE_Captives_fnc_handleOnUnconscious}] call EFUNC(common,addEventHandler);
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};

View File

@ -19,12 +19,12 @@ PREP(doUnloadCaptive);
PREP(findEmptyNonFFVCargoSeat); PREP(findEmptyNonFFVCargoSeat);
PREP(handleGetIn); PREP(handleGetIn);
PREP(handleGetOut); PREP(handleGetOut);
PREP(handleKilled);
PREP(handleOnUnconscious); PREP(handleOnUnconscious);
PREP(handlePlayerChanged); PREP(handlePlayerChanged);
PREP(handleRespawn); PREP(handleRespawn);
PREP(handleUnitInitPost); PREP(handleUnitInitPost);
PREP(handleZeusDisplayChanged); PREP(handleZeusDisplayChanged);
PREP(moduleHandcuffed);
PREP(moduleSettings); PREP(moduleSettings);
PREP(moduleSurrender); PREP(moduleSurrender);
PREP(setHandcuffed); PREP(setHandcuffed);

View File

@ -2,7 +2,7 @@
class CfgPatches { class CfgPatches {
class ADDON { class ADDON {
units[] = {QGVAR(ModuleSettings), QGVAR(ModuleSurrender)}; units[] = {QGVAR(ModuleSettings), QGVAR(ModuleSurrender), QGVAR(ModuleHandcuffed)};
weapons[] = {"ACE_CableTie"}; weapons[] = {"ACE_CableTie"};
requiredVersion = REQUIRED_VERSION; requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ACE_Interaction"}; requiredAddons[] = {"ACE_Interaction"};

View File

@ -20,7 +20,13 @@ params ["_unit", "_target"];
//Check sides, Player has cableTie, target is alive and not already handcuffed //Check sides, Player has cableTie, target is alive and not already handcuffed
(GVAR(allowHandcuffOwnSide) || {(side _unit) != (side _target)}) && (GVAR(allowHandcuffOwnSide) || {(side _unit) != (side _target)}) &&
("ACE_CableTie" in (items _unit)) && {"ACE_CableTie" in (items _unit)} &&
{alive _target} && {alive _target} &&
{!(_target getVariable [QGVAR(isHandcuffed), false])} && {!(_target getVariable [QGVAR(isHandcuffed), false])} &&
(GVAR(requireSurrender) == 0 || ((_target getVariable [QGVAR(isSurrendering), false]) || (currentWeapon _target == "" && GVAR(requireSurrender) == 2))) {
(_target getVariable ["ACE_isUnconscious", false]) || //isUnconscious
{!([_target] call EFUNC(common,isPlayer))} || //is an AI (not a player)
{GVAR(requireSurrender) == 0} || //or don't require surrendering
{_target getVariable [QGVAR(isSurrendering), false]} || //or is surrendering
{(GVAR(requireSurrender) == 2) && {(currentWeapon _target) == ""}} //or "SurrenderOrNoWeapon" and no weapon
}

View File

@ -45,7 +45,7 @@ if (_state) then {
}; };
if (!(_unit getVariable [QGVAR(isEscorting), false])) then { if (!(_unit getVariable [QGVAR(isEscorting), false])) then {
[(_this select 1)] call cba_fnc_removePerFrameHandler; [(_this select 1)] call CBA_fnc_removePerFrameHandler;
[objNull, _target, false] call EFUNC(common,claim); [objNull, _target, false] call EFUNC(common,claim);
detach _target; detach _target;
_unit removeAction _actionID; _unit removeAction _actionID;

View File

@ -26,7 +26,7 @@ if (local _unit) then {
}; };
if (_unit getVariable [QGVAR(isSurrendering), false]) then { if (_unit getVariable [QGVAR(isSurrendering), false]) then {
[_unit, false] call FUNC(setSurrender); [_unit, false] call FUNC(setSurrendered);
}; };
if (_unit getVariable [QGVAR(isHandcuffed), false]) then { if (_unit getVariable [QGVAR(isHandcuffed), false]) then {

View File

@ -1,32 +0,0 @@
/*
* Author: PabstMirror
* Handles when a unit is kill. Reset captivity and escorting status
*
* Arguments:
* 0: _oldUnit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [bob1] call ACE_captives_fnc_handleKilled
*
* Public: No
*/
#include "script_component.hpp"
params ["_oldUnit"];
if (!local _oldUnit) exitWith {};
if (_oldUnit getVariable [QGVAR(isHandcuffed), false]) then {
[_oldUnit, false] call FUNC(setHandcuffed);
};
if (_oldUnit getVariable [QGVAR(isEscorting), false]) then {
_oldUnit setVariable [QGVAR(isEscorting), false, true];
};
if (_oldUnit getVariable [QGVAR(isSurrendering), false]) then {
[_oldUnit, false] call FUNC(setSurrendered);
};

View File

@ -21,10 +21,10 @@ params ["_newUnit","_oldUnit"];
//set showHUD based on new unit status: //set showHUD based on new unit status:
if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable [QGVAR(isSurrendering), false]}) then { if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable [QGVAR(isSurrendering), false]}) then {
TRACE_1("Player Change (showHUD false)",_newUnit); TRACE_1("Player Change (showHUD false)",_newUnit);
showHUD false; ["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud);
} else { } else {
TRACE_1("Player Change (showHUD true)",_newUnit); TRACE_1("Player Change (showHUD true)",_newUnit);
showHUD true; ["captive", []] call EFUNC(common,showHud); //same as showHud true;
}; };
//If old player was escorting, stop //If old player was escorting, stop

View File

@ -20,20 +20,34 @@ params ["_unit","_dead"];
if (!local _unit) exitWith {}; if (!local _unit) exitWith {};
//With respawn="group", we could be respawning into a unit that is handcuffed/captive // Group and side respawn can potentially respawn you as a captive unit
//If they are, reset and rerun the SET function // Base and instant respawn cannot, so captive should be entirely reset
//if not, make sure to explicity disable the setCaptivityStatus, because captiveNum does not work correctly on respawn // So we explicity account for the respawn type
private ["_respawn"];
_respawn = [0] call BIS_fnc_missionRespawnType;
if (_respawn > 3) then {
if (_unit getVariable [QGVAR(isHandcuffed), false]) then { if (_unit getVariable [QGVAR(isHandcuffed), false]) then {
_unit setVariable [QGVAR(isHandcuffed), false]; _unit setVariable [QGVAR(isHandcuffed), false];
[_unit, true] call FUNC(setHandcuffed); [_unit, true] call FUNC(setHandcuffed);
} else {
[_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus);
}; };
if (_unit getVariable [QGVAR(isSurrendering), false]) then { if (_unit getVariable [QGVAR(isSurrendering), false]) then {
_unit setVariable [QGVAR(isSurrendering), false]; _unit setVariable [QGVAR(isSurrendering), false];
[_unit, true] call FUNC(setSurrendered); [_unit, true] call FUNC(setSurrendered);
} else { };
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); } else {
if (_unit getVariable [QGVAR(isHandcuffed), false]) then {
[_unit, false] call FUNC(setHandcuffed);
};
[_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus);
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
[_unit, false] call FUNC(setSurrendered);
};
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
if (_oldUnit getVariable [QGVAR(isEscorting), false]) then {
_oldUnit setVariable [QGVAR(isEscorting), false, true];
};
}; };

View File

@ -23,9 +23,9 @@ params ["_unit","_zeusIsOpen"];
if (!_zeusIsOpen) then { if (!_zeusIsOpen) then {
if ((_unit getVariable [QGVAR(isHandcuffed), false]) || {_unit getVariable [QGVAR(isSurrendering), false]}) then { if ((_unit getVariable [QGVAR(isHandcuffed), false]) || {_unit getVariable [QGVAR(isSurrendering), false]}) then {
TRACE_1("Player Change (showHUD false)",_unit); TRACE_1("Player Change (showHUD false)",_unit);
showHUD false; ["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud);
} else { } else {
TRACE_1("Player Change (showHUD true)",_unit); TRACE_1("Player Change (showHUD true)",_unit);
showHUD true; ["captive", []] call EFUNC(common,showHud); //same as showHud true;
}; };
}; };

View File

@ -0,0 +1,35 @@
/*
* Author: PabstMirror
* Module Function to make a unit handcuffed (can be called from editor)
*
* Arguments:
* 0: The Module Logic <OBJECT>
* 1: synced objects <ARRAY>
* 2: Activated <BOOL>
*
* Return Value:
* Nothing
*
* Example:
* Called from module
*
* Public: No
*/
#include "script_component.hpp"
params ["_logic", "_units", "_activated"];
TRACE_3("params",_logic,_units,_activated);
if (!_activated) exitWith {};
if (!isServer) exitWith {};
//Modules run before postInit can instal the event handler, so we need to wait a little bit
[{
params ["_units"];
{
["SetHandcuffed", [_x], [_x, true]] call EFUNC(common,targetEvent);
} forEach _units;
}, [_units], 0.05] call EFUNC(common,waitAndExecute);
deleteVehicle _logic;

View File

@ -1,9 +1,9 @@
/* /*
* Author: PabstMirror * Author: PabstMirror
* Module Function to make a unit surrender (can be called from editor, or placed with zeus) * Module Function to make a unit surrender (can be called from editor)
* *
* Arguments: * Arguments:
* 0: The Module Logic Object <OBJECT> * 0: The Module Logic <OBJECT>
* 1: synced objects <ARRAY> * 1: synced objects <ARRAY>
* 2: Activated <BOOL> * 2: Activated <BOOL>
* *
@ -17,13 +17,13 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_bisMouseOver", "_mouseOverObject"];
params ["_logic", "_units", "_activated"]; params ["_logic", "_units", "_activated"];
if (!_activated) exitWith {}; TRACE_3("params",_logic,_units,_activated);
if (!_activated) exitWith {};
if (!isServer) exitWith {};
if (local _logic) then {
//Modules run before postInit can instal the event handler, so we need to wait a little bit //Modules run before postInit can instal the event handler, so we need to wait a little bit
[{ [{
params ["_units"]; params ["_units"];
@ -33,4 +33,3 @@ if (local _logic) then {
}, [_units], 0.05] call EFUNC(common,waitAndExecute); }, [_units], 0.05] call EFUNC(common,waitAndExecute);
deleteVehicle _logic; deleteVehicle _logic;
};

View File

@ -19,7 +19,7 @@
params ["_unit","_state"]; params ["_unit","_state"];
TRACE_2("params",_unit,_state); TRACE_2("params",_unit,_state);
if (!local _unit) exitwith { if (!local _unit) exitWith {
ERROR("running setHandcuffed on remote unit"); ERROR("running setHandcuffed on remote unit");
}; };
if ((_unit getVariable [QGVAR(isHandcuffed), false]) isEqualTo _state) exitWith { if ((_unit getVariable [QGVAR(isHandcuffed), false]) isEqualTo _state) exitWith {
@ -38,7 +38,7 @@ if (_state) then {
_unit setVariable [QGVAR(CargoIndex), ((vehicle _unit) getCargoIndex _unit), true]; _unit setVariable [QGVAR(CargoIndex), ((vehicle _unit) getCargoIndex _unit), true];
if (_unit == ACE_player) then { if (_unit == ACE_player) then {
showHUD false; ["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud);
}; };
// fix anim on mission start (should work on dedicated servers) // fix anim on mission start (should work on dedicated servers)
@ -56,8 +56,11 @@ if (_state) then {
//Adds an animation changed eh //Adds an animation changed eh
//If we get a change in animation then redo the animation (handles people vaulting to break the animation chain) //If we get a change in animation then redo the animation (handles people vaulting to break the animation chain)
private "_animChangedEHID"; private _animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1];
if (_animChangedEHID != -1) then {
TRACE_1("removing animChanged EH",_animChangedEHID);
_unit removeEventHandler ["AnimChanged", _animChangedEHID];
};
_animChangedEHID = _unit addEventHandler ["AnimChanged", { _animChangedEHID = _unit addEventHandler ["AnimChanged", {
params ["_unit", "_newAnimation"]; params ["_unit", "_newAnimation"];
TRACE_2("AnimChanged",_unit,_newAnimation); TRACE_2("AnimChanged",_unit,_newAnimation);
@ -67,7 +70,6 @@ if (_state) then {
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
}; };
} else { } else {
_turretPath = []; _turretPath = [];
{ {
_x params ["_xUnit", "", "", "_xTurretPath"]; _x params ["_xUnit", "", "", "_xTurretPath"];
@ -90,8 +92,7 @@ if (_state) then {
[_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus); [_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus);
//remove AnimChanged EH //remove AnimChanged EH
private "_animChangedEHID"; private _animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1];
_animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1];
TRACE_1("removing animChanged EH",_animChangedEHID); TRACE_1("removing animChanged EH",_animChangedEHID);
_unit removeEventHandler ["AnimChanged", _animChangedEHID]; _unit removeEventHandler ["AnimChanged", _animChangedEHID];
_unit setVariable [QGVAR(handcuffAnimEHID), -1]; _unit setVariable [QGVAR(handcuffAnimEHID), -1];
@ -106,6 +107,9 @@ if (_state) then {
}; };
if (_unit == ACE_player) then { if (_unit == ACE_player) then {
showHUD true; ["captive", []] call EFUNC(common,showHud); //same as showHud true;
}; };
}; };
//Global Event after changes:
["CaptiveStatusChanged", [_unit, _state, "SetHandcuffed"]] call EFUNC(common,globalEvent);

View File

@ -19,7 +19,7 @@
params ["_unit","_state"]; params ["_unit","_state"];
TRACE_2("params",_unit,_state); TRACE_2("params",_unit,_state);
if (!local _unit) exitwith { if (!local _unit) exitWith {
ERROR("running surrender on remote unit"); ERROR("running surrender on remote unit");
}; };
@ -36,7 +36,7 @@ if (_state) then {
[_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus); [_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus);
if (_unit == ACE_player) then { if (_unit == ACE_player) then {
showHUD false; ["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud);
}; };
[_unit] call EFUNC(common,fixLoweredRifleAnimation); [_unit] call EFUNC(common,fixLoweredRifleAnimation);
@ -48,7 +48,11 @@ if (_state) then {
if (_unit getVariable [QGVAR(isSurrendering), false] && {(vehicle _unit) == _unit}) then { if (_unit getVariable [QGVAR(isSurrendering), false] && {(vehicle _unit) == _unit}) then {
//Adds an animation changed eh //Adds an animation changed eh
//If we get a change in animation then redo the animation (handles people vaulting to break the animation chain) //If we get a change in animation then redo the animation (handles people vaulting to break the animation chain)
private "_animChangedEHID"; private _animChangedEHID = _unit getVariable [QGVAR(surrenderAnimEHID), -1];
if (_animChangedEHID != -1) then {
TRACE_1("removing animChanged EH",_animChangedEHID);
_unit removeEventHandler ["AnimChanged", _animChangedEHID];
};
_animChangedEHID = _unit addEventHandler ["AnimChanged", { _animChangedEHID = _unit addEventHandler ["AnimChanged", {
params ["_unit", "_newAnimation"]; params ["_unit", "_newAnimation"];
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then { if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
@ -64,15 +68,14 @@ if (_state) then {
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
//remove AnimChanged EH //remove AnimChanged EH
private "_animChangedEHID"; private _animChangedEHID = _unit getVariable [QGVAR(surrenderAnimEHID), -1];
_animChangedEHID = _unit getVariable [QGVAR(surrenderAnimEHID), -1];
_unit removeEventHandler ["AnimChanged", _animChangedEHID]; _unit removeEventHandler ["AnimChanged", _animChangedEHID];
_unit setVariable [QGVAR(surrenderAnimEHID), -1]; _unit setVariable [QGVAR(surrenderAnimEHID), -1];
if (_unit == ACE_player) then { if (_unit == ACE_player) then {
//only re-enable HUD if not handcuffed //only re-enable HUD if not handcuffed
if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then { if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then {
showHUD true; ["captive", []] call EFUNC(common,showHud); //same as showHud true;
}; };
}; };
@ -101,3 +104,6 @@ if (_state) then {
}, 0, [_unit, (ACE_time + 20)]] call CBA_fnc_addPerFrameHandler; }, 0, [_unit, (ACE_time + 20)]] call CBA_fnc_addPerFrameHandler;
}; };
}; };
//Global Event after changes:
["CaptiveStatusChanged", [_unit, _state, "SetSurrendered"]] call EFUNC(common,globalEvent);

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project name="ACE"> <Project name="ACE">
<Package name="Captives"> <Package name="Captives">
<Key ID="STR_ACE_Captives_SetCaptive"> <Key ID="STR_ACE_Captives_SetCaptive">
@ -99,7 +99,7 @@
</Key> </Key>
<Key ID="STR_ACE_Captives_CableTieDescription"> <Key ID="STR_ACE_Captives_CableTieDescription">
<English>Cable ties that allow you to restrain prisoners.</English> <English>Cable ties that allow you to restrain prisoners.</English>
<German>Kabelbinder ermöglichen es, Gefangene zu fesseln.</German> <German>Mit Kabelbindern können Gefangene gefesselt werden.</German>
<Polish>Opaska zaciskowa pozwala na skrępowanie dłoni u więźnia.</Polish> <Polish>Opaska zaciskowa pozwala na skrępowanie dłoni u więźnia.</Polish>
<Spanish>Los precintos permiten maniatar prisioneros</Spanish> <Spanish>Los precintos permiten maniatar prisioneros</Spanish>
<French>Les Serflex permettent de menotter les prisonniers.</French> <French>Les Serflex permettent de menotter les prisonniers.</French>
@ -166,7 +166,7 @@
<Portuguese>Fazer unidade se render</Portuguese> <Portuguese>Fazer unidade se render</Portuguese>
<French>Faire capituler l'unité</French> <French>Faire capituler l'unité</French>
<Hungarian>Egység kapitulálása</Hungarian> <Hungarian>Egység kapitulálása</Hungarian>
<Russian>Сделать юнита пленным</Russian> <Russian>Заставить юнита сдаться</Russian>
<Italian>Permette alle unità di arrendersi</Italian> <Italian>Permette alle unità di arrendersi</Italian>
</Key> </Key>
<Key ID="STR_ACE_Captives_ModuleSurrender_Description"> <Key ID="STR_ACE_Captives_ModuleSurrender_Description">
@ -178,9 +178,23 @@
<Portuguese>Sincroniza uma unidade para fazer com que ela se renda. &lt;br/&gt;Fonte: ace_captives</Portuguese> <Portuguese>Sincroniza uma unidade para fazer com que ela se renda. &lt;br/&gt;Fonte: ace_captives</Portuguese>
<French>Synchronise une unité pour la rendre captive. &lt;br/&gt;Source: ace_captives</French> <French>Synchronise une unité pour la rendre captive. &lt;br/&gt;Source: ace_captives</French>
<Hungarian>Egység szinkronizálása, hogy kapituláljon.&lt;br /&gt;Forrás: ace_captives</Hungarian> <Hungarian>Egység szinkronizálása, hogy kapituláljon.&lt;br /&gt;Forrás: ace_captives</Hungarian>
<Russian>Синхронизируйте с юнитами, чтобы сделать их пленными.&lt;br /&gt;Источник: ace_captives</Russian> <Russian>Синхронизируйте с юнитами, чтобы заставить их сдаться в плен.&lt;br /&gt;Источник: ace_captives</Russian>
<Italian>Sincronizza una unità per farla arrendere.&lt;br/&gt;Fonte: ace_captives</Italian> <Italian>Sincronizza una unità per farla arrendere.&lt;br/&gt;Fonte: ace_captives</Italian>
</Key> </Key>
<Key ID="STR_ACE_Captives_ModuleHandcuffed_DisplayName">
<English>Make Unit Handcuffed</English>
<Polish>Skuj jednostkę</Polish>
<Portuguese>Fazer unidade algemada</Portuguese>
<Russian>Связать юнита</Russian>
<Czech>Spoutat jednotku</Czech>
</Key>
<Key ID="STR_ACE_Captives_ModuleHandcuffed_Description">
<English>Sync a unit to make them handcuffed.&lt;br /&gt;Source: ace_captives</English>
<Polish>Zsynchronizuj z jednostką, aby została skuta.&lt;br /&gt;Źródło: ace_captives</Polish>
<Portuguese>Sincronizar uma unidade para deixá-la algemada.&lt;br/&gt;Source: ace_captives</Portuguese>
<Russian>Синхронизируйте с юнитами, чтобы сделать их связанными.&lt;br /&gt;Источник: ace_captives</Russian>
<Czech>Synchronizovat s jednotkou, která má být v poutech.&lt;br /&gt;Zdroj: ace_captives</Czech>
</Key>
<Key ID="STR_ACE_Captives_ModuleSettings_DisplayName"> <Key ID="STR_ACE_Captives_ModuleSettings_DisplayName">
<English>Captives Settings</English> <English>Captives Settings</English>
<Polish>Ustawienia więźniów</Polish> <Polish>Ustawienia więźniów</Polish>
@ -210,7 +224,7 @@
<Polish>Skuwanie sojuszników</Polish> <Polish>Skuwanie sojuszników</Polish>
<Spanish>Se puede esposar el bando propio</Spanish> <Spanish>Se puede esposar el bando propio</Spanish>
<Czech>Může spoutat spolubojovníky</Czech> <Czech>Může spoutat spolubojovníky</Czech>
<German>Kann Teamkollegen fesseln</German> <German>Kann Kameraden fesseln</German>
<Portuguese>Pode algemar o próprio lado</Portuguese> <Portuguese>Pode algemar o próprio lado</Portuguese>
<French>Peut libérer sa propre faction</French> <French>Peut libérer sa propre faction</French>
<Hungarian>Saját oldal megbilincselhető</Hungarian> <Hungarian>Saját oldal megbilincselhető</Hungarian>
@ -222,7 +236,7 @@
<Polish>Czy gracze mogą skuwać sojuszników?</Polish> <Polish>Czy gracze mogą skuwać sojuszników?</Polish>
<Spanish>Pueden los jugadores esposar unidades en su propio bando</Spanish> <Spanish>Pueden los jugadores esposar unidades en su propio bando</Spanish>
<Czech>Mohou hráči spoutat jednotky na své straně</Czech> <Czech>Mohou hráči spoutat jednotky na své straně</Czech>
<German>Können Spieler eigene Einheiten fesseln</German> <German>Spieler können eigene Einheiten fesseln. </German>
<Portuguese>Os jogadores podem algemar unidades do seu lado</Portuguese> <Portuguese>Os jogadores podem algemar unidades do seu lado</Portuguese>
<French>Les joueurs peuvent utiliser les Serflex sur leur propre camp</French> <French>Les joueurs peuvent utiliser les Serflex sur leur propre camp</French>
<Hungarian>A játékosok megkötözhetik-e a saját oldalukon lévő egységeket</Hungarian> <Hungarian>A játékosok megkötözhetik-e a saját oldalukon lévő egységeket</Hungarian>
@ -246,7 +260,7 @@
<Polish>Gracze mogą skapitulować po schowaniu swojej broni do kabury</Polish> <Polish>Gracze mogą skapitulować po schowaniu swojej broni do kabury</Polish>
<Spanish>Los jugadores pueden rendirse después de enfundar su arma</Spanish> <Spanish>Los jugadores pueden rendirse después de enfundar su arma</Spanish>
<Czech>Hráč se může vzdát poté, co si skryje zbraň</Czech> <Czech>Hráč se může vzdát poté, co si skryje zbraň</Czech>
<German>Spieler können kapitulieren, nachdem sie ihre Waffe geholstert haben</German> <German>Spieler können kapitulieren, nachdem sie ihre Waffe geholstert haben.</German>
<Portuguese>Jogadores podem se render depois de guardar sua arma</Portuguese> <Portuguese>Jogadores podem se render depois de guardar sua arma</Portuguese>
<French>Les joueurs peuvent se rendre après avoir rangé leur arme</French> <French>Les joueurs peuvent se rendre après avoir rangé leur arme</French>
<Hungarian>A játékosok megadhatják magukat a fegyverük elrakása után</Hungarian> <Hungarian>A játékosok megadhatják magukat a fegyverük elrakása után</Hungarian>
@ -255,30 +269,42 @@
</Key> </Key>
<Key ID="STR_ACE_Captives_ModuleSettings_requireSurrender_name"> <Key ID="STR_ACE_Captives_ModuleSettings_requireSurrender_name">
<English>Require surrendering</English> <English>Require surrendering</English>
<German>Benötigt Kapitulation</German>
<Polish>Wymagaj kapitulacji</Polish> <Polish>Wymagaj kapitulacji</Polish>
<Portuguese>Requer rendição</Portuguese> <Portuguese>Requer rendição</Portuguese>
<Russian>Требовать пленения</Russian> <Russian>Требовать пленения</Russian>
<Spanish>Requiere rendición</Spanish>
<Czech>Vzdávání vyžadováno</Czech>
<Italian>Richiede arrendersi</Italian> <Italian>Richiede arrendersi</Italian>
</Key> </Key>
<Key ID="STR_ACE_Captives_ModuleSettings_requireSurrender_description"> <Key ID="STR_ACE_Captives_ModuleSettings_requireSurrender_description">
<English>Require Players to surrender before they can be arrested</English> <English>Require Players to surrender before they can be arrested</English>
<German>Spieler müssen sich erst ergeben, bevor sie gefangen genommen werden können</German>
<Polish>Wymagaj od graczy kapitulacji zanim będzie można ich zaaresztować</Polish> <Polish>Wymagaj od graczy kapitulacji zanim będzie można ich zaaresztować</Polish>
<Portuguese>Requer que jogadores se rendam antes de poderem ser presos</Portuguese> <Portuguese>Requer que jogadores se rendam antes de poderem ser presos</Portuguese>
<Russian>Требуется, чтобы игрок сдался в плен прежде, чем его можно будет связать</Russian> <Russian>Требуется, чтобы игрок сдался в плен прежде, чем его можно будет связать</Russian>
<Spanish>Requiere que los Jugadores se rindan antes de arrestarlos</Spanish>
<Czech>Vyžaduje, aby se hráč nejdříve vzdal, poté může být spoután</Czech>
<Italian>I giocatori devono arrendersi prima che possano essere arrestati</Italian> <Italian>I giocatori devono arrendersi prima che possano essere arrestati</Italian>
</Key> </Key>
<Key ID="STR_ACE_Captives_SurrenderOnly"> <Key ID="STR_ACE_Captives_SurrenderOnly">
<English>Surrendering only</English> <English>Surrendering only</English>
<German>Nur Ergeben</German>
<Polish>Tylko kapitulacja</Polish> <Polish>Tylko kapitulacja</Polish>
<Portuguese>Somente rendição </Portuguese> <Portuguese>Somente rendição </Portuguese>
<Russian>Только сдавшийся в плен</Russian> <Russian>Только сдавшийся в плен</Russian>
<Spanish>Solo rendición</Spanish>
<Czech>Pouze vzdávání</Czech>
<Italian>Solo arrendersi</Italian> <Italian>Solo arrendersi</Italian>
</Key> </Key>
<Key ID="STR_ACE_Captives_SurrenderOrNoWeapon"> <Key ID="STR_ACE_Captives_SurrenderOrNoWeapon">
<English>Surrendering or No weapon</English> <English>Surrendering or No weapon</English>
<German>Ergeben oder keine Waffe</German>
<Polish>Kapitulacja lub brak broni</Polish> <Polish>Kapitulacja lub brak broni</Polish>
<Portuguese>Rendição ou desarmado</Portuguese> <Portuguese>Rendição ou desarmado</Portuguese>
<Russian>Сдавшийся или безоружный</Russian> <Russian>Сдавшийся или безоружный</Russian>
<Spanish>Rendición o desarme</Spanish>
<Czech>Vzdávání nebo beze zbraně</Czech>
<Italian>Arrendersi o no armi</Italian> <Italian>Arrendersi o no armi</Italian>
</Key> </Key>
</Package> </Package>

View File

@ -16,85 +16,78 @@ class Extended_Killed_EventHandlers {
}; };
}; };
class Extended_Init_EventHandlers { //Need initPost or we have problems with setVariable with 'ACE_Cargo'
class Extended_InitPost_EventHandlers {
class StaticWeapon { class StaticWeapon {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(initObject)); init = QUOTE(_this call DFUNC(initObject));
}; };
}; };
class ReammoBox_F { class ReammoBox_F {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(initObject)); init = QUOTE(_this call DFUNC(initObject));
}; };
}; };
class Cargo_base_F { class Cargo_base_F {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
}; };
}; };
class CargoNet_01_box_F { class CargoNet_01_box_F {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
}; };
}; };
class Land_CargoBox_V1_F { class Land_CargoBox_V1_F {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
}; };
}; };
class Land_PaperBox_closed_F { class Land_PaperBox_closed_F {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
}; };
}; };
class RoadCone_F {
class ADDON {
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
};
};
class Car { class Car {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(initVehicle)); init = QUOTE(_this call DFUNC(initVehicle));
}; };
}; };
class Tank { class Tank {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(initVehicle)); init = QUOTE(_this call DFUNC(initVehicle));
}; };
}; };
class Helicopter { class Helicopter {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(initVehicle)); init = QUOTE(_this call DFUNC(initVehicle));
}; };
}; };
class Plane { class Plane {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(initVehicle)); init = QUOTE(_this call DFUNC(initVehicle));
}; };
}; };
class Ship_F { class Ship_F {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(initVehicle)); init = QUOTE(_this call DFUNC(initVehicle));
}; };
}; };
class ACE_RepairItem_Base { class ACE_RepairItem_Base {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(initObject)); init = QUOTE(_this call DFUNC(initObject));
}; };
}; };
class ACE_bodyBagObject { class ACE_bodyBagObject {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(initObject)); init = QUOTE(_this call DFUNC(initObject));
}; };
}; };
class ACE_ConcertinaWireCoil { class ACE_ConcertinaWireCoil {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(initObject)); init = QUOTE(_this call DFUNC(initObject));

View File

@ -8,8 +8,10 @@ class CfgVehicles {
function = QFUNC(moduleSettings); function = QFUNC(moduleSettings);
functionPriority = 1; functionPriority = 1;
isGlobal = 1; isGlobal = 1;
isSingular = 1;
isTriggerActivated = 0; isTriggerActivated = 0;
author = ECSTRING(common,ACETeam); author = ECSTRING(common,ACETeam);
class Arguments { class Arguments {
class enable { class enable {
displayName = CSTRING(ModuleSettings_enable); displayName = CSTRING(ModuleSettings_enable);
@ -18,13 +20,13 @@ class CfgVehicles {
defaultValue = 1; defaultValue = 1;
}; };
}; };
class ModuleDescription { class ModuleDescription {
description = CSTRING(SettingsModule_Description); description = CSTRING(SettingsModule_Description);
sync[] = {}; sync[] = {};
}; };
}; };
class LandVehicle; class LandVehicle;
class Car: LandVehicle { class Car: LandVehicle {
GVAR(space) = 4; GVAR(space) = 4;
@ -39,6 +41,7 @@ class CfgVehicles {
};*/ };*/
}; };
}; };
class Tank: LandVehicle { class Tank: LandVehicle {
GVAR(space) = 4; GVAR(space) = 4;
GVAR(hasCargo) = 1; GVAR(hasCargo) = 1;
@ -50,27 +53,161 @@ class CfgVehicles {
GVAR(hasCargo) = 1; GVAR(hasCargo) = 1;
}; };
// hemets
class Truck_01_base_F: Truck_F {
GVAR(space) = 8;
};
class B_Truck_01_transport_F: Truck_01_base_F {
GVAR(space) = 20;
};
class B_Truck_01_covered_F: B_Truck_01_transport_F {
GVAR(space) = 20;
};
class B_Truck_01_mover_F: B_Truck_01_transport_F {
GVAR(space) = 4;
};
class B_Truck_01_box_F: B_Truck_01_mover_F {
GVAR(space) = 40;
};
class B_Truck_01_Repair_F: B_Truck_01_mover_F {
GVAR(space) = 20;
};
class B_Truck_01_ammo_F: B_Truck_01_mover_F {
GVAR(space) = 8;
};
class B_Truck_01_fuel_F: B_Truck_01_mover_F {
GVAR(space) = 4;
};
class B_Truck_01_medical_F: B_Truck_01_transport_F {
GVAR(space) = 8;
};
// kamaz'
class Truck_02_base_F: Truck_F { //covers "covered" variants
GVAR(space) = 20;
};
class Truck_02_transport_base_F: Truck_02_base_F {
GVAR(space) = 20;
};
class Truck_02_box_base_F: Truck_02_base_F { // repair variant, not actually cargo box like hemet
GVAR(space) = 12;
};
class Truck_02_medical_base_F: Truck_02_box_base_F {
GVAR(space) = 8;
};
class Truck_02_Ammo_base_F: Truck_02_base_F {
GVAR(space) = 12;
};
class Truck_02_fuel_base_F: Truck_02_base_F {
GVAR(space) = 4;
};
// typhoon
class Truck_03_base_F: Truck_F {
GVAR(space) = 8;
};
class O_Truck_03_transport_F: Truck_03_base_F {
GVAR(space) = 20;
};
class O_Truck_03_covered_F: Truck_03_base_F {
GVAR(space) = 20;
};
class O_Truck_03_repair_F: Truck_03_base_F {
GVAR(space) = 12;
};
class O_Truck_03_ammo_F: Truck_03_base_F {
GVAR(space) = 8;
};
class O_Truck_03_fuel_F: Truck_03_base_F {
GVAR(space) = 4;
};
class O_Truck_03_medical_F: Truck_03_base_F {
GVAR(space) = 8;
};
class O_Truck_03_device_F: Truck_03_base_F {
GVAR(space) = 4;
};
// civ trucks
class Van_01_base_F: Truck_F {
GVAR(space) = 8;
};
class Van_01_transport_base_F: Van_01_base_F {
GVAR(space) = 8;
};
class Van_01_box_base_F: Van_01_base_F { // repair variant, not actually cargo box like hemet
GVAR(space) = 12;
};
class Van_01_fuel_base_F: Van_01_base_F {
GVAR(space) = 4;
};
// misc. vehicles
class Quadbike_01_base_F: Car_F {
GVAR(space) = 0;
GVAR(hasCargo) = 0;
};
class Kart_01_Base_F: Car_F {
GVAR(space) = 0;
GVAR(hasCargo) = 0;
};
// helicopters
class Air; class Air;
class Helicopter: Air { class Helicopter: Air {
GVAR(space) = 8; GVAR(space) = 8;
GVAR(hasCargo) = 1; GVAR(hasCargo) = 1;
}; };
class Heli_Transport_02_base_F; class Heli_Transport_02_base_F;
class I_Heli_Transport_02_F : Heli_Transport_02_base_F { class I_Heli_Transport_02_F : Heli_Transport_02_base_F {
GVAR(space) = 20; GVAR(space) = 20;
GVAR(hasCargo) = 1; GVAR(hasCargo) = 1;
}; };
// jets
class Plane: Air { class Plane: Air {
GVAR(space) = 4; GVAR(space) = 0;
GVAR(hasCargo) = 1; GVAR(hasCargo) = 0;
}; };
// autonomus
class Helicopter_Base_F;
class UAV_01_base_F: Helicopter_Base_F {
GVAR(space) = 0;
GVAR(hasCargo) = 0;
};
// boats
class Ship; class Ship;
class Ship_F: Ship { class Ship_F: Ship {
GVAR(space) = 4; GVAR(space) = 4;
GVAR(hasCargo) = 1; GVAR(hasCargo) = 1;
}; };
class Boat_Civil_01_base_F: Ship_F {
GVAR(space) = 4;
GVAR(hasCargo) = 1;
};
class Boat_F: Ship_F {};
class Rubber_duck_base_F: Boat_F {
GVAR(space) = 0;
GVAR(hasCargo) = 0;
};
class Boat_Armed_01_base_F: Boat_F {
GVAR(space) = 8;
GVAR(hasCargo) = 1;
};
// submarines
class SDV_01_base_F: Boat_F {
GVAR(space) = 0;
GVAR(hasCargo) = 0;
};
// Static weapons // Static weapons
class StaticWeapon: LandVehicle { class StaticWeapon: LandVehicle {
GVAR(size) = 2; // 1 = small, 2 = large GVAR(size) = 2; // 1 = small, 2 = large
@ -89,6 +226,26 @@ class CfgVehicles {
GVAR(size) = 2; // 1 = small, 2 = large GVAR(size) = 2; // 1 = small, 2 = large
GVAR(canLoad) = 1; GVAR(canLoad) = 1;
}; };
//"Supply Box" - Small Pallets
class B_supplyCrate_F: ReammoBox_F {
GVAR(size) = 6;
};
class IG_supplyCrate_F: ReammoBox_F {
GVAR(size) = 6;
};
class C_supplyCrate_F: ReammoBox_F {
GVAR(size) = 6;
};
// objects
class RoadCone_F: ThingX {
GVAR(size) = 1;
GVAR(canLoad) = 1;
};
class RoadBarrier_F: RoadCone_F {
GVAR(size) = 2;
};
class Scrapyard_base_F; class Scrapyard_base_F;
class Land_PaperBox_closed_F: Scrapyard_base_F { class Land_PaperBox_closed_F: Scrapyard_base_F {
@ -97,6 +254,7 @@ class CfgVehicles {
GVAR(size) = 11; GVAR(size) = 11;
GVAR(canLoad) = 1; GVAR(canLoad) = 1;
XEH_ENABLED; XEH_ENABLED;
class ACE_Actions { class ACE_Actions {
class ACE_MainActions { class ACE_MainActions {
displayName = ECSTRING(interaction,MainAction); displayName = ECSTRING(interaction,MainAction);
@ -114,6 +272,7 @@ class CfgVehicles {
GVAR(hasCargo) = 1; GVAR(hasCargo) = 1;
GVAR(size) = 4; GVAR(size) = 4;
GVAR(canLoad) = 1; GVAR(canLoad) = 1;
class ACE_Actions { class ACE_Actions {
class ACE_MainActions { class ACE_MainActions {
displayName = ECSTRING(interaction,MainAction); displayName = ECSTRING(interaction,MainAction);
@ -165,12 +324,14 @@ class CfgVehicles {
GVAR(size) = 50; GVAR(size) = 50;
XEH_ENABLED; XEH_ENABLED;
}; };
class Ruins_F; class Ruins_F;
class Land_Cargo20_military_ruins_F: Ruins_F { class Land_Cargo20_military_ruins_F: Ruins_F {
GVAR(space) = 49; GVAR(space) = 49;
GVAR(size) = 50; GVAR(size) = 50;
XEH_ENABLED; XEH_ENABLED;
}; };
class Land_Cargo20_orange_F: Cargo_base_F { class Land_Cargo20_orange_F: Cargo_base_F {
GVAR(space) = 49; GVAR(space) = 49;
GVAR(size) = 50; GVAR(size) = 50;
@ -202,7 +363,6 @@ class CfgVehicles {
XEH_ENABLED; XEH_ENABLED;
}; };
class Land_Cargo40_blue_F: Cargo_base_F { class Land_Cargo40_blue_F: Cargo_base_F {
GVAR(space) = 99; GVAR(space) = 99;
GVAR(size) = 100; GVAR(size) = 100;
@ -238,11 +398,13 @@ class CfgVehicles {
GVAR(size) = 100; GVAR(size) = 100;
XEH_ENABLED; XEH_ENABLED;
}; };
class Land_Cargo40_military_ruins_F: Ruins_F { class Land_Cargo40_military_ruins_F: Ruins_F {
GVAR(space) = 99; GVAR(space) = 99;
GVAR(size) = 100; GVAR(size) = 100;
XEH_ENABLED; XEH_ENABLED;
}; };
class Land_Cargo40_orange_F: Cargo_base_F { class Land_Cargo40_orange_F: Cargo_base_F {
GVAR(space) = 99; GVAR(space) = 99;
GVAR(size) = 100; GVAR(size) = 100;
@ -273,12 +435,14 @@ class CfgVehicles {
GVAR(size) = 100; GVAR(size) = 100;
XEH_ENABLED; XEH_ENABLED;
}; };
// small // small
class Land_CargoBox_V1_F: ThingX { class Land_CargoBox_V1_F: ThingX {
GVAR(space) = 7; GVAR(space) = 7;
GVAR(hasCargo) = 1; GVAR(hasCargo) = 1;
GVAR(size) = 7; GVAR(size) = 7;
XEH_ENABLED; XEH_ENABLED;
class ACE_Actions { class ACE_Actions {
class ACE_MainActions { class ACE_MainActions {
displayName = ECSTRING(interaction,MainAction); displayName = ECSTRING(interaction,MainAction);
@ -290,5 +454,4 @@ class CfgVehicles {
}; };
}; };
}; };
}; };

View File

@ -1,5 +1,45 @@
#include "script_component.hpp" #include "script_component.hpp"
["LoadCargo", {_this call FUNC(loadItem)}] call EFUNC(common,addEventHandler);
["UnloadCargo", {_this call FUNC(unloadItem)}] call EFUNC(common,addEventHandler);
["AddCargoByClass", {_this call FUNC(addCargoItem)}] call EFUNC(common,addEventHandler); ["AddCargoByClass", {_this call FUNC(addCargoItem)}] call EFUNC(common,addEventHandler);
["LoadCargo", {
(_this select 0) params ["_item","_vehicle"];
private ["_loaded", "_hint", "_itemName", "_vehicleName"];
_loaded = [_item, _vehicle] call FUNC(loadItem);
// Show hint as feedback
_hint = [LSTRING(LoadingFailed), LSTRING(LoadedItem)] select _loaded;
_itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName");
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
["displayTextStructured", [[_hint, _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
if (_loaded) then {
// Invoke listenable event
["cargoLoaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
};
}] call EFUNC(common,addEventHandler);
["UnloadCargo", {
(_this select 0) params ["_item","_vehicle"];
private ["_unloaded", "_itemClass", "_hint", "_itemName", "_vehicleName"];
_unloaded = [_item, _vehicle] call FUNC(unloadItem);
_itemClass = if (_item isEqualType "") then {_item} else {typeOf _item};
// Show hint as feedback
_hint = [LSTRING(UnloadingFailed), LSTRING(UnloadedItem)] select _unloaded;
_itemName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName");
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
["displayTextStructured", [[_hint, _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
if (_unloaded) then {
// Invoke listenable event
["cargoUnloaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
};
// TOOO maybe drag/carry the unloaded item?
}] call EFUNC(common,addEventHandler);

View File

@ -6,6 +6,7 @@
* 0: Item Classname <STRING> * 0: Item Classname <STRING>
* 1: Vehicle <OBJECT> * 1: Vehicle <OBJECT>
* 2: Amount <NUMBER> (default: 1) * 2: Amount <NUMBER> (default: 1)
* 3: Show Hint <BOOL> (default: false)
* *
* Return Value: * Return Value:
* None * None
@ -17,22 +18,12 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_position", "_item", "_i"]; params ["_itemClass", "_vehicle", ["_amount", 1], ["_showHint", false, [false]] ];
params ["_itemClass", "_vehicle", ["_amount", 1]];
TRACE_3("params",_itemClass,_vehicle,_amount); TRACE_3("params",_itemClass,_vehicle,_amount);
_position = getPos _vehicle;
_position set [1, (_position select 1) + 1];
_position set [2, (_position select 2) + 7.5];
for "_i" from 1 to _amount do { for "_i" from 1 to _amount do {
_item = createVehicle [_itemClass, _position, [], 0, "CAN_COLLIDE"]; [_itemClass, _vehicle] call FUNC(loadItem);
// Load item or delete it if no space left
if !([_item, _vehicle] call FUNC(loadItem)) exitWith {
deleteVehicle _item;
}; };
// Invoke listenable event // Invoke listenable event
["cargoAddedByClass", [_itemClass, _vehicle, _amount]] call EFUNC(common,globalEvent); ["cargoAddedByClass", [_itemClass, _vehicle, _amount]] call EFUNC(common,globalEvent);
};

View File

@ -31,4 +31,6 @@ if (_nearestVehicle isKindOf "Cargo_Base_F" || isNull _nearestVehicle) then {
if (isNull _nearestVehicle) exitWith {false}; if (isNull _nearestVehicle) exitWith {false};
if ((locked _nearestVehicle) >= 2) exitWith {false};
[_object, _nearestVehicle] call FUNC(canLoadItemIn) [_object, _nearestVehicle] call FUNC(canLoadItemIn)

View File

@ -3,7 +3,7 @@
* Check if item can be loaded into other Object. * Check if item can be loaded into other Object.
* *
* Arguments: * Arguments:
* 0: Item Object <OBJECT> * 0: Item <OBJECT or STRING>
* 1: Holder Object (Vehicle) <OBJECT> * 1: Holder Object (Vehicle) <OBJECT>
* *
* Return value: * Return value:
@ -16,14 +16,24 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_item", "_vehicle"]; params [["_item", "", [objNull,""]], "_vehicle"];
if (speed _vehicle > 1 || (((getPos _vehicle) select 2) > 3)) exitWith {false}; if (speed _vehicle > 1 || (((getPos _vehicle) select 2) > 3)) exitWith {false};
private "_itemSize"; private ["_itemSize", "_validItem"];
_itemSize = ([_item] call FUNC(getSizeItem)); _itemSize = [_item] call FUNC(getSizeItem);
(_itemSize > 0) && if (_item isEqualType "") then {
{alive _item && alive _vehicle} && _validItem =
{(_item distance _vehicle <= MAX_LOAD_DISTANCE)} && isClass (configFile >> "CfgVehicles" >> _item) &&
{getNumber (configFile >> "CfgVehicles" >> _item >> QGVAR(canLoad)) == 1};
} else {
_validItem =
(alive _item) &&
{(_item distance _vehicle) <= MAX_LOAD_DISTANCE};
};
_validItem &&
{_itemSize > 0} &&
{alive _vehicle} &&
{_itemSize <= ([_vehicle] call FUNC(getCargoSpaceLeft))} {_itemSize <= ([_vehicle] call FUNC(getCargoSpaceLeft))}

View File

@ -16,18 +16,19 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_loaded", "_validVehiclestate", "_emptyPos"];
params ["_item", "_vehicle"]; params ["_item", "_vehicle"];
private ["_loaded", "_itemClass", "_validVehiclestate", "_emptyPos"];
_loaded = _vehicle getVariable [QGVAR(loaded), []]; _loaded = _vehicle getVariable [QGVAR(loaded), []];
if !(_item in _loaded) exitWith {false}; if !(_item in _loaded) exitWith {false};
_itemClass = if (_item isEqualType "") then {_item} else {typeOf _item};
_validVehiclestate = true; _validVehiclestate = true;
_emptyPos = []; _emptyPos = [];
if (_vehicle isKindOf "Ship" ) then { if (_vehicle isKindOf "Ship" ) then {
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]); // TODO: if spot is underwater pick another spot. _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, _itemClass]); // TODO: if spot is underwater pick another spot.
} else { } else {
if (_vehicle isKindOf "Air" ) then { if (_vehicle isKindOf "Air" ) then {
if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false}; if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false};
@ -35,7 +36,7 @@ if (_vehicle isKindOf "Ship" ) then {
_emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ]; _emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ];
} else { } else {
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]); _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, _itemClass]);
}; };
}; };

View File

@ -17,4 +17,4 @@
params ["_object"]; params ["_object"];
_object getVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeof _object >> QGVAR(space))] _object getVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeOf _object >> QGVAR(space))]

View File

@ -3,7 +3,7 @@
* Get the cargo size of an object. * Get the cargo size of an object.
* *
* Arguments: * Arguments:
* 0: Object <OBJECT> * 0: Item <OBJECT or STRING>
* *
* Return value: * Return value:
* Cargo size <NUMBER> (default: -1) * Cargo size <NUMBER> (default: -1)
@ -15,14 +15,24 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private "_config";
params ["_item"]; params ["_item"];
private ["_isVirtual","_itemClass","_config"];
scopeName "return";
_isVirtual = (_item isEqualType "");
_itemClass = if (_isVirtual) then {_item} else {typeOf _item};
_config = (configFile >> "CfgVehicles" >> _itemClass >> QGVAR(size));
if (_isVirtual) then {
if (isNumber _config) then {
(getNumber _config) breakOut "return";
};
} else {
_config = (configFile >> "CfgVehicles" >> typeOf _item >> QGVAR(size)); _config = (configFile >> "CfgVehicles" >> typeOf _item >> QGVAR(size));
if (isNumber (_config)) exitWith { if (isNumber _config) then {
_item getVariable [QGVAR(size), getNumber (_config)] (_item getVariable [QGVAR(size), getNumber _config]) breakOut "return";
};
}; };
-1 -1

View File

@ -20,12 +20,13 @@ params ["_vehicle"];
private["_loaded"]; private["_loaded"];
_loaded = _vehicle getVariable [QGVAR(loaded), []]; _loaded = _vehicle getVariable [QGVAR(loaded), []];
if (count _loaded == 0) exitWith {}; if (_loaded isEqualTo []) exitWith {};
{ {
// TODO deleteVehicle or just delete vehicle? Do we want to be able to recover destroyed equipment? // TODO Do we want to be able to recover destroyed equipment?
if (_x isEqualType objNull) then {
deleteVehicle _x; deleteVehicle _x;
//_x setDamage 1; };
} count _loaded; } count _loaded;
[_vehicle] call FUNC(validateCargoSpace); [_vehicle] call FUNC(validateCargoSpace);

View File

@ -25,7 +25,11 @@ _initializedClasses = GETMVAR(GVAR(initializedClasses),[]);
if (isServer) then { if (isServer) then {
{ {
if (isClass _x) then { if (isClass _x) then {
["AddCargoByClass", [getText (_x >> "type"), _vehicle, getNumber (_x >> "amount")]] call EFUNC(common,localEvent); private ["_cargoClassname", "_cargoCount"];
_cargoClassname = getText (_x >> "type");
_cargoCount = getNumber (_x >> "amount");
TRACE_3("adding ACE_Cargo", (configName _x), _cargoClassname, _cargoCount);
["AddCargoByClass", [_cargoClassname, _vehicle, _cargoCount]] call EFUNC(common,localEvent);
}; };
} count ("true" configClasses (configFile >> "CfgVehicles" >> _type >> "ACE_Cargo" >> "Cargo")); } count ("true" configClasses (configFile >> "CfgVehicles" >> _type >> "ACE_Cargo" >> "Cargo"));
}; };
@ -41,7 +45,7 @@ if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) ex
private ["_text", "_condition", "_statement", "_icon", "_action"]; private ["_text", "_condition", "_statement", "_icon", "_action"];
_condition = { _condition = {
params ["_target", "_player"]; params ["_target", "_player"];
GVAR(enable) && {locked _target < 2} && {[_player, _target, []] call EFUNC(common,canInteractWith)} GVAR(enable) && {locked _target < 2} && {alive _target} && {[_player, _target, []] call EFUNC(common,canInteractWith)}
}; };
_text = localize LSTRING(openMenu); _text = localize LSTRING(openMenu);
_statement = {GVAR(interactionVehicle) = _target; createDialog QGVAR(menu);}; _statement = {GVAR(interactionVehicle) = _target; createDialog QGVAR(menu);};

View File

@ -1,10 +1,12 @@
/* /*
* Author: Glowbal * Author: Glowbal
* Load object into vehicle. * Load object into vehicle.
* Objects loaded via classname remain virtual until unloaded.
* *
* Arguments: * Arguments:
* 0: Object <OBJECT> * 0: Item <OBJECT or STRING>
* 1: Vehicle <OBJECT> * 1: Vehicle <OBJECT>
* 2: Show Hint <BOOL> (default: true)
* *
* Return value: * Return value:
* Object loaded <BOOL> * Object loaded <BOOL>
@ -16,25 +18,25 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params [["_item","",[objNull,""]], ["_vehicle",objNull,[objNull]]];
private ["_loaded", "_space", "_itemSize"]; private ["_loaded", "_space", "_itemSize"];
params ["_item", "_vehicle"];
if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {false}; if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {false};
_loaded = _vehicle getVariable [QGVAR(loaded), []]; _loaded = _vehicle getVariable [QGVAR(loaded), []];
_loaded pushback _item; _loaded pushBack _item;
_vehicle setVariable [QGVAR(loaded), _loaded, true]; _vehicle setVariable [QGVAR(loaded), _loaded, true];
TRACE_1("added to loaded array",_loaded);
_space = [_vehicle] call FUNC(getCargoSpaceLeft); _space = [_vehicle] call FUNC(getCargoSpaceLeft);
_itemSize = [_item] call FUNC(getSizeItem); _itemSize = [_item] call FUNC(getSizeItem);
_vehicle setVariable [QGVAR(space), _space - _itemSize, true]; _vehicle setVariable [QGVAR(space), _space - _itemSize, true];
if (_item isEqualType objNull) then {
detach _item; detach _item;
_item attachTo [_vehicle,[0,0,100]]; _item attachTo [_vehicle,[0,0,-100]];
["hideObjectGlobal", [_item, true]] call EFUNC(common,serverEvent); ["hideObjectGlobal", [_item, true]] call EFUNC(common,serverEvent);
};
// Invoke listenable event
["cargoLoaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
true true

View File

@ -25,4 +25,4 @@ if (!_activated) exitWith {};
[_logic, QGVAR(enable), "enable"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(enable), "enable"] call EFUNC(common,readSettingFromModule);
diag_log text "[ACE]: Cargo Module Initialized."; ACE_LOGINFO("Cargo Module Initialized.");

View File

@ -22,7 +22,7 @@ params ["_display"];
uiNamespace setVariable [QGVAR(menuDisplay), _display]; uiNamespace setVariable [QGVAR(menuDisplay), _display];
[{ [{
private ["_display","_loaded", "_ctrl", "_label"]; private ["_display","_loaded", "_ctrl", "_class", "_label"];
disableSerialization; disableSerialization;
_display = uiNamespace getVariable QGVAR(menuDisplay); _display = uiNamespace getVariable QGVAR(menuDisplay);
if (isnil "_display") exitWith { if (isnil "_display") exitWith {
@ -40,7 +40,8 @@ uiNamespace setVariable [QGVAR(menuDisplay), _display];
lbClear _ctrl; lbClear _ctrl;
{ {
_ctrl lbAdd (getText(configfile >> "CfgVehicles" >> typeOf _x >> "displayName")); _class = if (_x isEqualType "") then {_x} else {typeOf _x};
_ctrl lbAdd (getText(configfile >> "CfgVehicles" >> _class >> "displayName"));
true true
} count _loaded; } count _loaded;

View File

@ -16,16 +16,25 @@
#include "script_component.hpp" #include "script_component.hpp"
params ["_player", "_object"]; params ["_player", "_object"];
private ["_vehicle", "_size", "_displayName"];
private ["_nearestVehicle"]; _vehicle = [_player] call FUNC(findNearestVehicle);
_nearestVehicle = [_player] call FUNC(findNearestVehicle);
if (isNull _nearestVehicle || _nearestVehicle isKindOf "Cargo_Base_F") then { if (isNull _vehicle || _vehicle isKindOf "Cargo_Base_F") then {
{ {
if ([_object, _x] call FUNC(canLoadItemIn)) exitWith {_nearestVehicle = _x}; if ([_object, _x] call FUNC(canLoadItemIn)) exitWith {_vehicle = _x};
} foreach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]); } forEach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]);
}; };
if (isNull _nearestVehicle) exitWith {false}; if (isNull _vehicle) exitWith {false};
[_object, _nearestVehicle] call FUNC(loadItem) // Start progress bar
if ([_object, _vehicle] call FUNC(canLoadItemIn)) then {
_size = [_object] call FUNC(getSizeItem);
[5 * _size, [_object,_vehicle], "LoadCargo", {}, localize LSTRING(LoadingItem)] call EFUNC(common,progressBar);
} else {
_displayName = getText (configFile >> "CfgVehicles" >> typeOf _object >> "displayName");
["displayTextStructured", [[LSTRING(LoadingFailed), _displayName], 3.0]] call EFUNC(common,localEvent);
};

View File

@ -20,7 +20,7 @@ private ["_display", "_loaded", "_ctrl", "_selected", "_item"];
disableSerialization; disableSerialization;
_display = uiNamespace getVariable QGVAR(menuDisplay); _display = uiNamespace getVariable QGVAR(menuDisplay);
if (isnil "_display") exitWith {}; if (isNil "_display") exitWith {};
_loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []]; _loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []];
if (count _loaded == 0) exitWith {}; if (count _loaded == 0) exitWith {};
@ -32,4 +32,17 @@ _selected = (lbCurSel _ctrl) max 0;
if (count _loaded <= _selected) exitWith {}; if (count _loaded <= _selected) exitWith {};
_item = _loaded select _selected; _item = _loaded select _selected;
[_item, GVAR(interactionVehicle)] call FUNC(unloadItem);
// Start progress bar
private ["_size", "_itemClass", "_displayName"];
if ([_item, GVAR(interactionVehicle)] call FUNC(canUnloadItem)) then {
_size = [_item] call FUNC(getSizeItem);
[5 * _size, [_item, GVAR(interactionVehicle)], "UnloadCargo", {}, localize LSTRING(UnloadingItem)] call EFUNC(common,progressBar);
} else {
_itemClass = if (_item isEqualType "") then {_item} else {typeOf _item};
_displayName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName");
["displayTextStructured", [[LSTRING(UnloadingFailed), _displayName], 3.0]] call EFUNC(common,localEvent);
};

View File

@ -3,7 +3,7 @@
* Unload object from vehicle. * Unload object from vehicle.
* *
* Arguments: * Arguments:
* 0: Object <OBJECT> * 0: Item <OBJECT or STRING>
* 1: Vehicle <OBJECT> * 1: Vehicle <OBJECT>
* *
* Return value: * Return value:
@ -16,20 +16,21 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_loaded", "_space", "_itemSize", "_emptyPos", "_validVehiclestate"];
params ["_item", "_vehicle"]; params ["_item", "_vehicle"];
private ["_loaded", "_space", "_itemSize", "_emptyPos", "_validVehiclestate"];
if !([_item, _vehicle] call FUNC(canUnloadItem)) exitWith { if !([_item, _vehicle] call FUNC(canUnloadItem)) exitWith {
false false
}; };
_itemClass = if (_item isEqualType "") then {_item} else {typeOf _item};
_validVehiclestate = true; _validVehiclestate = true;
_emptyPos = []; _emptyPos = [];
if (_vehicle isKindOf "Ship" ) then { if (_vehicle isKindOf "Ship" ) then {
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
TRACE_1("SHIP Ground Check", getPosATL _vehicle ); TRACE_1("SHIP Ground Check", getPosATL _vehicle );
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]); // TODO: if spot is underwater pick another spot. _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, _itemClass]); // TODO: if spot is underwater pick another spot.
} else { } else {
if (_vehicle isKindOf "Air" ) then { if (_vehicle isKindOf "Air" ) then {
if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false}; if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false};
@ -39,30 +40,29 @@ if (_vehicle isKindOf "Ship" ) then {
} else { } else {
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle); TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle);
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, typeOf _item]); _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, _itemClass]);
}; };
}; };
TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle); TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle);
if (!_validVehiclestate) exitWith {false}; if (!_validVehiclestate) exitWith {false};
if (count _emptyPos == 0) exitWith {false}; //consider displaying text saying there are no safe places to exit the vehicle if (count _emptyPos == 0) exitWith {false};
_loaded = _vehicle getVariable [QGVAR(loaded), []]; _loaded = _vehicle getVariable [QGVAR(loaded), []];
_loaded = _loaded - [_item]; _loaded deleteAt (_loaded find _item);
_vehicle setVariable [QGVAR(loaded), _loaded, true]; _vehicle setVariable [QGVAR(loaded), _loaded, true];
_space = [_vehicle] call FUNC(getCargoSpaceLeft); _space = [_vehicle] call FUNC(getCargoSpaceLeft);
_itemSize = [_item] call FUNC(getSizeItem); _itemSize = [_item] call FUNC(getSizeItem);
_vehicle setVariable [QGVAR(space), (_space + _itemSize), true]; _vehicle setVariable [QGVAR(space), (_space + _itemSize), true];
if (_item isEqualType objNull) then {
detach _item; detach _item;
_item setPosASL (_emptyPos call EFUNC(common,PositiontoASL)); _item setPosASL (_emptyPos call EFUNC(common,PositiontoASL));
["hideObjectGlobal", [_item, false]] call EFUNC(common,serverEvent); ["hideObjectGlobal", [_item, false]] call EFUNC(common,serverEvent);
} else {
// TOOO maybe drag/carry the unloaded item? createVehicle [_item, _emptyPos, [], 0, ""];
};
// Invoke listenable event
["cargoUnloaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
true true

View File

@ -24,7 +24,7 @@ _loaded = _vehicle getVariable [QGVAR(loaded), []];
_newLoaded = []; _newLoaded = [];
_totalSpaceOccupied = 0; _totalSpaceOccupied = 0;
{ {
if !(isNull _x) then { if ((_x isEqualType "") || {!isNull _x}) then {
_newLoaded pushback _x; _newLoaded pushback _x;
_totalSpaceOccupied = _totalSpaceOccupied + ([_x] call FUNC(getSizeItem)); _totalSpaceOccupied = _totalSpaceOccupied + ([_x] call FUNC(getSizeItem));
}; };
@ -35,4 +35,4 @@ if (count _loaded != count _newLoaded) then {
_vehicle setVariable [QGVAR(loaded), _newLoaded, true]; _vehicle setVariable [QGVAR(loaded), _newLoaded, true];
}; };
_vehicle setVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeof _vehicle >> QGVAR(space)) - _totalSpaceOccupied, true]; _vehicle setVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(space)) - _totalSpaceOccupied, true];

View File

@ -1,6 +1,8 @@
#define COMPONENT cargo #define COMPONENT cargo
#include "\z\ace\addons\main\script_mod.hpp" #include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
#ifdef DEBUG_ENABLED_CARGO #ifdef DEBUG_ENABLED_CARGO
#define DEBUG_MODE_FULL #define DEBUG_MODE_FULL
#endif #endif

View File

@ -3,73 +3,144 @@
<Package name="Cargo"> <Package name="Cargo">
<Key ID="STR_ACE_Cargo_loadObject"> <Key ID="STR_ACE_Cargo_loadObject">
<English>Load</English> <English>Load</English>
<German>Beladen</German>
<Polish>Załaduj</Polish> <Polish>Załaduj</Polish>
<Portuguese>Carregar</Portuguese> <Portuguese>Carregar</Portuguese>
<Russian>Загрузить</Russian> <Russian>Загрузить</Russian>
<Czech>Naložit</Czech> <Czech>Naložit</Czech>
<Spanish>Cargar</Spanish>
<Italian>Carica</Italian> <Italian>Carica</Italian>
</Key> </Key>
<Key ID="STR_ACE_Cargo_unloadObject"> <Key ID="STR_ACE_Cargo_unloadObject">
<English>Unload</English> <English>Unload</English>
<German>Entladen</German>
<Polish>Wyładuj</Polish> <Polish>Wyładuj</Polish>
<Portuguese>Descarregar</Portuguese> <Portuguese>Descarregar</Portuguese>
<Russian>Выгрузить</Russian> <Russian>Выгрузить</Russian>
<Czech>Vyložit</Czech> <Czech>Vyložit</Czech>
<Spanish>Descargar</Spanish>
<Italian>Scarica</Italian> <Italian>Scarica</Italian>
</Key> </Key>
<Key ID="STR_ACE_Cargo_openMenu"> <Key ID="STR_ACE_Cargo_openMenu">
<English>Cargo</English> <English>Cargo</English>
<German>Fracht</German>
<Polish>Ładunek</Polish> <Polish>Ładunek</Polish>
<Portuguese>Carga</Portuguese> <Portuguese>Carga</Portuguese>
<Russian>Грузовой отсек</Russian> <Russian>Грузовой отсек</Russian>
<Czech>Náklad</Czech> <Czech>Náklad</Czech>
<Spanish>Carga</Spanish>
<Italian>Carico</Italian> <Italian>Carico</Italian>
</Key> </Key>
<Key ID="STR_ACE_Cargo_cargoMenu"> <Key ID="STR_ACE_Cargo_cargoMenu">
<English>Cargo Menu</English> <English>Cargo Menu</English>
<German>Frachtmenü</German>
<Polish>Menu ładunku</Polish> <Polish>Menu ładunku</Polish>
<Portuguese>Menu de carga</Portuguese> <Portuguese>Menu de carga</Portuguese>
<Russian>Грузовой отсек</Russian> <Russian>Грузовой отсек</Russian>
<Czech>Menu nákladu</Czech> <Czech>Menu nákladu</Czech>
<Spanish>Menu de carga</Spanish>
<Italian>Menu carico</Italian> <Italian>Menu carico</Italian>
</Key> </Key>
<Key ID="STR_ACE_Cargo_labelSpace"> <Key ID="STR_ACE_Cargo_labelSpace">
<English>Cargo space left: %1</English> <English>Cargo space left: %1</English>
<German>Frachtplätze frei: %1</German>
<Polish>Pozostałe miejsce: %1</Polish> <Polish>Pozostałe miejsce: %1</Polish>
<Portuguese>Espaço de carga restante: %1</Portuguese> <Portuguese>Espaço de carga restante: %1</Portuguese>
<Russian>Осталось мест: %1</Russian> <Russian>Осталось мест: %1</Russian>
<Czech>Volný prostor: %1</Czech> <Czech>Volný prostor: %1</Czech>
<Spanish>Espacio de carga restante: %1</Spanish>
<Italian>Carico rimasto:%1</Italian> <Italian>Carico rimasto:%1</Italian>
</Key> </Key>
<Key ID="STR_ACE_Cargo_ModuleSettings_enable"> <Key ID="STR_ACE_Cargo_ModuleSettings_enable">
<English>Enable Cargo</English> <English>Enable Cargo</English>
<German>Aktiviere Fracht</German>
<Polish>Aktywuj cargo</Polish> <Polish>Aktywuj cargo</Polish>
<Portuguese>Ativar carga</Portuguese> <Portuguese>Ativar carga</Portuguese>
<Russian>Включить модуль перевозки грузов</Russian> <Russian>Включить модуль перевозки грузов</Russian>
<Czech>Povolit náklad</Czech> <Czech>Povolit náklad</Czech>
<Spanish>Habilitar carga</Spanish>
<Italian>Abilita carico</Italian> <Italian>Abilita carico</Italian>
</Key> </Key>
<Key ID="STR_ACE_Cargo_ModuleSettings_enable_Description"> <Key ID="STR_ACE_Cargo_ModuleSettings_enable_Description">
<English>Enable the load in cargo module</English> <English>Enable the load in cargo module</English>
<German>Aktiviere das Frachtmodul</German>
<Polish>Aktywuj możliwość załadunku skrzyń i przedmiotów do pojazdów.</Polish> <Polish>Aktywuj możliwość załadunku skrzyń i przedmiotów do pojazdów.</Polish>
<Portuguese>Ativar o módulo de carregamento de carga</Portuguese> <Portuguese>Ativar o módulo de carregamento de carga</Portuguese>
<Russian>Включает модуль погрузки и перевозки грузов</Russian> <Russian>Включает модуль погрузки и перевозки грузов</Russian>
<Spanish>Habilitar la carga en el módulo de carga</Spanish>
<Italian>Attiva il modulo per caricare</Italian> <Italian>Attiva il modulo per caricare</Italian>
</Key> </Key>
<Key ID="STR_ACE_Cargo_SettingsModule_DisplayName"> <Key ID="STR_ACE_Cargo_SettingsModule_DisplayName">
<English>Cargo Settings</English> <English>Cargo Settings</English>
<German>Frachteinstellungen</German>
<Polish>Ustawienia cargo</Polish> <Polish>Ustawienia cargo</Polish>
<Portuguese>Preferências de carregamento</Portuguese> <Portuguese>Preferências de carregamento</Portuguese>
<Russian>Перевозка грузов</Russian> <Russian>Перевозка грузов</Russian>
<Czech>Nastavení nákladu</Czech> <Czech>Nastavení nákladu</Czech>
<Spanish>Ajustes de carga</Spanish>
<Italian>Impostazioni cargo</Italian> <Italian>Impostazioni cargo</Italian>
</Key> </Key>
<Key ID="STR_ACE_Cargo_SettingsModule_Description"> <Key ID="STR_ACE_Cargo_SettingsModule_Description">
<English>Configure the cargo module settings</English> <English>Configure the cargo module settings</English>
<German>Konfiguriere das Frachtmodul</German>
<Polish>Skonfiguruj ustawienia modułu cargo.</Polish> <Polish>Skonfiguruj ustawienia modułu cargo.</Polish>
<Portuguese>Configura as preferências do módulo de carga</Portuguese> <Portuguese>Configura as preferências do módulo de carga</Portuguese>
<Russian>Конфигурирует настройки модуля перевозки грузов</Russian> <Russian>Конфигурирует настройки модуля перевозки грузов</Russian>
<Spanish>Configure los ajustes del módulo de carga</Spanish>
<Czech>Konfigurace nákladního modulu</Czech>
<Italian>Configura le impostazioni del module per il carico</Italian> <Italian>Configura le impostazioni del module per il carico</Italian>
</Key> </Key>
<Key ID="STR_ACE_Cargo_LoadedItem">
<English>%1&lt;br/&gt;loaded into&lt;br/&gt;%2</English>
<Spanish>%1&lt;br/&gt;cargado en&lt;br/&gt;%2</Spanish>
<French>%1&lt;br/&gt;chargé dans&lt;br/&gt;%2</French>
<German>%1&lt;br/&gt;in&lt;br/&gt;%2 verladen</German>
<Polish>%1&lt;br/&gt;załadowano do&lt;br/&gt;%2</Polish>
<Czech>%1&lt;br/&gt;naloženo do&lt;br/&gt;%2</Czech>
<Portuguese>%1&lt;br/&gt;carregado em&lt;br/&gt;%2</Portuguese>
<Italian>%1&lt;br/&gt;caricato su&lt;br/&gt;%2</Italian>
<Hungarian>%1&lt;br/&gt;berakodva ide:&lt;br/&gt;%2</Hungarian>
<Russian>%1&lt;br/&gt;загружен в&lt;br/&gt;%2</Russian>
</Key>
<Key ID="STR_ACE_Cargo_UnloadedItem">
<English>Unloaded&lt;br/&gt;%1 from&lt;br/&gt;%2</English>
<German>%1&lt;br/&gt;von&lt;br/&gt;%2 abgeladen</German>
<Spanish>Descargado/a&lt;br/&gt;%1 de&lt;br/&gt;%2</Spanish>
<French>Déchargé&lt;br/&gt;%1 de&lt;br/&gt;%2</French>
<Polish>%1&lt;br/&gt;rozładowano z&lt;br/&gt;%2</Polish>
<Czech>%1&lt;br/&gt;vyloženo z&lt;br/&gt;%2</Czech>
<Portuguese>%1&lt;br/&gt;descarregado de&lt;br/&gt;%2</Portuguese>
<Italian>Hai scaricato&lt;br/&gt;%1 da&lt;br/&gt;%2</Italian>
<Hungarian>1%&lt;br/&gt;kirakodva ebből:&lt;br/&gt;%2</Hungarian>
<Russian>%1&lt;br/&gt;разгружен из&lt;br/&gt;%2</Russian>
</Key>
<Key ID="STR_ACE_Cargo_LoadingItem">
<English>Loading Cargo</English>
<Portuguese>Carregando carga</Portuguese>
<Polish>Ładowanie cargo</Polish>
<Czech>Nakládám</Czech>
<Russian>Погрузка</Russian>
</Key>
<Key ID="STR_ACE_Cargo_UnloadingItem">
<English>Unloading Cargo</English>
<Portuguese>Descarregando carga</Portuguese>
<Polish>Rozładowywanie cargo</Polish>
<Czech>Vykládám</Czech>
<Russian>Выгрузка</Russian>
</Key>
<Key ID="STR_ACE_Cargo_LoadingFailed">
<English>%1&lt;br/&gt;could not be loaded</English>
<Portuguese>%1&lt;br/&gt;não pode ser carregado</Portuguese>
<Polish>%1&lt;br/&gt;nie mógł zostać załadowany</Polish>
<Czech>%1&lt;br/&gt;nemůže být naloženo</Czech>
<Russian>%1&lt;br/&gt;не может быть погружен</Russian>
</Key>
<Key ID="STR_ACE_Cargo_UnloadingFailed">
<English>%1&lt;br/&gt;could not be unloaded</English>
<Portuguese>%1&lt;br/&gt;não pode ser descarregado</Portuguese>
<Polish>%1&lt;br/&gt;nie mógł zostać rozładowany</Polish>
<Czech>%1&lt;br/&gt;nemůže být vyloženo</Czech>
<Russian>%1&lt;br/&gt;не может быть выгружен</Russian>
</Key>
</Package> </Package>
</Project> </Project>

View File

@ -35,6 +35,7 @@ class CfgVehicles {
function = QFUNC(moduleCheckPBOs); function = QFUNC(moduleCheckPBOs);
scope = 2; scope = 2;
isGlobal = 1; isGlobal = 1;
isSingular = 1;
icon = QUOTE(PATHTOF(UI\Icon_Module_CheckPBO_ca.paa)); icon = QUOTE(PATHTOF(UI\Icon_Module_CheckPBO_ca.paa));
class Arguments { class Arguments {
class Action { class Action {
@ -140,4 +141,10 @@ class CfgVehicles {
isBicycle = 1; isBicycle = 1;
XEH_DISABLED; XEH_DISABLED;
}; };
class Bag_Base;
class ACE_FakeBackpack: Bag_Base {
scope = 1;
maximumLoad = 1E6;
};
}; };

View File

@ -41,7 +41,7 @@ class GVAR(ProgressBar_Dialog) {
w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
colorFrame[] = {1,1,1,0.5}; colorFrame[] = {1,1,1,0.5};
colorBar[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])","(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])"}; colorBar[] = {"(profilenamespace getVariable ['GUI_BCG_RGB_R',0.77])","(profilenamespace getVariable ['GUI_BCG_RGB_G',0.51])","(profilenamespace getVariable ['GUI_BCG_RGB_B',0.08])","(profilenamespace getVariable ['GUI_BCG_RGB_A',0.8])"};
texture = "#(argb,8,8,3)color(1,1,1,0.7)"; texture = "#(argb,8,8,3)color(1,1,1,0.7)";
}; };
class TitleText: TitleBackground { class TitleText: TitleBackground {

View File

@ -107,6 +107,10 @@ class RscInGameUI {
class RscOptics_LaserDesignator_02 { class RscOptics_LaserDesignator_02 {
onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent););
}; };
class RscStaminaBar {
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscStaminaBar"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2(QUOTE(QGVAR(dlgStaminaBar)),_this select 0)]);
};
}; };
class RscDisplayInventory { class RscDisplayInventory {
@ -115,18 +119,18 @@ class RscDisplayInventory {
// map // map
class RscDisplayMainMap { class RscDisplayMainMap {
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'Ingame')])] call FUNC(localEvent);); onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getVariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'Ingame')])] call FUNC(localEvent););
}; };
class RscDisplayGetReady: RscDisplayMainMap { class RscDisplayGetReady: RscDisplayMainMap {
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'Briefing')])] call FUNC(localEvent);); onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getVariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'Briefing')])] call FUNC(localEvent););
}; };
class RscDisplayServerGetReady: RscDisplayGetReady { class RscDisplayServerGetReady: RscDisplayGetReady {
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'ServerBriefing')])] call FUNC(localEvent);); onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getVariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'ServerBriefing')])] call FUNC(localEvent););
}; };
class RscDisplayClientGetReady: RscDisplayGetReady { class RscDisplayClientGetReady: RscDisplayGetReady {
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'ClientBriefing')])] call FUNC(localEvent);); onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getVariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'ClientBriefing')])] call FUNC(localEvent););
}; };

View File

@ -1,64 +1,88 @@
// ACE - Common // ACE - Common
// #define ENABLE_PERFORMANCE_COUNTERS
#include "script_component.hpp" #include "script_component.hpp"
//IGNORE_PRIVATE_WARNING("_handleNetEvent", "_handleRequestAllSyncedEvents", "_handleRequestSyncedEvent", "_handleSyncedEvent"); // #define ENABLE_PERFORMANCE_COUNTERS
//Singe PFEH to handle execNextFrame and waitAndExec: //////////////////////////////////////////////////
// PFHs
//////////////////////////////////////////////////
//Singe PFEH to handle execNextFrame, waitAndExec and waitUntilAndExec:
[{ [{
private ["_entry"]; BEGIN_COUNTER(waitAndExec);
//Handle the waitAndExec array: //Handle the waitAndExec array:
while {((count GVAR(waitAndExecArray)) > 0) && {((GVAR(waitAndExecArray) select 0) select 0) <= ACE_Time}} do { while {!(GVAR(waitAndExecArray) isEqualTo []) && {GVAR(waitAndExecArray) select 0 select 0 <= ACE_Time}} do {
_entry = GVAR(waitAndExecArray) deleteAt 0; private _entry = GVAR(waitAndExecArray) deleteAt 0;
(_entry select 2) call (_entry select 1); (_entry select 2) call (_entry select 1);
}; };
//Handle the execNextFrame array: //Handle the execNextFrame array:
{ {
(_x select 0) call (_x select 1); (_x select 0) call (_x select 1);
} forEach GVAR(nextFrameBufferA); false
} count GVAR(nextFrameBufferA);
//Swap double-buffer: //Swap double-buffer:
GVAR(nextFrameBufferA) = GVAR(nextFrameBufferB); GVAR(nextFrameBufferA) = GVAR(nextFrameBufferB);
GVAR(nextFrameBufferB) = []; GVAR(nextFrameBufferB) = [];
GVAR(nextFrameNo) = diag_frameno + 1; GVAR(nextFrameNo) = diag_frameno + 1;
//Handle the waitUntilAndExec array:
{
// if condition is satisifed call statement
if ((_x select 2) call (_x select 0)) then {
// make sure to delete the correct handle when multiple conditions are met in one frame
GVAR(waitUntilAndExecArray) deleteAt (GVAR(waitUntilAndExecArray) find _x);
(_x select 2) call (_x select 1);
};
nil
} count +GVAR(waitUntilAndExecArray);
END_COUNTER(waitAndExec);
}, 0, []] call CBA_fnc_addPerFrameHandler; }, 0, []] call CBA_fnc_addPerFrameHandler;
// Listens for global "SettingChanged" events, to update the force status locally //////////////////////////////////////////////////
["SettingChanged", { // Get Map Data
PARAMS_2(_name,_value); //////////////////////////////////////////////////
if !(count _this > 2) exitWith {};
private ["_force", "_settingData"];
_force = _this select 2;
if (_force) then {
_settingData = [_name] call FUNC(getSettingData);
if (count _settingData == 0) exitWith {};
_settingData set [6,_force];
};
}] call FUNC(addEventhandler);
["HeadbugFixUsed", {
PARAMS_2(_profileName,_animation);
diag_log text format ["[ACE] Headbug Used: Name: %1, Animation: %2", _profileName, _animation];
}] call FUNC(addEventHandler);
//~~~~~Get Map Data~~~~~
//Find MGRS zone and 100km grid for current map //Find MGRS zone and 100km grid for current map
[] call FUNC(getMGRSdata); [] call FUNC(getMGRSdata);
//Prepare variables for FUNC(getMapGridFromPos)/FUNC(getMapPosFromGrid) //Prepare variables for FUNC(getMapGridFromPos)/FUNC(getMapPosFromGrid)
[] call FUNC(getMapGridData); [] call FUNC(getMapGridData);
//////////////////////////////////////////////////
// Eventhandlers
//////////////////////////////////////////////////
["fixCollision", DFUNC(fixCollision)] call FUNC(addEventhandler); // Listens for global "SettingChanged" events, to update the force status locally
["fixFloating", DFUNC(fixFloating)] call FUNC(addEventhandler); ["SettingChanged", {
["fixPosition", DFUNC(fixPosition)] call FUNC(addEventhandler); params ["_name", "_value", "_force"];
["unloadPersonEvent", DFUNC(unloadPersonLocal)] call FUNC(addEventhandler); if (_force) then {
private "_settingData";
_settingData = [_name] call FUNC(getSettingData);
if (_settingData isEqualTo []) exitWith {};
_settingData set [6, _force];
};
}] call FUNC(addEventhandler);
// Event to log Fix Headbug output
["HeadbugFixUsed", {
params ["_profileName", "_animation"];
ACE_LOGINFO_2("Headbug Used: Name: %1, Animation: %2",_profileName,_animation);
}] call FUNC(addEventHandler);
["fixCollision", FUNC(fixCollision)] call FUNC(addEventhandler);
["fixFloating", FUNC(fixFloating)] call FUNC(addEventhandler);
["fixPosition", FUNC(fixPosition)] call FUNC(addEventhandler);
["unloadPersonEvent", FUNC(unloadPersonLocal)] call FUNC(addEventhandler);
["lockVehicle", { ["lockVehicle", {
_this setVariable [QGVAR(lockStatus), locked _this]; _this setVariable [QGVAR(lockStatus), locked _this];
@ -72,310 +96,413 @@
["setDir", {(_this select 0) setDir (_this select 1)}] call FUNC(addEventhandler); ["setDir", {(_this select 0) setDir (_this select 1)}] call FUNC(addEventhandler);
["setFuel", {(_this select 0) setFuel (_this select 1)}] call FUNC(addEventhandler); ["setFuel", {(_this select 0) setFuel (_this select 1)}] call FUNC(addEventhandler);
["setSpeaker", {(_this select 0) setSpeaker (_this select 1)}] call FUNC(addEventhandler); ["setSpeaker", {(_this select 0) setSpeaker (_this select 1)}] call FUNC(addEventhandler);
["selectLeader", {(_this select 0) selectLeader (_this select 1)}] call FUNC(addEventHandler);
["setVelocity", {(_this select 0) setVelocity (_this select 1)}] call FUNC(addEventHandler);
if (isServer) then { if (isServer) then {
["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler); ["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler);
["enableSimulationGlobal", {(_this select 0) enableSimulationGlobal (_this select 1)}] call FUNC(addEventHandler);
}; };
//////////////////////////////////////////////////
// Set up remote execution
//////////////////////////////////////////////////
// ACE events
"ACEg" addPublicVariableEventHandler {_this call FUNC(_handleNetEvent)};
"ACEc" addPublicVariableEventHandler {_this call FUNC(_handleNetEvent)};
// Synced ACE events
// Handle JIP scenario
if (!isServer) then {
["PlayerJip", {
ACE_LOGINFO("JIP event synchronization initialized");
["SEH_all", [player]] call FUNC(serverEvent);
}] call FUNC(addEventHandler);
} else {
["SEH_all", FUNC(_handleRequestAllSyncedEvents)] call FUNC(addEventHandler);
};
["SEH", FUNC(_handleSyncedEvent)] call FUNC(addEventHandler);
["SEH_s", FUNC(_handleRequestSyncedEvent)] call FUNC(addEventHandler);
if (isServer) then {
[FUNC(syncedEventPFH), 0.5, []] call CBA_fnc_addPerFrameHandler;
};
// @todo deprecated
QGVAR(remoteFnc) addPublicVariableEventHandler { QGVAR(remoteFnc) addPublicVariableEventHandler {
(_this select 1) call FUNC(execRemoteFnc); (_this select 1) call FUNC(execRemoteFnc);
}; };
// @todo figure out what this does.
[missionNamespace] call FUNC(executePersistent); [missionNamespace] call FUNC(executePersistent);
//////////////////////////////////////////////////
// Check files, previous installed version etc.
//////////////////////////////////////////////////
private ["_currentVersion", "_previousVersion"]; private ["_currentVersion", "_previousVersion"];
// check previous version number from profile
_currentVersion = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version"); _currentVersion = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version");
_previousVersion = profileNamespace getVariable ["ACE_VersionNumberString", ""]; _previousVersion = profileNamespace getVariable ["ACE_VersionNumberString", ""];
// check previous version number from profile
if (_currentVersion != _previousVersion) then { if (_currentVersion != _previousVersion) then {
// do something // do something
profileNamespace setVariable ["ACE_VersionNumberString", _currentVersion]; profileNamespace setVariable ["ACE_VersionNumberString", _currentVersion];
}; };
// ACE events
"ACEg" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
"ACEc" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
// Synced ACE events
// Handle JIP scenario
if(!isServer) then {
["PlayerJip", {
diag_log text format["[ACE] * JIP event synchronization initialized"];
["SEH_all", [player]] call FUNC(serverEvent);
}] call FUNC(addEventHandler);
} else {
["SEH_all", FUNC(_handleRequestAllSyncedEvents)] call FUNC(addEventHandler);
};
["SEH", FUNC(_handleSyncedEvent)] call FUNC(addEventHandler);
["SEH_s", FUNC(_handleRequestSyncedEvent)] call FUNC(addEventHandler);
if (isServer) then {
[FUNC(syncedEventPFH), 0.5, []] call CBA_fnc_addPerFrameHandler;
};
call FUNC(checkFiles); call FUNC(checkFiles);
//////////////////////////////////////////////////
// Set up SettingsInitialized eventhandler
//////////////////////////////////////////////////
["SettingsInitialized", {
[
GVAR(checkPBOsAction),
GVAR(checkPBOsCheckAll),
GVAR(checkPBOsWhitelist)
] call FUNC(checkPBOs)
}] call FUNC(addEventHandler);
// Create a pfh to wait until all postinits are ready and settings are initialized // Create a pfh to wait until all postinits are ready and settings are initialized
[{ [{
PARAMS_1(_args); params ["_args"];
EXPLODE_1_PVT(_args,_waitingMsgSent);
_args params ["_waitingMsgSent"];
// If post inits are not ready then wait // If post inits are not ready then wait
if !(SLX_XEH_MACHINE select 8) exitWith {}; if !(SLX_XEH_MACHINE select 8) exitWith {};
// If settings are not initialized then wait // If settings are not initialized then wait
if (isNil QGVAR(settings) || {(!isServer) && (isNil QEGVAR(modules,serverModulesRead))}) exitWith { if (isNil QGVAR(settings) || {!isServer && isNil QEGVAR(modules,serverModulesRead)}) exitWith {
if (!_waitingMsgSent) then { if !(_waitingMsgSent) then {
_args set [0, true]; _args set [0, true];
diag_log text format["[ACE] Waiting on settings from server"]; ACE_LOGINFO("Waiting on settings from server...");
}; };
}; };
[(_this select 1)] call cba_fnc_removePerFrameHandler; [_this select 1] call CBA_fnc_removePerFrameHandler;
diag_log text format["[ACE] Settings received from server"]; ACE_LOGINFO("Settings received from server.");
if (isServer) then { //read settings from paramsArray
[] call FUNC(readSettingsFromParamsArray);
};
// Event so that ACE_Modules have their settings loaded: // Event so that ACE_Modules have their settings loaded:
["InitSettingsFromModules", []] call FUNC(localEvent); ["InitSettingsFromModules", []] call FUNC(localEvent);
if (isServer) then {
// Publish all settings data after all configs and modules are read
publicVariable QGVAR(settings);
};
// Load user settings from profile // Load user settings from profile
if (hasInterface) then { if (hasInterface) then {
call FUNC(loadSettingsFromProfile); call FUNC(loadSettingsFromProfile);
call FUNC(loadSettingsLocalizedText); call FUNC(loadSettingsLocalizedText);
}; };
diag_log text format["[ACE] Settings initialized"]; ACE_LOGINFO("Settings initialized.");
//Event that settings are safe to use: //Event that settings are safe to use:
["SettingsInitialized", []] call FUNC(localEvent); ["SettingsInitialized", []] call FUNC(localEvent);
//Set init finished and run all delayed functions: //Set init finished and run all delayed functions:
GVAR(settingsInitFinished) = true; GVAR(settingsInitFinished) = true;
diag_log text format ["[ACE] %1 delayed functions running", (count GVAR(runAtSettingsInitialized))]; ACE_LOGINFO_1("%1 delayed functions running.",count GVAR(runAtSettingsInitialized));
{
_x params ["_func", "_params"];
_params call _func;
} forEach GVAR(runAtSettingsInitialized);
GVAR(runAtSettingsInitialized) = nil; //cleanup
{
(_x select 1) call (_x select 0);
false
} count GVAR(runAtSettingsInitialized);
GVAR(runAtSettingsInitialized) = nil; //cleanup
}, 0, [false]] call CBA_fnc_addPerFrameHandler; }, 0, [false]] call CBA_fnc_addPerFrameHandler;
["SettingsInitialized", { /***************************************************************************/
[ /***************************************************************************/
GVAR(checkPBOsAction), /** everything that only player controlled machines need, goes below this **/
GVAR(checkPBOsCheckAll), /***************************************************************************/
call compile GVAR(checkPBOsWhitelist) /***************************************************************************/
] call FUNC(checkPBOs)
}] call FUNC(addEventHandler);
/***************************************************************/
/***************************************************************/
/***************************************************************/
/***************************************************************/
/***************************************************************/
// everything that only player controlled machines need, goes below this
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
call COMPILE_FILE(scripts\assignedItemFix); //////////////////////////////////////////////////
call COMPILE_FILE(scripts\initScrollWheel); // Set up mouse wheel eventhandler
//////////////////////////////////////////////////
DFUNC(mouseZHandler) = { call FUNC(assignedItemFix);
waitUntil {!isNull (findDisplay 46)}; sleep 0.1;
findDisplay 46 displayAddEventHandler ["MouseZChanged", QUOTE( _this call GVAR(onScrollWheel) )]; GVAR(ScrollWheelFrame) = diag_frameno;
[false] call FUNC(disableUserInput);
["mainDisplayLoaded", {
[{
call FUNC(handleScrollWheelInit);
call FUNC(handleModifierKeyInit);
}, [], 0.1] call FUNC(waitAndExecute); // needs delay, otherwise doesn't work without pressing "RESTART" in editor once. Tested in 1.52RC
}] call FUNC(addEventHandler);
// add PFH to execute event that fires when the main display (46) is created
private "_fnc_initMainDisplayCheck";
_fnc_initMainDisplayCheck = {
[{
if !(isNull findDisplay 46) then {
// Raise ACE event locally
["mainDisplayLoaded", [findDisplay 46]] call FUNC(localEvent);
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
}, 0, []] call CBA_fnc_addPerFrameHandler;
}; };
addMissionEventHandler ["Loaded", {[] spawn FUNC(mouseZHandler)}]; call _fnc_initMainDisplayCheck;
[] spawn FUNC(mouseZHandler);
// repeat this every time a savegame is loaded
addMissionEventHandler ["Loaded", _fnc_initMainDisplayCheck];
// @todo remove?
enableCamShake true; enableCamShake true;
//////////////////////////////////////////////////
// Eventhandler to set player names
//////////////////////////////////////////////////
// Set the name for the current player // Set the name for the current player
["playerChanged", { ["playerChanged", {
EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer); params ["_newPlayer","_oldPlayer"];
if (alive _newPlayer) then { if (alive _newPlayer) then {
[_newPlayer] call FUNC(setName) [_newPlayer] call FUNC(setName);
};
if (alive _oldPlayer) then {
[_oldPlayer] call FUNC(setName)
}; };
if (alive _oldPlayer) then {
[_oldPlayer] call FUNC(setName);
};
}] call FUNC(addEventhandler); }] call FUNC(addEventhandler);
GVAR(OldPlayerInventory) = [ACE_player] call FUNC(getAllGear);
GVAR(OldPlayerVisionMode) = currentVisionMode ACE_player; //////////////////////////////////////////////////
GVAR(OldZeusDisplayIsOpen) = !(isNull findDisplay 312); // Set up numerous eventhanders for player controlled units
GVAR(OldCameraView) = cameraView; //////////////////////////////////////////////////
GVAR(OldPlayerVehicle) = vehicle ACE_player;
GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex); // default variables
GVAR(OldPlayerWeapon) = currentWeapon ACE_player; GVAR(OldPlayerVehicle) = vehicle objNull;
GVAR(OldPlayerTurret) = [objNull] call FUNC(getTurretIndex);
GVAR(OldPlayerWeapon) = currentWeapon objNull;
GVAR(OldPlayerInventory) = [objNull] call FUNC(getAllGear);
GVAR(OldPlayerVisionMode) = currentVisionMode objNull;
GVAR(OldCameraView) = "";
GVAR(OldVisibleMap) = false; GVAR(OldVisibleMap) = false;
GVAR(OldInventoryDisplayIsOpen) = nil; //@todo check this
GVAR(OldZeusDisplayIsOpen) = false;
GVAR(OldIsCamera) = false;
// clean up playerChanged eventhandler from preinit and put it in the same PFH as the other events to reduce overhead and guarantee advantageous execution order
if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then {
[GVAR(PreInit_playerChanged_PFHID)] call CBA_fnc_removePerFrameHandler;
GVAR(PreInit_playerChanged_PFHID) = nil;
};
// PFH to raise varios events // PFH to raise varios events
[{ [{
BEGIN_COUNTER(stateChecker); BEGIN_COUNTER(stateChecker);
private ["_newCameraView", "_newInventoryDisplayIsOpen", "_newPlayerInventory", "_newPlayerTurret", "_newPlayerVehicle", "_newPlayerVisionMode", "_newPlayerWeapon", "_newZeusDisplayIsOpen", "_newVisibleMap"]; private "_data"; // reuse one variable to reduce number of variables that have to be set to private each frame
// "playerInventoryChanged" event
_newPlayerInventory = [ACE_player] call FUNC(getAllGear);
if !(_newPlayerInventory isEqualTo GVAR(OldPlayerInventory)) then {
// Raise ACE event locally
GVAR(OldPlayerInventory) = _newPlayerInventory;
["playerInventoryChanged", [ACE_player, _newPlayerInventory]] call FUNC(localEvent);
};
// "playerVisionModeChanged" event // "playerChanged" event
_newPlayerVisionMode = currentVisionMode ACE_player; _data = call FUNC(player);
if !(_newPlayerVisionMode isEqualTo GVAR(OldPlayerVisionMode)) then { if !(_data isEqualTo ACE_player) then {
// Raise ACE event locally private "_oldPlayer";
GVAR(OldPlayerVisionMode) = _newPlayerVisionMode; _oldPlayer = ACE_player;
["playerVisionModeChanged", [ACE_player, _newPlayerVisionMode]] call FUNC(localEvent);
};
// "inventoryDisplayChanged" event ACE_player = _data;
_newInventoryDisplayIsOpen = !(isNull findDisplay 602); uiNamespace setVariable ["ACE_player", _data];
if !(_newInventoryDisplayIsOpen isEqualTo GVAR(OldInventoryDisplayIsOpen)) then {
// Raise ACE event locally
GVAR(OldInventoryDisplayIsOpen) = _newInventoryDisplayIsOpen;
["inventoryDisplayChanged", [ACE_player, _newInventoryDisplayIsOpen]] call FUNC(localEvent);
};
// "zeusDisplayChanged" event
_newZeusDisplayIsOpen = !(isNull findDisplay 312);
if !(_newZeusDisplayIsOpen isEqualTo GVAR(OldZeusDisplayIsOpen)) then {
// Raise ACE event locally // Raise ACE event locally
GVAR(OldZeusDisplayIsOpen) = _newZeusDisplayIsOpen; ["playerChanged", [ACE_player, _oldPlayer]] call FUNC(localEvent);
["zeusDisplayChanged", [ACE_player, _newZeusDisplayIsOpen]] call FUNC(localEvent);
};
// "cameraViewChanged" event
_newCameraView = cameraView;
if !(_newCameraView isEqualTo GVAR(OldCameraView)) then {
// Raise ACE event locally
GVAR(OldCameraView) = _newCameraView;
["cameraViewChanged", [ACE_player, _newCameraView]] call FUNC(localEvent);
}; };
// "playerVehicleChanged" event // "playerVehicleChanged" event
_newPlayerVehicle = vehicle ACE_player; _data = vehicle ACE_player;
if !(_newPlayerVehicle isEqualTo GVAR(OldPlayerVehicle)) then { if !(_data isEqualTo GVAR(OldPlayerVehicle)) then {
// Raise ACE event locally // Raise ACE event locally
GVAR(OldPlayerVehicle) = _newPlayerVehicle; GVAR(OldPlayerVehicle) = _data;
["playerVehicleChanged", [ACE_player, _newPlayerVehicle]] call FUNC(localEvent); ["playerVehicleChanged", [ACE_player, _data]] call FUNC(localEvent);
}; };
// "playerTurretChanged" event // "playerTurretChanged" event
_newPlayerTurret = [ACE_player] call FUNC(getTurretIndex); _data = [ACE_player] call FUNC(getTurretIndex);
if !(_newPlayerTurret isEqualTo GVAR(OldPlayerTurret)) then { if !(_data isEqualTo GVAR(OldPlayerTurret)) then {
// Raise ACE event locally // Raise ACE event locally
GVAR(OldPlayerTurret) = _newPlayerTurret; GVAR(OldPlayerTurret) = _data;
["playerTurretChanged", [ACE_player, _newPlayerTurret]] call FUNC(localEvent); ["playerTurretChanged", [ACE_player, _data]] call FUNC(localEvent);
}; };
// "playerWeaponChanged" event // "playerWeaponChanged" event
_newPlayerWeapon = currentWeapon ACE_player; _data = currentWeapon ACE_player;
if (_newPlayerWeapon != GVAR(OldPlayerWeapon)) then { if (_data != GVAR(OldPlayerWeapon)) then {
// Raise ACE event locally // Raise ACE event locally
GVAR(OldPlayerWeapon) = _newPlayerWeapon; GVAR(OldPlayerWeapon) = _data;
["playerWeaponChanged", [ACE_player, _newPlayerWeapon]] call FUNC(localEvent); ["playerWeaponChanged", [ACE_player, _data]] call FUNC(localEvent);
};
// "playerInventoryChanged" event
_data = [ACE_player] call FUNC(getAllGear);
if !(_data isEqualTo GVAR(OldPlayerInventory)) then {
// Raise ACE event locally
GVAR(OldPlayerInventory) = _data;
["playerInventoryChanged", [ACE_player, _data]] call FUNC(localEvent);
};
// "playerVisionModeChanged" event
_data = currentVisionMode ACE_player;
if !(_data isEqualTo GVAR(OldPlayerVisionMode)) then {
// Raise ACE event locally
GVAR(OldPlayerVisionMode) = _data;
["playerVisionModeChanged", [ACE_player, _data]] call FUNC(localEvent);
};
// "cameraViewChanged" event
_data = cameraView;
if !(_data isEqualTo GVAR(OldCameraView)) then {
// Raise ACE event locally
GVAR(OldCameraView) = _data;
["cameraViewChanged", [ACE_player, _data]] call FUNC(localEvent);
}; };
// "visibleMapChanged" event // "visibleMapChanged" event
_newVisibleMap = visibleMap; _data = visibleMap;
if (!_newVisibleMap isEqualTo GVAR(OldVisibleMap)) then { if (!_data isEqualTo GVAR(OldVisibleMap)) then {
// Raise ACE event locally // Raise ACE event locally
GVAR(OldVisibleMap) = _newVisibleMap; GVAR(OldVisibleMap) = _data;
["visibleMapChanged", [ACE_player, _newVisibleMap]] call FUNC(localEvent); ["visibleMapChanged", [ACE_player, _data]] call FUNC(localEvent);
};
// "inventoryDisplayChanged" event
_data = !(isNull findDisplay 602);
if !(_data isEqualTo GVAR(OldInventoryDisplayIsOpen)) then {
// Raise ACE event locally
GVAR(OldInventoryDisplayIsOpen) = _data;
["inventoryDisplayChanged", [ACE_player, _data]] call FUNC(localEvent);
};
// "zeusDisplayChanged" event
_data = !(isNull findDisplay 312);
if !(_data isEqualTo GVAR(OldZeusDisplayIsOpen)) then {
// Raise ACE event locally
GVAR(OldZeusDisplayIsOpen) = _data;
["zeusDisplayChanged", [ACE_player, _data]] call FUNC(localEvent);
};
// "activeCameraChanged" event
_data = call FUNC(isfeatureCameraActive);
if !(_data isEqualTo GVAR(OldIsCamera)) then {
// Raise ACE event locally
GVAR(OldIsCamera) = _data;
["activeCameraChanged", [ACE_player, _data]] call FUNC(localEvent);
}; };
END_COUNTER(stateChecker); END_COUNTER(stateChecker);
}, 0, []] call CBA_fnc_addPerFrameHandler; }, 0, []] call CBA_fnc_addPerFrameHandler;
GVAR(OldIsCamera) = false; //////////////////////////////////////////////////
// Eventhandlers for player controlled machines
[{ //////////////////////////////////////////////////
// "activeCameraChanged" event
private ["_isCamera"];
_isCamera = call FUNC(isfeatureCameraActive);
if !(_isCamera isEqualTo GVAR(OldIsCamera)) then {
// Raise ACE event locally
GVAR(OldIsCamera) = _isCamera;
["activeCameraChanged", [ACE_player, _isCamera]] call FUNC(localEvent);
};
}, 1, []] call CBA_fnc_addPerFrameHandler; // feel free to decrease the sleep ACE_time if you need it.
// @todo still needed?
[QGVAR(StateArrested), false, true, QUOTE(ADDON)] call FUNC(defineVariable); [QGVAR(StateArrested), false, true, QUOTE(ADDON)] call FUNC(defineVariable);
["displayTextStructured", FUNC(displayTextStructured)] call FUNC(addEventhandler); ["displayTextStructured", {_this call FUNC(displayTextStructured)}] call FUNC(addEventhandler);
["displayTextPicture", FUNC(displayTextPicture)] call FUNC(addEventhandler); ["displayTextPicture", {_this call FUNC(displayTextPicture)}] call FUNC(addEventhandler);
["medical_onUnconscious", {if (local (_this select 0) && {!(_this select 1)}) then {[ _this select 0, false, QUOTE(FUNC(loadPerson)), west /* dummy side */] call FUNC(switchToGroupSide);};}] call FUNC(addEventhandler);
["medical_onUnconscious", {
params ["_unit", "_isUnconscious"];
if (local _unit && {!_isUnconscious}) then {
[_unit, false, QFUNC(loadPerson), west /* dummy side */] call FUNC(switchToGroupSide);
};
}] call FUNC(addEventhandler);
//////////////////////////////////////////////////
// Add various canInteractWith conditions
//////////////////////////////////////////////////
["notOnMap", {!visibleMap}] call FUNC(addCanInteractWithCondition); ["notOnMap", {!visibleMap}] call FUNC(addCanInteractWithCondition);
["isNotInside", { ["isNotInside", {
params ["_unit", "_target"];
// Players can always interact with himself if not boarded // Players can always interact with himself if not boarded
vehicle (_this select 0) == (_this select 0) || vehicle _unit == _unit ||
// Players can always interact with his vehicle // Players can always interact with his vehicle
{vehicle (_this select 0) == (_this select 1)} || {vehicle _unit == _target} ||
// Players can always interact with passengers of the same vehicle // Players can always interact with passengers of the same vehicle
{!((_this select 0) isEqualTo (_this select 1)) && {vehicle (_this select 0) == vehicle (_this select 1)}} {_unit != _target && {vehicle _unit == vehicle _target}}
}] call FUNC(addCanInteractWithCondition); }] call FUNC(addCanInteractWithCondition);
//////////////////////////////////////////////////
// Set up PlayerJIP eventhandler
//////////////////////////////////////////////////
// Lastly, do JIP events // Lastly, do JIP events
// JIP Detection and event trigger. Run this at the very end, just in case anything uses it // JIP Detection and event trigger. Run this at the very end, just in case anything uses it
// Note: usage of player is most likely on purpose
if (didJip) then { if (didJip) then {
// We are jipping! Get ready and wait, and throw the event // We are jipping! Get ready and wait, and throw the event
[{ [{
if((!(isNull player)) && GVAR(settingsInitFinished)) then { if(!isNull player && GVAR(settingsInitFinished)) then {
["PlayerJip", [player]] call FUNC(localEvent); ["PlayerJip", [player]] call FUNC(localEvent);
[(_this select 1)] call cba_fnc_removePerFrameHandler; [_this select 1] call CBA_fnc_removePerFrameHandler;
}; };
}, 0, []] call CBA_fnc_addPerFrameHandler; }, 0, []] call CBA_fnc_addPerFrameHandler;
}; };
//////////////////////////////////////////////////
// CBA key input handling
//////////////////////////////////////////////////
//Device Handler: //Device Handler:
GVAR(deviceKeyHandlingArray) = []; GVAR(deviceKeyHandlingArray) = [];
GVAR(deviceKeyCurrentIndex) = -1; GVAR(deviceKeyCurrentIndex) = -1;
// Register localizations for the Keybinding categories // Register localizations for the Keybinding categories
["ACE3 Equipment", localize LSTRING(ACEKeybindCategoryEquipment)] call cba_fnc_registerKeybindModPrettyName; ["ACE3 Equipment", localize LSTRING(ACEKeybindCategoryEquipment)] call CBA_fnc_registerKeybindModPrettyName;
["ACE3 Common", localize LSTRING(ACEKeybindCategoryCommon)] call cba_fnc_registerKeybindModPrettyName; ["ACE3 Common", localize LSTRING(ACEKeybindCategoryCommon)] call CBA_fnc_registerKeybindModPrettyName;
["ACE3 Weapons", localize LSTRING(ACEKeybindCategoryWeapons)] call cba_fnc_registerKeybindModPrettyName; ["ACE3 Weapons", localize LSTRING(ACEKeybindCategoryWeapons)] call CBA_fnc_registerKeybindModPrettyName;
["ACE3 Movement", localize LSTRING(ACEKeybindCategoryMovement)] call cba_fnc_registerKeybindModPrettyName; ["ACE3 Movement", localize LSTRING(ACEKeybindCategoryMovement)] call CBA_fnc_registerKeybindModPrettyName;
["ACE3 Scope Adjustment", localize LSTRING(ACEKeybindCategoryScopeAdjustment)] call cba_fnc_registerKeybindModPrettyName; ["ACE3 Scope Adjustment", localize LSTRING(ACEKeybindCategoryScopeAdjustment)] call CBA_fnc_registerKeybindModPrettyName;
["ACE3 Vehicles", localize LSTRING(ACEKeybindCategoryVehicles)] call cba_fnc_registerKeybindModPrettyName; ["ACE3 Vehicles", localize LSTRING(ACEKeybindCategoryVehicles)] call CBA_fnc_registerKeybindModPrettyName;
["ACE3 Equipment", QGVAR(openDevice), (localize "STR_ACE_Common_toggleHandheldDevice"), ["ACE3 Equipment", QGVAR(openDevice), (localize "STR_ACE_Common_toggleHandheldDevice"), {
{
[] call FUNC(deviceKeyFindValidIndex); [] call FUNC(deviceKeyFindValidIndex);
if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false}; if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false};
[] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 3); [] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 3);
true true
}, },
{false}, {false},
[0xC7, [false, false, false]], false] call cba_fnc_addKeybind; //Home Key [0xC7, [false, false, false]], false] call CBA_fnc_addKeybind; //Home Key
["ACE3 Equipment", QGVAR(closeDevice), (localize "STR_ACE_Common_closeHandheldDevice"), ["ACE3 Equipment", QGVAR(closeDevice), (localize "STR_ACE_Common_closeHandheldDevice"), {
{
[] call FUNC(deviceKeyFindValidIndex); [] call FUNC(deviceKeyFindValidIndex);
if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false}; if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false};
[] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 4); [] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 4);
true true
}, },
{false}, {false},
[0xC7, [false, true, false]], false] call cba_fnc_addKeybind; //CTRL + Home Key [0xC7, [false, true, false]], false] call CBA_fnc_addKeybind; //CTRL + Home Key
["ACE3 Equipment", QGVAR(cycleDevice), (localize "STR_ACE_Common_cycleHandheldDevices"), ["ACE3 Equipment", QGVAR(cycleDevice), (localize "STR_ACE_Common_cycleHandheldDevices"), {
{
[1] call FUNC(deviceKeyFindValidIndex); [1] call FUNC(deviceKeyFindValidIndex);
if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false}; if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false};
_displayName = ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 0); _displayName = ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 0);
@ -384,6 +511,6 @@ GVAR(deviceKeyCurrentIndex) = -1;
true true
}, },
{false}, {false},
[0xC7, [true, false, false]], false] call cba_fnc_addKeybind; //SHIFT + Home Key [0xC7, [true, false, false]], false] call CBA_fnc_addKeybind; //SHIFT + Home Key
GVAR(commonPostInited) = true; GVAR(commonPostInited) = true;

View File

@ -1,16 +1,13 @@
// by commy2 // by commy2
#include "script_component.hpp" #include "script_component.hpp"
//IGNORE_PRIVATE_WARNING("_handleNetEvent", "_handleRequestAllSyncedEvents", "_handleRequestSyncedEvent", "_handleSyncedEvent");
ADDON = false; ADDON = false;
// ACE Common Function
PREP(addCanInteractWithCondition); PREP(addCanInteractWithCondition);
PREP(addLineToDebugDraw); PREP(addLineToDebugDraw);
PREP(addSetting); PREP(addSetting);
PREP(addToInventory); PREP(addToInventory);
PREP(assignedItemFix);
PREP(assignObjectsInList); PREP(assignObjectsInList);
PREP(ambientBrightness); PREP(ambientBrightness);
PREP(applyForceWalkStatus); PREP(applyForceWalkStatus);
@ -19,17 +16,14 @@ PREP(binarizeNumber);
PREP(blurScreen); PREP(blurScreen);
PREP(cachedCall); PREP(cachedCall);
PREP(canGetInPosition); PREP(canGetInPosition);
PREP(canInteract);
PREP(canInteractWith); PREP(canInteractWith);
PREP(canUseWeapon); PREP(canUseWeapon);
PREP(changeProjectileDirection); PREP(changeProjectileDirection);
PREP(checkFiles); PREP(checkFiles);
PREP(checkPBOs); PREP(checkPBOs);
PREP(claim); PREP(claim);
PREP(closeDialogIfTargetMoves);
PREP(codeToLetter); PREP(codeToLetter);
PREP(codeToString); PREP(codeToString);
PREP(convertKeyCode);
PREP(createOrthonormalReference); PREP(createOrthonormalReference);
PREP(currentChannel); PREP(currentChannel);
PREP(debug); PREP(debug);
@ -80,19 +74,12 @@ PREP(getNumberFromMissionSQM);
PREP(getNumberMagazinesIn); PREP(getNumberMagazinesIn);
PREP(getPitchBankYaw); PREP(getPitchBankYaw);
PREP(getSettingData); PREP(getSettingData);
PREP(getStaminaBarControl);
PREP(getStringFromMissionSQM); PREP(getStringFromMissionSQM);
PREP(getTargetAzimuthAndInclination); PREP(getTargetAzimuthAndInclination);
PREP(getTargetDistance); PREP(getTargetDistance);
PREP(getTargetObject); PREP(getTargetObject);
PREP(getTurnedOnLights); PREP(getTurnedOnLights);
PREP(getTurretCommander);
PREP(getTurretConfigPath);
PREP(getTurretCopilot);
PREP(getTurretGunner);
PREP(getTurretIndex);
PREP(getTurrets);
PREP(getTurretsFFV);
PREP(getTurretsOther);
PREP(getTurretDirection); PREP(getTurretDirection);
PREP(getUavControlPosition); PREP(getUavControlPosition);
PREP(getVehicleCargo); PREP(getVehicleCargo);
@ -105,6 +92,11 @@ PREP(getWindDirection);
PREP(getZoom); PREP(getZoom);
PREP(goKneeling); PREP(goKneeling);
PREP(hadamardProduct); PREP(hadamardProduct);
PREP(handleModifierKey);
PREP(handleModifierKeyUp);
PREP(handleModifierKeyInit);
PREP(handleScrollWheel);
PREP(handleScrollWheelInit);
PREP(hasItem); PREP(hasItem);
PREP(hasMagazine); PREP(hasMagazine);
PREP(headBugFix); PREP(headBugFix);
@ -115,7 +107,6 @@ PREP(interpolateFromArray);
PREP(inTransitionAnim); PREP(inTransitionAnim);
PREP(inWater); PREP(inWater);
PREP(isAlive); PREP(isAlive);
PREP(isArrested);
PREP(isAutoWind); PREP(isAutoWind);
PREP(isAwake); PREP(isAwake);
PREP(isEngineer); PREP(isEngineer);
@ -125,6 +116,7 @@ PREP(isInBuilding);
PREP(isModLoaded); PREP(isModLoaded);
PREP(isPlayer); PREP(isPlayer);
PREP(isTurnedOut); PREP(isTurnedOut);
PREP(isUnderwater);
PREP(letterToCode); PREP(letterToCode);
PREP(lightIntensityFromObject); PREP(lightIntensityFromObject);
PREP(loadPerson); PREP(loadPerson);
@ -135,7 +127,6 @@ PREP(loadSettingsLocalizedText);
PREP(map); PREP(map);
PREP(moduleCheckPBOs); PREP(moduleCheckPBOs);
PREP(moduleLSDVehicles); PREP(moduleLSDVehicles);
PREP(moveToTempGroup);
PREP(muteUnit); PREP(muteUnit);
PREP(muteUnitHandleInitPost); PREP(muteUnitHandleInitPost);
PREP(muteUnitHandleRespawn); PREP(muteUnitHandleRespawn);
@ -144,25 +135,25 @@ PREP(numberToDigitsString);
PREP(numberToString); PREP(numberToString);
PREP(onAnswerRequest); PREP(onAnswerRequest);
PREP(owned); PREP(owned);
PREP(parseList);
PREP(player); PREP(player);
PREP(playerSide); PREP(playerSide);
PREP(positionToASL); PREP(positionToASL);
PREP(progressBar); PREP(progressBar);
PREP(queueAnimation);
PREP(readSettingFromModule); PREP(readSettingFromModule);
PREP(readSettingsFromParamsArray);
PREP(receiveRequest); PREP(receiveRequest);
PREP(removeCanInteractWithCondition); PREP(removeCanInteractWithCondition);
PREP(removeSpecificMagazine); PREP(removeSpecificMagazine);
PREP(requestCallback); PREP(requestCallback);
PREP(resetAllDefaults); PREP(resetAllDefaults);
PREP(restoreVariablesJIP); PREP(restoreVariablesJIP);
PREP(revertKeyCodeLocalized);
PREP(runAfterSettingsInit); PREP(runAfterSettingsInit);
PREP(sanitizeString); PREP(sanitizeString);
PREP(selectWeaponMode);
PREP(sendRequest); PREP(sendRequest);
PREP(serverLog); PREP(serverLog);
PREP(setArrestState); PREP(setAllGear);
PREP(setCanInteract);
PREP(setCaptivityStatus); PREP(setCaptivityStatus);
PREP(setDefinedVariable); PREP(setDefinedVariable);
PREP(setDisableUserInputStatus); PREP(setDisableUserInputStatus);
@ -178,6 +169,7 @@ PREP(setVariableJIP);
PREP(setVariablePublic); PREP(setVariablePublic);
PREP(setVolume); PREP(setVolume);
PREP(sortAlphabeticallyBy); PREP(sortAlphabeticallyBy);
PREP(showHud);
PREP(stringCompare); PREP(stringCompare);
PREP(stringToColoredText); PREP(stringToColoredText);
PREP(stringRemoveWhiteSpace); PREP(stringRemoveWhiteSpace);
@ -188,6 +180,7 @@ PREP(toBitmask);
PREP(toHex); PREP(toHex);
PREP(toNumber); PREP(toNumber);
PREP(unhideUnit); PREP(unhideUnit);
PREP(uniqueElements);
PREP(uniqueElementsOnly); PREP(uniqueElementsOnly);
PREP(unloadPerson); PREP(unloadPerson);
PREP(unloadPersonLocal); PREP(unloadPersonLocal);
@ -195,6 +188,7 @@ PREP(unmuteUnit);
PREP(useItem); PREP(useItem);
PREP(useMagazine); PREP(useMagazine);
PREP(waitAndExecute); PREP(waitAndExecute);
PREP(waitUntilAndExecute);
PREP(waveHeightAt); PREP(waveHeightAt);
PREP(translateToWeaponSpace); PREP(translateToWeaponSpace);
@ -216,10 +210,12 @@ PREP(getConfigGunner);
PREP(getConfigCommander); PREP(getConfigCommander);
PREP(getHitPoints); PREP(getHitPoints);
PREP(getHitPointsWithSelections); PREP(getHitPointsWithSelections);
PREP(getSelectionsWithoutHitPoints);
PREP(getReflectorsWithSelections); PREP(getReflectorsWithSelections);
PREP(getLightProperties); PREP(getLightProperties);
PREP(getLightPropertiesWeapon); PREP(getLightPropertiesWeapon);
PREP(getVehicleCrew); PREP(getVehicleCrew);
PREP(getVehicleUAVCrew);
// turrets // turrets
PREP(getTurrets); PREP(getTurrets);
@ -231,15 +227,16 @@ PREP(getTurretCopilot);
PREP(getDoorTurrets); PREP(getDoorTurrets);
PREP(getTurretsFFV); PREP(getTurretsFFV);
PREP(getTurretsOther); PREP(getTurretsOther);
PREP(hasHatch);
// missing inventory commands
PREP(binocularMagazine);
PREP(removeBinocularMagazine);
// ACE_Debug // ACE_Debug
PREP(exportConfig); PREP(exportConfig);
PREP(getChildren); PREP(getChildren);
PREP(getDisplayConfigName); PREP(getDisplayConfigName);
PREP(log);
PREP(logControls);
PREP(logDisplays);
PREP(logModEntries);
PREP(monitor); PREP(monitor);
PREP(showUser); PREP(showUser);
@ -262,6 +259,17 @@ PREP(localEvent);
PREP(removeEventHandler); PREP(removeEventHandler);
PREP(removeAlLEventHandlers); PREP(removeAlLEventHandlers);
// Synchronized Events
PREP(syncedEventPFH);
PREP(addSyncedEventHandler);
PREP(removeSyncedEventHandler);
PREP(requestSyncedEvent);
PREP(syncedEvent);
PREP(_handleSyncedEvent);
PREP(_handleRequestSyncedEvent);
PREP(_handleRequestAllSyncedEvents);
// other eventhandlers // other eventhandlers
PREP(addActionEventHandler); PREP(addActionEventHandler);
PREP(addActionMenuEventHandler); PREP(addActionMenuEventHandler);
@ -285,29 +293,20 @@ PREP(hashListSelect);
PREP(hashListSet); PREP(hashListSet);
PREP(hashListPush); PREP(hashListPush);
// Synchronized Events
PREP(syncedEventPFH);
PREP(addSyncedEventHandler);
PREP(removeSyncedEventHandler);
PREP(requestSyncedEvent);
PREP(syncedEvent);
PREP(_handleSyncedEvent);
PREP(_handleRequestSyncedEvent);
PREP(_handleRequestAllSyncedEvents);
GVAR(syncedEvents) = HASH_CREATE; GVAR(syncedEvents) = HASH_CREATE;
GVAR(showHudHash) = [] call FUNC(hashCreate);
//GVARS for execNextFrame and waitAndExec //GVARS for execNextFrame and waitAndExec and waitUntilAndExecute
GVAR(waitAndExecArray) = []; GVAR(waitAndExecArray) = [];
GVAR(nextFrameNo) = diag_frameno; GVAR(nextFrameNo) = diag_frameno;
GVAR(nextFrameBufferA) = []; GVAR(nextFrameBufferA) = [];
GVAR(nextFrameBufferB) = []; GVAR(nextFrameBufferB) = [];
GVAR(waitUntilAndExecArray) = [];
GVAR(settingsInitFinished) = false; GVAR(settingsInitFinished) = false;
GVAR(runAtSettingsInitialized) = []; GVAR(runAtSettingsInitialized) = [];
// @TODO: Generic local-managed global-synced objects (createVehicleLocal) // @todo: Generic local-managed global-synced objects (createVehicleLocal)
//Debug //Debug
ACE_COUNTERS = []; ACE_COUNTERS = [];
@ -317,11 +316,18 @@ if (isServer) then {
call FUNC(loadSettingsOnServer); call FUNC(loadSettingsOnServer);
}; };
ACE_player = player;
//////////////////////////////////////////////////
// Set up PlayerChanged eventhandler for pre init
//////////////////////////////////////////////////
ACE_player = objNull;
uiNamespace setVariable ["ACE_player", objNull];
// @todo check if this can be removed
if (hasInterface) then { if (hasInterface) then {
// PFH to update the ACE_player variable // PFH to update the ACE_player variable
[{ GVAR(PreInit_playerChanged_PFHID) = [{
if !(ACE_player isEqualTo (call FUNC(player))) then { if !(ACE_player isEqualTo (call FUNC(player))) then {
private ["_oldPlayer"]; private ["_oldPlayer"];
_oldPlayer = ACE_player; _oldPlayer = ACE_player;
@ -335,7 +341,11 @@ if (hasInterface) then {
}, 0, []] call CBA_fnc_addPerFrameHandler; }, 0, []] call CBA_fnc_addPerFrameHandler;
}; };
//////////////////////////////////////////////////
// Time handling // Time handling
//////////////////////////////////////////////////
ACE_time = diag_tickTime; ACE_time = diag_tickTime;
ACE_realTime = diag_tickTime; ACE_realTime = diag_tickTime;
ACE_virtualTime = diag_tickTime; ACE_virtualTime = diag_tickTime;
@ -350,6 +360,8 @@ PREP(timePFH);
// Init toHex // Init toHex
[0] call FUNC(toHex); [0] call FUNC(toHex);
ADDON = true; isHC = !hasInterface && !isDedicated; // deprecated because no tag
missionNamespace setVariable ["ACE_isHC", ACE_isHC];
uiNamespace setVariable ["ACE_isHC", ACE_isHC];
isHC = !(hasInterface || isDedicated); ADDON = true;

View File

@ -88,7 +88,7 @@ class CfgUIGrids {
// check dll // check dll
class RscStandardDisplay; class RscStandardDisplay;
class RscDisplayMain: RscStandardDisplay { class RscDisplayMain: RscStandardDisplay {
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDisplayMain"",'GUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); [ARR_5('header','tail',{0},{},_this select 0)] call COMPILE_FILE(functions\fnc_errorMessage)); onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDisplayMain"",'GUI')] call (uinamespace getVariable 'BIS_fnc_initDisplay'); [ARR_5('header','tail',{0},{},_this select 0)] call COMPILE_FILE(functions\fnc_errorMessage));
}; };
*/ */

View File

@ -116,9 +116,9 @@ class ACE_gui_editBase
}; };
colorSelection[] = colorSelection[] =
{ {
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getVariable ['GUI_BCG_RGB_R',0.3843])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getVariable ['GUI_BCG_RGB_G',0.7019])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", "(profilenamespace getVariable ['GUI_BCG_RGB_B',0.8862])",
1 1
}; };
autocomplete = ""; autocomplete = "";
@ -249,7 +249,7 @@ class ACE_gui_listBoxBase : RscListBox{
colorSelect2[] = {0.95, 0.95, 0.95, 1}; colorSelect2[] = {0.95, 0.95, 0.95, 1};
colorSelectBackground[] = {0, 0, 0, 1}; colorSelectBackground[] = {0, 0, 0, 1};
colorSelectBackground2[] = {0.543, 0.5742, 0.4102, 1.0}; colorSelectBackground2[] = {0.543, 0.5742, 0.4102, 1.0};
colorDisabled[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", 0.25}; colorDisabled[] = {"(profilenamespace getVariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getVariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getVariable ['GUI_BCG_RGB_B',0.5])", 0.25};
period = 1.2; period = 1.2;
rowHeight = 0.03; rowHeight = 0.03;
colorBackground[] = {0, 0, 0, 1}; colorBackground[] = {0, 0, 0, 1};
@ -505,7 +505,7 @@ onMouseButtonDblClick = "";
iconCanceled = "\A3\ui_f\data\map\mapcontrol\taskIconCanceled_CA.paa"; iconCanceled = "\A3\ui_f\data\map\mapcontrol\taskIconCanceled_CA.paa";
iconDone = "\A3\ui_f\data\map\mapcontrol\taskIconDone_CA.paa"; iconDone = "\A3\ui_f\data\map\mapcontrol\taskIconDone_CA.paa";
iconFailed = "\A3\ui_f\data\map\mapcontrol\taskIconFailed_CA.paa"; iconFailed = "\A3\ui_f\data\map\mapcontrol\taskIconFailed_CA.paa";
color[] = {"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])","(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])","(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"}; color[] = {"(profilenamespace getVariable ['IGUI_TEXT_RGB_R',0])","(profilenamespace getVariable ['IGUI_TEXT_RGB_G',1])","(profilenamespace getVariable ['IGUI_TEXT_RGB_B',1])","(profilenamespace getVariable ['IGUI_TEXT_RGB_A',0.8])"};
colorCreated[] = {1,1,1,1}; colorCreated[] = {1,1,1,1};
colorCanceled[] = {0.7,0.7,0.7,1}; colorCanceled[] = {0.7,0.7,0.7,1};
colorDone[] = {0.7,1,0.3,1}; colorDone[] = {0.7,1,0.3,1};

View File

@ -3,9 +3,9 @@
* Converts ASL to Arma "Position" * Converts ASL to Arma "Position"
* *
* Arguments: * Arguments:
* 0: position x <Number> * 0: position x <NUMBER>
* 1: position y <Number> * 1: position y <NUMBER>
* 2: position z <Number> * 2: position z <NUMBER>
* *
* Return Value: * Return Value:
* None * None

View File

@ -1,32 +1,41 @@
//fnc__handleNetEvent.sqf /*
// internal handler for net events * Author: jaynus
* Internal net event handler.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp" #include "script_component.hpp"
private ["_eventName", "_eventArgs", "_eventNames", "_eventIndex", "_eventTargets", "_sentEvents", "_owner", "_serverFlagged", "_events"]; params ["_eventType", "_event"];
//IGNORE_PRIVATE_WARNING("_handleNetEvent");
PARAMS_2(_eventType,_event);
if (_eventType == "ACEg") then { if (_eventType == "ACEg") then {
_eventName = _event select 0; _event params ["_eventName", "_eventArgs"];
_eventArgs = _event select 1;
private ["_eventNames", "_eventIndex"];
_eventNames = GVAR(events) select 0; _eventNames = GVAR(events) select 0;
_eventIndex = _eventNames find _eventName; _eventIndex = _eventNames find _eventName;
if (_eventIndex != -1) then { if (_eventIndex != -1) then {
private "_events";
_events = (GVAR(events) select 1) select _eventIndex; _events = (GVAR(events) select 1) select _eventIndex;
#ifdef DEBUG_EVENTS #ifdef DEBUG_EVENTS
diag_log text format[ARR_2("* Net Event %1",_eventName)]; ACE_LOGINFO_1("* Net Event %1",_eventName);
diag_log text format[ARR_2(" args=%1",_eventArgs)]; ACE_LOGINFO_1(" args=%1",_eventArgs);
#endif #endif
{ {
if (!isNil "_x") then { if (!isNil "_x") then {
_eventArgs call CALLSTACK_NAMED(_x, format[ARR_3("Net Event %1 ID: %2",_eventName,_forEachIndex)]); _eventArgs call CALLSTACK_NAMED(_x, FORMAT_2("Net Event %1 ID: %2",_eventName,_forEachIndex));
#ifdef DEBUG_EVENTS_CALLSTACK #ifdef DEBUG_EVENTS_CALLSTACK
diag_log text format[ARR_2(" ID: %1",_forEachIndex)]; ACE_LOGINFO_1(" ID: %1",_forEachIndex);
#endif #endif
}; };
} forEach _events; } forEach _events;
@ -35,9 +44,9 @@ if (_eventType == "ACEg") then {
if (_eventType == "ACEc") then { if (_eventType == "ACEc") then {
if (isServer) then { if (isServer) then {
_eventName = _event select 0; _event params ["_eventName", "_eventTargets", "_eventArgs"];
_eventTargets = _event select 1;
_eventArgs = _event select 2; private ["_sentEvents", "_owner", "_serverFlagged"];
_sentEvents = []; _sentEvents = [];
if (!IS_ARRAY(_eventTargets)) then { if (!IS_ARRAY(_eventTargets)) then {
@ -45,7 +54,7 @@ if (_eventType == "ACEc") then {
}; };
//If not multiplayer, and there are targets, then just run localy //If not multiplayer, and there are targets, then just run localy
if ((!isMultiplayer) && {(count _eventTargets) > 0}) exitWith { if (!isMultiplayer && {count _eventTargets > 0}) exitWith {
ACEg = [_eventName, _eventArgs]; ACEg = [_eventName, _eventArgs];
["ACEg", ACEg] call FUNC(_handleNetEvent); ["ACEg", ACEg] call FUNC(_handleNetEvent);
}; };
@ -56,9 +65,10 @@ if (_eventType == "ACEc") then {
if (IS_OBJECT(_x)) then { if (IS_OBJECT(_x)) then {
_owner = owner _x; _owner = owner _x;
}; };
if (!(_owner in _sentEvents)) then { if !(_owner in _sentEvents) then {
PUSH(_sentEvents, _owner); _sentEvents pushBack _owner;
ACEg = [_eventName, _eventArgs]; ACEg = [_eventName, _eventArgs];
if (isDedicated || {_x != ACE_player}) then { if (isDedicated || {_x != ACE_player}) then {
if (isDedicated && {local _x} && {!_serverFlagged}) then { if (isDedicated && {local _x} && {!_serverFlagged}) then {
_serverFlagged = true; _serverFlagged = true;
@ -70,6 +80,7 @@ if (_eventType == "ACEc") then {
["ACEg", ACEg] call FUNC(_handleNetEvent); ["ACEg", ACEg] call FUNC(_handleNetEvent);
}; };
}; };
} forEach _eventTargets; false
} count _eventTargets;
}; };
}; };

View File

@ -1,25 +1,27 @@
/* /*
* Author: jaynus * Author: jaynus
*
* Handles a server-side request for synchronization ALL events on JIP to a client. * Handles a server-side request for synchronization ALL events on JIP to a client.
* *
* Argument: * Arguments:
* 0: client (object) * 0: client <OBJECT>
* *
* Return value: * Return Value:
* Boolean of success * Event is successed <BOOL>
*
* Public: No
*/ */
//#define DEBUG_MODE_FULL
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_1(_client);
params ["_client"];
{ {
private["_eventName", "_eventEntry", "_eventLog"]; private ["_eventEntry", "_eventLog"];
_eventName = _x;
_eventEntry = HASH_GET(GVAR(syncedEvents),_eventName); _eventEntry = HASH_GET(GVAR(syncedEvents),_x);
_eventLog = _eventEntry select 1; _eventLog = _eventEntry select 1;
["SEH_s", _client, [_eventName, _eventLog] ] call FUNC(targetEvent); ["SEH_s", _client, [_x, _eventLog]] call FUNC(targetEvent);
} forEach (GVAR(syncedEvents) select 0); false
} count (GVAR(syncedEvents) select 0);
true true

View File

@ -1,48 +1,50 @@
/* /*
* Author: jaynus * Author: jaynus
*
* Receives either requests for synchronization from clients, or the synchronization data from the server. * Receives either requests for synchronization from clients, or the synchronization data from the server.
* *
* Arguments [Client] : * Arguments [Client] :
* 0: eventName (String) * 0: eventName <STRING>
* 1: eventLog (Array) * 1: eventLog <ARRAY>
* *
* Arguments [Server] : * Arguments [Server] :
* 0: eventName (String) * 0: eventName <STRING>
* 1: client (Object) * 1: client <OBJECT>
* *
* Return value: * Return Value:
* Boolean of success * Event is successed <BOOL>
*
* Public: No
*/ */
//#define DEBUG_MODE_FULL
#include "script_component.hpp" #include "script_component.hpp"
//IGNORE_PRIVATE_WARNING("_handleSyncedEvent");
//SEH_s //SEH_s
if (isServer) then { if (isServer) then {
// Find the event name, and shovel out the events to the client // Find the event name, and shovel out the events to the client
PARAMS_2(_eventName,_client); params ["_eventName", "_client"];
private["_eventEntry", "_eventLog"];
if (!HASH_HASKEY(GVAR(syncedEvents),_eventName)) exitWith { if (!HASH_HASKEY(GVAR(syncedEvents),_eventName)) exitWith {
diag_log text format["[ACE] Error, request for synced event - key not found."]; ACE_LOGERROR("Request for synced event - key not found.");
false false
}; };
private ["_eventEntry", "_eventLog"];
_eventEntry = HASH_GET(GVAR(syncedEvents),_eventName); _eventEntry = HASH_GET(GVAR(syncedEvents),_eventName);
_eventLog = _eventEntry select 1; _eventLog = _eventEntry select 1;
["SEH_s", _client, [_eventName, _eventLog]] call FUNC(targetEvent); ["SEH_s", _client, [_eventName, _eventLog]] call FUNC(targetEvent);
} else { } else {
PARAMS_2(_eventName,_eventLog); params ["_eventName", "_eventLog"];
private ["_eventArgs"];
// This is the client handling the response from the server // This is the client handling the response from the server
// Start running the events // Start running the events
{ {
_eventArgs = _x select 1; _x params ["", "_eventArgs","_ttl"];
[_eventName, _eventArgs, (_x select 2)] call FUNC(_handleSyncedEvent); [_eventName, _eventArgs, _ttl] call FUNC(_handleSyncedEvent);
} forEach _eventLog; false
diag_log text format["[ACE] + [%1] synchronized", _eventName]; } count _eventLog;
ACE_LOGINFO_1("[%1] synchronized",_eventName);
}; };
true true

View File

@ -1,34 +1,38 @@
/* /*
* Author: jaynus * Author: jaynus
*
* Handles synced events being received. Server will log them, and server/client will execute them. * Handles synced events being received. Server will log them, and server/client will execute them.
* *
* Arguments [Client] : * Arguments [Client] :
* 0: eventName (String) * 0: eventName <STRING>
* 1: arguments (Array) * 1: arguments <ARRAY>
* 2: ttl (Scalar) * 2: ttl <SCALAR>
* *
* Return value: * Return Value:
* Boolean of success * Boolean of success <BOOL>
*
* Public: No
*/ */
//#define DEBUG_MODE_FULL
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_3(_name,_args,_ttl);
private["_internalData", "_eventLog", "_eventCode"]; params ["_name", "_args", "_ttl"];
if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
diag_log text format["[ACE] Error, synced event key not found."]; ACE_LOGERROR("Synced event key not found.");
false false
}; };
private ["_internalData", "_eventCode"];
_internalData = HASH_GET(GVAR(syncedEvents),_name); _internalData = HASH_GET(GVAR(syncedEvents),_name);
if (isServer) then { if (isServer) then {
// Server needs to internally log it for synchronization // Server needs to internally log it for synchronization
if (_ttl > -1) then { if (_ttl > -1) then {
_internalData = HASH_GET(GVAR(syncedEvents),_name); _internalData = HASH_GET(GVAR(syncedEvents),_name);
private "_eventLog";
_eventLog = _internalData select 1; _eventLog = _internalData select 1;
_eventLog pushback [ACE_diagTime, _args, _ttl]; _eventLog pushBack [ACE_diagTime, _args, _ttl];
}; };
}; };

View File

@ -1,49 +1,43 @@
/* /*
* Author: commy2 * Author: commy2
*
* Add an addAction event to a unit. Used to handle multiple addAction events. Global arguments, local effects. Does only work for player controlled units. * Add an addAction event to a unit. Used to handle multiple addAction events. Global arguments, local effects. Does only work for player controlled units.
* *
* Argument: * Arguments:
* 0: Unit the action should be assigned to (Object) * 0: Unit the action should be assigned to <OBJECT>
* 1: Name of the action, e.g. "DefaultAction" (String) * 1: Name of the action, e.g. "DefaultAction" <STRING>
* 2: Condition (Code or String) * 2: Condition <CODE, STRING>
* 3: Code to execute (Code or String) * 3: Code to execute <CODE, STRING>
* *
* Return value: * Return Value:
* ID of the action (used to remove it later). * ID of the action (used to remove it later) <NUMBER>
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_unit", "_action", "_condition", "_statement", "_name", "_actionsVar", "_actionID", "_actions", "_id", "_actionIDs"]; params ["_unit", "_action", "_condition", "_statement"];
//IGNORE_PRIVATE_WARNING("_count", "_index", "_return", "_target");
_unit = _this select 0; if (_condition isEqualType "") then {
_action = _this select 1;
_condition = _this select 2;
_statement = _this select 3;
if (typeName _condition == "STRING") then {
_condition = compile _condition; _condition = compile _condition;
}; };
if (typeName _statement == "STRING") then { if (_statement isEqualType "") then {
_statement = compile _statement; _statement = compile _statement;
}; };
_name = format ["ACE_Action_%1", _action]; private ["_name", "_actionsVar"];
_name = format ["ACE_Action_%1", _action];
_actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]]; _actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]];
if (_unit != _actionsVar select 2) then { // check if the unit is still valid, fixes respawn issues if (_unit != _actionsVar select 2) then { // check if the unit is still valid, fixes respawn issues
_actionsVar = [-1, [-1, [], []], objNull]; _actionsVar = [-1, [-1, [], []], objNull];
}; };
_actionID = _actionsVar select 0; _actionsVar params ["_actionID", "_actionsArray"];
_actions = _actionsVar select 1; _actionsArray params ["_id", "_actionIDs", "_actions"];
_id = (_actions select 0) + 1; _id = _id + 1;
_actionIDs = _actions select 1;
_actions = _actions select 2;
_actionIDs pushBack _id; _actionIDs pushBack _id;
_actions pushBack [_condition, _statement]; _actions pushBack [_condition, _statement];
@ -51,7 +45,6 @@ _actions pushBack [_condition, _statement];
// first action to add, unit needs addAction command // first action to add, unit needs addAction command
if (_actionID == -1) then { if (_actionID == -1) then {
private "_addAction"; private "_addAction";
_addAction = call compile format [ _addAction = call compile format [
"[ "[
'', '',

View File

@ -1,53 +1,52 @@
/* /*
* Author: commy2 * Author: commy2
*
* Add an addAction event to a unit. Used to handle multiple addAction events and add a action to the mouse wheel menu. Global arguments, local effects. Does only work for player controlled units. * Add an addAction event to a unit. Used to handle multiple addAction events and add a action to the mouse wheel menu. Global arguments, local effects. Does only work for player controlled units.
* *
* Argument: * Arguments:
* 0: Unit the action should be assigned to (Object) * 0: Unit the action should be assigned to <OBJECT>
* 1: Menu title of the action (String) * 1: Menu title of the action <STRING>
* 2: Name of the action, e.g. "DefaultAction" (String) * 2: Name of the action, e.g. "DefaultAction" <STRING>
* 3: Condition (Code or String) * 3: Condition <CODE, STRING>
* 4: Code to execute by the action (Code or String) * 4: Code to execute by the action <CODE, STRING>
* 5: Condition for the menu action (Code or String) * 5: Condition for the menu action <CODE, STRING>
* 6: Code to execute from the menu (Code or String) * 6: Code to execute from the menu <CODE, STRING>
* 7: Priority of the action (Number, optional default: 0) * 7: Priority of the action (default: 0) <NUMBER>
* *
* Return value: * Return Value:
* ID of the action (used to remove it later). * ID of the action (used to remove it later) <NUMBER>
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_name", "_actionsVar", "_id", "_actionIDs", "_actions", "_nameVar", "_addAction", "_actionID"]; params ["_unit", "_displayName", "_action", "_condition", "_statement", "_condition2", "_statement2", ["_priority", 0]];
//IGNORE_PRIVATE_WARNING("_target");
PARAMS_8(_unit,_displayName,_action,_condition,_statement,_condition2,_statement2,_priority); if (_condition isEqualType "") then {
if (isNil "_priority") then {_priority = 0};
if (typeName _condition == "STRING") then {
_condition = compile _condition; _condition = compile _condition;
}; };
if (typeName _statement == "STRING") then { if (_statement isEqualType "") then {
_statement = compile _statement; _statement = compile _statement;
}; };
if (typeName _condition2 == "STRING") then { if (_condition2 isEqualType "") then {
_condition2 = compile _condition2; _condition2 = compile _condition2;
}; };
if (typeName _statement2 == "STRING") then { if (_statement2 isEqualType "") then {
_statement2 = compile _statement2; _statement2 = compile _statement2;
}; };
_name = format ["ACE_ActionMenu_%1", _action]; private ["_name", "_actionsVar"];
_name = format ["ACE_ActionMenu_%1", _action];
_actionsVar = _unit getVariable [_name, [-1, [], []]]; _actionsVar = _unit getVariable [_name, [-1, [], []]];
_id = (_actionsVar select 0) + 1; _actionsVar params ["_id", "_actionIDs", "_actions"];
_actionIDs = _actionsVar select 1;
_actions = _actionsVar select 2; _id = _id + 1;
private ["_nameVar", "_addAction", "_actionID"];
_nameVar = format ["%1_ID%2", _name, _id]; _nameVar = format ["%1_ID%2", _name, _id];
missionNamespace setVariable [_nameVar, [_condition, _statement, _condition2, _statement2]]; missionNamespace setVariable [_nameVar, [_condition, _statement, _condition2, _statement2]];

View File

@ -1,33 +1,27 @@
/* /*
* Author: commy2 * Author: commy2
*
* Add a condition that gets checked by ace_common_fnc_canInteractWith. * Add a condition that gets checked by ace_common_fnc_canInteractWith.
* *
* Arguments: * Arguments:
* 0: The conditions id. Used to remove later or as exception name. An already existing name overwrites. (String) * 0: The conditions id. Used to remove later or as exception name. An already existing name overwrites. <STRING>
* 1: The condition to check. format of "_this" is "[_player, _target]". (Code) * 1: The condition to check. format of "_this" is "[_player, _target]". <CODE>
* *
* Return Value: * Return Value:
* Unit can interact? * None
* *
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_conditionName", "_conditionFunc"]; params ["_conditionName", "_conditionFunc"];
//IGNORE_PRIVATE_WARNING("_player", "_target");
_conditionName = toLower _conditionName;
_conditionName = toLower (_this select 0); private ["_conditions", "_index"];
_conditionFunc = _this select 1;
private ["_conditions", "_conditionNames", "_conditionFuncs"];
_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]]; _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
_conditions params ["_conditionNames", "_conditionFuncs"];
_conditionNames = _conditions select 0;
_conditionFuncs = _conditions select 1;
private "_index";
_index = _conditionNames find _conditionName; _index = _conditionNames find _conditionName;
if (_index == -1) then { if (_index == -1) then {
@ -37,4 +31,4 @@ if (_index == -1) then {
_conditionNames set [_index, _conditionName]; _conditionNames set [_index, _conditionName];
_conditionFuncs set [_index, _conditionFunc]; _conditionFuncs set [_index, _conditionFunc];
GVAR(InteractionConditions) = [_conditionNames, _conditionFuncs]; GVAR(InteractionConditions) = _conditions;

View File

@ -1,13 +1,23 @@
// by commy2 /*
* Author: commy2
*
* Arguments:
* Display where the Unload event was added <DISPLAY>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp" #include "script_component.hpp"
private "_dlg";
disableSerialization; disableSerialization;
private "_dlg";
_dlg = ctrlParent _this; _dlg = ctrlParent _this;
_dlg displayAddEventHandler ["unload", { _dlg displayAddEventHandler ["unload", {
if (_this select 1 == 1) then { if (_this select 1 == 1) then {
[missionnamespace getvariable ["BIS_fnc_initCuratorAttributes_target", objNull]] call FUNC(fixCrateContent); [missionnamespace getVariable ["BIS_fnc_initCuratorAttributes_target", objNull]] call FUNC(fixCrateContent);
}; };
}]; }];

View File

@ -1,33 +1,34 @@
/* /*
* Author: Nou * Author: Nou
* Add an event handler.
* *
* Add a event handler. * Arguments:
* 0: Event name <STRING>
* 1: Event code <CODE>
* *
* Argument: * Return Value:
* 0: Event name (string) * Event handler ID number (for use with fnc_removeEventHandler) <NUMBER>
* 1: Event code (code)
* *
* Return value: * Public: Yes
* Event handler ID number (for use with fnc_removeEventHandler)
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_eventNames", "_eventFunctions", "_eventNameCount", "_eventIndex", "_eventFunctionCount"]; params ["_eventName", "_eventCode"];
PARAMS_2(_eventName,_eventCode); private ["_eventNames", "_eventFunctions", "_eventIndex"];
_eventNames = GVAR(events) select 0; _eventNames = GVAR(events) select 0;
_eventFunctions = []; _eventFunctions = [];
_eventIndex = _eventNames find _eventName; _eventIndex = _eventNames find _eventName;
if (_eventIndex != -1) then { if (_eventIndex != -1) then {
_eventFunctions = (GVAR(events) select 1) select _eventIndex; _eventFunctions = (GVAR(events) select 1) select _eventIndex;
} else { } else {
private "_eventNameCount";
_eventNameCount = count _eventNames; _eventNameCount = count _eventNames;
_eventNames set [_eventNameCount, _eventName]; _eventNames set [_eventNameCount, _eventName];
(GVAR(events) select 1) set [_eventNameCount, _eventFunctions]; (GVAR(events) select 1) set [_eventNameCount, _eventFunctions];
}; };
_eventFunctionCount = count _eventFunctions; _eventFunctions pushBack _eventCode // Return event function count
_eventFunctions set [_eventFunctionCount, _eventCode];
_eventFunctionCount;

View File

@ -1,15 +1,15 @@
/* /*
* Author: esteldunedain * Author: esteldunedain
*
* Add line to draw on debug * Add line to draw on debug
* *
* Argument: * Arguments:
* 0: Start point ASL (Array) * 0: Start point ASL <ARRAY>
* 1: End point ASL (Array) * 1: End point ASL <ARRAY>
* 2: Color (Array) * 2: Color <ARRAY>
* *
* Return value: * None
* *
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -1,29 +1,29 @@
/* /*
* Author: commy2 * Author: commy2
*
* Add a map marker creation event handler. * Add a map marker creation event handler.
* *
* Argument: * Arguments:
* 0: Code to execute (Code or String) * 0: Code to execute <CODE, STRING>
* *
* Return value: * Return Value:
* ID of the event script (used to remove it later). * ID of the event script (used to remove it later). <NUMBER>
*
* Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_actionsVar", "_id", "_actionIDs", "_actions"]; params ["_statement"];
PARAMS_1(_statement); if (_statement isEqualType "") then {
if (typeName _statement == "STRING") then {
_statement = compile _statement; _statement = compile _statement;
}; };
private "_actionsVar";
_actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]]; _actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]];
_id = (_actionsVar select 0) + 1; _actionsVar params ["_id", "_actionIDs", "_actions"];
_actionIDs = _actionsVar select 1;
_actions = _actionsVar select 2; _id = _id + 1;
if (_id == 0) then { if (_id == 0) then {
uiNamespace setVariable ["ACE_EventHandler_MapMarker", count allMapMarkers]; uiNamespace setVariable ["ACE_EventHandler_MapMarker", count allMapMarkers];

View File

@ -1,29 +1,30 @@
/* /*
* Author: commy2 * Author: commy2
* Add an event handler that executes every time the scroll wheel is used. This is needed, because adding a MouseZ display event handler to display 46 will break in save games.
* _this will be [Interval] where 'Interval' is a number.
* *
* Add an event handler that executes every ACE_time the scroll wheel is used. This is needed, because adding a MouseZ display event handler to display 46 will break in save games. Argument will be [Interval] where 'Interval' is a number. * Arguments:
* 0: Code to execute <CODE, STRING>
* *
* Argument: * Return Value:
* 0: Code to execute (Code or String) * ID of the event script (used to remove it later). <NUMBER>
* *
* Return value: * Public: Yes
* ID of the event script (used to remove it later).
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_actionsVar", "_id", "_actionIDs", "_actions"]; params ["_statement"];
PARAMS_1(_statement); if (_statement isEqualType "") then {
if (typeName _statement == "STRING") then {
_statement = compile _statement; _statement = compile _statement;
}; };
private "_actionsVar";
_actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]]; _actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]];
_id = (_actionsVar select 0) + 1; _actionsVar params ["_id", "_actionIDs", "_actions"];
_actionIDs = _actionsVar select 1;
_actions = _actionsVar select 2; _id = _id + 1;
_actionIDs pushBack _id; _actionIDs pushBack _id;
_actions pushBack _statement; _actions pushBack _statement;

View File

@ -11,7 +11,7 @@
* 4: localizedDescription <STRING> * 4: localizedDescription <STRING>
* 5: possibleValues <ARRAY> * 5: possibleValues <ARRAY>
* 6: isForced <BOOL> * 6: isForced <BOOL>
* 7: defaultValue (Any) * 7: defaultValue <ANY>
* *
* Return Value: * Return Value:
* None * None
@ -20,10 +20,9 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_8(_name,_typeName,_isClientSetable,_localizedName,_localizedDescription,_possibleValues,_isForced,_value); params ["_name", "", "", "", "", "", "", "_value"]; //["_name", "_typeName", "_isClientSetable", "_localizedName", "_localizedDescription", "_possibleValues", "_isForced", "_value"];
private ["_settingData"];
private "_settingData";
_settingData = [_name] call FUNC(getSettingData); _settingData = [_name] call FUNC(getSettingData);
// Exit if the setting already exists // Exit if the setting already exists

View File

@ -1,34 +1,29 @@
/* /*
* Author: jaynus * Author: jaynus
*
* Register an event handler for an ACE synced event * Register an event handler for an ACE synced event
* *
* Argument: * Arguments:
* 0: Name (String) * 0: Name <STRING>
* 1: Handler (Code) * 1: Handler <CODE>
* 2: TTL (Number or Code) [Optional] * 2: TTL (optional: 0) <NUMBER, CODE>
* *
* Return value: * Return Value:
* Boolean of success * Boolean of success <BOOL>
*
* Public: Yes
*/ */
//#define DEBUG_MODE_FULL
#include "script_component.hpp" #include "script_component.hpp"
//IGNORE_PRIVATE_WARNING("_handleSyncedEvent");
PARAMS_2(_name,_handler); params ["_name", "_handler", ["_ttl", 0]];
private["_ttl", "_eventId", "_data"];
if( (count _this) > 2) then {
_ttl = _this select 2;
} else {
_ttl = 0;
};
if (HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { if (HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
diag_log text format["[ACE] Error, duplicate synced event creation."]; ACE_LOGERROR("Duplicate synced event creation.");
false false
}; };
private ["_eventId", "_data"];
_eventId = [_name, FUNC(_handleSyncedEvent)] call FUNC(addEventHandler); _eventId = [_name, FUNC(_handleSyncedEvent)] call FUNC(addEventHandler);
_data = [_handler, [], _ttl, _eventId]; _data = [_handler, [], _ttl, _eventId];
HASH_SET(GVAR(syncedEvents),_name,_data); HASH_SET(GVAR(syncedEvents),_name,_data);

View File

@ -1,93 +1,141 @@
/* /*
* Author: Garth 'L-H' de Wet * Author: Garth 'L-H' de Wet
* Adds an item,weapon,magazine to the unit's inventory * Adds an item, weapon, or magazine to the unit's inventory or places it in a weaponHolder if no space.
* or places it in a weaponHolder if no space.
* *
* Arguments: * Arguments:
* 0: Unit <OBJECT> * 0: Unit <OBJECT>
* 1: Classname <STRING> * 1: Classname <STRING>
* 2: Container (uniform, vest, backpack) <STRING><OPTIONAL> * 2: Container (uniform, vest, backpack) (default: "") <STRING>
* 3: Magazine Ammo Count <NUMBER><OPTIONAL> * 3: Magazine Ammo Count (default: -1) <NUMBER>
* *
* Return Value: * Return Value:
* Array: * 0: Added to player <BOOL>
* 0: Added to player (Bool) * 1: weaponholder <OBJECT>
* 1: weaponholder (OBJECT)
* *
* Public: Yes * Public: Yes
*/ */
//#define DEBUG_MODE_FULL
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_2(_unit,_classname); params ["_unit", "_classname", ["_container", ""], ["_ammoCount", -1]];
DEFAULT_PARAM(2,_container,"");
DEFAULT_PARAM(3,_ammoCount,-1);
private ["_addedToPlayer", "_canAdd", "_type", "_pos"]; private ["_type", "_canAdd", "_addedToUnit"];
_canAdd = false; _type = [_classname] call FUNC(getItemType);
_addedToPlayer = true;
_type = [_classname] call EFUNC(common,getItemType);
switch (_container) do { switch (_container) do {
case "vest": { _canAdd = _unit canAddItemToVest _classname; }; case "vest": {
case "backpack": { _canAdd = _unit canAddItemToBackpack _classname; }; _canAdd = _unit canAddItemToVest _classname;
case "uniform": { _canAdd = _unit canAddItemToUniform _classname; }; };
default {_canAdd = _unit canAdd _classname;}; case "backpack": {
_canAdd = _unit canAddItemToBackpack _classname;
};
case "uniform": {
_canAdd = _unit canAddItemToUniform _classname;
};
default {
_canAdd = _unit canAdd _classname;
};
}; };
switch ((_type select 0)) do { switch (_type select 0) do {
case "weapon": { case "weapon": {
if (_canAdd) then { if (_canAdd) then {
_addedToUnit = true;
switch (_container) do { switch (_container) do {
case "vest": { (vestContainer _unit) addWeaponCargoGlobal [_classname, 1]; }; case "vest": {
case "backpack": { (backpackContainer _unit) addWeaponCargoGlobal [_classname, 1]; }; (vestContainer _unit) addWeaponCargoGlobal [_classname, 1];
case "uniform": { (uniformContainer _unit) addWeaponCargoGlobal [_classname, 1]; }; };
default { _unit addWeaponGlobal _classname; }; case "backpack": {
(backpackContainer _unit) addWeaponCargoGlobal [_classname, 1];
};
case "uniform": {
(uniformContainer _unit) addWeaponCargoGlobal [_classname, 1];
};
default {
_unit addWeaponGlobal _classname;
};
}; };
} else { } else {
_addedToPlayer = false; _addedToUnit = false;
private "_pos";
_pos = _unit modelToWorldVisual [0,1,0.05]; _pos = _unit modelToWorldVisual [0,1,0.05];
_unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"]; _unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
_unit addWeaponCargoGlobal [_classname, 1]; _unit addWeaponCargoGlobal [_classname, 1];
_unit setPosATL _pos; _unit setPosATL _pos;
}; };
}; };
case "magazine": { case "magazine": {
if (_ammoCount == -1) then {_ammoCount = getNumber (configFile >> "CfgMagazines" >> _classname >> "count");}; if (_ammoCount == -1) then {
_ammoCount = getNumber (configFile >> "CfgMagazines" >> _classname >> "count");
};
if (_canAdd) then { if (_canAdd) then {
_addedToUnit = true;
switch (_container) do { switch (_container) do {
case "vest": { (vestContainer _unit) addMagazineCargoGlobal [_classname, _ammoCount]; }; case "vest": {
case "backpack": { (backpackContainer _unit) addMagazineCargoGlobal [_classname, _ammoCount]; }; (vestContainer _unit) addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command.
case "uniform": { (uniformContainer _unit) addMagazineCargoGlobal [_classname, _ammoCount]; }; };
default {_unit addMagazine [_classname, _ammoCount]; }; case "backpack": {
(backpackContainer _unit) addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command.
};
case "uniform": {
(uniformContainer _unit) addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command.
};
default {
_unit addMagazine [_classname, _ammoCount];
};
}; };
} else { } else {
_addedToPlayer = false; _addedToUnit = false;
private "_pos";
_pos = _unit modelToWorldVisual [0,1,0.05]; _pos = _unit modelToWorldVisual [0,1,0.05];
_unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"]; _unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
_unit addMagazineCargoGlobal [_classname, _ammoCount]; _unit addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command.
_unit setPosATL _pos; _unit setPosATL _pos;
}; };
}; };
case "item": { case "item": {
if (_canAdd) then { if (_canAdd) then {
_addedToUnit = true;
switch (_container) do { switch (_container) do {
case "vest": { _unit addItemToVest _classname; }; case "vest": {
case "backpack": { _unit addItemToBackpack _classname; }; _unit addItemToVest _classname;
case "uniform": { _unit addItemToUniform _classname; }; };
default { _unit addItem _classname; }; case "backpack": {
_unit addItemToBackpack _classname;
};
case "uniform": {
_unit addItemToUniform _classname;
};
default {
_unit addItem _classname;
};
}; };
} else { } else {
_addedToPlayer = false; _addedToUnit = false;
private "_pos";
_pos = _unit modelToWorldVisual [0,1,0.05]; _pos = _unit modelToWorldVisual [0,1,0.05];
_unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"]; _unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
_unit addItemCargoGlobal [_classname, 1]; _unit addItemCargoGlobal [_classname, 1];
_unit setPosATL _pos; _unit setPosATL _pos;
}; };
}; };
default {diag_log format ["ACE: Incorrect item type passed to %1, passed: %2",QFUNC(AddToInventory),_type];};
default {
_addedToUnit = false;
ACE_LOGWARNING_2("Incorrect item type passed to %1, passed: %2",QFUNC(AddToInventory),_type);
};
}; };
[_addedToPlayer,_unit] [_addedToUnit, _unit]

View File

@ -1,13 +1,14 @@
/* /*
* Author: commy2, idea by Falke * Author: commy2, idea by Falke
*
* Returns a brightness value depending on the sun and moon state. Ranges from 0 to 1 (dark ... bright). * Returns a brightness value depending on the sun and moon state. Ranges from 0 to 1 (dark ... bright).
* *
* Argument: * Arguments:
* None. * None
* *
* Return value: * Return Value:
* Ambient brightness (Number) * Ambient brightness <NUMBER>
*
* Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -1,25 +1,23 @@
/* /*
Name: FUNC(applyForceWalkStatus) * Author: Pabst Mirror
* Applys the forceWalk status of an unit. Called from Extended_InitPost_EventHandlers.
Author: Pabst Mirror *
* Arguments:
Description: * 0: Unit <OBJECT>
Applys the forceWalk status of an unit. Called from Extended_InitPost_EventHandlers. *
* Return Value:
Parameters: * None
0: OBJECT - Unit *
* Example:
Returns: * [ACE_Player] call ace_common_fnc_applyForceWalkStatus
None *
* Public: No
Example:
[ACE_Player] call FUNC(applyForceWalkStatus)
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_forceWalkNumber"]; params ["_unit"];
PARAMS_1(_unit); private "_forceWalkNumber";
_forceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0]; _forceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0];
_unit forceWalk (_forceWalkNumber > 0); _unit forceWalk (_forceWalkNumber > 0);

View File

@ -4,47 +4,41 @@
* Used by moduleAssign* within various parts of the ACE3 project. * Used by moduleAssign* within various parts of the ACE3 project.
* *
* Arguments: * Arguments:
* 0: list <STRING> * 0: List <STRING>
* 1: variableName <STRING> * 1: Variable Name <STRING>
* 2: value <ANY> * 2: Value <ANY>
* 3: Global <BOOL> * 3: Global <BOOL>
* 4: Vehicle <BOOL> (default: false)
* *
* Return Value: * Return Value:
* None <NIL> * None
*
* Example:
* ["text", "variable", value, true] call ace_common_fnc_assignObjectsInList
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_splittedList", "_nilCheckPassedList"]; params ["_list", "_variable", "_setting", "_global", ["_vehicle", false]];
params ["_list", "_variable", "_setting", "_global"];
if (typeName _list == "STRING") then { if (_list isEqualType "") then {
_splittedList = [_list, ","] call BIS_fnc_splitString; _list = [_list, true, true] call FUNC(parseList);
_nilCheckPassedList = ""; TRACE_1("Parsed",_list)
{
_x = [_x] call FUNC(stringRemoveWhiteSpace);
if !(isnil _x) then {
if (_nilCheckPassedList == "") then {
_nilCheckPassedList = _x;
} else {
_nilCheckPassedList = _nilCheckPassedList + ","+ _x;
};
};
}foreach _splittedList;
_list = [] call compile format["[%1]",_nilCheckPassedList];
}; };
{ {
if (!isnil "_x") then { if (!isNil "_x") then {
if (typeName _x == typeName objNull) then { if (_x isEqualType objNull) then {
if (local _x) then { if (local _x) then {
_x setvariable [_variable, _setting, _global]; if (_vehicle) then {
(vehicle _x) setVariable [_variable, _setting, _global];
TRACE_6("Set variable vehicle",_x,vehicle _x,typeOf (vehicle _x),_variable,_setting,_global);
} else {
_x setVariable [_variable, _setting, _global];
TRACE_5("Set variable",_x,typeOf _x,_variable,_setting,_global);
}; };
}; };
}; };
}foreach _list; };
} count _list;
true

View File

@ -0,0 +1,75 @@
/*
* Author: commy2
* Initialized the assigned item fix.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public : No
*/
#include "script_component.hpp"
private "_config";
ACE_isMapEnabled = call {_config = missionConfigFile >> "showMap"; !isNumber _config || {getNumber _config == 1}}; // default value is 1, so do isNumber check first
ACE_isCompassEnabled = call {_config = missionConfigFile >> "showCompass"; !isNumber _config || {getNumber _config == 1}};
ACE_isWatchEnabled = call {_config = missionConfigFile >> "showWatch"; !isNumber _config || {getNumber _config == 1}};
ACE_isRadioEnabled = call {_config = missionConfigFile >> "showRadio"; !isNumber _config || {getNumber _config == 1}};
ACE_isGPSEnabled = call {_config = missionConfigFile >> "showGPS"; !isNumber _config || {getNumber _config == 1}};
GVAR(AssignedItems) = [];
GVAR(AssignedItemsInfo) = [];
GVAR(AssignedItemsShownItems) = [
ACE_isMapEnabled,
ACE_isCompassEnabled,
ACE_isWatchEnabled,
ACE_isRadioEnabled,
ACE_isGPSEnabled
];
["playerInventoryChanged", {
params ["_unit", "_assignedItems"];
_assignedItems = _assignedItems select 17;
GVAR(AssignedItemsShownItems) = [true, true, true, true, true];
{
if !(_x in GVAR(AssignedItems)) then {
GVAR(AssignedItems) pushBack _x;
GVAR(AssignedItemsInfo) pushBack toLower getText (configFile >> "CfgWeapons" >> _x >> "ACE_hideItemType");
};
switch (GVAR(AssignedItemsInfo) select (GVAR(AssignedItems) find _x)) do {
case ("map"): {
GVAR(AssignedItemsShownItems) set [0, false];
};
case ("compass"): {
GVAR(AssignedItemsShownItems) set [1, false];
};
case ("watch"): {
GVAR(AssignedItemsShownItems) set [2, false];
};
case ("radio"): {
GVAR(AssignedItemsShownItems) set [3, false];
};
case ("gps"): {
GVAR(AssignedItemsShownItems) set [4, false];
};
};
false
} count _assignedItems;
//systemChat str GVAR(AssignedItemsShownItems);
GVAR(AssignedItemsShownItems) params ["_showMap", "_showCompass", "_showWatch", "_showRadio", "_showGPS"];
showMap _showMap;
showCompass _showCompass;
showWatch _showWatch;
showRadio _showRadio;
showGPS (_showGPS || {cameraOn == getConnectedUAV _unit}); //If player is activly controling a UAV, showGPS controls showing the map (m key)
}] call FUNC(addEventHandler);

View File

@ -1,23 +1,23 @@
/* /*
* Author: commy2 * Author: commy2
*
* Get a binary equivalent of a decimal number. * Get a binary equivalent of a decimal number.
* *
* Argument: * Arguments:
* 0: Decimal Number (Number) * 0: Decimal Number <NUMBER>
* 1: Minimum length of the returned Array, note: returned array can be larger (Number, optional default 8) * 1: Minimum length of the returned Array, note: returned array can be larger (default: 8) <NUMBER>
* *
* Return value: * Return Value:
* Booleans (Array) * Booleans <ARRAY>
*
* Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_number", "_minLength", "_array", "_index", "_rest"]; params ["_number", ["_minLength", 8]];
_number = round (_this select 0); _number = round _number;
_minLength = _this select 1;
if (isNil "_minLength") then {_minLength = 8}; private ["_array", "_index", "_rest"];
_array = []; _array = [];
_array resize _minLength; _array resize _minLength;
@ -35,4 +35,5 @@ while {_number > 0} do {
_array set [_index, _rest == 1]; _array set [_index, _rest == 1];
_index = _index + 1; _index = _index + 1;
}; };
_array _array

View File

@ -0,0 +1,32 @@
/*
* Author: commy2
* Returns the magazine of the units rangefinder.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* Magazine of the units binocular <STRING>
*
* Example:
* player call ace_common_fnc_binocularMagazine
*
* Public: Yes
*/
#include "script_component.hpp"
params [["_unit", objNull, [objNull]]];
private _binocular = binocular _unit;
scopeName "main";
{
if ((_x select 0) isEqualTo _binocular) then {
// note: if there is no magazine, _x(4,0) will be nil, which skips the breakOut.
(_x select 4 select 0) breakOut "main";
};
false
} count weaponsitems _unit;
""

View File

@ -1,30 +1,34 @@
/** /*
* fn_gui_blurScreen.sqf * Author: Glowbal
* @Descr:
* @Author: Glowbal
* *
* @Arguments: [] * Arguments:
* @Return: * 0: ID <NUMBER>
* @PublicAPI: true * 1: Show? <BOOL, NUMBER>
*
* Return Value:
* None
*
* Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_show"]; if (!hasInterface) exitWith {};
PARAMS_1(_id);
_show = if (count _this > 1) then {_this select 1} else {false}; params ["_id", ["_show", false]];
if (_show isEqualType 0) then {
_show = _show == 1;
};
if (isNil QGVAR(SHOW_BLUR_SCREEN_COLLECTION)) then { if (isNil QGVAR(SHOW_BLUR_SCREEN_COLLECTION)) then {
GVAR(SHOW_BLUR_SCREEN_COLLECTION) = []; GVAR(SHOW_BLUR_SCREEN_COLLECTION) = [];
}; };
if (typeName _show == typeName 0) then {
_show = (_show == 1);
};
if (_show) then { if (_show) then {
GVAR(SHOW_BLUR_SCREEN_COLLECTION) pushback _id; GVAR(SHOW_BLUR_SCREEN_COLLECTION) pushBack _id;
// show blur // show blur
if (isnil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then { if (isNil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then {
GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = ppEffectCreate ["DynamicBlur", 102]; GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = ppEffectCreate ["DynamicBlur", 102];
GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) ppEffectAdjust [0.9]; GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) ppEffectAdjust [0.9];
GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) ppEffectEnable true; GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) ppEffectEnable true;
@ -32,9 +36,10 @@ if (_show) then {
}; };
} else { } else {
GVAR(SHOW_BLUR_SCREEN_COLLECTION) = GVAR(SHOW_BLUR_SCREEN_COLLECTION) - [_id]; GVAR(SHOW_BLUR_SCREEN_COLLECTION) = GVAR(SHOW_BLUR_SCREEN_COLLECTION) - [_id];
if (GVAR(SHOW_BLUR_SCREEN_COLLECTION) isEqualTo []) then { if (GVAR(SHOW_BLUR_SCREEN_COLLECTION) isEqualTo []) then {
// hide blur // hide blur
if (!isnil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then { if (!isNil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then {
ppEffectDestroy GVAR(MENU_ppHandle_GUI_BLUR_SCREEN); ppEffectDestroy GVAR(MENU_ppHandle_GUI_BLUR_SCREEN);
GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = nil; GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = nil;
}; };

View File

@ -1,6 +1,6 @@
/* /*
* Author: esteldunedain and Jaynus * Author: esteldunedain, Jaynus
* Returns the result of the function and caches it up to a given ACE_time or event * Returns the result of the function and caches it up to a given time or event
* *
* Arguments: * Arguments:
* 0: Parameters <ARRAY> * 0: Parameters <ARRAY>
@ -8,7 +8,7 @@
* 2: Namespace to store the cache on <NAMESPACE> * 2: Namespace to store the cache on <NAMESPACE>
* 3: Cache uid <STRING> * 3: Cache uid <STRING>
* 4: Max duration of the cache <NUMBER> * 4: Max duration of the cache <NUMBER>
* 5: Event that clears the cache <STRING> (Optional) * 5: Event that clears the cache (default: nil) <STRING>
* *
* Return Value: * Return Value:
* Result of the function <ANY> * Result of the function <ANY>
@ -17,22 +17,20 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_5(_params,_function,_namespace,_uid,_duration); params ["_params", "_function", "_namespace", "_uid", "_duration", "_event"];
//IGNORE_PRIVATE_WARNING("_eventName"); if ((_namespace getVariable [_uid, [-99999]]) select 0 < ACE_diagTime) then {
if (((_namespace getVariable [_uid, [-99999]]) select 0) < ACE_diagTime) then {
_namespace setVariable [_uid, [ACE_diagTime + _duration, _params call _function]]; _namespace setVariable [_uid, [ACE_diagTime + _duration, _params call _function]];
// Does the cache needs to be cleared on an event? // Does the cache needs to be cleared on an event?
if (count _this > 5) then { if (!isNil "_event") then {
private ["_event","_varName","_cacheList"]; private ["_varName", "_cacheList"];
_event = _this select 5;
_varName = format [QGVAR(clearCache_%1), _event]; _varName = format [QGVAR(clearCache_%1), _event];
_cacheList = missionNamespace getVariable _varName; _cacheList = missionNamespace getVariable _varName;
// If there was no EH to clear these caches, add one // If there was no EH to clear these caches, add one
if (isNil {_cacheList}) then { if (isNil "_cacheList") then {
_cacheList = []; _cacheList = [];
missionNamespace setVariable [_varName, _cacheList]; missionNamespace setVariable [_varName, _cacheList];
@ -40,7 +38,7 @@ if (((_namespace getVariable [_uid, [-99999]]) select 0) < ACE_diagTime) then {
private ["_varName", "_cacheList"]; private ["_varName", "_cacheList"];
// _eventName is defined on the function that calls the event // _eventName is defined on the function that calls the event
#ifdef DEBUG_MODE_FULL #ifdef DEBUG_MODE_FULL
diag_log text format ["ACE: Clear cached variables on event: %1", _eventName]; ACE_LOGINFO_1("Clear cached variables on event: %1",_eventName);
#endif #endif
// Get the list of caches to clear // Get the list of caches to clear
_varName = format [QGVAR(clearCache_%1), _eventName]; _varName = format [QGVAR(clearCache_%1), _eventName];
@ -57,11 +55,13 @@ if (((_namespace getVariable [_uid, [-99999]]) select 0) < ACE_diagTime) then {
// Add this cache to the list of the event // Add this cache to the list of the event
_cacheList pushBack [_namespace, _uid]; _cacheList pushBack [_namespace, _uid];
}; };
#ifdef DEBUG_MODE_FULL #ifdef DEBUG_MODE_FULL
diag_log format ["Calculated result: %1 %2", _namespace, _uid]; ACE_LOGINFO_2("Calculated result: %1 %2",_namespace,_uid);
} else { } else {
diag_log format ["Cached result : %1 %2", _namespace, _uid]; ACE_LOGINFO_2("Cached result: %1 %2",_namespace,_uid);
#endif #endif
}; };
(_namespace getVariable _uid) select 1 (_namespace getVariable _uid) select 1

View File

@ -1,35 +1,28 @@
/* /*
* Author: commy2 * Author: commy2
*
* Is the unit able to enter the vehicle in the given position? * Is the unit able to enter the vehicle in the given position?
* *
* Arguments: * Arguments:
* 0: Unit to enter the vehicle (Object) * 0: Unit to enter the vehicle <OBJECT>
* 1: The vehicle to be entered (Object) * 1: The vehicle to be entered <OBJECT>
* 2: Position. Can be "Driver", "Pilot", "Gunner", "Commander", "Copilot", "Turret", "FFV", "Codriver" or "Cargo" (String) * 2: Position. Can be "Driver", "Pilot", "Gunner", "Commander", "Copilot", "Turret", "FFV", "Codriver" or "Cargo" <STRING>
* 3: Check current distance to vehicles memory point? (Bool, optional default: false) * 3: Check current distance to vehicles memory point? (default: false) <BOOL>
* 4: Index. "Turret", "FFV", "Codriver" and "Cargo" support this optional parameter. Which position should be taken. * 4: Index. "Turret", "FFV", "Codriver" and "Cargo" support this optional parameter. Which position should be taken.
* Note: This index is diffrent from Armas "cargoIndex". (Number, optional default: next free index) * Note: This index is diffrent from Armas "cargoIndex". (default: next free index) <NUMBER>
* *
* Return Value: * Return Value:
* Nothing * None
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
#define CANGETINDRIVER (isNull (driver _vehicle) || {!alive driver _vehicle}) && {!lockedDriver _vehicle} && {getNumber (_config >> "isUav") != 1} #define CANGETINDRIVER (isNull (driver _vehicle) || {!alive driver _vehicle}) && {!lockedDriver _vehicle} && {getNumber (_config >> "isUav") != 1}
#define CANGETINTURRETINDEX (isNull (_vehicle turretUnit _turret) || {!alive (_vehicle turretUnit _turret)}) && {!(_vehicle lockedTurret _turret)} && {getNumber (_config >> "isUav") != 1} #define CANGETINTURRETINDEX (isNull (_vehicle turretUnit _turret) || {!alive (_vehicle turretUnit _turret)}) && {!(_vehicle lockedTurret _turret)} && {getNumber (_config >> "isUav") != 1}
private ["_position", "_checkDistance", "_index"]; params ["_unit", "_vehicle", "_position", ["_checkDistance", false], ["_index", -1]];
_this resize 5; _position = toLower _position;
PARAMS_2(_unit,_vehicle);
_position = toLower (_this select 2);
_checkDistance = _this select 3;
_index = _this select 4; // optional, please don't use
if (isNil "_checkDistance") then {_checkDistance = false};
if (isNil "_index") then {_index = -1};
// general // general
if (!alive _vehicle || {locked _vehicle > 1}) exitWith {false}; if (!alive _vehicle || {locked _vehicle > 1}) exitWith {false};

View File

@ -1,14 +0,0 @@
/**
* fn_canInteract.sqf
* @Descr: Check if unit can interact with enviroment. Unit has to be awake and not be in arrested state.
* @Author: Glowbal
*
* @Arguments: [unit OBJECT]
* @Return: BOOL True if unit can interact with enviroment.
* @PublicAPI: true
*/
#include "script_component.hpp"
PARAMS_1(_unit);
(((_unit getvariable [QGVAR(canInteract),0]) < 1) && ([_unit] call FUNC(isAwake)) && !([_unit] call FUNC(isArrested)))

View File

@ -5,45 +5,33 @@
* Arguments: * Arguments:
* 0: The player. <OBJECT> * 0: The player. <OBJECT>
* 1: The interaction target. objNull to ignore. <OBJECT> * 1: The interaction target. objNull to ignore. <OBJECT>
* 2: Exceptions. What general conditions are to skip? <ARRAY> (Optional) * 2: Exceptions. What general conditions are to skip? (default: []) <ARRAY>
* *
* Return Value: * Return Value:
* Unit can interact? * Unit can interact?
* *
* Public: No * Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_exceptions"]; params ["_unit", "_target", ["_exceptions", []]];
PARAMS_2(_unit,_target);
_exceptions = if (count _this > 2) then {
_this select 2;
} else {
[];
};
_exceptions = [_exceptions, {toLower _this}] call FUNC(map); _exceptions = [_exceptions, {toLower _this}] call FUNC(map);
// exit if the target is not free to interact
private "_owner"; private "_owner";
_owner = _target getVariable [QGVAR(owner), objNull]; _owner = _target getVariable [QGVAR(owner), objNull];
// exit if the target is not free to interact
if (!isNull _owner && {_unit != _owner}) exitWith {false}; if (!isNull _owner && {_unit != _owner}) exitWith {false};
// check general conditions // check general conditions
private ["_conditions", "_canInteract"];
private ["_conditions", "_conditionNames", "_conditionFuncs"];
_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]]; _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
_conditionNames = _conditions select 0; _conditions params ["_conditionNames", "_conditionFuncs"];
_conditionFuncs = _conditions select 1;
private "_canInteract";
_canInteract = true; _canInteract = true;
{ {
if (!(_x in _exceptions) && {!([_unit, _target] call (_conditionFuncs select _forEachIndex))}) exitWith { if (!(_x in _exceptions) && {!([_unit, _target] call (_conditionFuncs select _forEachIndex))}) exitWith {
_canInteract = false; _canInteract = false;

View File

@ -1,14 +1,23 @@
// by commy2 /*
* Author: commy2
* Check if the unit can use a Weapon.
* Returns true if the unit is on foot or in a FFV position.
*
* Arguments:
* 0: The Unit <OBJECT>
*
* Return Value:
* Can the Unit use Weapons <BOOL>
*
* Public: Yes
*/
#include "script_component.hpp" #include "script_component.hpp"
// returns true if the unit is on foot or in a ffv position params ["_unit"];
private ["_config"];
PARAMS_1(_unit);
if (_unit == vehicle _unit) exitWith {true}; if (_unit == vehicle _unit) exitWith {true};
private "_config";
_config = configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit; _config = configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit;
isClass _config isClass _config

View File

@ -1,30 +1,23 @@
/* /*
* Author: commy2 * Author: commy2
*
* Adjust a projectiles velocity and dir + up vector. * Adjust a projectiles velocity and dir + up vector.
* *
* Argument: * Arguments:
* 0: Projectile (Object, CfgAmmo) * 0: Projectile <OBJECT>
* 1: Adjust azimuth this much. (Number) * 1: Adjust azimuth this much. <NUMBER>
* 2: Adjust inclination this much. (Number) * 2: Adjust inclination this much. <NUMBER>
* 3: Adjust projectile speed this much. In m/s. (Number, optional default: 0 m/s) * 3: Adjust projectile speed this much. In m/s. (optional: 0) <NUMBER>
* *
* Return value: * Return Value:
* None. * None
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_adjustSpeed", "_vdir", "_dir", "_up", "_vup", "_vel", "_vlat"]; params ["_projectile", "_adjustDir", "_adjustUp", ["_adjustSpeed",0]];
PARAMS_3(_projectile,_adjustDir,_adjustUp); private ["_vdir", "_dir", "_up", "_vlat", "_vup", "_vel"];
_adjustSpeed = if (count _this > 3) then {
_this select 3
} else {
0
};
["CPD", [_fnc_scriptNameParent, _adjustDir, _adjustUp, _adjustSpeed], nil, false] call FUNC(log);
// get old direction vector // get old direction vector
_vdir = vectorNormalized velocity _projectile; _vdir = vectorNormalized velocity _projectile;

View File

@ -1,13 +1,14 @@
/* /*
* Author: commy2 * Author: commy2
*
* Compares version numbers of PBOs and DLLs. * Compares version numbers of PBOs and DLLs.
* *
* Argument: * Arguments:
* None. * None
* *
* Return value: * Return Value:
* None. * None
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
@ -17,7 +18,7 @@
private "_version"; private "_version";
_version = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr"); _version = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr");
diag_log text format ["[ACE]: ACE is version %1.", _version]; ACE_LOGINFO_1("ACE is version %1.",_version);
private "_addons"; private "_addons";
//_addons = activatedAddons; // broken with High-Command module, see #2134 //_addons = activatedAddons; // broken with High-Command module, see #2134
@ -30,37 +31,45 @@ _addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter);
private "_errorMsg"; private "_errorMsg";
_errorMsg = format ["File %1.pbo is outdated.", _x]; _errorMsg = format ["File %1.pbo is outdated.", _x];
diag_log text format ["[ACE] ERROR: %1", _errorMsg]; ACE_LOGERROR(_errorMsg);
if (hasInterface) then { if (hasInterface) then {
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage); ["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
}; };
}; };
} forEach _addons; false
} count _addons;
/////////////// ///////////////
// check dlls // check dlls
/////////////// ///////////////
{ {
if (_x callExtension "version" == "") then { private "_versionEx";
_versionEx = _x callExtension "version";
if (_versionEx == "") then {
private "_errorMsg"; private "_errorMsg";
_errorMsg = format ["Extension %1.dll not installed.", _x]; _errorMsg = format ["Extension %1.dll not installed.", _x];
diag_log text format ["[ACE] ERROR: %1", _errorMsg]; ACE_LOGERROR(_errorMsg);
if (hasInterface) then { if (hasInterface) then {
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage); ["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
}; };
} else { } else {
// Print the current extension version // Print the current extension version
diag_log text format ["[ACE] Extension version: %1: %2", _x, (_x callExtension "version")]; ACE_LOGINFO_2("Extension version: %1: %2",_x,_versionEx);
}; };
} forEach getArray (configFile >> "ACE_Extensions" >> "extensions"); false
} count getArray (configFile >> "ACE_Extensions" >> "extensions");
/////////////// ///////////////
// check server version/addons // check server version/addons
/////////////// ///////////////
if (isMultiplayer) then { if (isMultiplayer) then {
// don't check optional addons
_addons = [_addons, {getNumber (configFile >> "CfgPatches" >> _this >> "ACE_isOptional") != 1}] call FUNC(filter);
if (isServer) then { if (isServer) then {
// send servers version of ACE to all clients // send servers version of ACE to all clients
GVAR(ServerVersion) = _version; GVAR(ServerVersion) = _version;
@ -72,15 +81,13 @@ if (isMultiplayer) then {
[{ [{
if (isNil QGVAR(ServerVersion) || isNil QGVAR(ServerAddons)) exitWith {}; if (isNil QGVAR(ServerVersion) || isNil QGVAR(ServerAddons)) exitWith {};
private ["_version","_addons"]; (_this select 0) params ["_version", "_addons"];
_version = (_this select 0) select 0;
_addons = (_this select 0) select 1;
if (_version != GVAR(ServerVersion)) then { if (_version != GVAR(ServerVersion)) then {
private "_errorMsg"; private "_errorMsg";
_errorMsg = format ["Client/Server Version Mismatch. Server: %1, Client: %2.", GVAR(ServerVersion), _version]; _errorMsg = format ["Client/Server Version Mismatch. Server: %1, Client: %2.", GVAR(ServerVersion), _version];
diag_log text format ["[ACE] ERROR: %1", _errorMsg]; ACE_LOGERROR(_errorMsg);
if (hasInterface) then { if (hasInterface) then {
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage); ["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
@ -91,7 +98,7 @@ if (isMultiplayer) then {
if !(_addons isEqualTo []) then { if !(_addons isEqualTo []) then {
_errorMsg = format ["Client/Server Addon Mismatch. Client has extra addons: %1.",_addons]; _errorMsg = format ["Client/Server Addon Mismatch. Client has extra addons: %1.",_addons];
diag_log text format ["[ACE] ERROR: %1", _errorMsg]; ACE_LOGERROR(_errorMsg);
if (hasInterface) then { if (hasInterface) then {
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage); ["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);

Some files were not shown because too many files have changed in this diff Show More