Merge branch 'master' of https://github.com/acemod/ACE3 into interactions_lamps

Conflicts:
	addons/cargo/CfgVehicles.hpp
	addons/interaction/CfgVehicles.hpp
	addons/interaction/XEH_preInit.sqf
	addons/interaction/stringtable.xml
This commit is contained in:
SzwedzikPL
2015-10-15 11:49:08 +02:00
1267 changed files with 20743 additions and 21206 deletions

View File

@ -1,14 +1,30 @@
branches: branches:
only: only:
- master - master
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:
secure: aWYF/YX7vxEdXJ5w1jhYJQ2TtTP2NRdnXzJDMYXTv2dlXYhO9qp2qjxDGW3dezuPY7B1mPBgebfSKRx3Robkt1rAfEwPWivOiEztL30rwzOy+5Q1wpORv1JkvTC/q2wqQzxQCU/FPVjD2GkF1wtq1Rnx3ESWD8gbvzYoMNdIw1g=
on_success: change
on_failure: always
on_start: never
rooms:
secure: MvxmqL1NGwiGTVv6uIVTM7jeNLQH95KYtTgSWlXaSw4jdjnf4cmrb/ofHQ3FHhhNVdhRN6W8n0cJfTC3DBZ90bionVh+528qw2mDnDbKljVdIwmoFSexBcH7H1uTLF3gsEz0tbrHtLcnAyTMxdjsdIXDLZ5hwxABNmW5/03jOgs=
email:
on_success: never
on_failure: change

View File

@ -1,4 +1,4 @@
# ACE 3 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
# #
@ -14,6 +14,7 @@ Garth "L-H" de Wet <garthofhearts@gmail.com>
Giallustio Giallustio
Glowbal Glowbal
Janus Janus
jokoho482 <jokoho482@gmail.com>`
Kieran Kieran
NouberNou NouberNou
PabstMirror <pabstmirror@gmail.com> PabstMirror <pabstmirror@gmail.com>
@ -50,6 +51,8 @@ Coren <coren4@gmail.com>
Crusty 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>
Dudakov <dudakov.s@gmail.com>
eRazeri eRazeri
evromalarkey <evromalarkey@gmail.com> evromalarkey <evromalarkey@gmail.com>
F3 Project <alanr@ferstaberinde.com> F3 Project <alanr@ferstaberinde.com>
@ -68,8 +71,7 @@ Hamburger SV
Harakhti <shadowdragonphd@gmail.com> Harakhti <shadowdragonphd@gmail.com>
havena <silveredenis@gmail.com> havena <silveredenis@gmail.com>
Hawkins Hawkins
Head Head <brobergsebastian@gmail.com>
jokoho482 <jokoho482@gmail.com>`
Jonpas <jonpas33@gmail.com> Jonpas <jonpas33@gmail.com>
Karneck <dschultz26@hotmail.com> Karneck <dschultz26@hotmail.com>
Kavinsky <nmunozfernandez@gmail.com> Kavinsky <nmunozfernandez@gmail.com>
@ -81,6 +83,7 @@ Macusercom <macusercom@gmail.com>
MarcBook MarcBook
meat <p.humberdroz@gmail.com> meat <p.humberdroz@gmail.com>
Michail Nikolaev Michail Nikolaev
MikeMatrix <m.braun92@gmail.com>
nic547 <nic547@outlook.com> nic547 <nic547@outlook.com>
nikolauska <nikolauska1@gmail.com> nikolauska <nikolauska1@gmail.com>
nomisum <nomisum@gmail.com> nomisum <nomisum@gmail.com>
@ -106,5 +109,3 @@ Valentin Torikian <valentin.torikian@gmail.com>
VyMajoris(W-Cephei)<vycanismajoriscsa@gmail.com> VyMajoris(W-Cephei)<vycanismajoriscsa@gmail.com>
Winter <simon@agius-muscat.net> Winter <simon@agius-muscat.net>
zGuba zGuba
Drill <drill87@gmail.com>
MikeMatrix <m.braun92@gmail.com>

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 <a href="{{ site.githubUrl }}/issues" target="_blank">ACE3 GitHub issue tracker</a> and press the <a href="{{ site.githubUrl }}/issues/new" target="_blank">"New issue"</a> 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 <a href="http://daringfireball.net/projects/markdown/syntax" target="_blank">"Markdown"</a> to style the output. If you want to know more about it (e.g. how to <a href="https://help.github.com/articles/markdown-basics/#styling-text" target="_blank">turn text bold</a>, how to denote <a href="https://help.github.com/articles/markdown-basics/#inline-formats" target="_blank">code blocks</a> or <a href="https://help.github.com/articles/markdown-basics/#multiple-lines" target="_blank">inline code</a>) have a look at the <a href="https://help.github.com/articles/github-flavored-markdown/" target="_blank">GitHub markdown documentation</a>.
# 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 <a href="{{ site.githubUrl }}/issues/414/" target="_blank">ACE 3 Feature requests</a>. 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

@ -3,75 +3,82 @@
</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.2.1-blue.svg" alt="ACE3 version"> <img src="https://img.shields.io/badge/Version-3.3.2-blue.svg" alt="ACE3 Version">
</a> </a>
<a href="https://github.com/acemod/ACE3/releases/download/v3.2.1/ace3_3.2.1.zip"> <a href="https://github.com/acemod/ACE3/releases/download/v3.3.2/ace3_3.3.2.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-65.7_MB-green.svg" 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?label=Issues" alt="ACE3 Issues">
</a> </a>
<a href="http://forums.bistudio.com/showthread.php?191716-ACE3-A-collaborative-merger-between-AGM-CSE-and-ACE&p=2935435&viewfull=1#post2935435"> <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" 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" alt="ACE3 License">
</a>
<a href="http://slackin.ace3mod.com/">
<img src="http://slackin.ace3mod.com/badge.svg" alt="ACE3 Slack">
</a>
<a href="https://travis-ci.org/acemod/ACE3">
<img src="https://img.shields.io/travis/acemod/ACE3.svg" alt="ACE3 Build Status">
</a> </a>
</p> </p>
<p align="center"><sup><strong>Requires the latest version of <a href="http://www.armaholic.com/page.php?id=18767">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>. 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>
**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.
The project is entirely **open-source** and all contributions are welcome. Feel free to maintain your own custom version, so long as the changes you make are open to the public in accordance with the GNU General Public License ([GPLv2](https://github.com/acemod/ACE3/blob/master/LICENSE)). The project is entirely **open-source** and all contributions are welcome. Feel free to maintain your own custom version, so long as the changes you make are open to the public in accordance with the GNU General Public License ([GPLv2](https://github.com/acemod/ACE3/blob/master/LICENSE)).
The mod is **built modularly**, so almost any included PBO can be easily removed from the configuration. This way, a team can maintain its own tailored version of ACE by simply excluding any components they don't need, or those possibly in conflict with other add-ons. Modules themselves, e.g. the medical system, also include various customization options, allowing mission designers to tweak the overall experience. The mod is **built modularly**, so almost any included PBO can be easily removed from the configuration. This way, a team can maintain its own tailored version of ACE3 by simply excluding any components they don't need, or those possibly in conflict with other mods. Modules themselves, e.g. the medical system, also include various customization options, allowing mission designers to tweak the overall experience.
### Core features ### Core features
* Brand new 3D interaction/action system - Brand new 3D interaction/action system
* Performance and reliability framework - Performance and reliability framework
* Focus on modularity and customization - Focus on modularity and customization
* New flexible client and server settings & configuration - New flexible client and server settings & configuration
* Improved medical system with various levels (basic/advanced) focus on gameplay/realism - Improved medical system with various levels (basic/advanced) focus on gameplay/realism
* Proper & consistent network-synced weather - Proper & consistent network-synced weather
* Wind and weather-based ballistics - Wind and weather-based ballistics
* 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
* Advanced missile guidance and laser designation - Advanced missile guidance and laser designation
#### Additional features #### Additional features
* Carrying and dragging - Carrying and dragging
* Realistic names for vehicles and weapons - Realistic names for vehicles and weapons
* A fire control system (FCS) for armored vehicles and helicopters - A fire control system (FCS) for armored vehicles and helicopters
* Realistic ballistics/FCS calculated in C/C++ extensions - Realistic ballistics/FCS calculated in C/C++ extensions
* Backblast area and overpressure simulation - Backblast area and overpressure simulation
* Disposable launchers - Disposable launchers
* Realistic G-forces - Realistic G-forces
* Vehicle locking - Vehicle locking
* Realistic night and thermal vision modes - Realistic night and thermal vision modes
* Magazine repacking - Magazine repacking
* Realistic weapon overheating mechanic - Realistic weapon overheating mechanic
* Combat deafness (temporary loss of hearing) simulation - Combat deafness (temporary loss of hearing) simulation
* Improved ragdoll physics - Improved ragdoll physics
* Improved interactions for AARs and ammo bearers - Improved interactions for AARs and ammo bearers
* Adjustable sniper scopes - Adjustable sniper scopes
* No idle animation with lowered weapon - No idle animation with lowered weapon
* No talking player avatar - No talking player avatar
* Jumping over obstacles, climbing over walls and cutting down fences - Jumping over obstacles, climbing over walls and cutting down fences
* Vector, MicroDAGR and Kestrel devices<br> - Vector, MicroDAGR and Kestrel devices<br>
***and much more...*** ***and much more...***
### 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 ACE, 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.
Please, use our [Issue Tracker](https://github.com/acemod/ACE3/issues) to report a bug, propose a feature, or suggest changes to the existing ones. See also: Please, use our [Issue Tracker](https://github.com/acemod/ACE3/issues) to report a bug, propose a feature, or suggest changes to the existing ones. See also:
* [How to report an issue](http://ace3mod.com/wiki/user/how-to-report-an-issue.html) - [How to report an issue](http://ace3mod.com/wiki/user/how-to-report-an-issue.html)
* [How to make a feature request](http://ace3mod.com/wiki/user/how-to-make-a-feature-request.html) - [How to make a feature request](http://ace3mod.com/wiki/user/how-to-make-a-feature-request.html)
#### Testing & building #### Testing & building
To help us test the latest development changes, download our master branch ([directly](https://github.com/acemod/ACE3/archive/master.zip), or [with git](https://help.github.com/articles/fetching-a-remote/)), then assemble a test build: To help us test the latest development changes, download our master branch ([directly](https://github.com/acemod/ACE3/archive/master.zip), or [with git](https://help.github.com/articles/fetching-a-remote/)), then assemble a test build:
* [Setting up the development environment](http://ace3mod.com/wiki/development/setting-up-the-development-environment.html) step-by-step instructions on how to properly setup and build a version of ACE for testing purposes. - [Setting up the development environment](http://ace3mod.com/wiki/development/setting-up-the-development-environment.html) step-by-step instructions on how to properly setup and build a version of ACE3 for testing purposes.

Binary file not shown.

View File

@ -6,9 +6,8 @@ GVAR(currentbulletID) = -1;
GVAR(Protractor) = false; GVAR(Protractor) = false;
GVAR(ProtractorStart) = ACE_time; GVAR(ProtractorStart) = ACE_time;
GVAR(allBullets) = [];
GVAR(currentGrid) = 0; GVAR(currentGrid) = 0;
GVAR(initMessageEnabled) = false;
GVAR(extensionAvailable) = true; GVAR(extensionAvailable) = true;
/* @TODO: Remove this until versioning is in sync with cmake/build versioning /* @TODO: Remove this until versioning is in sync with cmake/build versioning

View File

@ -13,5 +13,5 @@ PREP(initializeTerrainExtension);
PREP(initModuleSettings); PREP(initModuleSettings);
PREP(readAmmoDataFromConfig); PREP(readAmmoDataFromConfig);
PREP(readWeaponDataFromConfig); PREP(readWeaponDataFromConfig);
PREP(handleFirePFH);
ADDON = true; ADDON = true;

View File

@ -8,29 +8,29 @@
* 1: temperature - degrees celcius <NUMBER> * 1: temperature - degrees celcius <NUMBER>
* *
* Return Value: * Return Value:
* 0: muzzle velocity shift - m/s <NUMBER> * muzzle velocity shift - m/s <NUMBER>
* *
* Return value: * Public: No
* None
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_muzzleVelocityShiftTable", "_temperature", "_muzzleVelocityShift", "_temperatureIndexA", "_temperatureIndexB", "_temperatureRatio"]; private ["_muzzleVelocityShiftTableUpperLimit", "_temperatureIndexFunction",
_muzzleVelocityShiftTable = _this select 0; "_temperatureIndexA", "_temperatureIndexB", "_interpolationRatio"];
_temperature = _this select 1; params["_muzzleVelocityShiftTable", "_temperature"];
if (count _muzzleVelocityShiftTable != 11) exitWith { 0 }; // Check if muzzleVelocityShiftTable is Larger Than 11 Entrys
_muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10;
if (isNil "_muzzleVelocityShiftTableUpperLimit") exitWith { 0 };
_temperatureIndexA = floor((_temperature + 15) / 5); // Find exact data index required for given temperature
_temperatureIndexA = 0 max _temperatureIndexA; _temperatureIndexFunction = (_temperature + 15) / 5;
_temperatureIndexA = _temperatureIndexA min 10;
_temperatureIndexB = ceil((_temperature + 15) / 5); // lower and upper data index used for interpolation
_temperatureIndexB = 0 max _temperatureIndexB; _temperatureIndexA = (0 max (floor(_temperatureIndexFunction))) min 10;
_temperatureIndexB = _temperatureIndexB min 10; _temperatureIndexB = (0 max (ceil(_temperatureIndexFunction))) min 10;
_temperatureRatio = ((_temperature + 15) / 5) - floor((_temperature + 15) / 5); // Interpolation ratio
_interpolationRatio = _temperatureIndexFunction - floor(_temperatureIndexFunction);
_muzzleVelocityShift = (_muzzleVelocityShiftTable select _temperatureIndexA) * (1 - _temperatureRatio) + (_muzzleVelocityShiftTable select _temperatureIndexB) * _temperatureRatio; // Interpolation
(_muzzleVelocityShiftTable select _temperatureIndexA) * (1 - _interpolationRatio) + (_muzzleVelocityShiftTable select _temperatureIndexB) * _interpolationRatio // Return
_muzzleVelocityShift

View File

@ -17,12 +17,9 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_ballisticCoefficient", "_temperature", "_pressure", "_relativeHumidity", "_atmosphereModel", "_airDensity"]; private "_airDensity";
_ballisticCoefficient = _this select 0;
_temperature = _this select 1; // in C params ["_ballisticCoefficient", "_temperature"/*in C*/, "_pressure"/*in hPa*/, "_relativeHumidity"/*as ratio 0-1*/, "_atmosphereModel"/*"ICAO" or "ASM"*/];
_pressure = _this select 2; // in hPa
_relativeHumidity = _this select 3; // as ratio 0-1
_atmosphereModel = _this select 4; // "ICAO" or "ASM"
_airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity); _airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity);

View File

@ -1,5 +1,5 @@
/* /*
* Author: Ruthberg * Author: Ruthberg, MikeMatrix, joko // Jonas
* *
* Calculates the muzzle velocity shift caused by different barrel lengths * Calculates the muzzle velocity shift caused by different barrel lengths
* *
@ -10,46 +10,61 @@
* 3: muzzle velocity - m/s <NUMBER> * 3: muzzle velocity - m/s <NUMBER>
* *
* Return Value: * Return Value:
* 0: muzzle velocity shift - m/s <NUMBER> * muzzle velocity shift - m/s <NUMBER>
* *
* Return value: * Public: No
* None
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_barrelLength", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocity", "_lowerIndex", "_upperIndex", "_barrelLengthRatio", "_muzzleVelocityNew"]; scopeName "main";
_barrelLength = _this select 0;
_muzzleVelocityTable = _this select 1;
_barrelLengthTable = _this select 2;
_muzzleVelocity = _this select 3;
private ["_muzzleVelocityTableCount", "_barrelLengthTableCount", "_lowerDataIndex",
"_upperDataIndex", "_lowerBarrelLength", "_upperBarrelLength", "_lowerMuzzleVelocity",
"_upperMuzzleVelocity", "_interpolationRatio"];
params ["_barrelLength", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocity"];
// If barrel length is not defined, then there is no point in calculating muzzle velocity
if (_barrelLength == 0) exitWith { 0 }; if (_barrelLength == 0) exitWith { 0 };
if (count _muzzleVelocityTable != count _barrelLengthTable) exitWith { 0 };
if (count _muzzleVelocityTable == 0 || count _barrelLengthTable == 0) exitWith { 0 };
if (count _muzzleVelocityTable == 1) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity };
_lowerIndex = 0; _muzzleVelocityTableCount = count _muzzleVelocityTable;
_upperIndex = (count _barrelLengthTable) - 1; _barrelLengthTableCount = count _barrelLengthTable;
if (_barrelLength <= (_barrelLengthTable select _lowerIndex)) exitWith { (_muzzleVelocityTable select _lowerIndex) - _muzzleVelocity }; // Exit if tables are different sizes, have no elements or have only one element
if (_barrelLength >= (_barrelLengthTable select _upperIndex)) exitWith { (_muzzleVelocityTable select _upperIndex) - _muzzleVelocity }; if (_muzzleVelocityTableCount != _barrelLengthTableCount || _muzzleVelocityTableCount == 0 || _barrelLengthTableCount == 0) exitWith { 0 };
if (_muzzleVelocityTableCount == 1) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity };
for "_i" from 0 to (count _barrelLengthTable) - 1 do { // If we have the precise barrel length value, return result immediately
if (_barrelLength >= _barrelLengthTable select _i) then { if (_barrelLength in _barrelLengthTable) exitWith {
_lowerIndex = _i; (_muzzleVelocityTable select (_barrelLengthTable find _barrelLength)) - _muzzleVelocity
}; };
};
for "_i" from (count _barrelLengthTable) - 1 to 0 step -1 do { // Limit values to lower and upper bound of data we have available
if (_barrelLength <= _barrelLengthTable select _i) then { if (_barrelLength <= (_barrelLengthTable select 0)) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity };
_upperIndex = _i; if (_barrelLength >= (_barrelLengthTable select _barrelLengthTableCount - 1)) exitWith { (_muzzleVelocityTable select _barrelLengthTableCount - 1) - _muzzleVelocity };
// Find closest bordering values for barrel length
{
if (_barrelLength <= _x) then {
_upperDataIndex = _forEachIndex;
_lowerDataIndex = _upperDataIndex - 1;
breakTo "main";
}; };
} forEach _barrelLengthTable;
// Worst case scenario
if (isNil "_lowerDataIndex" || isNil "_upperDataIndex") exitWith {0};
_lowerBarrelLength = _barrelLengthTable select _lowerDataIndex;
_upperBarrelLength = _barrelLengthTable select _upperDataIndex;
_lowerMuzzleVelocity = _muzzleVelocityTable select _lowerDataIndex;
_upperMuzzleVelocity = _muzzleVelocityTable select _upperDataIndex;
// Calculate interpolation ratio
_interpolationRatio = if (abs (_lowerBarrelLength - _upperBarrelLength) > 0) then {
(_upperBarrelLength - _barrelLength) / (_upperBarrelLength - _lowerBarrelLength)
} else {
0
}; };
_barrelLengthRatio = 0; // Calculate interpolated muzzle velocity shift
if ((_barrelLengthTable select _upperIndex) - (_barrelLengthTable select _lowerIndex) > 0) then { (_lowerMuzzleVelocity + ((_upperMuzzleVelocity - _lowerMuzzleVelocity) * (1 - _interpolationRatio))) - _muzzleVelocity // Return
_barrelLengthRatio = ((_barrelLengthTable select _upperIndex) - _barrelLength) / ((_barrelLengthTable select _upperIndex) - (_barrelLengthTable select _lowerIndex));
};
_muzzleVelocityNew = (_muzzleVelocityTable select _lowerIndex) + ((_muzzleVelocityTable select _upperIndex) - (_muzzleVelocityTable select _lowerIndex)) * (1 - _barrelLengthRatio);
_muzzleVelocityNew - _muzzleVelocity

View File

@ -4,142 +4,129 @@
* Calculates the retardation of the bullet * Calculates the retardation of the bullet
* *
* Arguments: * Arguments:
* 0: drag model - 1-7 <integer> * 0: drag model - integer 1-7 <NUMBER>
* 1: drag coefficient - bc <NUMBER> * 1: drag coefficient - bc <NUMBER>
* 2: velocity - m/s <NUMBER> * 2: velocity - m/s <NUMBER>
* *
* Return Value: * Return Value:
* 0: retardation - m/(s^2) <NUMBER> * retardation - m/(s^2) <NUMBER>
* *
* Return value: * Public: No
* None
*/ */
#include "script_component.hpp" #include "script_component.hpp"
// Source: GNU Exterior Ballistics // Source: GNU Exterior Ballistics
private ["_dragModel", "_dragCoefficient", "_velocity", "_A", "_M", "_result"]; private ["_A", "_M"];
_dragModel = _this select 0; params ["_dragModel", "_dragCoefficient", "_velocity"];
_dragCoefficient = _this select 1; _velocity = _velocity * 3.2808399;
_velocity = (_this select 2) * 3.2808399;
_A = -1;
_M = -1;
_result = 0;
switch _dragModel do { switch _dragModel do {
case 1: case 1: {
{ call {
switch true do { if (_velocity > 4230) exitWith { _A = 0.0001477404177730177; _M = 1.9565; };
case (_velocity > 4230) : { _A = 0.0001477404177730177; _M = 1.9565; }; if (_velocity > 3680) exitWith { _A = 0.0001920339268755614; _M = 1.925; };
case (_velocity > 3680) : { _A = 0.0001920339268755614; _M = 1.925 ; }; if (_velocity > 3450) exitWith { _A = 0.0002894751026819746; _M = 1.875; };
case (_velocity > 3450) : { _A = 0.0002894751026819746; _M = 1.875 ; }; if (_velocity > 3295) exitWith { _A = 0.0004349905111115636; _M = 1.825; };
case (_velocity > 3295) : { _A = 0.0004349905111115636; _M = 1.825 ; }; if (_velocity > 3130) exitWith { _A = 0.0006520421871892662; _M = 1.775; };
case (_velocity > 3130) : { _A = 0.0006520421871892662; _M = 1.775 ; }; if (_velocity > 2960) exitWith { _A = 0.0009748073694078696; _M = 1.725; };
case (_velocity > 2960) : { _A = 0.0009748073694078696; _M = 1.725 ; }; if (_velocity > 2830) exitWith { _A = 0.001453721560187286; _M = 1.675; };
case (_velocity > 2830) : { _A = 0.001453721560187286; _M = 1.675 ; }; if (_velocity > 2680) exitWith { _A = 0.002162887202930376; _M = 1.625; };
case (_velocity > 2680) : { _A = 0.002162887202930376; _M = 1.625 ; }; if (_velocity > 2460) exitWith { _A = 0.003209559783129881; _M = 1.575; };
case (_velocity > 2460) : { _A = 0.003209559783129881; _M = 1.575 ; }; if (_velocity > 2225) exitWith { _A = 0.003904368218691249; _M = 1.55; };
case (_velocity > 2225) : { _A = 0.003904368218691249; _M = 1.55 ; }; if (_velocity > 2015) exitWith { _A = 0.003222942271262336; _M = 1.575; };
case (_velocity > 2015) : { _A = 0.003222942271262336; _M = 1.575 ; }; if (_velocity > 1890) exitWith { _A = 0.002203329542297809; _M = 1.625; };
case (_velocity > 1890) : { _A = 0.002203329542297809; _M = 1.625 ; }; if (_velocity > 1810) exitWith { _A = 0.001511001028891904; _M = 1.675; };
case (_velocity > 1810) : { _A = 0.001511001028891904; _M = 1.675 ; }; if (_velocity > 1730) exitWith { _A = 0.0008609957592468259; _M = 1.75; };
case (_velocity > 1730) : { _A = 0.0008609957592468259; _M = 1.75 ; }; if (_velocity > 1595) exitWith { _A = 0.0004086146797305117; _M = 1.85; };
case (_velocity > 1595) : { _A = 0.0004086146797305117; _M = 1.85 ; }; if (_velocity > 1520) exitWith { _A = 0.0001954473210037398; _M = 1.95; };
case (_velocity > 1520) : { _A = 0.0001954473210037398; _M = 1.95 ; }; if (_velocity > 1420) exitWith { _A = 0.00005431896266462351; _M = 2.125; };
case (_velocity > 1420) : { _A = 0.00005431896266462351; _M = 2.125 ; }; if (_velocity > 1360) exitWith { _A = 0.000008847742581674416; _M = 2.375; };
case (_velocity > 1360) : { _A = 0.000008847742581674416; _M = 2.375 ; }; if (_velocity > 1315) exitWith { _A = 0.000001456922328720298; _M = 2.625; };
case (_velocity > 1315) : { _A = 0.000001456922328720298; _M = 2.625 ; }; if (_velocity > 1280) exitWith { _A = 0.0000002419485191895565; _M = 2.875; };
case (_velocity > 1280) : { _A = 0.0000002419485191895565; _M = 2.875 ; }; if (_velocity > 1220) exitWith { _A = 0.00000001657956321067612; _M = 3.25; };
case (_velocity > 1220) : { _A = 0.00000001657956321067612; _M = 3.25 ; }; if (_velocity > 1185) exitWith { _A = 0.0000000004745469537157371; _M = 3.75; };
case (_velocity > 1185) : { _A = 0.0000000004745469537157371; _M = 3.75 ; }; if (_velocity > 1150) exitWith { _A = 0.00000000001379746590025088; _M = 4.25; };
case (_velocity > 1150) : { _A = 0.00000000001379746590025088; _M = 4.25 ; }; if (_velocity > 1100) exitWith { _A = 0.0000000000004070157961147882; _M = 4.75; };
case (_velocity > 1100) : { _A = 0.0000000000004070157961147882; _M = 4.75 ; }; if (_velocity > 1060) exitWith { _A = 0.00000000000002938236954847331; _M = 5.125; };
case (_velocity > 1060) : { _A = 0.00000000000002938236954847331; _M = 5.125 ; }; if (_velocity > 1025) exitWith { _A = 0.00000000000001228597370774746; _M = 5.25; };
case (_velocity > 1025) : { _A = 0.00000000000001228597370774746; _M = 5.25 ; }; if (_velocity > 980) exitWith { _A = 0.00000000000002916938264100495; _M = 5.125; };
case (_velocity > 980) : { _A = 0.00000000000002916938264100495; _M = 5.125 ; }; if (_velocity > 945) exitWith { _A = 0.0000000000003855099424807451; _M = 4.75; };
case (_velocity > 945) : { _A = 0.0000000000003855099424807451; _M = 4.75 ; }; if (_velocity > 905) exitWith { _A = 0.00000000001185097045689854; _M = 4.25; };
case (_velocity > 905) : { _A = 0.00000000001185097045689854; _M = 4.25 ; }; if (_velocity > 860) exitWith { _A = 0.0000000003566129470974951; _M = 3.75; };
case (_velocity > 860) : { _A = 0.0000000003566129470974951; _M = 3.75 ; }; if (_velocity > 810) exitWith { _A = 0.00000001045513263966272; _M = 3.25; };
case (_velocity > 810) : { _A = 0.00000001045513263966272; _M = 3.25 ; }; if (_velocity > 780) exitWith { _A = 0.0000001291159200846216; _M = 2.875; };
case (_velocity > 780) : { _A = 0.0000001291159200846216; _M = 2.875 ; }; if (_velocity > 750) exitWith { _A = 0.0000006824429329105383; _M = 2.625; };
case (_velocity > 750) : { _A = 0.0000006824429329105383; _M = 2.625 ; }; if (_velocity > 700) exitWith { _A = 0.000003569169672385163; _M = 2.375; };
case (_velocity > 700) : { _A = 0.000003569169672385163; _M = 2.375 ; }; if (_velocity > 640) exitWith { _A = 0.00001839015095899579; _M = 2.125; };
case (_velocity > 640) : { _A = 0.00001839015095899579; _M = 2.125 ; }; if (_velocity > 600) exitWith { _A = 0.00005711174688734240; _M = 1.950; };
case (_velocity > 600) : { _A = 0.00005711174688734240; _M = 1.950 ; }; if (_velocity > 550) exitWith { _A = 0.00009226557091973427; _M = 1.875; };
case (_velocity > 550) : { _A = 0.00009226557091973427; _M = 1.875 ; }; if (_velocity > 250) exitWith { _A = 0.00009337991957131389; _M = 1.875; };
case (_velocity > 250) : { _A = 0.00009337991957131389; _M = 1.875 ; }; if (_velocity > 100) exitWith { _A = 0.00007225247327590413; _M = 1.925; };
case (_velocity > 100) : { _A = 0.00007225247327590413; _M = 1.925 ; }; if (_velocity > 65) exitWith { _A = 0.00005792684957074546; _M = 1.975; };
case (_velocity > 65) : { _A = 0.00005792684957074546; _M = 1.975 ; }; if (_velocity > 0) exitWith { _A = 0.00005206214107320588; _M = 2.000; };
case (_velocity > 0) : { _A = 0.00005206214107320588; _M = 2.000 ; };
}; };
}; };
case 2: case 2: {
{ call {
switch true do { if (_velocity > 1674) exitWith { _A = 0.0079470052136733; _M = 1.36999902851493; };
case (_velocity > 1674) : { _A = 0.0079470052136733; _M = 1.36999902851493; }; if (_velocity > 1172) exitWith { _A = 0.00100419763721974; _M = 1.65392237010294; };
case (_velocity > 1172) : { _A = 0.00100419763721974; _M = 1.65392237010294; }; if (_velocity > 1060) exitWith { _A = 0.0000000000000000000000715571228255369; _M = 7.91913562392361; };
case (_velocity > 1060) : { _A = 0.0000000000000000000000715571228255369; _M = 7.91913562392361; }; if (_velocity > 949) exitWith { _A = 0.000000000139589807205091; _M = 3.81439537623717; };
case (_velocity > 949) : { _A = 0.000000000139589807205091; _M = 3.81439537623717; }; if (_velocity > 670) exitWith { _A = 0.000234364342818625; _M = 1.71869536324748; };
case (_velocity > 670) : { _A = 0.000234364342818625; _M = 1.71869536324748; }; if (_velocity > 335) exitWith { _A = 0.000177962438921838; _M = 1.76877550388679; };
case (_velocity > 335) : { _A = 0.000177962438921838; _M = 1.76877550388679; }; if (_velocity > 0) exitWith { _A = 0.0000518033561289704; _M = 1.98160270524632; };
case (_velocity > 0) : { _A = 0.0000518033561289704; _M = 1.98160270524632; };
}; };
}; };
case 5: case 5: {
{ call {
switch true do { if (_velocity > 1730) exitWith { _A = 0.00724854775171929; _M = 1.41538574492812; };
case (_velocity > 1730) : { _A = 0.00724854775171929; _M = 1.41538574492812; }; if (_velocity > 1228) exitWith { _A = 0.0000350563361516117; _M = 2.13077307854948; };
case (_velocity > 1228) : { _A = 0.0000350563361516117; _M = 2.13077307854948; }; if (_velocity > 1116) exitWith { _A = 0.000000000000184029481181151; _M = 4.81927320350395; };
case (_velocity > 1116) : { _A = 0.000000000000184029481181151; _M = 4.81927320350395; }; if (_velocity > 1004) exitWith { _A = 0.000000000000000000000134713064017409; _M = 7.8100555281422; };
case (_velocity > 1004) : { _A = 0.000000000000000000000134713064017409; _M = 7.8100555281422 ; }; if (_velocity > 837) exitWith { _A = 0.000000103965974081168; _M = 2.84204791809926; };
case (_velocity > 837) : { _A = 0.000000103965974081168; _M = 2.84204791809926; }; if (_velocity > 335) exitWith { _A = 0.0001093015938698234; _M = 1.81096361579504; };
case (_velocity > 335) : { _A = 0.0001093015938698234; _M = 1.81096361579504; }; if (_velocity > 0) exitWith { _A = 0.0000351963178524273; _M = 2.00477856801111; };
case (_velocity > 0) : { _A = 0.0000351963178524273; _M = 2.00477856801111; };
}; };
}; };
case 6: case 6: {
{ call {
switch true do { if (_velocity > 3236) exitWith { _A = 0.0455384883480781; _M = 1.15997674041274; };
case (_velocity > 3236) : { _A = 0.0455384883480781; _M = 1.15997674041274; }; if (_velocity > 2065) exitWith { _A = 0.07167261849653769; _M = 1.10704436538885; };
case (_velocity > 2065) : { _A = 0.07167261849653769; _M = 1.10704436538885; }; if (_velocity > 1311) exitWith { _A = 0.00166676386084348; _M = 1.60085100195952; };
case (_velocity > 1311) : { _A = 0.00166676386084348; _M = 1.60085100195952; }; if (_velocity > 1144) exitWith { _A = 0.000000101482730119215; _M = 2.9569674731838; };
case (_velocity > 1144) : { _A = 0.000000101482730119215; _M = 2.9569674731838 ; }; if (_velocity > 1004) exitWith { _A = 0.00000000000000000431542773103552; _M = 6.34106317069757; };
case (_velocity > 1004) : { _A = 0.00000000000000000431542773103552; _M = 6.34106317069757; }; if (_velocity > 670) exitWith { _A = 0.0000204835650496866; _M = 2.11688446325998; };
case (_velocity > 670) : { _A = 0.0000204835650496866; _M = 2.11688446325998; }; if (_velocity > 0) exitWith { _A = 0.0000750912466084823; _M = 1.92031057847052; };
case (_velocity > 0) : { _A = 0.0000750912466084823; _M = 1.92031057847052; };
}; };
}; };
case 7: case 7: {
{ call {
switch true do { if (_velocity > 4200) exitWith { _A = 0.00000000129081656775919; _M = 3.24121295355962; };
case (_velocity > 4200) : { _A = 0.00000000129081656775919; _M = 3.24121295355962; }; if (_velocity > 3000) exitWith { _A = 0.0171422231434847; _M = 1.27907168025204; };
case (_velocity > 3000) : { _A = 0.0171422231434847; _M = 1.27907168025204; }; if (_velocity > 1470) exitWith { _A = 0.00233355948302505; _M = 1.52693913274526; };
case (_velocity > 1470) : { _A = 0.00233355948302505; _M = 1.52693913274526; }; if (_velocity > 1260) exitWith { _A = 0.000797592111627665; _M = 1.67688974440324; };
case (_velocity > 1260) : { _A = 0.000797592111627665; _M = 1.67688974440324; }; if (_velocity > 1110) exitWith { _A = 0.00000000000571086414289273; _M = 4.3212826264889; };
case (_velocity > 1110) : { _A = 0.00000000000571086414289273; _M = 4.3212826264889 ; }; if (_velocity > 960) exitWith { _A = 0.0000000000000000302865108244904; _M = 5.99074203776707; };
case (_velocity > 960) : { _A = 0.0000000000000000302865108244904; _M = 5.99074203776707; }; if (_velocity > 670) exitWith { _A = 0.00000752285155782535; _M = 2.1738019851075; };
case (_velocity > 670) : { _A = 0.00000752285155782535; _M = 2.1738019851075 ; }; if (_velocity > 540) exitWith { _A = 0.0000131766281225189; _M = 2.08774690257991; };
case (_velocity > 540) : { _A = 0.0000131766281225189; _M = 2.08774690257991; }; if (_velocity > 0) exitWith { _A = 0.0000134504843776525; _M = 2.08702306738884; };
case (_velocity > 0) : { _A = 0.0000134504843776525; _M = 2.08702306738884; };
}; };
}; };
case 8: case 8: {
{ call {
switch true do { if (_velocity > 3571) exitWith { _A = 0.0112263766252305; _M = 1.33207346655961; };
case (_velocity > 3571) : { _A = 0.0112263766252305; _M = 1.33207346655961; }; if (_velocity > 1841) exitWith { _A = 0.0167252613732636; _M = 1.28662041261785; };
case (_velocity > 1841) : { _A = 0.0167252613732636; _M = 1.28662041261785; }; if (_velocity > 1120) exitWith { _A = 0.00220172456619625; _M = 1.55636358091189; };
case (_velocity > 1120) : { _A = 0.00220172456619625; _M = 1.55636358091189; }; if (_velocity > 1088) exitWith { _A = 0.00000000000000020538037167098; _M = 5.80410776994789; };
case (_velocity > 1088) : { _A = 0.00000000000000020538037167098; _M = 5.80410776994789; }; if (_velocity > 976) exitWith { _A = 0.00000000000592182174254121; _M = 4.29275576134191; };
case (_velocity > 976) : { _A = 0.00000000000592182174254121; _M = 4.29275576134191; }; if (_velocity > 0) exitWith { _A = 0.000043917343795117; _M = 1.99978116283334; };
case (_velocity > 0) : { _A = 0.000043917343795117; _M = 1.99978116283334; };
}; };
}; };
}; };
if (_A != -1 && _M != -1 && _velocity > 0 && _velocity < 10000) then { if (!isNil "_A" && !isNil "_M" && _velocity > 0 && _velocity < 10000) then {
_result = _A * (_velocity ^ _M) / _dragCoefficient; (_A * (_velocity ^ _M) / _dragCoefficient) / 3.2808399
_result = _result / 3.2808399; } else {
0
}; };
_result

View File

@ -13,33 +13,23 @@
* 6: barometric Pressure - hPA <NUMBER> * 6: barometric Pressure - hPA <NUMBER>
* *
* Return Value: * Return Value:
* 0: stability factor <NUMBER> * stability factor <NUMBER>
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure", "_l", "_t", "_stabilityFactor"]; private ["_twist", "_length", "_stabilityFactor"];
_caliber = _this select 0; params ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure"];
_bulletLength = _this select 1;
_bulletMass = _this select 2;
_barrelTwist = _this select 3;
_muzzleVelocity = _this select 4;
_temperature = _this select 5;
_barometricPressure = _this select 6;
// Source: http://www.jbmballistics.com/ballistics/bibliography/articles/miller_stability_1.pdf // Source: http://www.jbmballistics.com/ballistics/bibliography/articles/miller_stability_1.pdf
_t = _barrelTwist / _caliber; _twist = _barrelTwist / _caliber;
_l = _bulletLength / _caliber; _length = _bulletLength / _caliber;
_stabilityFactor = 7587000 * _bulletMass / (_t^2 * _caliber^3 * _l * (1 + _l^2)); _stabilityFactor = 7587000 * _bulletMass / (_twist^2 * _caliber^3 * _length * (1 + _length^2));
if (_muzzleVelocity > 341.376) then { if (_muzzleVelocity > 341.376) then {
_stabilityFactor = _stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3); (_stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure
} else { } else {
_stabilityFactor = _stabilityFactor * (_muzzleVelocity / 341.376) ^ (1/3); (_stabilityFactor * (_muzzleVelocity / 341.376) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure
}; };
_stabilityFactor = _stabilityFactor * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure;
_stabilityFactor

View File

@ -8,6 +8,8 @@
* *
* Return value: * Return value:
* None * None
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
@ -15,8 +17,6 @@
#define __ctrl1 (__dsp displayCtrl 132950) #define __ctrl1 (__dsp displayCtrl 132950)
#define __ctrl2 (__dsp displayCtrl 132951) #define __ctrl2 (__dsp displayCtrl 132951)
private ["_inclinationAngle", "_refPosition"];
if (GVAR(Protractor)) exitWith { if (GVAR(Protractor)) exitWith {
GVAR(Protractor) = false; GVAR(Protractor) = false;
1 cutText ["", "PLAIN"]; 1 cutText ["", "PLAIN"];
@ -32,30 +32,26 @@ EGVAR(weather,WindInfo) = false;
GVAR(Protractor) = true; GVAR(Protractor) = true;
[{ [{
params ["","_idPFH"];
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"];
[_this select 1] call cba_fnc_removePerFrameHandler; [_idPFH] call cba_fnc_removePerFrameHandler;
}; };
_refPosition = [SafeZoneX + 0.001, SafeZoneY + 0.001, 0.2, 0.2 * 4/3];
_inclinationAngle = asin((ACE_player weaponDirection currentWeapon ACE_player) select 2);
_inclinationAngle = -58 max _inclinationAngle min 58;
1 cutRsc ["RscProtractor", "PLAIN", 1, false]; 1 cutRsc ["RscProtractor", "PLAIN", 1, false];
__ctrl1 ctrlSetScale 1; __ctrl1 ctrlSetScale 1;
__ctrl1 ctrlCommit 0; __ctrl1 ctrlCommit 0;
__ctrl1 ctrlSetText QUOTE(PATHTOF(UI\protractor.paa)); __ctrl1 ctrlSetText QUOTE(PATHTOF(UI\protractor.paa));
__ctrl1 ctrlSetTextColor [1, 1, 1, 1]; __ctrl1 ctrlSetTextColor [1, 1, 1, 1];
__ctrl2 ctrlSetScale 1; __ctrl2 ctrlSetScale 1;
__ctrl2 ctrlSetPosition [(_refPosition select 0), (_refPosition select 1) - 0.0012 * _inclinationAngle, (_refPosition select 2), (_refPosition select 3)]; __ctrl2 ctrlSetPosition [SafeZoneX + 0.001, SafeZoneY + 0.001 - 0.0012 * (-58 max (asin((ACE_player weaponDirection currentWeapon ACE_player) select 2)) min 58), 0.2, 0.2 * 4/3];
__ctrl2 ctrlCommit 0; __ctrl2 ctrlCommit 0;
__ctrl2 ctrlSetText QUOTE(PATHTOF(UI\protractor_marker.paa)); __ctrl2 ctrlSetText QUOTE(PATHTOF(UI\protractor_marker.paa));
__ctrl2 ctrlSetTextColor [1, 1, 1, 1]; __ctrl2 ctrlSetTextColor [1, 1, 1, 1];
}, 0.1, []] call CBA_fnc_addPerFrameHandler; }, 0.1, []] call CBA_fnc_addPerFrameHandler;
true true

View File

@ -0,0 +1,46 @@
/*
* Author: Glowbal, Ruthberg, joko // Jonas
* Handle the PFH for Bullets
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private "_deleted";
_deleted = 0;
_aceTimeSecond = floor ACE_time;
{
private ["_bulletVelocity", "_bulletPosition", "_bulletSpeed"];
_x params["_bullet","_caliber","_bulletTraceVisible","_index"];
_bulletVelocity = velocity _bullet;
_bulletSpeed = vectorMagnitude _bulletVelocity;
if (!alive _bullet || _bulletSpeed < 100) exitWith {
GVAR(allBullets) deleteAt (_forEachIndex - _deleted);
_deleted = _deleted + 1;
};
_bulletPosition = getPosASL _bullet;
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,"","",""];
};
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);
if (GVAR(allBullets) isEqualTo []) then {
[_this select 1] call CBA_fnc_removePerFrameHandler;
GVAR(BulletPFH) = nil;
};

View File

@ -13,28 +13,28 @@
* 6: projectile - Object of the projectile that was shot <OBJECT> * 6: projectile - Object of the projectile that was shot <OBJECT>
* *
* Return Value: * Return Value:
* Nothing * None
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_unit", "_weapon", "_mode", "_ammo", "_magazine", "_caliber", "_bullet", "_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"]; // Early Quiting
_unit = _this select 0; if (!hasInterface) exitWith {};
_weapon = _this select 1; if (!GVAR(enabled)) exitWith {};
_mode = _this select 3;
_ammo = _this select 4; // Parameterization
_magazine = _this select 5; private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"];
_bullet = _this select 6; params ["_unit", "_weapon", "", "_mode", "_ammo", "_magazine", "_bullet"];
_abort = false; _abort = false;
if (!hasInterface) exitWith {};
if (!alive _bullet) exitWith {};
if (!GVAR(enabled)) exitWith {};
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {};
if (underwater _unit) exitWith {};
if (!(_ammo isKindOf "BulletBase")) exitWith {}; if (!(_ammo isKindOf "BulletBase")) exitWith {};
if (!alive _bullet) exitWith {};
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {};
if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {}; if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {};
if (underwater _unit) exitWith {};
if (!GVAR(simulateForEveryone) && !(local _unit)) then { if (!GVAR(simulateForEveryone) && !(local _unit)) then {
// The shooter is non local // The shooter is non local
_abort = true; _abort = true;
@ -58,34 +58,41 @@ if (_abort || !(GVAR(extensionAvailable))) exitWith {
}; };
}; };
// Get Weapon and Ammo Configurations
_AmmoCacheEntry = uiNamespace getVariable format[QGVAR(%1), _ammo]; _AmmoCacheEntry = uiNamespace getVariable format[QGVAR(%1), _ammo];
if (isNil {_AmmoCacheEntry}) then { if (isNil "_AmmoCacheEntry") then {
_AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig); _AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig);
}; };
_WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1), _weapon]; _WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1), _weapon];
if (isNil {_WeaponCacheEntry}) then { if (isNil "_WeaponCacheEntry") then {
_WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig); _WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig);
}; };
_AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable"];
_WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"];
_bulletVelocity = velocity _bullet; _bulletVelocity = velocity _bullet;
_muzzleVelocity = vectorMagnitude _bulletVelocity; _muzzleVelocity = vectorMagnitude _bulletVelocity;
if (GVAR(barrelLengthInfluenceEnabled)) then { if (GVAR(barrelLengthInfluenceEnabled)) then {
_muzzleVelocityShift = [_WeaponCacheEntry select 2, _AmmoCacheEntry select 10, _AmmoCacheEntry select 11, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); _barrelVelocityShift = uiNamespace getVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],nil];
if (_muzzleVelocityShift != 0) then { if (isNil "_barrelVelocityShift") then {
_bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); _barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift);
_bullet setVelocity _bulletVelocity; uiNamespace setVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],_muzzleVelocityShift];
_muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
}; };
}; };
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);
_muzzleVelocityShift = [_AmmoCacheEntry select 9, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift); _temperatureVelocityShift = ([_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift));
};
if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then {
if (_muzzleVelocityShift != 0) then { if (_muzzleVelocityShift != 0) then {
_muzzleVelocity = _muzzleVelocity + (_barrelVelocityShift + _ammoTemperatureVelocityShift);
_bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift));
_bullet setVelocity _bulletVelocity; _bullet setVelocity _bulletVelocity;
_muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
}; };
}; };
@ -102,43 +109,22 @@ if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER") then {
}; };
}; };
_caliber = _AmmoCacheEntry select 1;
_bulletLength = _AmmoCacheEntry select 2;
_bulletMass = _AmmoCacheEntry select 3;
_barrelTwist = _WeaponCacheEntry select 0;
_stabilityFactor = 1.5; _stabilityFactor = 1.5;
if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then { if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then {
_temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); if (isNil "_temperature") then {
_temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight);
};
_barometricPressure = ((getPosASL _bullet) select 2) call EFUNC(weather,calculateBarometricPressure); _barometricPressure = ((getPosASL _bullet) select 2) call EFUNC(weather,calculateBarometricPressure);
_stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor); _stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor);
}; };
GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000; GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000;
"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _AmmoCacheEntry select 0, _AmmoCacheEntry select 6, _AmmoCacheEntry select 7, _AmmoCacheEntry select 8, _AmmoCacheEntry select 5, _stabilityFactor, _WeaponCacheEntry select 1, _muzzleVelocity, _AmmoCacheEntry select 4, getPosASL _bullet, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, floor(ACE_time), ACE_time - floor(ACE_time)]; _aceTimeSecond = floor ACE_time;
"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _bullet, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, _aceTimeSecond, ACE_time - _aceTimeSecond];
[{ GVAR(allBullets) pushBack [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)];
private ["_args", "_index", "_bullet", "_caliber", "_bulletTraceVisible", "_bulletVelocity", "_bulletPosition"];
_args = _this select 0;
_bullet = _args select 0;
_caliber = _args select 1;
_bulletTraceVisible = _args select 2;
_index = _args select 3;
_bulletVelocity = velocity _bullet;
_bulletPosition = getPosASL _bullet;
_bulletSpeed = vectorMagnitude _bulletVelocity;
if (!alive _bullet || _bulletSpeed < 100) exitWith {
[_this select 1] call cba_fnc_removePerFrameHandler;
};
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,"","",""];
};
call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, floor(ACE_time), ACE_time - floor(ACE_time)]); if (isNil QGVAR(BulletPFH)) then {
GVAR(BulletPFH) = [FUNC(handleFirePFH), GVAR(simulationInterval), []] call CBA_fnc_addPerFrameHandler;
}, GVAR(simulationInterval), [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]] call CBA_fnc_addPerFrameHandler; };

View File

@ -8,17 +8,13 @@
* 2: activated <BOOL> * 2: activated <BOOL>
* *
* Return Value: * Return Value:
* None <NIL> * None
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_logic", "_units", "_activated"]; params ["_logic","_units", "_activated"];
_logic = _this select 0;
_units = _this select 1;
_activated = _this select 2;
if !(_activated) exitWith {}; if !(_activated) exitWith {};

View File

@ -3,10 +3,10 @@
* Initializes the advanced ballistics dll extension with terrain data * Initializes the advanced ballistics dll extension with terrain data
* *
* Arguments: * Arguments:
* Nothing * None
* *
* Return Value: * Return Value:
* Nothing * None
* *
* Public: No * Public: No
*/ */
@ -22,9 +22,9 @@ _initStartTime = ACE_time;
_mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize"); _mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize");
if (("ace_advanced_ballistics" callExtension format["init:%1:%2", worldName, _mapSize]) == "Terrain already initialized") exitWith { if (("ace_advanced_ballistics" callExtension format["init:%1:%2", worldName, _mapSize]) == "Terrain already initialized") exitWith {
if (GVAR(initMessageEnabled)) then { #ifdef DEBUG_MODE_FULL
systemChat "AdvancedBallistics: Terrain already initialized"; systemChat "AdvancedBallistics: Terrain already initialized";
}; #endIf
}; };
_mapGrids = ceil(_mapSize / 50) + 1; _mapGrids = ceil(_mapSize / 50) + 1;
@ -33,19 +33,16 @@ _gridCells = _mapGrids * _mapGrids;
GVAR(currentGrid) = 0; GVAR(currentGrid) = 0;
[{ [{
private ["_args", "_mapGrids", "_gridCells", "_initStartTime"]; params ["_args","_idPFH"];
_args = _this select 0; _args params ["_mapGrids", "_gridCells", "_initStartTime"];
_mapGrids = _args select 0;
_gridCells = _args select 1;
_initStartTime = _args select 2;
if (GVAR(currentGrid) >= _gridCells) exitWith { if (GVAR(currentGrid) >= _gridCells) exitWith {
if (GVAR(initMessageEnabled)) then { #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
[_this select 1] call cba_fnc_removePerFrameHandler; [_idPFH] call cba_fnc_removePerFrameHandler;
}; };
for "_i" from 1 to 50 do { for "_i" from 1 to 50 do {
_x = floor(GVAR(currentGrid) / _mapGrids) * 50; _x = floor(GVAR(currentGrid) / _mapGrids) * 50;
_y = (GVAR(currentGrid) - floor(GVAR(currentGrid) / _mapGrids) * _mapGrids) * 50; _y = (GVAR(currentGrid) - floor(GVAR(currentGrid) / _mapGrids) * _mapGrids) * 50;
@ -57,5 +54,5 @@ GVAR(currentGrid) = 0;
GVAR(currentGrid) = GVAR(currentGrid) + 1; GVAR(currentGrid) = GVAR(currentGrid) + 1;
if (GVAR(currentGrid) >= _gridCells) exitWith {}; if (GVAR(currentGrid) >= _gridCells) exitWith {};
}; };
}, 0, [_mapGrids, _gridCells, _initStartTime]] call CBA_fnc_addPerFrameHandler }, 0, [_mapGrids, _gridCells, _initStartTime]] call CBA_fnc_addPerFrameHandler

View File

@ -4,61 +4,53 @@
* Reads the ammo class config and updates the config cache * Reads the ammo class config and updates the config cache
* *
* Arguments: * Arguments:
* 0: ammo - classname <string> * ammo - classname <STRING>
* *
* Return Value: * Return Value:
* 0: [_airFriction, _caliber, _bulletLength, _bulletMass, _transonicStabilityCoef, _dragModel, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _ammoTempMuzzleVelocityShifts, _muzzleVelocityTable, _barrelLengthTable] <ARRAY> * 0: _airFriction
* 1: _caliber
* 2: _bulletLength
* 3: _bulletMass
* 4: _transonicStabilityCoef
* 5: _dragModel
* 6: _ballisticCoefficients
* 7: _velocityBoundaries
* 8: _atmosphereModel
* 9: _ammoTempMuzzleVelocityShifts
* 10: _muzzleVelocityTable
* 11: _barrelLengthTable
* *
* Return value: * Public: No
* None
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_ammo", "_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_result"]; private ["_ammo", "_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_result"];
_ammo = _this; _ammoConfig = configFile >> "CfgAmmo" >> _this;
_airFriction = getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction"); _airFriction = getNumber(_ammoConfig >> "airFriction");
_caliber = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_caliber"); _caliber = getNumber(_ammoConfig >> "ACE_caliber");
_bulletLength = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_bulletLength"); _bulletLength = getNumber(_ammoConfig >> "ACE_bulletLength");
_bulletMass = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_bulletMass"); _bulletMass = getNumber(_ammoConfig >> "ACE_bulletMass");
_transonicStabilityCoef = 0.5; _transonicStabilityCoef = getNumber(_ammoConfig >> "ACE_transonicStabilityCoef");
if (isNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_transonicStabilityCoef")) then { if (_transonicStabilityCoef == 0) then {
_transonicStabilityCoef = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_transonicStabilityCoef"); _transonicStabilityCoef = 0.5;
}; };
_dragModel = 1; _dragModel = getNumber(_ammoConfig >> "ACE_dragModel");
_ballisticCoefficients = []; if (_dragModel == 0 || !(_dragModel in [1, 2, 5, 6, 7, 8])) then {
_velocityBoundaries = []; _dragModel = 1;
_atmosphereModel = "ICAO";
if (isNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_dragModel")) then {
_dragModel = getNumber(configFile >> "CfgAmmo" >> _ammo >> "ACE_dragModel");
if (!(_dragModel in [1, 2, 5, 6, 7, 8])) then {
_dragModel = 1;
};
}; };
if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ballisticCoefficients")) then { _ballisticCoefficients = getArray(_ammoConfig >> "ACE_ballisticCoefficients");
_ballisticCoefficients = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ballisticCoefficients"); _velocityBoundaries = getArray(_ammoConfig >> "ACE_velocityBoundaries");
}; _atmosphereModel = getText(_ammoConfig >> "ACE_standardAtmosphere");
if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_velocityBoundaries")) then { if (_atmosphereModel isEqualTo "") then {
_velocityBoundaries = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_velocityBoundaries"); _atmosphereModel = "ICAO";
};
if (isText(configFile >> "CfgAmmo" >> _ammo >> "ACE_standardAtmosphere")) then {
_atmosphereModel = getText(configFile >> "CfgAmmo" >> _ammo >> "ACE_standardAtmosphere");
};
_ammoTempMuzzleVelocityShifts = [];
if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ammoTempMuzzleVelocityShifts")) then {
_ammoTempMuzzleVelocityShifts = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_ammoTempMuzzleVelocityShifts");
};
_muzzleVelocityTable = [];
_barrelLengthTable = [];
if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_muzzleVelocities")) then {
_muzzleVelocityTable = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_muzzleVelocities");
};
if (isArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_barrelLengths")) then {
_barrelLengthTable = getArray(configFile >> "CfgAmmo" >> _ammo >> "ACE_barrelLengths");
}; };
_ammoTempMuzzleVelocityShifts = getArray(_ammoConfig >> "ACE_ammoTempMuzzleVelocityShifts");
_muzzleVelocityTable = getArray(_ammoConfig >> "ACE_muzzleVelocities");
_barrelLengthTable = getArray(_ammoConfig >> "ACE_barrelLengths");
_result = [_airFriction, _caliber, _bulletLength, _bulletMass, _transonicStabilityCoef, _dragModel, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _ammoTempMuzzleVelocityShifts, _muzzleVelocityTable, _barrelLengthTable]; _result = [_airFriction, _caliber, _bulletLength, _bulletMass, _transonicStabilityCoef, _dragModel, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _ammoTempMuzzleVelocityShifts, _muzzleVelocityTable, _barrelLengthTable];
uiNamespace setVariable [format[QGVAR(%1), _ammo], _result]; uiNamespace setVariable [format[QGVAR(%1), _this], _result];
_result _result

View File

@ -4,28 +4,28 @@
* Reads the weapon class config and updates the config cache * Reads the weapon class config and updates the config cache
* *
* Arguments: * Arguments:
* 0: weapon - classname <string> * weapon - classname <STRING>
* *
* Return Value: * Return Value:
* 0: [_barrelTwist, _twistDirection, _barrelLength] <ARRAY> * 0: _barrelTwist
* 1: _twistDirection
* 2: _barrelLength
* *
* Return value: * Public: No
* None
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_weapon", "_barrelTwist", "_twistDirection", "_barrelLength", "_result"]; private ["_weaponConfig", "_barrelTwist", "_twistDirection", "_barrelLength", "_result"];
_weapon = _this; _weaponConfig = (configFile >> "CfgWeapons" >> _this);
_barrelTwist = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_barrelTwist"); _barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist");
_twistDirection = 1; _twistDirection = 1;
if (isNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_twistDirection")) then { _twistDirection = getNumber(_weaponConfig >> "ACE_twistDirection");
_twistDirection = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_twistDirection"); if !(_twistDirection in [-1, 0, 1]) then {
if (_twistDirection != -1 && _twistDirection != 0 && _twistDirection != 1) then { _twistDirection = 1;
_twistDirection = 1;
};
}; };
_barrelLength = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_barrelLength");
_barrelLength = getNumber(_weaponConfig >> "ACE_barrelLength");
_result = [_barrelTwist, _twistDirection, _barrelLength]; _result = [_barrelTwist, _twistDirection, _barrelLength];

View File

@ -32,6 +32,9 @@
<German>Erweiterte Ballistik</German> <German>Erweiterte Ballistik</German>
<Czech>Pokročilá balistika</Czech> <Czech>Pokročilá balistika</Czech>
<Portuguese>Balística avançada</Portuguese> <Portuguese>Balística avançada</Portuguese>
<French>Balistique avancée</French>
<Hungarian>Fejlett ballisztika</Hungarian>
<Russian>Продвинутая баллистика</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_enabled_DisplayName"> <Key ID="STR_ACE_Advanced_Ballistics_enabled_DisplayName">
<English>Advanced Ballistics</English> <English>Advanced Ballistics</English>
@ -40,6 +43,9 @@
<German>Erweiterte Ballistik</German> <German>Erweiterte Ballistik</German>
<Czech>Pokročilá balistika</Czech> <Czech>Pokročilá balistika</Czech>
<Portuguese>Balística avançada</Portuguese> <Portuguese>Balística avançada</Portuguese>
<French>Balistique avancée</French>
<Hungarian>Fejlett ballisztika</Hungarian>
<Russian>Продвинутая баллистика</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_enabled_Description"> <Key ID="STR_ACE_Advanced_Ballistics_enabled_Description">
<English>Enables advanced ballistics</English> <English>Enables advanced ballistics</English>
@ -48,6 +54,9 @@
<German>Aktiviert die erweiterte Ballistik</German> <German>Aktiviert die erweiterte Ballistik</German>
<Czech>Aktivuje pokročilou balistiku</Czech> <Czech>Aktivuje pokročilou balistiku</Czech>
<Portuguese>Ativa balística avançada</Portuguese> <Portuguese>Ativa balística avançada</Portuguese>
<French>Activer la balistique avancée</French>
<Hungarian>Engedélyezi a fejlett ballisztikát</Hungarian>
<Russian>Включает продвинутую баллистику</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_simulateForSnipers_DisplayName"> <Key ID="STR_ACE_Advanced_Ballistics_simulateForSnipers_DisplayName">
<English>Enabled For Snipers</English> <English>Enabled For Snipers</English>
@ -56,6 +65,9 @@
<German>Für Scharfschützen aktiviert</German> <German>Für Scharfschützen aktiviert</German>
<Czech>Povoleno pro odstřelovače</Czech> <Czech>Povoleno pro odstřelovače</Czech>
<Portuguese>Ativar para caçadores</Portuguese> <Portuguese>Ativar para caçadores</Portuguese>
<French>Activer pour les snipers</French>
<Hungarian>Mesterlövészeknek engedélyezve</Hungarian>
<Russian>Включена для снайперов</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_simulateForSnipers_Description"> <Key ID="STR_ACE_Advanced_Ballistics_simulateForSnipers_Description">
<English>Enables advanced ballistics for non local snipers (when using high power optics)</English> <English>Enables advanced ballistics for non local snipers (when using high power optics)</English>
@ -64,6 +76,9 @@
<German>Aktiviert die erweiterte Ballistik für nicht lokale Scharfschützen (bei Benutzung von Optiken mit starker Vergrößerung)</German> <German>Aktiviert die erweiterte Ballistik für nicht lokale Scharfschützen (bei Benutzung von Optiken mit starker Vergrößerung)</German>
<Czech>Aktivuje pokročilou balistiku pro nelokální odstřelovače (když používá výkonnou optiku)</Czech> <Czech>Aktivuje pokročilou balistiku pro nelokální odstřelovače (když používá výkonnou optiku)</Czech>
<Portuguese>Ativa balística avançada para caçadores não locais (quando usando miras telescópicas)</Portuguese> <Portuguese>Ativa balística avançada para caçadores não locais (quando usando miras telescópicas)</Portuguese>
<French>Active la balistique avancée pour les snipers non locaux (en utilisant les optiques avancées)</French>
<Hungarian>Engedélyezi a fejlett ballisztikát nem-helyi mesterlövészeknek (nagy-teljesítményű optika használatakor)</Hungarian>
<Russian>Включает продвинутую баллистику для нелокальных снайперов (при использовании мощной оптики)</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_simulateForGroupMembers_DisplayName"> <Key ID="STR_ACE_Advanced_Ballistics_simulateForGroupMembers_DisplayName">
<English>Enabled For Group Members</English> <English>Enabled For Group Members</English>
@ -72,6 +87,9 @@
<German>Für Gruppenmitglieder aktiviert</German> <German>Für Gruppenmitglieder aktiviert</German>
<Czech>Povoleno pro členy skupiny</Czech> <Czech>Povoleno pro členy skupiny</Czech>
<Portuguese>Ativada para membros do grupo</Portuguese> <Portuguese>Ativada para membros do grupo</Portuguese>
<French>Activer pour les membres groupés</French>
<Hungarian>Csoporttagoknak engedélyezve</Hungarian>
<Russian>Включена для группы</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_simulateForGroupMembers_Description"> <Key ID="STR_ACE_Advanced_Ballistics_simulateForGroupMembers_Description">
<English>Enables advanced ballistics for non local group members</English> <English>Enables advanced ballistics for non local group members</English>
@ -80,6 +98,9 @@
<German>Aktiviert die erweiterte Ballistik für nicht lokale Gruppenmitglieder</German> <German>Aktiviert die erweiterte Ballistik für nicht lokale Gruppenmitglieder</German>
<Czech>Aktivuje pokročilou balistiku pro nelokální členy skupiny</Czech> <Czech>Aktivuje pokročilou balistiku pro nelokální členy skupiny</Czech>
<Portuguese>Ativa balística avançada para membros de grupo não locais</Portuguese> <Portuguese>Ativa balística avançada para membros de grupo não locais</Portuguese>
<French>Active la balistique avancée pour les membres groupés non locaux</French>
<Hungarian>Engedélyezi a fejlett ballisztikát nem-helyi csoporttagoknak</Hungarian>
<Russian>Включает продвинутую баллистику для нелокальных членов группы</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_simulateForEveryone_DisplayName"> <Key ID="STR_ACE_Advanced_Ballistics_simulateForEveryone_DisplayName">
<English>Enabled For Everyone</English> <English>Enabled For Everyone</English>
@ -88,6 +109,9 @@
<German>Für jeden aktiviert</German> <German>Für jeden aktiviert</German>
<Czech>Povoleno pro všechny</Czech> <Czech>Povoleno pro všechny</Czech>
<Portuguese>Ativada para todos</Portuguese> <Portuguese>Ativada para todos</Portuguese>
<French>Activer pour tout le monde</French>
<Hungarian>Mindenkinek engedélyezve</Hungarian>
<Russian>Включена для всех</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_simulateForEveryone_Description"> <Key ID="STR_ACE_Advanced_Ballistics_simulateForEveryone_Description">
<English>Enables advanced ballistics for all non local players (enabling this may degrade performance during heavy firefights in multiplayer)</English> <English>Enables advanced ballistics for all non local players (enabling this may degrade performance during heavy firefights in multiplayer)</English>
@ -96,6 +120,9 @@
<German>Aktiviert die erweiterte Ballistik für alle nicht lokalen Spieler (das Aktivieren dieser Funktion kann zur Beeinträchtigung des Spielerlebnisses im Multiplayer führen)</German> <German>Aktiviert die erweiterte Ballistik für alle nicht lokalen Spieler (das Aktivieren dieser Funktion kann zur Beeinträchtigung des Spielerlebnisses im Multiplayer führen)</German>
<Czech>Aktivovat pokročilou balistiku pro všechny nelokální hráče (aktivace této možnosti způsobuje pokles snímu za sekundu během těžké přestřelky v multiplayeru)</Czech> <Czech>Aktivovat pokročilou balistiku pro všechny nelokální hráče (aktivace této možnosti způsobuje pokles snímu za sekundu během těžké přestřelky v multiplayeru)</Czech>
<Portuguese>Ativa balística avançada para todos os jogadores não locais (ativando isso pode degradar a performance durante troca de tiros intensas no multiplayer)</Portuguese> <Portuguese>Ativa balística avançada para todos os jogadores não locais (ativando isso pode degradar a performance durante troca de tiros intensas no multiplayer)</Portuguese>
<French>Active la balistique avancé pour tous les joueurs non locaux (activer cette option peut avoir un impact sur les performance en multi durant les grands échanges de tirs)</French>
<Hungarian>Engedélyezi a fejlett ballisztikát az összes nem-helyi játékosnak (ez a funkció leronthatja a teljesítményt intenzív többjátékos tűzharcok alatt)</Hungarian>
<Russian>Включает продвинутую баллистику для всех нелокальных игроков (включение этой опции может снизить производительность при массовых перестрелках в мультиплеере)</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_alwaysSimulateForGroupMembers_DisplayName"> <Key ID="STR_ACE_Advanced_Ballistics_alwaysSimulateForGroupMembers_DisplayName">
<English>Always Enabled For Group Members</English> <English>Always Enabled For Group Members</English>
@ -104,6 +131,9 @@
<German>Für Gruppenmitglieder immer aktiviert</German> <German>Für Gruppenmitglieder immer aktiviert</German>
<Czech>Vždy povoleno pro členy skupiny</Czech> <Czech>Vždy povoleno pro členy skupiny</Czech>
<Portuguese>Sempre ativada para membros do grupo</Portuguese> <Portuguese>Sempre ativada para membros do grupo</Portuguese>
<French>Toujours activer pour les membres groupés</French>
<Hungarian>Mindig engedélyezve csoporttagoknak</Hungarian>
<Russian>Всегда включена для членов группы</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_alwaysSimulateForGroupMembers_Description"> <Key ID="STR_ACE_Advanced_Ballistics_alwaysSimulateForGroupMembers_Description">
<English>Always enables advanced ballistics when a group member fires</English> <English>Always enables advanced ballistics when a group member fires</English>
@ -112,6 +142,9 @@
<German>Aktiviert die erweiterte Ballistik immer, wenn ein Gruppenmitglied schießt</German> <German>Aktiviert die erweiterte Ballistik immer, wenn ein Gruppenmitglied schießt</German>
<Czech>Aktivuje pokročilou balistiku pro členy skupiny</Czech> <Czech>Aktivuje pokročilou balistiku pro členy skupiny</Czech>
<Portuguese>Sempre ative balística avançada quando um membro do grupo disparar</Portuguese> <Portuguese>Sempre ative balística avançada quando um membro do grupo disparar</Portuguese>
<French>Active tout le temps la balistique avancée quand un membre du groupe ouvre le feu</French>
<Hungarian>Mindig engedélyezi a fejlett ballisztikát, ha egy csoporttag tüzel</Hungarian>
<Russian>Всегда включает продвинутую баллистику когда стреляет член группы</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_disabledInFullAutoMod_DisplayName"> <Key ID="STR_ACE_Advanced_Ballistics_disabledInFullAutoMod_DisplayName">
<English>Disabled In FullAuto Mode</English> <English>Disabled In FullAuto Mode</English>
@ -120,6 +153,9 @@
<German>Beim vollautomatischen Feuern deaktiviert</German> <German>Beim vollautomatischen Feuern deaktiviert</German>
<Czech>Zakázáno v automatickém režimu střelby</Czech> <Czech>Zakázáno v automatickém režimu střelby</Czech>
<Portuguese>Desabilitar no modo automático</Portuguese> <Portuguese>Desabilitar no modo automático</Portuguese>
<French>Désactiver en mode rafale libre</French>
<Hungarian>Automata módban letiltva</Hungarian>
<Russian>Выкл. для автомат. режима</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_disabledInFullAutoMod_Description"> <Key ID="STR_ACE_Advanced_Ballistics_disabledInFullAutoMod_Description">
<English>Disables the advanced ballistics during full auto fire</English> <English>Disables the advanced ballistics during full auto fire</English>
@ -128,6 +164,9 @@
<German>Deaktiviert die erweiterte Ballistik beim vollautomatischen Feuern</German> <German>Deaktiviert die erweiterte Ballistik beim vollautomatischen Feuern</German>
<Czech>Zákáže pokročilou balistiku během střelby v režimu automat</Czech> <Czech>Zákáže pokročilou balistiku během střelby v režimu automat</Czech>
<Portuguese>Desabilitar a balística avançada durante fogo automático</Portuguese> <Portuguese>Desabilitar a balística avançada durante fogo automático</Portuguese>
<French>Désactive la balistique avancée pour les tirs en rafale libre</French>
<Hungarian>Letiltja a fejlett ballisztikát automata tüzelés folyamán</Hungarian>
<Russian>Выключает продвинутую баллистику при стрельбе в полностью автоматическом режиме</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_ammoTemperatureEnabled_DisplayName"> <Key ID="STR_ACE_Advanced_Ballistics_ammoTemperatureEnabled_DisplayName">
<English>Enable Ammo Temperature Simulation</English> <English>Enable Ammo Temperature Simulation</English>
@ -136,6 +175,9 @@
<German>Simulation der Munitionstemperatur aktivieren</German> <German>Simulation der Munitionstemperatur aktivieren</German>
<Czech>Povolit simulaci teploty munice</Czech> <Czech>Povolit simulaci teploty munice</Czech>
<Portuguese>Ativar simulação de temperatura de munição</Portuguese> <Portuguese>Ativar simulação de temperatura de munição</Portuguese>
<French>Activer la simulation de la température</French>
<Hungarian>Lőszer-hő szimuláció engedélyezése</Hungarian>
<Russian>Симуляция температуры для боеприпасов</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_ammoTemperatureEnabled_Description"> <Key ID="STR_ACE_Advanced_Ballistics_ammoTemperatureEnabled_Description">
<English>Muzzle velocity varies with ammo temperature</English> <English>Muzzle velocity varies with ammo temperature</English>
@ -144,6 +186,9 @@
<German>Munitionstemperatur hat Einfluss auf die Mündungsgeschwindigkeit</German> <German>Munitionstemperatur hat Einfluss auf die Mündungsgeschwindigkeit</German>
<Czech>Úsťová rychlost je závislá na teplotě munice</Czech> <Czech>Úsťová rychlost je závislá na teplotě munice</Czech>
<Portuguese>A velocidade de saída varia com a temperatura da munição</Portuguese> <Portuguese>A velocidade de saída varia com a temperatura da munição</Portuguese>
<French>La température de la munition influe sur la vélocité intiale</French>
<Hungarian>A kezdősebesség a lőszer hőmérsékletétől függően változó</Hungarian>
<Russian>Начальная скорость пули зависит от температуры</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_barrelLengthInfluenceEnabled_DisplayName"> <Key ID="STR_ACE_Advanced_Ballistics_barrelLengthInfluenceEnabled_DisplayName">
<English>Enable Barrel Length Simulation</English> <English>Enable Barrel Length Simulation</English>
@ -152,6 +197,9 @@
<German>Simulation der Lauflänge aktivieren</German> <German>Simulation der Lauflänge aktivieren</German>
<Czech>Povolit simulaci délky hlavně</Czech> <Czech>Povolit simulaci délky hlavně</Czech>
<Portuguese>Ativar a simulação de comprimento do cano</Portuguese> <Portuguese>Ativar a simulação de comprimento do cano</Portuguese>
<French>Activer la simulation de la longueur de canon</French>
<Hungarian>Csőhossz-szimuláció engedélyezése</Hungarian>
<Russian>Симуляция длины ствола</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_barrelLengthInfluenceEnabled_Description"> <Key ID="STR_ACE_Advanced_Ballistics_barrelLengthInfluenceEnabled_Description">
<English>Muzzle velocity varies with barrel length</English> <English>Muzzle velocity varies with barrel length</English>
@ -160,6 +208,9 @@
<German>Lauflänge beeinflusst Mündungsgeschwindigkeit</German> <German>Lauflänge beeinflusst Mündungsgeschwindigkeit</German>
<Czech>Úsťová rychlost je závislá na délce hlavně</Czech> <Czech>Úsťová rychlost je závislá na délce hlavně</Czech>
<Portuguese>A velocidade de saída caria com o comprimento do cano</Portuguese> <Portuguese>A velocidade de saída caria com o comprimento do cano</Portuguese>
<French>La longueur du canon influe sur la vélocité initale</French>
<Hungarian>A kezdősebesség a cső hosszától függően változó</Hungarian>
<Russian>Начальная скорость пули зависит от длины ствола</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_bulletTraceEnabled_DisplayName"> <Key ID="STR_ACE_Advanced_Ballistics_bulletTraceEnabled_DisplayName">
<English>Enable Bullet Trace Effect</English> <English>Enable Bullet Trace Effect</English>
@ -168,6 +219,9 @@
<German>Geschossspureffekt aktivieren</German> <German>Geschossspureffekt aktivieren</German>
<Czech>Povolit efekt trasírek</Czech> <Czech>Povolit efekt trasírek</Czech>
<Portuguese>Ativa efeito traçante de projétil</Portuguese> <Portuguese>Ativa efeito traçante de projétil</Portuguese>
<French>Activer l'effet traçante</French>
<Hungarian>Nyomkövető-effekt engedélyezése</Hungarian>
<Russian>Следы пуль</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_bulletTraceEnabled_Description"> <Key ID="STR_ACE_Advanced_Ballistics_bulletTraceEnabled_Description">
<English>Enables a bullet trace effect to high caliber bullets (only visible when looking through high power optics)</English> <English>Enables a bullet trace effect to high caliber bullets (only visible when looking through high power optics)</English>
@ -176,6 +230,9 @@
<German>Aktiviere Geschossspureffekt für hohe Kaliber (bei Benutzung von Optiken mit starker Vergrößerung)</German> <German>Aktiviere Geschossspureffekt für hohe Kaliber (bei Benutzung von Optiken mit starker Vergrößerung)</German>
<Czech>Aktivuje efekt trasírek z vysokokaliberních zbraní (viditelné pouze skrze výkonnou optiku)</Czech> <Czech>Aktivuje efekt trasírek z vysokokaliberních zbraní (viditelné pouze skrze výkonnou optiku)</Czech>
<Portuguese>Ativa o efeito traçante de projétil para projéteis de alto calibre (somente visível quando observado por miras telescópicas)</Portuguese> <Portuguese>Ativa o efeito traçante de projétil para projéteis de alto calibre (somente visível quando observado por miras telescópicas)</Portuguese>
<French>Active une tracante pour les munitions de gros calibre (seulement visible en utilisant des optiques avancées)</French>
<Hungarian>Engedélyezi a nagy kaliberű lövedékek nyomának vizuális követését (csak nagy teljesítményű optikán keresztül látható)</Hungarian>
<Russian>Включает эффект следов пуль для больших калибров (видны только через мощную оптику)</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_simulationInterval_DisplayName"> <Key ID="STR_ACE_Advanced_Ballistics_simulationInterval_DisplayName">
<English>Simulation Interval</English> <English>Simulation Interval</English>
@ -184,6 +241,9 @@
<German>Simulationsintervall</German> <German>Simulationsintervall</German>
<Czech>Interval simulace</Czech> <Czech>Interval simulace</Czech>
<Portuguese>Intervalo da simulação</Portuguese> <Portuguese>Intervalo da simulação</Portuguese>
<French>Intervalle de simulation</French>
<Hungarian>Szimuláció intervalluma</Hungarian>
<Russian>Интервал симуляции</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_simulationInterval_Description"> <Key ID="STR_ACE_Advanced_Ballistics_simulationInterval_Description">
<English>Defines the interval between every calculation step</English> <English>Defines the interval between every calculation step</English>
@ -192,6 +252,9 @@
<German>Legt das Intervall zwischen den Berechnungsschritten fest</German> <German>Legt das Intervall zwischen den Berechnungsschritten fest</German>
<Czech>Určuje interval mezi každým výpočtem</Czech> <Czech>Určuje interval mezi každým výpočtem</Czech>
<Portuguese>Define o intervalo entre cada cálculo</Portuguese> <Portuguese>Define o intervalo entre cada cálculo</Portuguese>
<French>Défini un intervalle de calcul entre deux simulations</French>
<Hungarian>Meghatározza a számítási lépések közötti időintervallumot</Hungarian>
<Russian>Определяет временной интервал между вычислениями</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_simulationRadius_DisplayName"> <Key ID="STR_ACE_Advanced_Ballistics_simulationRadius_DisplayName">
<English>Simulation Radius</English> <English>Simulation Radius</English>
@ -200,6 +263,9 @@
<German>Simulationsradius</German> <German>Simulationsradius</German>
<Czech>Rozsah simulace</Czech> <Czech>Rozsah simulace</Czech>
<Portuguese>Raio de simulação</Portuguese> <Portuguese>Raio de simulação</Portuguese>
<French>Rayon de simulation</French>
<Hungarian>Szimuláció hatóköre</Hungarian>
<Russian>Радиус симуляции</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_simulationRadius_Description"> <Key ID="STR_ACE_Advanced_Ballistics_simulationRadius_Description">
<English>Defines the radius around the player (in meters) at which advanced ballistics are applied to projectiles</English> <English>Defines the radius around the player (in meters) at which advanced ballistics are applied to projectiles</English>
@ -208,12 +274,19 @@
<German>Gibt den Radius (in Metern) um den Spieler an, bei dem die erweiterte Ballistik auf Geschosse angewendet wird</German> <German>Gibt den Radius (in Metern) um den Spieler an, bei dem die erweiterte Ballistik auf Geschosse angewendet wird</German>
<Czech>Určuje oblast kolem hráče (v metrech), kde je pokročilá balistika použita na projektil</Czech> <Czech>Určuje oblast kolem hráče (v metrech), kde je pokročilá balistika použita na projektil</Czech>
<Portuguese>Define o raio ao redor do jogador (em metros) onde a balística avançada será aplicada aos projéteis</Portuguese> <Portuguese>Define o raio ao redor do jogador (em metros) onde a balística avançada será aplicada aos projéteis</Portuguese>
<French>Défini le rayon autour du joueur (en mètres) d'application de la balistique avancée</French>
<Hungarian>Meghatározza a játékos körüli hatókört (méterben), ahol a lövedékek fejlett ballisztikát használnak</Hungarian>
<Russian>Определяет радиус вокруг игрока (в метрах), в котором продвинутая баллистика применяется к снарядам</Russian>
</Key> </Key>
<Key ID="STR_ACE_Advanced_Ballistics_Description"> <Key ID="STR_ACE_Advanced_Ballistics_Description">
<English>This module enables advanced ballistics simulation - meaning the trajectory of projectiles is influenced by variables like air temperature, atmospheric pressure, humidity, gravity, the type of ammunition and the weapon from which it was fired.</English> <English>This module enables advanced ballistics simulation - meaning the trajectory of projectiles is influenced by variables like air temperature, atmospheric pressure, humidity, gravity, the type of ammunition and the weapon from which it was fired.</English>
<Polish>Moduł ten pozwala aktywować zaawansowaną balistykę biorącą przy obliczeniach trajektorii lotu pocisku pod uwagę takie rzeczy jak temperatura powietrza, ciśnienie atmosferyczne, wilgotność powietrza, siły Coriolisa i Eotvosa, grawitację a także broń z jakiej wykonywany jest strzał oraz rodzaj amunicji. Wszystko to sprowadza się na bardzo dokładne odwzorowanie balistyki.</Polish> <Polish>Moduł ten pozwala aktywować zaawansowaną balistykę biorącą przy obliczeniach trajektorii lotu pocisku pod uwagę takie rzeczy jak temperatura powietrza, ciśnienie atmosferyczne, wilgotność powietrza, siły Coriolisa i Eotvosa, grawitację a także broń z jakiej wykonywany jest strzał oraz rodzaj amunicji. Wszystko to sprowadza się na bardzo dokładne odwzorowanie balistyki.</Polish>
<Czech>Tento modul umožňuje aktivovat pokročilou balistiku, která vypočítává trajektorii kulky a bere do úvahy věci jako je teplota vzduchu, atmosférický tlak, vlhkost vzduchu, gravitaci, typ munice a zbraň, ze které je náboj vystřelen. To vše přispívá k velmi přesné balistice.</Czech> <Czech>Tento modul umožňuje aktivovat pokročilou balistiku, která vypočítává trajektorii kulky a bere do úvahy věci jako je teplota vzduchu, atmosférický tlak, vlhkost vzduchu, gravitaci, typ munice a zbraň, ze které je náboj vystřelen. To vše přispívá k velmi přesné balistice.</Czech>
<Portuguese>Este módulo permite que você ative cálculos de balística avançada, fazendo a trajetória do projétil levar em consideração coisas como temperatura do ar, pressão atmosférica, umidade, força de Coriolis, a gravidade, o modelo da arma no qual o disparo é realizado e o tipo de munição. Tudo isso acrescenta-se a um balística muito precisa.</Portuguese> <Portuguese>Este módulo permite que você ative cálculos de balística avançada, fazendo a trajetória do projétil levar em consideração coisas como temperatura do ar, pressão atmosférica, umidade, força de Coriolis, a gravidade, o modelo da arma no qual o disparo é realizado e o tipo de munição. Tudo isso acrescenta-se a um balística muito precisa.</Portuguese>
<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>
<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>
</Key> </Key>
</Package> </Package>
</Project> </Project>

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="Aircraft"> <Package name="Aircraft">
<Key ID="STR_ACE_Aircraft_CMFlareLauncher_Burst_Name"> <Key ID="STR_ACE_Aircraft_CMFlareLauncher_Burst_Name">

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="ATragMX"> <Package name="ATragMX">
<Key ID="STR_ACE_ATragMX_Name"> <Key ID="STR_ACE_ATragMX_Name">
@ -50,4 +50,4 @@
<Portuguese>Abrir ATragMX</Portuguese> <Portuguese>Abrir ATragMX</Portuguese>
</Key> </Key>
</Package> </Package>
</Project> </Project>

View File

@ -8,3 +8,24 @@ class Extended_PostInit_EventHandlers {
clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) ); clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) );
}; };
}; };
class Extended_GetIn_EventHandlers {
class All {
class ADDON {
getIn = QUOTE(_this call FUNC(handleGetIn));
};
};
};
class Extended_GetOut_EventHandlers {
class All {
class ADDON {
getOut = QUOTE(_this call FUNC(handleGetOut));
};
};
};
class Extended_Killed_EventHandlers {
class All {
class ADDON {
killed = QUOTE(_this call FUNC(handleKilled));
};
};
};

View File

@ -7,6 +7,9 @@ PREP(canAttach);
PREP(canDetach); PREP(canDetach);
PREP(detach); PREP(detach);
PREP(getChildrenAttachActions); PREP(getChildrenAttachActions);
PREP(handleGetIn);
PREP(handleGetOut);
PREP(handleKilled);
PREP(placeApprove); PREP(placeApprove);
ADDON = true; ADDON = true;

View File

@ -17,15 +17,14 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_itemVehClass", "_onAtachText", "_selfAttachPosition", "_attachedItem", "_tempObject", "_actionID", "_model"]; params ["_attachToVehicle","_unit","_args", ["_silentScripted", false]];
params ["_attachToVehicle","_unit","_args"];
_args params [["_itemClassname","", [""]]]; _args params [["_itemClassname","", [""]]];
TRACE_3("params",_attachToVehicle,_unit,_itemClassname); TRACE_4("params",_attachToVehicle,_unit,_itemClassname,_silentScripted);
private ["_itemVehClass", "_onAtachText", "_selfAttachPosition", "_attachedItem", "_tempObject", "_actionID", "_model"];
//Sanity Check (_unit has item in inventory, not over attach limit) //Sanity Check (_unit has item in inventory, not over attach limit)
if ((_itemClassname == "") || {!(_this call FUNC(canAttach))}) exitWith {ERROR("Tried to attach, but check failed");}; if ((_itemClassname == "") || {(!_silentScripted) && {!(_this call FUNC(canAttach))}}) exitWith {ERROR("Tried to attach, but check failed");};
_selfAttachPosition = [_unit, [-0.05, 0, 0.12], "rightshoulder"];
_itemVehClass = getText (configFile >> "CfgWeapons" >> _itemClassname >> "ACE_Attachable"); _itemVehClass = getText (configFile >> "CfgWeapons" >> _itemClassname >> "ACE_Attachable");
_onAtachText = getText (configFile >> "CfgWeapons" >> _itemClassname >> "displayName"); _onAtachText = getText (configFile >> "CfgWeapons" >> _itemClassname >> "displayName");
@ -40,12 +39,13 @@ if (_itemVehClass == "") exitWith {ERROR("no ACE_Attachable for Item");};
_onAtachText = format [localize LSTRING(Item_Attached), _onAtachText]; _onAtachText = format [localize LSTRING(Item_Attached), _onAtachText];
if (_unit == _attachToVehicle) then { //Self Attachment if (_unit == _attachToVehicle) then { //Self Attachment
_unit removeItem _itemClassname; // Remove item
_attachedItem = _itemVehClass createVehicle [0,0,0]; _attachedItem = _itemVehClass createVehicle [0,0,0];
_attachedItem attachTo _selfAttachPosition; _attachedItem attachTo [_unit, [-0.05, 0, 0.12], "rightshoulder"];
[_onAtachText] call EFUNC(common,displayTextStructured); if (!_silentScripted) then {
_attachToVehicle setVariable [QGVAR(Objects), [_attachedItem], true]; _unit removeItem _itemClassname; // Remove item
_attachToVehicle setVariable [QGVAR(ItemNames), [_itemClassname], true]; [_onAtachText] call EFUNC(common,displayTextStructured);
};
_unit setVariable [QGVAR(attached), [[_attachedItem, _itemClassname]], true];
} else { } else {
GVAR(placeAction) = PLACE_WAITING; GVAR(placeAction) = PLACE_WAITING;

View File

@ -17,14 +17,17 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_attachLimit", "_attachedObjects","_playerPos"];
params ["_attachToVehicle","_player","_args"]; params ["_attachToVehicle","_player","_args"];
_args params [["_itemClassname","", [""]]]; _args params [["_itemClassname","", [""]]];
TRACE_3("params",_attachToVehicle,_unit,_itemClassname); TRACE_3("params",_attachToVehicle,_player,_itemClassname);
private ["_attachLimit", "_attachedObjects"];
_attachLimit = [6, 1] select (_player == _attachToVehicle); _attachLimit = [6, 1] select (_player == _attachToVehicle);
_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; _attachedObjects = _attachToVehicle getVariable [QGVAR(attached), []];
_playerPos = (ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot")); ((_player == _attachToVehicle) || {canStand _player}) &&
{(_attachToVehicle distance _player) < 7} &&
(canStand _player) && {(_attachToVehicle distance _player) < 7} && {alive _attachToVehicle} && {(count _attachedObjects) < _attachLimit} && {_itemClassname in ((itemsWithMagazines _player) + [""])}; {alive _attachToVehicle} &&
{(count _attachedObjects) < _attachLimit} &&
{_itemClassname in ((itemsWithMagazines _player) + [""])};

View File

@ -16,25 +16,27 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_attachedObjects", "_inRange"];
params ["_attachToVehicle", "_unit"]; params ["_attachToVehicle", "_unit"];
TRACE_2("params",_attachToVehicle,_unit); TRACE_2("params",_attachToVehicle,_unit);
_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; if ((vehicle _unit) != _unit) exitWith {false};
_attachedList = _attachToVehicle getVariable [QGVAR(attached), []];
if ((count _attachedList) == 0) exitWith {false};
private ["_inRange"];
_inRange = false; _inRange = false;
if (_unit == _attachToVehicle) then { {
_inRange = count _attachedObjects > 0; _x params ["_xObject"];
} else { if (isNull _xObject) exitWith {
//Scan if unit is within range (using 2d distance) TRACE_1("Null attached",_x);
private ["_unitPos", "_objectPos"]; _attachedList deleteAt _forEachIndex;
_unitPos = getPos _unit; _attachToVehicle setVariable [QGVAR(attached), _attachedList, true];
_unitPos set [2,0]; };
{ if (((getPos _unit) distance2d (getPos _xObject)) < 4) exitWith {_inRange = true};
_objectPos = getPos _x; } forEach _attachedList;
_objectPos set [2, 0];
if (_objectPos distance _unitPos < 4) exitWith {_inRange = true};
} forEach _attachedObjects;
};
canStand _unit && {_inRange} && {alive _attachToVehicle} _inRange &&
{(_unit == _attachToVehicle) || {canStand _unit}} &&
{alive _attachToVehicle}

View File

@ -16,15 +16,12 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_attachedObjects", "_attachedItems", "_itemDisplayName",
"_attachedObject", "_attachedIndex", "_itemName", "_minDistance",
"_unitPos", "_objectPos"
];
params ["_attachToVehicle","_unit"], params ["_attachToVehicle","_unit"],
TRACE_2("params",_attachToVehicle,_unit); TRACE_2("params",_attachToVehicle,_unit);
_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; private ["_attachedList", "_itemDisplayName", "_attachedObject", "_attachedIndex", "_itemName", "_minDistance"];
_attachedItems = _attachToVehicle getVariable [QGVAR(ItemNames), []];
_attachedList = _attachToVehicle getVariable [QGVAR(attached), []];
_attachedObject = objNull; _attachedObject = objNull;
_attachedIndex = -1; _attachedIndex = -1;
@ -32,18 +29,17 @@ _itemName = "";
//Find closest attached object //Find closest attached object
_minDistance = 1000; _minDistance = 1000;
_unitPos = getPos _unit;
_unitPos set [2,0];
{ {
_objectPos = getPos _x; _x params ["_xObject", "_xItemName"];
_objectPos set [2, 0];
if (_objectPos distance _unitPos < _minDistance) then { if (((getPos _unit) distance2d (getPos _xObject)) < _minDistance) then {
_minDistance = _objectPos distance _unitPos; _minDistance = ((getPos _unit) distance2d (getPos _xObject));
_attachedObject = _x; _attachedObject = _xObject;
_itemName = _attachedItems select _forEachIndex; _itemName = _xItemName;
_attachedIndex = _forEachIndex; _attachedIndex = _forEachIndex;
}; };
} forEach _attachedObjects; } forEach _attachedList;
// Check if unit has an attached item // Check if unit has an attached item
if (isNull _attachedObject || {_itemName == ""}) exitWith {ERROR("Could not find attached object")}; if (isNull _attachedObject || {_itemName == ""}) exitWith {ERROR("Could not find attached object")};
@ -68,10 +64,8 @@ if (toLower _itemName in ["b_ir_grenade", "o_ir_grenade", "i_ir_grenade"]) then
}; };
// Reset unit variables // Reset unit variables
_attachedObjects deleteAt _attachedIndex; _attachedList deleteAt _attachedIndex;
_attachedItems deleteAt _attachedIndex; _attachToVehicle setVariable [QGVAR(attached), _attachedList, true];
_attachToVehicle setVariable [QGVAR(Objects), _attachedObjects, true];
_attachToVehicle setVariable [QGVAR(ItemNames), _attachedItems, true];
// Display message // Display message
_itemDisplayName = getText (configFile >> "CfgWeapons" >> _itemName >> "displayName"); _itemDisplayName = getText (configFile >> "CfgWeapons" >> _itemName >> "displayName");

View File

@ -0,0 +1,43 @@
/*
* Author: PabstMirror
* Handles when a unit gets in to a vehicle.
*
* Arguments:
* 0: vehicle <OBJECT>
* 1: dunno <OBJECT>
* 2: unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [car2, x, player] call ACE_attach_fnc_handleGetIn
*
* Public: No
*/
#include "script_component.hpp"
params ["", "", "_unit"];
TRACE_1("params",_unit);
if (!local _unit) exitWith {};
private ["_attachedList"];
_attachedList = _unit getVariable [QGVAR(attached), []];
if ((count _attachedList) == 0) exitWith {};
(_attachedList select 0) params ["_xObject"];
if (!isNull _xObject) then {
TRACE_1("detaching and moving attached light",_xObject);
detach _xObject;
_xObject setPos ((getPos _unit) vectorAdd [0, 0, -1000]);
[{
params ["_detachedLight"];
TRACE_1("delayed delete",_detachedLight);
deleteVehicle _detachedLight;
}, [_xObject], 2] call EFUNC(common,waitAndExecute);
(_attachedList select 0) set [0, objNull];
};
_unit setVariable [QGVAR(attached), _attachedList, true];

View File

@ -0,0 +1,35 @@
/*
* Author: PabstMirror
* Handles when a unit gets in to a vehicle.
*
* Arguments:
* 0: vehicle <OBJECT>
* 1: dunno <OBJECT>
* 2: unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [car2, x, player] call ACE_attach_fnc_handleGetOut
*
* Public: No
*/
#include "script_component.hpp"
params ["", "", "_unit"];
TRACE_1("params",_unit);
if (!local _unit) exitWith {};
private ["_attachedList"];
_attachedList = _unit getVariable [QGVAR(attached), []];
if ((count _attachedList) == 0) exitWith {};
(_attachedList select 0) params ["_xObject", "_xItemName"];
if (isNull _xObject) then {
TRACE_1("null attached when exiting vehicle, scripted reattach",_xItemName);
_unit setVariable [QGVAR(attached), [], true];
[_unit, _unit, _xItemName, true] call FUNC(attach);
};

View File

@ -0,0 +1,39 @@
/*
* Author: PabstMirror
* Handles when vehicle or man is killed.
* Note: Runs where unit is local.
*
* Arguments:
* 0: DeadVehicle <OBJECT>
*
* Return Value:
* None
*
* Example:
* [bob1] call ACE_attach_fnc_handleKilled
*
* Public: No
*/
#include "script_component.hpp"
params ["_deadUnit"];
TRACE_1("params",_deadUnit);
private ["_attachedList"];
_attachedList = _deadUnit getVariable [QGVAR(attached), []];
if ((count _attachedList) == 0) exitWith {};
{
_x params ["_xObject"];
TRACE_2("detaching",_xObject,_deadUnit);
detach _xObject;
//If it's a vehicle, also delete the attached
if (!(_deadUnit isKindOf "CAManBase")) then {
_xObject setPos ((getPos _deadUnit) vectorAdd [0, 0, -1000]);
[{deleteVehicle (_this select 0)}, [_xObject], 2] call EFUNC(common,waitAndExecute);
};
} forEach _attachedList;
_deadUnit setVariable [QGVAR(attached), nil, true];

View File

@ -25,7 +25,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_startingOffset", "_startDistanceFromCenter", "_closeInUnitVector", "_closeInMax", "_closeInMin", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_doesIntersect", "_startingPosShifted", "_startASL", "_endPosShifted", "_endASL", "_attachedObject", "_currentObjects", "_currentItemNames"]; private ["_startingOffset", "_startDistanceFromCenter", "_closeInUnitVector", "_closeInMax", "_closeInMin", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_doesIntersect", "_startingPosShifted", "_startASL", "_endPosShifted", "_endASL", "_attachedObject", "_attachList"];
params ["_unit", "_attachToVehicle", "_itemClassname", "_itemVehClass", "_onAtachText", "_startingPosition"]; params ["_unit", "_attachToVehicle", "_itemClassname", "_itemVehClass", "_onAtachText", "_startingPosition"];
TRACE_6("params",_unit,_attachToVehicle,_itemClassname,_itemVehClass,_onAtachText,_startingPosition); TRACE_6("params",_unit,_attachToVehicle,_itemClassname,_itemVehClass,_onAtachText,_startingPosition);
@ -87,12 +87,9 @@ _attachedObject attachTo [_attachToVehicle, _endPosTestOffset];
//Remove Item from inventory //Remove Item from inventory
_unit removeItem _itemClassname; _unit removeItem _itemClassname;
//Add Object to ACE_AttachedObjects and ACE_AttachedItemNames //Add Object to attached array
_currentObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; _attachList = _attachToVehicle getVariable [QGVAR(attached), []];
_currentObjects pushBack _attachedObject; _attachList pushBack [_attachedObject, _itemClassname];
_attachToVehicle setVariable [QGVAR(Objects), _currentObjects, true]; _attachToVehicle setVariable [QGVAR(attached), _attachList, true];
_currentItemNames = _attachToVehicle getVariable [QGVAR(ItemNames), []];
_currentItemNames pushBack _itemClassname;
_attachToVehicle setVariable [QGVAR(ItemNames), _currentItemNames, true];
[_onAtachText] call EFUNC(common,displayTextStructured); [_onAtachText] call EFUNC(common,displayTextStructured);

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="Attach"> <Package name="Attach">
<Key ID="STR_ACE_Attach_AttachDetach"> <Key ID="STR_ACE_Attach_AttachDetach">

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

@ -3,7 +3,6 @@
ADDON = false; ADDON = false;
PREP(backpackOpened); PREP(backpackOpened);
PREP(getBackpackAssignedUnit);
PREP(isBackpack); PREP(isBackpack);
PREP(onOpenInventory); PREP(onOpenInventory);

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,22 +0,0 @@
/*
* Author: commy2
*
* Returns the unit that has the given backpack object equipped.
*
* Argument:
* 0: Executing Unit (Object)
* 1: A backpack object (Object)
*
* Return value:
* Unit that has the backpack equipped. (Object)
*/
#include "script_component.hpp"
scopeName "main";
params ["_unit","_backpack"];
_target = objNull;
{
if (backpackContainer _x == _backpack) then {_target = _x; breakTo "main"};
} count nearestObjects [_unit, ["Man"], 5];
if (isNull _target) exitWith {ACE_Player};
_target

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 (typeName _backpack == "OBJECT") 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,26 +1,29 @@
/* /*
* Author: commy2 * Author: commy2
* Handle the open inventory event. Camshake and sound on target client.
* *
* Handle the open inventory event. Display message on traget 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"
private "_target"; params ["_unit", "_backpack"];
params ["","_backpack"];
// exit if the target is not a backpack // exit if the target is not a real backpack, i.e. parachute, static weapon bag etc.
if !([_backpack] call FUNC(isBackpack)) exitWith {}; if !([_backpack] call FUNC(isBackpack)) exitWith {false};
// get the unit that wears the backpack object // get the unit that wears the backpack object
_target = _this call FUNC(getBackpackAssignedUnit); private "_target";
_target = objectParent _backpack;
if (isNull _target) exitWith {false}; if (isNull _target) exitWith {false};
// raise event on target unit // raise event on target unit
["backpackOpened", _target, [_target, _backpack]] call EFUNC(common,targetEvent); ["backpackOpened", _target, [_target, _backpack]] call EFUNC(common,targetEvent);

View File

@ -6,23 +6,11 @@ class CfgAmmo {
timeToLive=6; timeToLive=6;
}; };
class B_20mm : BulletBase {
timeToLive=30;
};
class B_25mm : BulletBase {
timeToLive=30;
};
class B_35mm_AA : BulletBase {
timeToLive=30;
};
class B_30mm_AP : BulletBase {
timeToLive=30;
};
class B_556x45_Ball : BulletBase { class B_556x45_Ball : BulletBase {
airFriction=-0.00126466; airFriction=-0.00126466;
hit=8; hit=8;
typicalSpeed=750; typicalSpeed=750;
tracerScale = 1;
tracerStartTime=0.073; // M856 tracer burns out to 800m tracerStartTime=0.073; // M856 tracer burns out to 800m
tracerEndTime=1.57123; // Time in seconds calculated with ballistics calculator tracerEndTime=1.57123; // Time in seconds calculated with ballistics calculator
ACE_caliber=5.69; ACE_caliber=5.69;
@ -128,9 +116,13 @@ class CfgAmmo {
ACE_muzzleVelocities[]={785, 883, 925}; ACE_muzzleVelocities[]={785, 883, 925};
ACE_barrelLengths[]={254.0, 414.02, 508.0}; ACE_barrelLengths[]={254.0, 414.02, 508.0};
}; };
class B_56x15_dual: BulletBase {
tracerScale = 0.5;
};
class B_65x39_Caseless : BulletBase { class B_65x39_Caseless : BulletBase {
airFriction=-0.00075308; airFriction=-0.00075308;
typicalSpeed=800; typicalSpeed=800;
tracerScale = 1.1; //1.0;
ACE_caliber=6.706; ACE_caliber=6.706;
ACE_bulletLength=32.893; ACE_bulletLength=32.893;
ACE_bulletMass=7.9704; ACE_bulletMass=7.9704;
@ -180,10 +172,15 @@ class CfgAmmo {
ACE_muzzleVelocities[]={750, 820, 840, 852, 860}; ACE_muzzleVelocities[]={750, 820, 840, 852, 860};
ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4};
}; };
class SubmunitionBullet;
class B_65x39_Minigun_Caseless: SubmunitionBullet {
tracerScale = 1.1; //1.0;
};
class B_762x51_Ball : BulletBase { class B_762x51_Ball : BulletBase {
airFriction=-0.00100957; airFriction=-0.00100957;
typicalSpeed=833; typicalSpeed=833;
hit=9; hit=9;
tracerScale = 1.2; //0.6;
tracerStartTime=0.073; // Based on the British L5A1 which burns out to 1000m tracerStartTime=0.073; // Based on the British L5A1 which burns out to 1000m
tracerEndTime=2.15957; // Time in seconds calculated with ballistics calculator tracerEndTime=2.15957; // Time in seconds calculated with ballistics calculator
ACE_caliber=7.823; ACE_caliber=7.823;
@ -479,6 +476,7 @@ class CfgAmmo {
class B_9x21_Ball : BulletBase { class B_9x21_Ball : BulletBase {
airFriction=-0.00226847; airFriction=-0.00226847;
typicalSpeed=390; typicalSpeed=390;
tracerScale = 0.5;
hit=6; hit=6;
ACE_caliber=9.042; ACE_caliber=9.042;
ACE_bulletLength=15.494; ACE_bulletLength=15.494;
@ -491,6 +489,9 @@ class CfgAmmo {
ACE_muzzleVelocities[]={440, 460, 480}; ACE_muzzleVelocities[]={440, 460, 480};
ACE_barrelLengths[]={101.6, 127.0, 228.6}; ACE_barrelLengths[]={101.6, 127.0, 228.6};
}; };
class B_9x21_Ball_Tracer_Green: B_9x21_Ball {
tracerScale = 0.5;
};
class ACE_9x18_Ball_57N181S : B_9x21_Ball { class ACE_9x18_Ball_57N181S : B_9x21_Ball {
hit=5; hit=5;
airFriction=-0.00190333; airFriction=-0.00190333;
@ -584,6 +585,7 @@ class CfgAmmo {
timeToLive=10; timeToLive=10;
airFriction=-0.00038944; airFriction=-0.00038944;
typicalSpeed=910; typicalSpeed=910;
tracerScale = 1.3; //1.2;
ACE_caliber=10.363; ACE_caliber=10.363;
ACE_bulletLength=54.0; ACE_bulletLength=54.0;
ACE_bulletMass=26.568; ACE_bulletMass=26.568;
@ -670,9 +672,13 @@ class CfgAmmo {
ACE_muzzleVelocities[]={880, 915, 925}; ACE_muzzleVelocities[]={880, 915, 925};
ACE_barrelLengths[]={508.0, 660.4, 711.2}; ACE_barrelLengths[]={508.0, 660.4, 711.2};
}; };
class B_127x33_Ball: BulletBase {
tracerScale = 1.3; //1.2;
};
class B_127x54_Ball : BulletBase { class B_127x54_Ball : BulletBase {
airFriction=-0.00019268; airFriction=-0.00019268;
typicalSpeed=300; typicalSpeed=300;
tracerScale = 1.3;//
ACE_caliber=12.954; ACE_caliber=12.954;
ACE_bulletLength=64.516; ACE_bulletLength=64.516;
ACE_bulletMass=48.6; ACE_bulletMass=48.6;
@ -688,6 +694,7 @@ class CfgAmmo {
timeToLive=10; timeToLive=10;
airFriction=-0.00057503; airFriction=-0.00057503;
typicalSpeed=900; typicalSpeed=900;
tracerScale = 1.3; //1.2;
ACE_caliber=12.954; ACE_caliber=12.954;
ACE_bulletLength=58.674; ACE_bulletLength=58.674;
ACE_bulletMass=41.9256; ACE_bulletMass=41.9256;
@ -703,6 +710,7 @@ class CfgAmmo {
timeToLive=10; timeToLive=10;
airFriction=-0.00057503; airFriction=-0.00057503;
typicalSpeed=900; typicalSpeed=900;
tracerScale = 1.3;//
hit=25; hit=25;
caliber=4.0; caliber=4.0;
ACE_caliber=12.954; ACE_caliber=12.954;
@ -736,6 +744,7 @@ class CfgAmmo {
timeToLive=10; timeToLive=10;
airFriction=-0.00063800; airFriction=-0.00063800;
typicalSpeed=820; typicalSpeed=820;
tracerScale = 1.3; //1.5;
ACE_caliber=12.979; ACE_caliber=12.979;
ACE_bulletLength=64.008; ACE_bulletLength=64.008;
ACE_bulletMass=48.276; ACE_bulletMass=48.276;
@ -750,6 +759,7 @@ class CfgAmmo {
class B_45ACP_Ball : BulletBase { class B_45ACP_Ball : BulletBase {
airFriction=-0.00081221; airFriction=-0.00081221;
typicalSpeed=250; typicalSpeed=250;
tracerScale = 0.6;
ACE_caliber=11.481; ACE_caliber=11.481;
ACE_bulletLength=17.272; ACE_bulletLength=17.272;
ACE_bulletMass=14.904; ACE_bulletMass=14.904;
@ -761,4 +771,36 @@ class CfgAmmo {
ACE_muzzleVelocities[]={230, 250, 285}; ACE_muzzleVelocities[]={230, 250, 285};
ACE_barrelLengths[]={101.6, 127.0, 228.6}; ACE_barrelLengths[]={101.6, 127.0, 228.6};
}; };
class B_19mm_HE: BulletBase {
tracerScale = 1;
};
class B_30mm_HE: B_19mm_HE {
tracerScale = 2.5;
};
class B_20mm: BulletBase {
timeToLive=30;
tracerScale = 1.5; //1;
};
class B_25mm: BulletBase {
timeToLive=30;
tracerScale = 2.0; //1;
};
class B_30mm_AP: BulletBase {
timeToLive=30;
tracerScale = 2.5;
};
class B_35mm_AA: BulletBase {
timeToLive=30;
tracerScale = 2.75; //1.85;
};
class ShellBase;
class Sh_120mm_HE: ShellBase {
tracerScale = 3;
};
class Sh_120mm_APFSDS: ShellBase {
tracerScale = 3;
};
class Gatling_30mm_HE_Plane_CAS_01_F: BulletBase {
tracerScale = 2.5;
};
}; };

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="Ballistics"> <Package name="Ballistics">
<!-- MX --> <!-- MX -->
@ -1599,6 +1599,9 @@
<German>[ACE] Munitionskiste</German> <German>[ACE] Munitionskiste</German>
<Czech>[ACE] Bedna s municí</Czech> <Czech>[ACE] Bedna s municí</Czech>
<Portuguese>[ACE] Caixa com suprimentos de munição</Portuguese> <Portuguese>[ACE] Caixa com suprimentos de munição</Portuguese>
<French>[ACE] Caisse de munitions</French>
<Hungarian>[ACE] Lőszeres láda</Hungarian>
<Russian>[ACE] Ящик с боеприпасами</Russian>
</Key> </Key>
</Package> </Package>
</Project> </Project>

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

@ -18,6 +18,11 @@ class CfgMovesBasic {
default = "ACE_AmovPercMstpSsurWnonDnon"; default = "ACE_AmovPercMstpSsurWnonDnon";
PutDown = ""; PutDown = "";
}; };
class ACE_CivilHandCuffedFFVActions: ACE_CivilStandHandcuffedActions {
stop = "ACE_HandcuffedFFV";
StopRelaxed = "ACE_HandcuffedFFV";
default = "ACE_HandcuffedFFV";
};
}; };
}; };
@ -30,6 +35,12 @@ class CfgMovesMaleSdr: CfgMovesBasic {
class CutSceneAnimationBase; class CutSceneAnimationBase;
#define MACRO_ANIMATION \
head = "headDefault"; \
aimingBody = "aimingNo"; \
forceAim = 1; \
static = 1;
//Handcuffed Anims: //Handcuffed Anims:
class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase { class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase {
actions = "ACE_CivilStandHandcuffedActions"; actions = "ACE_CivilStandHandcuffedActions";
@ -40,6 +51,7 @@ class CfgMovesMaleSdr: CfgMovesBasic {
ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon",0.1}; ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon",0.1};
InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1};
canReload = 0; canReload = 0;
MACRO_ANIMATION
}; };
class ACE_AmovPercMstpScapWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { class ACE_AmovPercMstpScapWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon {
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease"; file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease";
@ -47,14 +59,25 @@ class CfgMovesMaleSdr: CfgMovesBasic {
ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1};
InterpolateTo[] = {"Unconscious",0.01}; InterpolateTo[] = {"Unconscious",0.01};
looped = 1; looped = 1;
MACRO_ANIMATION
}; };
class ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { class ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon {
actions = "CivilStandActions"; actions = "CivilStandActions";
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\amovpercmstpsnonwnondnon_easeout"; file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\amovpercmstpsnonwnondnon_easeout";
ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1};
InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1};
MACRO_ANIMATION
}; };
//Handcuffed-FFV:
class ACE_HandcuffedFFV: ACE_AmovPercMstpScapWnonDnon {
file = "\A3\cargoposes_F_heli\anim\passenger_flatground_3idleunarmed.rtm";
actions = "ACE_CivilHandCuffedFFVActions";
ConnectTo[] = {};
MACRO_ANIMATION
};
//Surrender Anims: //Surrender Anims:
class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon: CutSceneAnimationBase { class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon: CutSceneAnimationBase {
actions = "ACE_CivilStandSurrenderActions"; actions = "ACE_CivilStandSurrenderActions";
@ -65,6 +88,7 @@ class CfgMovesMaleSdr: CfgMovesBasic {
ConnectTo[] = {"ACE_AmovPercMstpSsurWnonDnon",0.1}; ConnectTo[] = {"ACE_AmovPercMstpSsurWnonDnon",0.1};
InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1};
canReload = 0; canReload = 0;
MACRO_ANIMATION
}; };
class ACE_AmovPercMstpSsurWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { class ACE_AmovPercMstpSsurWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon {
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon"; file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon";
@ -72,6 +96,7 @@ class CfgMovesMaleSdr: CfgMovesBasic {
looped = 1; looped = 1;
ConnectTo[] = {"ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; ConnectTo[] = {"ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1};
InterpolateTo[] = {"Unconscious",0.01}; InterpolateTo[] = {"Unconscious",0.01};
MACRO_ANIMATION
}; };
class ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { class ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon {
speed = 0.5; //for gameplay reasons, slow this down speed = 0.5; //for gameplay reasons, slow this down
@ -79,6 +104,7 @@ class CfgMovesMaleSdr: CfgMovesBasic {
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon";
ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1};
InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1}; InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1};
MACRO_ANIMATION
}; };
}; };
}; };

View File

@ -12,17 +12,17 @@ class CfgVehicles {
exceptions[] = {}; exceptions[] = {};
icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); icon = QUOTE(PATHTOF(UI\handcuff_ca.paa));
}; };
class ACE_RemoveHandcuffs {
displayName = CSTRING(ReleaseCaptive);
selection = "righthand";
distance = 2;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs));
exceptions[] = {};
icon = QUOTE(PATHTOF(UI\handcuff_ca.paa));
};
class ACE_MainActions { class ACE_MainActions {
class ACE_RemoveHandcuffs {
displayName = CSTRING(ReleaseCaptive);
selection = "righthand";
distance = 2;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs));
exceptions[] = {};
icon = QUOTE(PATHTOF(UI\handcuff_ca.paa));
};
class ACE_EscortCaptive { class ACE_EscortCaptive {
displayName = CSTRING(EscortCaptive); displayName = CSTRING(EscortCaptive);
distance = 4; distance = 4;
@ -97,7 +97,7 @@ class CfgVehicles {
}; };
}; };
#define MACRO_LOADUNLOADCAPTIVE \ #define MACRO_LOADCAPTIVE \
class ACE_Actions { \ class ACE_Actions { \
class ACE_MainActions { \ class ACE_MainActions { \
class GVAR(LoadCaptive) { \ class GVAR(LoadCaptive) { \
@ -113,27 +113,27 @@ class CfgVehicles {
class LandVehicle; class LandVehicle;
class Car: LandVehicle { class Car: LandVehicle {
MACRO_LOADUNLOADCAPTIVE MACRO_LOADCAPTIVE
}; };
class Tank: LandVehicle { class Tank: LandVehicle {
MACRO_LOADUNLOADCAPTIVE MACRO_LOADCAPTIVE
}; };
class Air; class Air;
class Helicopter: Air { class Helicopter: Air {
MACRO_LOADUNLOADCAPTIVE MACRO_LOADCAPTIVE
}; };
class Plane: Air { class Plane: Air {
MACRO_LOADUNLOADCAPTIVE MACRO_LOADCAPTIVE
}; };
class Ship; class Ship;
class Ship_F: Ship { class Ship_F: Ship {
MACRO_LOADUNLOADCAPTIVE MACRO_LOADCAPTIVE
}; };
class StaticWeapon: LandVehicle { class StaticWeapon: LandVehicle {
MACRO_LOADUNLOADCAPTIVE MACRO_LOADCAPTIVE
}; };
class Box_NATO_Support_F; class Box_NATO_Support_F;

View File

@ -6,12 +6,11 @@
if (isServer) then { if (isServer) then {
addMissionEventHandler ["HandleDisconnect", { addMissionEventHandler ["HandleDisconnect", {
PARAMS_1(_disconnectedPlayer); params ["_disconnectedPlayer"];
private "_escortedUnit"; private "_escortedUnit";
_escortedUnit = _disconnectedPlayer getVariable [QGVAR(escortedUnit), objNull]; _escortedUnit = _disconnectedPlayer getVariable [QGVAR(escortedUnit), objNull];
if ((!isNull _escortedUnit) && {(attachedTo _escortedUnit) == _disconnectedPlayer}) then { if ((!isNull _escortedUnit) && {(attachedTo _escortedUnit) == _disconnectedPlayer}) then {
detach _escortedUnit; detach _escortedUnit;
//systemChat "debug: DC detach";
}; };
if (_disconnectedPlayer getVariable [QGVAR(isEscorting), false]) then { if (_disconnectedPlayer getVariable [QGVAR(isEscorting), false]) then {
_disconnectedPlayer setVariable [QGVAR(isEscorting), false, true]; _disconnectedPlayer setVariable [QGVAR(isEscorting), false, true];
@ -19,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);
@ -28,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

@ -16,9 +16,9 @@ PREP(doFriskPerson);
PREP(doLoadCaptive); PREP(doLoadCaptive);
PREP(doRemoveHandcuffs); PREP(doRemoveHandcuffs);
PREP(doUnloadCaptive); PREP(doUnloadCaptive);
PREP(findEmptyNonFFVCargoSeat);
PREP(handleGetIn); PREP(handleGetIn);
PREP(handleGetOut); PREP(handleGetOut);
PREP(handleKilled);
PREP(handleOnUnconscious); PREP(handleOnUnconscious);
PREP(handlePlayerChanged); PREP(handlePlayerChanged);
PREP(handleRespawn); PREP(handleRespawn);

View File

@ -23,4 +23,9 @@ params ["_unit", "_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
{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

@ -11,28 +11,36 @@
* The return value <BOOL> * The return value <BOOL>
* *
* Example: * Example:
* [player, bob] call ACE_captives_fnc_canLoadCaptive * [player, bob, car] call ACE_captives_fnc_canLoadCaptive
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_objects"];
params ["_unit", "_target","_vehicle"]; params ["_unit", "_target","_vehicle"];
if (isNull _target) then { if ((isNull _target) && {_unit getVariable [QGVAR(isEscorting), false]}) then {
_objects = attachedObjects _unit; //Looking at a vehicle while escorting, get target from attached objects:
_objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); {
if ((count _objects) > 0) then {_target = _objects select 0;}; if (_x getVariable [QGVAR(isHandcuffed), false]) exitWith {
_target = _x;
};
} forEach (attachedObjects _unit);
}; };
if ((isNull _target) || {(vehicle _target) != _target} || {!(_target getVariable [QGVAR(isHandcuffed), false])}) exitWith {false};
if (isNull _vehicle) then { if (isNull _vehicle) then {
_objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10]; //Looking at a captive unit, search for nearby vehicles with valid seats:
if ((count _objects) > 0) then {_vehicle = _objects select 0;}; {
if ((_x emptyPositions "cargo") > 0) exitWith {
_vehicle = _x;
};
} forEach (nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10]);
} else {
//We have a vehicle picked, make sure it has empty seats:
if ((_vehicle emptyPositions "cargo") == 0) then {
_vehicle = objNull;
};
}; };
(!isNull _target) (!isNull _vehicle)
&& {!isNull _vehicle}
&& {_unit getVariable [QGVAR(isEscorting), false]}
&& {_target getVariable [QGVAR(isHandcuffed), false]}
&& {_vehicle emptyPositions "cargo" > 0}

View File

@ -20,4 +20,5 @@ params ["_unit", "_target"];
//Unit is handcuffed and not currently being escorted //Unit is handcuffed and not currently being escorted
_target getVariable [QGVAR(isHandcuffed), false] && _target getVariable [QGVAR(isHandcuffed), false] &&
{isNull (attachedTo _target)} {isNull (attachedTo _target)} &&
{(vehicle _target) == _target}

View File

@ -35,7 +35,9 @@ if (_state) then {
nil, 20, false, true, "", QUOTE(!isNull (GETVAR(_target,QGVAR(escortedUnit),objNull)))]; nil, 20, false, true, "", QUOTE(!isNull (GETVAR(_target,QGVAR(escortedUnit),objNull)))];
[{ [{
EXPLODE_3_PVT((_this select 0),_unit,_target,_actionID); params ["_args", "_pfID"];
_args params ["_unit", "_target", "_actionID"];
if (_unit getVariable [QGVAR(isEscorting), false]) then { if (_unit getVariable [QGVAR(isEscorting), false]) then {
if (!alive _target || {!alive _unit} || {!canStand _target} || {!canStand _unit} || {_target getVariable ["ACE_isUnconscious", false]} || {_unit getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo _unit)}) then { if (!alive _target || {!alive _unit} || {!canStand _target} || {!canStand _unit} || {_target getVariable ["ACE_isUnconscious", false]} || {_unit getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo _unit)}) then {
_unit setVariable [QGVAR(isEscorting), false, true]; _unit setVariable [QGVAR(isEscorting), false, true];

View File

@ -18,7 +18,6 @@
private ["_weapon", "_listedItemClasses", "_actions", "_allGear"]; private ["_weapon", "_listedItemClasses", "_actions", "_allGear"];
PARAMS_2(_player,_unit);
params ["_player", "_unit"]; params ["_player", "_unit"];
_weapon = currentWeapon _player; _weapon = currentWeapon _player;

View File

@ -1,6 +1,6 @@
/* /*
* Author: commy2 * Author: commy2
* Unit loads the target object into a vehicle. * Unit loads the target object into a vehicle. (logic same as canLoadCaptive)
* *
* Arguments: * Arguments:
* 0: Unit that wants to load a captive <OBJECT> * 0: Unit that wants to load a captive <OBJECT>
@ -17,24 +17,34 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private "_objects";
params ["_unit", "_target","_vehicle"]; params ["_unit", "_target","_vehicle"];
if (isNull _target) then { if ((isNull _target) && {_unit getVariable [QGVAR(isEscorting), false]}) then {
_objects = attachedObjects _unit; //Looking at a vehicle while escorting, get target from attached objects:
_objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); {
if ((count _objects) > 0) then {_target = _objects select 0;}; if (_x getVariable [QGVAR(isHandcuffed), false]) exitWith {
_target = _x;
};
} forEach (attachedObjects _unit);
}; };
if (isNull _target) exitWith {}; if ((isNull _target) || {(vehicle _target) != _target} || {!(_target getVariable [QGVAR(isHandcuffed), false])}) exitWith {ERROR("");};
if (isNull _vehicle) then { if (isNull _vehicle) then {
_objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10]; //Looking at a captive unit, search for nearby vehicles with valid seats:
if ((count _objects) > 0) then {_vehicle = _objects select 0;}; {
// if (([_x] call FUNC(findEmptyNonFFVCargoSeat)) != -1) exitWith {
if ((_x emptyPositions "cargo") > 0) exitWith {
_vehicle = _x;
};
} forEach (nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship"], 10]);
} else {
// if (([_vehicle] call FUNC(findEmptyNonFFVCargoSeat)) == -1) then {
if ((_vehicle emptyPositions "cargo") == 0) then {
_vehicle = objNull;
};
}; };
if (isNull _vehicle) exitWith {};
if ((!isNil "_target") && {!isNil "_vehicle"}) then { if (isNull _vehicle) exitWith {ERROR("");};
_unit setVariable [QGVAR(isEscorting), false, true];
["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); _unit setVariable [QGVAR(isEscorting), false, true];
}; ["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent);

View File

@ -0,0 +1,67 @@
/*
* Author: PabstMirror
* Finds a free cargo seat, searching non FFV first
*
* Arguments:
* 0: The Vehicle <OBJECT>
*
* Return Value:
* ARRAY [seat index <NUMBER>, is FFV <BOOL>]
*
* Example:
* [car1] call ACE_captives_fnc_findEmptyNonFFVCargoSeat
*
* Public: No
*/
#include "script_component.hpp"
params ["_vehicle"];
TRACE_1("params", _vehicle);
_vehicleConfig = configFile >> "CfgVehicles" >> (typeOf _vehicle);
_proxyOrder = getArray (_vehicleConfig >> "getInProxyOrder");
_transportSoldier = getNumber (_vehicleConfig >> "transportSoldier");
_realCargoCount = if (isArray (_vehicleConfig >> "getInProxyOrder")) then {count _proxyOrder} else {_transportSoldier};
//Find FFV turrets:
_ffvCargoIndexes = [];
{
_turretConfig = [_vehicleConfig, _x] call EFUNC(common,getTurretConfigPath);
_isCargoProxy = ((getText (_turretConfig >> "proxyType")) == "CPCargo") && {isNumber (_turretConfig >> "proxyIndex")};
if (_isCargoProxy) then {
_proxyCargoIndex = getNumber (_turretConfig >> "proxyIndex");
_cargoIndex = _proxyOrder find _proxyCargoIndex;
_ffvCargoIndexes pushBack _cargoIndex;
};
} forEach (allTurrets [_vehicle, true]);
//Find Empty Seats:
_occupiedSeats = [];
{
_x params ["", "", "_xIndex"];
if (_xIndex > -1) then {_occupiedSeats pushBack _xIndex;};
} forEach (fullCrew _vehicle);
TRACE_3("Searching for empty seat",_realCargoCount,_ffvCargoIndexes,_occupiedSeats);
_emptyCargoSeatReturn = [-1, false];
//First seach for non-ffv seats:
for "_index" from 0 to (_realCargoCount - 1) do {
if ((!(_index in _ffvCargoIndexes)) && {!(_index in _occupiedSeats)}) exitWith {
_emptyCargoSeatReturn = [_index, false];
};
};
//Only use FFV if none found:
if (_emptyCargoSeatReturn isEqualTo [-1, false]) then {
for "_index" from 0 to (_realCargoCount - 1) do {
if (!(_index in _occupiedSeats)) exitWith {
_emptyCargoSeatReturn = [_index, true];
};
};
};
_emptyCargoSeatReturn

View File

@ -4,8 +4,8 @@
* *
* Arguments: * Arguments:
* 0: _vehicle <OBJECT> * 0: _vehicle <OBJECT>
* 2: dunno <OBJECT> * 1: dunno <OBJECT>
* 1: _unit <OBJECT> * 2: _unit <OBJECT>
* *
* Return Value: * Return Value:
* The return value <BOOL> * The return value <BOOL>
@ -17,7 +17,8 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_vehicle", "_dontcare","_unit"]; params ["_vehicle", "","_unit"];
TRACE_2("params",_vehicle,_unit);
if (local _unit) then { if (local _unit) then {
if (_unit getVariable [QGVAR(isEscorting), false]) then { if (_unit getVariable [QGVAR(isEscorting), false]) then {
@ -25,6 +26,20 @@ 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 {
//Need to force animation for FFV turrets
_turretPath = [];
{
_x params ["_xUnit", "", "", "_xTurretPath"];
if (_unit == _xUnit) exitWith {_turretPath = _xTurretPath};
} forEach (fullCrew (vehicle _unit));
if (!(_turretPath isEqualTo [])) then {
TRACE_1("Setting FFV Handcuffed Animation",_turretPath);
[_unit, "ACE_HandcuffedFFV", 2] call EFUNC(common,doAnimation);
[_unit, "ACE_HandcuffedFFV", 1] call EFUNC(common,doAnimation);
};
}; };
}; };

View File

@ -4,8 +4,8 @@
* *
* Arguments: * Arguments:
* 0: _vehicle <OBJECT> * 0: _vehicle <OBJECT>
* 2: dunno <OBJECT> * 1: dunno <OBJECT>
* 1: _unit <OBJECT> * 2: _unit <OBJECT>
* *
* Return Value: * Return Value:
* The return value <BOOL> * The return value <BOOL>
@ -17,17 +17,21 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_vehicle", "_dontcare","_unit"]; params ["_vehicle", "", "_unit"];
TRACE_2("params",_vehicle,_unit);
if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then { if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then {
private ["_cargoIndex"]; private ["_cargoIndex"];
_cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1]; _cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1];
//If captive was not "unloaded", then move them back into the vehicle. if (_cargoIndex != -1) then {
if (_cargoIndex != -1) exitWith { //If captive was not "unloaded", then move them back into the vehicle.
TRACE_1("forcing back into vehicle",_cargoIndex);
_unit moveInCargo [_vehicle, _cargoIndex]; _unit moveInCargo [_vehicle, _cargoIndex];
} else {
//Getting out of vehicle:
[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation);
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
}; };
[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation);
}; };

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

@ -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 (_unit getVariable [QGVAR(isHandcuffed), false]) then { if (_respawn > 3) then {
_unit setVariable [QGVAR(isHandcuffed), false]; if (_unit getVariable [QGVAR(isHandcuffed), false]) then {
[_unit, true] call FUNC(setHandcuffed); _unit setVariable [QGVAR(isHandcuffed), false];
[_unit, true] call FUNC(setHandcuffed);
};
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
_unit setVariable [QGVAR(isSurrendering), false];
[_unit, true] call FUNC(setSurrendered);
};
} else { } else {
if (_unit getVariable [QGVAR(isHandcuffed), false]) then {
[_unit, false] call FUNC(setHandcuffed);
};
[_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus); [_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, false] call FUNC(setSurrendered);
[_unit, true] call FUNC(setSurrendered); };
} else {
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
if (_oldUnit getVariable [QGVAR(isEscorting), false]) then {
_oldUnit setVariable [QGVAR(isEscorting), false, true];
};
}; };

View File

@ -18,7 +18,7 @@
params ["_unit"]; params ["_unit"];
// prevent players from throwing grenades (added to all units) // prevent players from throwing grenades (added to all units)
[_unit, "Throw", {((_this select 1) getVariable [QGVAR(isHandcuffed), false]) || {(_this select 1) getVariable [QGVAR(isSurrendering), false]}}, {}] call EFUNC(common,addActionEventhandler); // [_unit, "Throw", {systemChat "a"; ((_this select 1) getVariable [QGVAR(isHandcuffed), false]) || {(_this select 1) getVariable [QGVAR(isSurrendering), false]}; true}, {systemChat "b";}] call EFUNC(common,addActionEventhandler);
if (local _unit) then { if (local _unit) then {
// reset status on mission start // reset status on mission start

View File

@ -26,11 +26,11 @@ if (!_activated) exitWith {};
if (local _logic) then { 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_1(_units); params ["_units"];
{ {
["SetSurrendered", [_x], [_x, true]] call EFUNC(common,targetEvent); ["SetSurrendered", [_x], [_x, true]] call EFUNC(common,targetEvent);
} forEach _units; } forEach _units;
}, [_units], 0.05, 0.05]call EFUNC(common,waitAndExecute); }, [_units], 0.05]call EFUNC(common,waitAndExecute);
deleteVehicle _logic; deleteVehicle _logic;
}; };

View File

@ -17,6 +17,7 @@
#include "script_component.hpp" #include "script_component.hpp"
params ["_unit","_state"]; 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");
@ -43,24 +44,47 @@ if (_state) then {
// fix anim on mission start (should work on dedicated servers) // fix anim on mission start (should work on dedicated servers)
[{ [{
params ["_unit"]; params ["_unit"];
if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then { if (!(_unit getVariable [QGVAR(isHandcuffed), false])) exitWith {};
if ((vehicle _unit) == _unit) then {
[_unit] call EFUNC(common,fixLoweredRifleAnimation); [_unit] call EFUNC(common,fixLoweredRifleAnimation);
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
} else {
[_unit, "ACE_HandcuffedFFV", 2] call EFUNC(common,doAnimation);
[_unit, "ACE_HandcuffedFFV", 1] call EFUNC(common,doAnimation);
};
//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";
_animChangedEHID = _unit addEventHandler ["AnimChanged", {
PARAMS_2(_unit,_newAnimation); _animChangedEHID = _unit addEventHandler ["AnimChanged", {
params ["_unit", "_newAnimation"];
TRACE_2("AnimChanged",_unit,_newAnimation);
if (_unit == (vehicle _unit)) then {
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then { if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
TRACE_1("Handcuff animation interrupted",_newAnimation); TRACE_1("Handcuff animation interrupted",_newAnimation);
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
}; };
}]; } else {
_unit setVariable [QGVAR(handcuffAnimEHID), _animChangedEHID];
}; _turretPath = [];
}, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute); {
_x params ["_xUnit", "", "", "_xTurretPath"];
if (_unit == _xUnit) exitWith {_turretPath = _xTurretPath};
} forEach (fullCrew (vehicle _unit));
TRACE_1("turret Path",_turretPath);
if (_turretPath isEqualTo []) exitWith {};
TRACE_1("Handcuff (FFV) animation interrupted",_newAnimation);
[_unit, "ACE_HandcuffedFFV", 2] call EFUNC(common,doAnimation);
[_unit, "ACE_HandcuffedFFV", 1] call EFUNC(common,doAnimation);
};
}];
TRACE_2("Adding animChangedEH",_unit,_animChangedEHID);
_unit setVariable [QGVAR(handcuffAnimEHID), _animChangedEHID];
}, [_unit], 0.01] call EFUNC(common,waitAndExecute);
} else { } else {
_unit setVariable [QGVAR(isHandcuffed), false, true]; _unit setVariable [QGVAR(isHandcuffed), false, true];
[_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus); [_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus);
@ -68,6 +92,7 @@ if (_state) then {
//remove AnimChanged EH //remove AnimChanged EH
private "_animChangedEHID"; private "_animChangedEHID";
_animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1]; _animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1];
TRACE_1("removing animChanged EH",_animChangedEHID);
_unit removeEventHandler ["AnimChanged", _animChangedEHID]; _unit removeEventHandler ["AnimChanged", _animChangedEHID];
_unit setVariable [QGVAR(handcuffAnimEHID), -1]; _unit setVariable [QGVAR(handcuffAnimEHID), -1];
@ -84,3 +109,6 @@ if (_state) then {
showHUD true; showHUD true;
}; };
}; };
//Global Event after changes:
["CaptiveStatusChanged", [_unit, _state, "SetHandcuffed"]] call EFUNC(common,globalEvent);

View File

@ -17,6 +17,7 @@
#include "script_component.hpp" #include "script_component.hpp"
params ["_unit","_state"]; 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");
@ -43,13 +44,13 @@ if (_state) then {
// fix anim on mission start (should work on dedicated servers) // fix anim on mission start (should work on dedicated servers)
[{ [{
PARAMS_1(_unit); params ["_unit"];
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";
_animChangedEHID = _unit addEventHandler ["AnimChanged", { _animChangedEHID = _unit addEventHandler ["AnimChanged", {
PARAMS_2(_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 {
TRACE_1("Surrender animation interrupted",_newAnimation); TRACE_1("Surrender animation interrupted",_newAnimation);
[_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation); [_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation);
@ -57,7 +58,7 @@ if (_state) then {
}]; }];
_unit setVariable [QGVAR(surrenderAnimEHID), _animChangedEHID]; _unit setVariable [QGVAR(surrenderAnimEHID), _animChangedEHID];
}; };
}, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute); }, [_unit], 0.01] call EFUNC(common,waitAndExecute);
} else { } else {
_unit setVariable [QGVAR(isSurrendering), false, true]; _unit setVariable [QGVAR(isSurrendering), false, true];
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
@ -85,8 +86,8 @@ if (_state) then {
//spin up a PFEH, to watching animationState for the next 20 seconds to make sure we don't enter "hands up" //spin up a PFEH, to watching animationState for the next 20 seconds to make sure we don't enter "hands up"
//Handles long animation chains //Handles long animation chains
[{ [{
PARAMS_2(_args,_pfID); params ["_args", "_pfID"];
EXPLODE_2_PVT(_args,_unit,_maxTime); _args params ["_unit", "_maxTime"];
//If waited long enough or they re-surrendered or they are unconscious, exit loop //If waited long enough or they re-surrendered or they are unconscious, exit loop
if ((ACE_time > _maxTime) || {_unit getVariable [QGVAR(isSurrendering), false]} || {_unit getVariable ["ACE_isUnconscious", false]}) exitWith { if ((ACE_time > _maxTime) || {_unit getVariable [QGVAR(isSurrendering), false]} || {_unit getVariable ["ACE_isUnconscious", false]}) exitWith {
[_pfID] call CBA_fnc_removePerFrameHandler; [_pfID] call CBA_fnc_removePerFrameHandler;
@ -100,3 +101,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

@ -16,11 +16,17 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_target","_vehicle"];
TRACE_2("params",_target,_vehicle);
private ["_cargoIndex"]; private ["_cargoIndex"];
params ["_target","_vehicle"]; _getSeat = [_vehicle] call FUNC(findEmptyNonFFVCargoSeat);
TRACE_1("free cargo seat",_getSeat);
_cargoIndex = _getSeat select 0;
if (_cargoIndex == -1) exitWith {ERROR("cargo index -1");};
_target moveInCargo [_vehicle, _cargoIndex];
_target assignAsCargoIndex [_vehicle, _cargoIndex];
_target moveInCargo _vehicle;
_target assignAsCargo _vehicle;
_cargoIndex = _vehicle getCargoIndex _target;
_target setVariable [QGVAR(CargoIndex), _cargoIndex, true]; _target setVariable [QGVAR(CargoIndex), _cargoIndex, true];

View File

@ -16,8 +16,11 @@
#include "script_component.hpp" #include "script_component.hpp"
params ["_unit"]; params ["_unit"];
TRACE_1("params",_unit);
_unit setVariable [QGVAR(CargoIndex), -1, true]; _unit setVariable [QGVAR(CargoIndex), -1, true];
moveOut _unit; moveOut _unit;
[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation);
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
unassignVehicle _unit; unassignVehicle _unit;

View File

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

View File

@ -164,6 +164,9 @@
<German>Einheit kapitulieren lassen</German> <German>Einheit kapitulieren lassen</German>
<Czech>Vzdávající se jednotka</Czech> <Czech>Vzdávající se jednotka</Czech>
<Portuguese>Fazer unidade se render</Portuguese> <Portuguese>Fazer unidade se render</Portuguese>
<French>Faire capituler l'unité</French>
<Hungarian>Egység kapitulálása</Hungarian>
<Russian>Сделать юнита пленным</Russian>
</Key> </Key>
<Key ID="STR_ACE_Captives_ModuleSurrender_Description"> <Key ID="STR_ACE_Captives_ModuleSurrender_Description">
<English>Sync a unit to make them surrender.&lt;br /&gt;Source: ace_captives</English> <English>Sync a unit to make them surrender.&lt;br /&gt;Source: ace_captives</English>
@ -172,6 +175,9 @@
<German>Einheit synchronisieren, um sie kapitulieren zu lassen.&lt;br /&gt;Quelle: ace_captives</German> <German>Einheit synchronisieren, um sie kapitulieren zu lassen.&lt;br /&gt;Quelle: ace_captives</German>
<Czech>Synchronizuj s jednotkou, která se má vzdát.&lt;br /&gt;Zdroj: ace_captives</Czech> <Czech>Synchronizuj s jednotkou, která se má vzdát.&lt;br /&gt;Zdroj: ace_captives</Czech>
<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>
<Hungarian>Egység szinkronizálása, hogy kapituláljon.&lt;br /&gt;Forrás: ace_captives</Hungarian>
<Russian>Синхронизируйте с юнитами, чтобы сделать их пленными.&lt;br /&gt;Источник: ace_captives</Russian>
</Key> </Key>
<Key ID="STR_ACE_Captives_ModuleSettings_DisplayName"> <Key ID="STR_ACE_Captives_ModuleSettings_DisplayName">
<English>Captives Settings</English> <English>Captives Settings</English>
@ -180,6 +186,9 @@
<Czech>Nastavení zajatce</Czech> <Czech>Nastavení zajatce</Czech>
<German>Gefangenen-Einstellungen</German> <German>Gefangenen-Einstellungen</German>
<Portuguese>Ajustes de prisioneiros</Portuguese> <Portuguese>Ajustes de prisioneiros</Portuguese>
<French>Options de capitulation</French>
<Hungarian>Fogoly-beállítások</Hungarian>
<Russian>Настройки пленения</Russian>
</Key> </Key>
<Key ID="STR_ACE_Captives_ModuleSettings_Description"> <Key ID="STR_ACE_Captives_ModuleSettings_Description">
<English>Controls settings for surrender and cable ties</English> <English>Controls settings for surrender and cable ties</English>
@ -188,6 +197,9 @@
<Czech>Toto kontroluje nastavení kapitulace a pout</Czech> <Czech>Toto kontroluje nastavení kapitulace a pout</Czech>
<German>Einstellungen zur Kapitulation und Kabelbindern</German> <German>Einstellungen zur Kapitulation und Kabelbindern</German>
<Portuguese>Controla as configurações de rendição e abraçadeiras</Portuguese> <Portuguese>Controla as configurações de rendição e abraçadeiras</Portuguese>
<French>Contrôle les paramètres de la rédition et des Serflex</French>
<Hungarian>Szabályozza a kapituláció és bilincselés beállításait</Hungarian>
<Russian>Управляет настройками сдачи в плен и связывания</Russian>
</Key> </Key>
<Key ID="STR_ACE_Captives_ModuleSettings_handcuffSide_name"> <Key ID="STR_ACE_Captives_ModuleSettings_handcuffSide_name">
<English>Can handcuff own side</English> <English>Can handcuff own side</English>
@ -196,6 +208,9 @@
<Czech>Může spoutat spolubojovníky</Czech> <Czech>Může spoutat spolubojovníky</Czech>
<German>Kann Teamkollegen fesseln</German> <German>Kann Teamkollegen 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>
<Hungarian>Saját oldal megbilincselhető</Hungarian>
<Russian>Связать союзника</Russian>
</Key> </Key>
<Key ID="STR_ACE_Captives_ModuleSettings_handcuffSide_description"> <Key ID="STR_ACE_Captives_ModuleSettings_handcuffSide_description">
<English>Can players cabletie units on their own side</English> <English>Can players cabletie units on their own side</English>
@ -204,6 +219,9 @@
<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>Können Spieler 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>
<Hungarian>A játékosok megkötözhetik-e a saját oldalukon lévő egységeket</Hungarian>
<Russian>Разрешить игрокам связывать юнитов своей стороны</Russian>
</Key> </Key>
<Key ID="STR_ACE_Captives_ModuleSettings_allowSurrender_name"> <Key ID="STR_ACE_Captives_ModuleSettings_allowSurrender_name">
<English>Allow surrendering</English> <English>Allow surrendering</English>
@ -212,6 +230,9 @@
<Czech>Povolit vzdávání</Czech> <Czech>Povolit vzdávání</Czech>
<German>Kapitulation erlauben</German> <German>Kapitulation erlauben</German>
<Portuguese>Permite rendição</Portuguese> <Portuguese>Permite rendição</Portuguese>
<French>Permettre la capitulation</French>
<Hungarian>Kapituláció engedélyezése</Hungarian>
<Russian>Сдаться в плен</Russian>
</Key> </Key>
<Key ID="STR_ACE_Captives_ModuleSettings_allowSurrender_description"> <Key ID="STR_ACE_Captives_ModuleSettings_allowSurrender_description">
<English>Players can surrender after holstering their weapon</English> <English>Players can surrender after holstering their weapon</English>
@ -220,22 +241,37 @@
<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>
<Hungarian>A játékosok megadhatják magukat a fegyverük elrakása után</Hungarian>
<Russian>Игроки могут сдаться в плен после того, как уберут оружие</Russian>
</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>
<Polish>Wymagaj kapitulacji</Polish> <Polish>Wymagaj kapitulacji</Polish>
<Portuguese>Requer rendição</Portuguese>
<Russian>Требовать пленения</Russian>
<Spanish>Requiere rendición</Spanish>
</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>
<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>
<Russian>Требуется, чтобы игрок сдался в плен прежде, чем его можно будет связать</Russian>
<Spanish>Requiere que los Jugadores se rindan antes de arrestarlos</Spanish>
</Key> </Key>
<Key ID="STR_ACE_Captives_SurrenderOnly"> <Key ID="STR_ACE_Captives_SurrenderOnly">
<English>Surrendering only</English> <English>Surrendering only</English>
<Polish>Tylko kapitulacja</Polish> <Polish>Tylko kapitulacja</Polish>
<Portuguese>Somente rendição </Portuguese>
<Russian>Только сдавшийся в плен</Russian>
<Spanish>Solo rendición</Spanish>
</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>
<Polish>Kapitulacja lub brak broni</Polish> <Polish>Kapitulacja lub brak broni</Polish>
<Portuguese>Rendição ou desarmado</Portuguese>
<Russian>Сдавшийся или безоружный</Russian>
<Spanish>Rendición o desarme</Spanish>
</Key> </Key>
</Package> </Package>
</Project> </Project>

View File

@ -4,91 +4,85 @@ class Extended_PreInit_EventHandlers {
}; };
}; };
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
class Extended_Killed_EventHandlers { class Extended_Killed_EventHandlers {
class All { class All {
init = QUOTE(call FUNC(handleDestroyed)); init = QUOTE(call FUNC(handleDestroyed));
}; };
}; };
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 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));
@ -106,4 +100,4 @@ class Extended_Init_EventHandlers {
init = QUOTE(_this call DFUNC(initObject)); init = QUOTE(_this call DFUNC(initObject));
}; };
}; };
}; };

View File

@ -10,6 +10,7 @@ class CfgVehicles {
isGlobal = 1; isGlobal = 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 +19,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 +40,7 @@ class CfgVehicles {
};*/ };*/
}; };
}; };
class Tank: LandVehicle { class Tank: LandVehicle {
GVAR(space) = 4; GVAR(space) = 4;
GVAR(hasCargo) = 1; GVAR(hasCargo) = 1;
@ -50,27 +52,154 @@ 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;
}; };
// 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 +218,18 @@ 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;
};
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 +238,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 +256,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 +308,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 +347,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 +382,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 +419,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);
@ -300,5 +448,4 @@ class CfgVehicles {
GVAR(size) = 1; GVAR(size) = 1;
GVAR(canLoad) = 1; GVAR(canLoad) = 1;
}; };
}; };

View File

@ -0,0 +1,5 @@
#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);

View File

@ -2,6 +2,7 @@
ADDON = false; ADDON = false;
PREP(addCargoItem);
PREP(canLoad); PREP(canLoad);
PREP(canLoadItemIn); PREP(canLoadItemIn);
PREP(canUnloadItem); PREP(canUnloadItem);
@ -21,8 +22,4 @@ PREP(validateCargoSpace);
GVAR(initializedItemClasses) = []; GVAR(initializedItemClasses) = [];
if (isServer) then {
["cargo_hideItem", {params ["_object", "_status"]; _object hideObjectGlobal _status;}] call EFUNC(common,addEventHandler);
};
ADDON = true; ADDON = true;

View File

@ -0,0 +1,41 @@
/*
* Author: Glowbal, Jonpas
* Adds a cargo item to the vehicle.
*
* Arguments:
* 0: Item Classname <STRING>
* 1: Vehicle <OBJECT>
* 2: Amount <NUMBER> (default: 1)
* 3: Show Hint <BOOL> (default: false)
*
* Return Value:
* None
*
* Example:
* ["item", vehicle] call ace_cargo_fnc_addCargoItem
*
* Public: No
*/
#include "script_component.hpp"
private ["_position", "_item", "_i"];
params ["_itemClass", "_vehicle", ["_amount", 1], ["_showHint", false, [false]] ];
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 {
_item = createVehicle [_itemClass, _position, [], 0, "CAN_COLLIDE"];
// Load item or delete it if no space left
if !([_item, _vehicle, _showHint] call FUNC(loadItem)) exitWith {
TRACE_1("no room to load item - deleting",_item);
deleteVehicle _item;
};
TRACE_1("Item Loaded",_item);
// Invoke listenable event
["cargoAddedByClass", [_itemClass, _vehicle, _amount]] call EFUNC(common,globalEvent);
};

View File

@ -18,6 +18,8 @@
params ["_player", "_object"]; params ["_player", "_object"];
if (!([_player, _object, []] call EFUNC(common,canInteractWith))) exitWith {false};
private ["_nearestVehicle"]; private ["_nearestVehicle"];
_nearestVehicle = [_player] call FUNC(findNearestVehicle); _nearestVehicle = [_player] call FUNC(findNearestVehicle);
@ -29,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

@ -19,7 +19,7 @@ private "_config";
params ["_item"]; params ["_item"];
_config = (configFile >> "CfgVehicles" >> typeof _item >> QGVAR(size)); _config = (configFile >> "CfgVehicles" >> typeOf _item >> QGVAR(size));
if (isNumber (_config)) exitWith { if (isNumber (_config)) exitWith {
_item getVariable [QGVAR(size), getNumber (_config)] _item getVariable [QGVAR(size), getNumber (_config)]

View File

@ -1,6 +1,6 @@
/* /*
* Author: Glowbal * Author: Glowbal
* Initializes vehicle, adds open caro menu action if available. * Initializes vehicle, adds open cargo menu action if available.
* *
* Arguments: * Arguments:
* 0: Vehicle <OBJECT> * 0: Vehicle <OBJECT>
@ -25,20 +25,12 @@ _initializedClasses = GETMVAR(GVAR(initializedClasses),[]);
if (isServer) then { if (isServer) then {
{ {
if (isClass _x) then { if (isClass _x) then {
private ["_className", "_amount","_position","_object"]; private ["_cargoClassname", "_cargoCount"];
_className = getText (_x >> "type"); _cargoClassname = getText (_x >> "type");
_amount = getNumber (_x >> "amount"); _cargoCount = getNumber (_x >> "amount");
_position = getPos _vehicle; TRACE_3("adding ACE_Cargo", (configName _x), _cargoClassname, _cargoCount);
_position set [1, (_position select 1) + 1]; ["AddCargoByClass", [_cargoClassname, _vehicle, _cargoCount]] call EFUNC(common,localEvent);
_position set [2, (_position select 2) + 7.5];
for "_i" from 1 to _amount do {
_object = createVehicle [_className, _position, [], 0, "CAN_COLLIDE"];
if !([_object, _vehicle] call FUNC(loadItem)) exitWith {
deleteVehicle _object;
};
};
}; };
nil
} count ("true" configClasses (configFile >> "CfgVehicles" >> _type >> "ACE_Cargo" >> "Cargo")); } count ("true" configClasses (configFile >> "CfgVehicles" >> _type >> "ACE_Cargo" >> "Cargo"));
}; };
@ -51,7 +43,10 @@ SETMVAR(GVAR(initializedClasses),_initializedClasses);
if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) exitWith {}; if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) exitWith {};
private ["_text", "_condition", "_statement", "_icon", "_action"]; private ["_text", "_condition", "_statement", "_icon", "_action"];
_condition = {GVAR(enable)}; _condition = {
params ["_target", "_player"];
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);};
_icon = ""; _icon = "";

View File

@ -5,6 +5,7 @@
* Arguments: * Arguments:
* 0: Object <OBJECT> * 0: Object <OBJECT>
* 1: Vehicle <OBJECT> * 1: Vehicle <OBJECT>
* 2: Show Hint <BOOL> (default: true)
* *
* Return value: * Return value:
* Object loaded <BOOL> * Object loaded <BOOL>
@ -18,20 +19,39 @@
private ["_loaded", "_space", "_itemSize"]; private ["_loaded", "_space", "_itemSize"];
params ["_item", "_vehicle"]; params ["_item", "_vehicle", ["_showHint", true, [true]] ];
TRACE_2("params",_item,_vehicle);
if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {false}; if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {
TRACE_2("canLoadItemIn failed",_item,_vehicle);
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];
detach _item; detach _item;
_item attachTo [_vehicle,[0,0,100]]; _item attachTo [_vehicle,[0,0,100]];
["cargo_hideItem", [_item, true]] call EFUNC(common,serverEvent); ["hideObjectGlobal", [_item, true]] call EFUNC(common,serverEvent);
// show hint
private ["_itemName", "_vehicleName"];
_itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName");
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
if (_showHint) then {
["displayTextStructured", [[localize LSTRING(LoadedItem), _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
};
// 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

@ -58,8 +58,19 @@ _vehicle setVariable [QGVAR(space), (_space + _itemSize), true];
detach _item; detach _item;
_item setPosASL (_emptyPos call EFUNC(common,PositiontoASL)); _item setPosASL (_emptyPos call EFUNC(common,PositiontoASL));
["cargo_hideItem", [_item, false]] call EFUNC(common,serverEvent); ["hideObjectGlobal", [_item, false]] call EFUNC(common,serverEvent);
// show hint
private ["_itemName", "_vehicleName"];
_itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName");
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
["displayTextStructured", [[localize LSTRING(UnloadedItem), _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
// TOOO maybe drag/carry the unloaded item? // TOOO maybe drag/carry the unloaded item?
// Invoke listenable event
["cargoUnloaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
true 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

@ -4,38 +4,96 @@
<Key ID="STR_ACE_Cargo_loadObject"> <Key ID="STR_ACE_Cargo_loadObject">
<English>Load</English> <English>Load</English>
<Polish>Załaduj</Polish> <Polish>Załaduj</Polish>
<Portuguese>Carregar</Portuguese>
<Russian>Загрузить</Russian>
<Czech>Naložit</Czech>
<Spanish>Cargar</Spanish>
</Key> </Key>
<Key ID="STR_ACE_Cargo_unloadObject"> <Key ID="STR_ACE_Cargo_unloadObject">
<English>Unload</English> <English>Unload</English>
<Polish>Wyładuj</Polish> <Polish>Wyładuj</Polish>
<Portuguese>Descarregar</Portuguese>
<Russian>Выгрузить</Russian>
<Czech>Vyložit</Czech>
<Spanish>Descargar</Spanish>
</Key> </Key>
<Key ID="STR_ACE_Cargo_openMenu"> <Key ID="STR_ACE_Cargo_openMenu">
<English>Cargo</English> <English>Cargo</English>
<Polish>Ładunek</Polish> <Polish>Ładunek</Polish>
<Portuguese>Carga</Portuguese>
<Russian>Грузовой отсек</Russian>
<Czech>Náklad</Czech>
<Spanish>Carga</Spanish>
</Key> </Key>
<Key ID="STR_ACE_Cargo_cargoMenu"> <Key ID="STR_ACE_Cargo_cargoMenu">
<English>Cargo Menu</English> <English>Cargo Menu</English>
<Polish>Menu ładunku</Polish> <Polish>Menu ładunku</Polish>
<Portuguese>Menu de carga</Portuguese>
<Russian>Грузовой отсек</Russian>
<Czech>Menu nákladu</Czech>
<Spanish>Menu de carga</Spanish>
</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>
<Polish>Pozostałe miejsce: %1</Polish> <Polish>Pozostałe miejsce: %1</Polish>
<Portuguese>Espaço de carga restante: %1</Portuguese>
<Russian>Осталось мест: %1</Russian>
<Czech>Volný prostor: %1</Czech>
<Spanish>Espacio de carga restante: %1</Spanish>
</Key> </Key>
<Key ID="STR_ACE_Cargo_ModuleSettings_enable"> <Key ID="STR_ACE_Cargo_ModuleSettings_enable">
<English>Enable Cargo</English> <English>Enable Cargo</English>
<Polish>Aktywuj cargo</Polish> <Polish>Aktywuj cargo</Polish>
<Portuguese>Ativar carga</Portuguese>
<Russian>Включить модуль перевозки грузов</Russian>
<Czech>Povolit náklad</Czech>
<Spanish>Habilitar carga</Spanish>
</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>
<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>
<Russian>Включает модуль погрузки и перевозки грузов</Russian>
<Spanish>Habilitar la carga en el módulo de carga</Spanish>
</Key> </Key>
<Key ID="STR_ACE_Cargo_SettingsModule_DisplayName"> <Key ID="STR_ACE_Cargo_SettingsModule_DisplayName">
<English>Cargo Settings</English> <English>Cargo Settings</English>
<Polish>Ustawienia cargo</Polish> <Polish>Ustawienia cargo</Polish>
<Portuguese>Preferências de carregamento</Portuguese>
<Russian>Перевозка грузов</Russian>
<Czech>Nastavení nákladu</Czech>
<Spanish>Ajustes de carga</Spanish>
</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>
<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>
<Russian>Конфигурирует настройки модуля перевозки грузов</Russian>
<Spanish>Configure los ajustes del módulo de carga</Spanish>
</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>Nezatížený&lt;br/&gt;%1 do&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>
</Package> </Package>
</Project> </Project>

View File

@ -140,4 +140,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

@ -1,62 +1,89 @@
// ACE - Common // ACE - Common
#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; local _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:
local _deleted = 0;
{
// 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 (_forEachIndex - _deleted);
_deleted = _deleted + 1;
(_x select 2) call (_x select 1);
};
} forEach 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];
@ -70,68 +97,102 @@
["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);
["assignTeam", {(_this select 0) assignTeam (_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),
call compile 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.");
// 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);
@ -142,225 +203,300 @@ call FUNC(checkFiles);
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:
GVAR(settingsInitFinished) = true;
ACE_LOGINFO_1("%1 delayed functions running.",count GVAR(runAtSettingsInitialized));
{
(_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) )];
[false] call FUNC(disableUserInput);
};
addMissionEventHandler ["Loaded", {[] spawn FUNC(mouseZHandler)}]; GVAR(ScrollWheelFrame) = diag_frameno;
[] spawn FUNC(mouseZHandler);
["mainDisplayLoaded", {
enableCamShake true;
// Set the name for the current player
["playerChanged", {
EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer);
if (alive _newPlayer) then {
[_newPlayer] call FUNC(setName)
};
if (alive _oldPlayer) then {
[_oldPlayer] call FUNC(setName)
};
}] call FUNC(addEventhandler);
GVAR(OldPlayerInventory) = [ACE_player] call FUNC(getAllGear);
GVAR(OldPlayerVisionMode) = currentVisionMode ACE_player;
GVAR(OldZeusDisplayIsOpen) = !(isNull findDisplay 312);
GVAR(OldCameraView) = cameraView;
GVAR(OldPlayerVehicle) = vehicle ACE_player;
GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
// PFH to raise varios events
[{
private ["_newCameraView", "_newInventoryDisplayIsOpen", "_newPlayerInventory", "_newPlayerTurret", "_newPlayerVehicle", "_newPlayerVisionMode", "_newPlayerWeapon", "_newZeusDisplayIsOpen"];
// "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
_newPlayerVisionMode = currentVisionMode ACE_player;
if !(_newPlayerVisionMode isEqualTo GVAR(OldPlayerVisionMode)) then {
// Raise ACE event locally
GVAR(OldPlayerVisionMode) = _newPlayerVisionMode;
["playerVisionModeChanged", [ACE_player, _newPlayerVisionMode]] call FUNC(localEvent);
};
// "inventoryDisplayChanged" event
_newInventoryDisplayIsOpen = !(isNull findDisplay 602);
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
GVAR(OldZeusDisplayIsOpen) = _newZeusDisplayIsOpen;
["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
_newPlayerVehicle = vehicle ACE_player;
if !(_newPlayerVehicle isEqualTo GVAR(OldPlayerVehicle)) then {
// Raise ACE event locally
GVAR(OldPlayerVehicle) = _newPlayerVehicle;
["playerVehicleChanged", [ACE_player, _newPlayerVehicle]] call FUNC(localEvent);
};
// "playerTurretChanged" event
_newPlayerTurret = [ACE_player] call FUNC(getTurretIndex);
if !(_newPlayerTurret isEqualTo GVAR(OldPlayerTurret)) then {
// Raise ACE event locally
GVAR(OldPlayerTurret) = _newPlayerTurret;
["playerTurretChanged", [ACE_player, _newPlayerTurret]] call FUNC(localEvent);
};
// "playerWeaponChanged" event
_newPlayerWeapon = currentWeapon ACE_player;
if (_newPlayerWeapon != GVAR(OldPlayerWeapon)) then {
// Raise ACE event locally
GVAR(OldPlayerWeapon) = _newPlayerWeapon;
["playerWeaponChanged", [ACE_player, _newPlayerWeapon]] call FUNC(localEvent);
};
}, 0, []] call CBA_fnc_addPerFrameHandler;
// PFH to raise camera created event. Only works on these cams by BI.
#define ALL_CAMERAS [ \
missionNamespace getVariable ["BIS_DEBUG_CAM", objNull], \
missionNamespace getVariable ["BIS_fnc_camera_cam", objNull], \
uiNamespace getVariable ["BIS_fnc_arsenal_cam", objNull], \
uiNamespace getVariable ["BIS_fnc_animViewer_cam", objNull], \
missionNamespace getVariable ["BIS_fnc_establishingShot_fakeUAV", objNull] \
]
GVAR(OldIsCamera) = false;
[{
// "activeCameraChanged" event
private ["_isCamera"];
_isCamera = {!isNull _x} count ALL_CAMERAS > 0;
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.
[QGVAR(StateArrested),false,true,QUOTE(ADDON)] call FUNC(defineVariable);
["displayTextStructured", FUNC(displayTextStructured)] call FUNC(addEventhandler);
["displayTextPicture", 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);
["notOnMap", {!visibleMap}] call FUNC(addCanInteractWithCondition);
["isNotInside", {
// Players can always interact with himself if not boarded
vehicle (_this select 0) == (_this select 0) ||
// Players can always interact with his vehicle
{vehicle (_this select 0) == (_this select 1)} ||
// 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)}}
}] call FUNC(addCanInteractWithCondition);
// Lastly, do JIP events
// JIP Detection and event trigger. Run this at the very end, just in case anything uses it
if(isMultiplayer && { ACE_time > 0 || isNull player } ) then {
// We are jipping! Get ready and wait, and throw the event
[{ [{
if(!(isNull player)) then { call FUNC(handleScrollWheelInit);
["PlayerJip", [player] ] call FUNC(localEvent); call FUNC(handleModifierKeyInit);
[(_this select 1)] call cba_fnc_removePerFrameHandler; }, [], 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; }, 0, []] call CBA_fnc_addPerFrameHandler;
}; };
call _fnc_initMainDisplayCheck;
// repeat this every time a savegame is loaded
addMissionEventHandler ["Loaded", _fnc_initMainDisplayCheck];
// @todo remove?
enableCamShake true;
//////////////////////////////////////////////////
// Eventhandler to set player names
//////////////////////////////////////////////////
// Set the name for the current player
["playerChanged", {
params ["_newPlayer","_oldPlayer"];
if (alive _newPlayer) then {
[_newPlayer] call FUNC(setName);
};
if (alive _oldPlayer) then {
[_oldPlayer] call FUNC(setName);
};
}] call FUNC(addEventhandler);
//////////////////////////////////////////////////
// Set up numerous eventhanders for player controlled units
//////////////////////////////////////////////////
// default variables
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(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
[{
BEGIN_COUNTER(stateChecker);
private "_data"; // reuse one variable to reduce number of variables that have to be set to private each frame
// "playerChanged" event
_data = call FUNC(player);
if !(_data isEqualTo ACE_player) then {
private "_oldPlayer";
_oldPlayer = ACE_player;
ACE_player = _data;
uiNamespace setVariable ["ACE_player", _data];
// Raise ACE event locally
["playerChanged", [ACE_player, _oldPlayer]] call FUNC(localEvent);
};
// "playerVehicleChanged" event
_data = vehicle ACE_player;
if !(_data isEqualTo GVAR(OldPlayerVehicle)) then {
// Raise ACE event locally
GVAR(OldPlayerVehicle) = _data;
["playerVehicleChanged", [ACE_player, _data]] call FUNC(localEvent);
};
// "playerTurretChanged" event
_data = [ACE_player] call FUNC(getTurretIndex);
if !(_data isEqualTo GVAR(OldPlayerTurret)) then {
// Raise ACE event locally
GVAR(OldPlayerTurret) = _data;
["playerTurretChanged", [ACE_player, _data]] call FUNC(localEvent);
};
// "playerWeaponChanged" event
_data = currentWeapon ACE_player;
if (_data != GVAR(OldPlayerWeapon)) then {
// Raise ACE event locally
GVAR(OldPlayerWeapon) = _data;
["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
_data = visibleMap;
if (!_data isEqualTo GVAR(OldVisibleMap)) then {
// Raise ACE event locally
GVAR(OldVisibleMap) = _data;
["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);
}, 0, []] call CBA_fnc_addPerFrameHandler;
//////////////////////////////////////////////////
// Eventhandlers for player controlled machines
//////////////////////////////////////////////////
// @todo still needed?
[QGVAR(StateArrested), false, true, QUOTE(ADDON)] call FUNC(defineVariable);
["displayTextStructured", {_this call FUNC(displayTextStructured)}] call FUNC(addEventhandler);
["displayTextPicture", {_this call FUNC(displayTextPicture)}] 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);
["isNotInside", {
params ["_unit", "_target"];
// Players can always interact with himself if not boarded
vehicle _unit == _unit ||
// Players can always interact with his vehicle
{vehicle _unit == _target} ||
// Players can always interact with passengers of the same vehicle
{_unit != _target && {vehicle _unit == vehicle _target}}
}] call FUNC(addCanInteractWithCondition);
//////////////////////////////////////////////////
// Set up PlayerJIP eventhandler
//////////////////////////////////////////////////
// Lastly, do JIP events
// 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 {
// We are jipping! Get ready and wait, and throw the event
[{
if(!isNull player && GVAR(settingsInitFinished)) then {
["PlayerJip", [player]] call FUNC(localEvent);
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
}, 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);
@ -369,7 +505,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);
@ -85,14 +79,6 @@ 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 +91,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 +106,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);
@ -135,7 +125,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);
@ -148,7 +137,6 @@ PREP(player);
PREP(playerSide); PREP(playerSide);
PREP(positionToASL); PREP(positionToASL);
PREP(progressBar); PREP(progressBar);
PREP(queueAnimation);
PREP(readSettingFromModule); PREP(readSettingFromModule);
PREP(receiveRequest); PREP(receiveRequest);
PREP(removeCanInteractWithCondition); PREP(removeCanInteractWithCondition);
@ -156,12 +144,12 @@ PREP(removeSpecificMagazine);
PREP(requestCallback); PREP(requestCallback);
PREP(resetAllDefaults); PREP(resetAllDefaults);
PREP(restoreVariablesJIP); PREP(restoreVariablesJIP);
PREP(revertKeyCodeLocalized); 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);
@ -187,6 +175,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);
@ -194,6 +183,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);
@ -215,10 +205,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,14 +223,14 @@ PREP(getDoorTurrets);
PREP(getTurretsFFV); PREP(getTurretsFFV);
PREP(getTurretsOther); PREP(getTurretsOther);
// 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);
@ -261,6 +253,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);
@ -284,26 +287,19 @@ 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;
//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) = [];
// @TODO: Generic local-managed global-synced objects (createVehicleLocal) GVAR(settingsInitFinished) = false;
GVAR(runAtSettingsInitialized) = [];
// @todo: Generic local-managed global-synced objects (createVehicleLocal)
//Debug //Debug
ACE_COUNTERS = []; ACE_COUNTERS = [];
@ -313,11 +309,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;
@ -331,7 +334,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;
@ -346,6 +353,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

@ -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,30 +44,31 @@ 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 {
_eventTargets = [_eventTargets]; _eventTargets = [_eventTargets];
}; };
//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);
}; };
_serverFlagged = false; _serverFlagged = false;
{ {
_owner = _x; _owner = _x;
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 { ACE_LOGERROR("Request for synced event - key not found.");
diag_log text format["[ACE] Error, 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,36 +1,40 @@
/* /*
* 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"];
if(!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { params ["_name", "_args", "_ttl"];
diag_log text format["[ACE] Error, synced event key not found."];
if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
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];
}; };
}; };
_eventCode = _internalData select 0; _eventCode = _internalData select 0;
_args call _eventCode; _args call _eventCode;

View File

@ -1,73 +1,66 @@
/* /*
* 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;
_action = _this select 1;
_condition = _this select 2;
_statement = _this select 3;
if (typeName _condition == "STRING") then { if (typeName _condition == "STRING") then {
_condition = compile _condition; _condition = compile _condition;
}; };
if (typeName _statement == "STRING") then { if (typeName _statement == "STRING") 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];
// 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 [
"[
'',
{if (inputAction '%1' == 0) exitWith {}; {if (_this call (_x select 0)) then {_this call (_x select 1)}} forEach (((_this select 0) getVariable '%2') select 1 select 2)},
nil,
-1,
false,
true,
'%1',
""if (_this != ACE_player || {vehicle _this != _target}) exitWith {false}; _actions = (_this getVariable '%2') select 1 select 2; _count = count _actions; _index = 0; _return = false; while {_index < _count && {!_return}} do {_return = [_target, _this] call ((_actions select _index) select 0); _index = _index + 1}; _return""
]",
_action,
_name
];
_addAction = call compile format [ _actionID = _unit addAction _addAction;
"[
'',
{if (inputAction '%1' == 0) exitWith {}; {if (_this call (_x select 0)) then {_this call (_x select 1)}} forEach (((_this select 0) getVariable '%2') select 1 select 2)},
nil,
-1,
false,
true,
'%1',
""if (_this != ACE_player || {vehicle _this != _target}) exitWith {false}; _actions = (_this getVariable '%2') select 1 select 2; _count = count _actions; _index = 0; _return = false; while {_index < _count && {!_return}} do {_return = [_target, _this] call ((_actions select _index) select 0); _index = _index + 1}; _return""
]",
_action,
_name
];
_actionID = _unit addAction _addAction;
}; };
_unit setVariable [_name, [_actionID, [_id, _actionIDs, _actions], _unit], false]; _unit setVariable [_name, [_actionID, [_id, _actionIDs, _actions], _unit], false];

View File

@ -1,29 +1,25 @@
/* /*
* 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 (isNil "_priority") then {_priority = 0};
if (typeName _condition == "STRING") then { if (typeName _condition == "STRING") then {
_condition = compile _condition; _condition = compile _condition;
@ -41,13 +37,16 @@ if (typeName _statement2 == "STRING") 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]];
@ -56,14 +55,14 @@ _actionIDs pushBack _id;
_addAction = call compile format [ _addAction = call compile format [
"[ "[
'%2', '%2',
{if (inputAction '%1' == 0) then {if (_this call (%3 select 2)) then {_this call (%3 select 3)}} else {_this call (%3 select 1)}}, {if (inputAction '%1' == 0) then {if (_this call (%3 select 2)) then {_this call (%3 select 3)}} else {_this call (%3 select 1)}},
nil, nil,
%4, %4,
false, false,
true, true,
'%1', '%1',
""if (_this != ACE_player || {vehicle _this != _target}) exitWith {false}; [_target, _this] call (%3 select 0)"" ""if (_this != ACE_player || {vehicle _this != _target}) exitWith {false}; [_target, _this] call (%3 select 0)""
]", ]",
_action, _action,
_displayName, _displayName,

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,9 +1,19 @@
// 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", {

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];
(GVAR(events) select 1) set[_eventNameCount, _eventFunctions]; _eventNames set [_eventNameCount, _eventName];
(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"
@ -45,4 +45,4 @@ if (isNil QGVAR(debugDrawHandler)) then {
drawLine3D [_p0, _p1, _x select 2]; drawLine3D [_p0, _p1, _x select 2];
} forEach GVAR(debugLines); } forEach GVAR(debugLines);
}]; }];
}; };

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 (typeName _statement == "STRING") 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 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.
* _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 (typeName _statement == "STRING") 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 (HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
if( (count _this) > 2) then { ACE_LOGERROR("Duplicate synced event creation.");
_ttl = _this select 2;
} else {
_ttl = 0;
};
if(HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
diag_log text format["[ACE] Error, 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 addWeaponCargoGlobal [_classname,1]; _unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
_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 addMagazineCargoGlobal [_classname, _ammoCount]; _unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
_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 addItemCargoGlobal [_classname,1]; _unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
_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,14 +1,15 @@
/* /*
* 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"
(sunOrMoon * sunOrMoon * (1 - overcast * 0.25) + (moonIntensity/5) * (1 - overcast)) min 1 (sunOrMoon * sunOrMoon * (1 - overcast * 0.25) + (moonIntensity / 5) * (1 - overcast)) min 1

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);

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