Skip to content

Commit

Permalink
Merge pull request #6 from CBATeam/master
Browse files Browse the repository at this point in the history
Update from original
  • Loading branch information
classicarma authored Apr 29, 2019
2 parents 3dd6c87 + 649445b commit 10a90d9
Show file tree
Hide file tree
Showing 152 changed files with 3,003 additions and 149 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ branches:
dist: trusty
language: python
python:
- '3.5'
- '3.6'
install: true
before_script:
- if [ -n "${GH_TOKEN}" ] && [ "${TRAVIS_BRANCH}" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Community Base Addons
[![](https://img.shields.io/travis/CBATeam/CBA_A3.svg?style=flat-square)](https://travis-ci.org/CBATeam/CBA_A3)
[![](https://img.shields.io/badge/Changelog-Link-orange.svg?style=flat-square)](https://github.com/CBATeam/CBA_A3/issues?q=is%3Aclosed+milestone%3A3.9.1)
[![](https://img.shields.io/badge/Release-3.9.1-blue.svg?style=flat-square)](https://github.com/CBATeam/CBA_A3/releases/tag/v3.9.1.181229)
[![](https://img.shields.io/badge/Changelog-Link-orange.svg?style=flat-square)](https://github.com/CBATeam/CBA_A3/issues?q=is%3Aclosed+milestone%3A3.10.1)
[![](https://img.shields.io/badge/Release-3.10.0-blue.svg?style=flat-square)](https://github.com/CBATeam/CBA_A3/releases/tag/v3.10.1.190316)
[![](https://img.shields.io/badge/Github-Wiki-lightgrey.svg?style=flat-square)](https://github.com/CBATeam/CBA_A3/wiki)
[![](https://img.shields.io/badge/BIF-Thread-lightgrey.svg?style=flat-square)](https://forums.bistudio.com/topic/168277-cba-community-base-addons-arma-3)
[![](https://img.shields.io/badge/Function-Documentation-yellow.svg?style=flat-square)](https://cbateam.github.io/CBA_A3/docs/files/overview-txt.html)
Expand Down
9 changes: 9 additions & 0 deletions addons/accessory/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<Polish>Community Base Addons - Funkcje Akcesoriów</Polish>
<French>Community Base Addons - Fonctions des accessoires</French>
<Turkish>Community Base Addons - Aksesuar Fonksiyonları</Turkish>
<Italian>Community Base Addons - Funzioni per Accessori</Italian>
</Key>
<Key ID="STR_CBA_accessory_railNext">
<English>Next rail item state</English>
Expand All @@ -22,6 +23,7 @@
<Polish>Następny tryb akcesoria na szynie</Polish>
<French>Mode de l'accessoire sur rail suivant</French>
<Turkish>Sonraki ray aksesuarı</Turkish>
<Italian>Stato successivo dell'oggetto sulla slitta</Italian>
</Key>
<Key ID="STR_CBA_accessory_railNext_tooltip">
<English>Cycles to the next mode available for your rail slot attachment</English>
Expand All @@ -33,6 +35,7 @@
<Polish>Przełącza na następny tryb akcesoria na szynie</Polish>
<French>Passe au prochain mode disponible de votre accessoire sur rail</French>
<Turkish>Ray aksesuarınızı sonraki moda geçirir</Turkish>
<Italian>Passa alla modalità successiva del tuo accessorio sulla slitta</Italian>
</Key>
<Key ID="STR_CBA_accessory_railPrev">
<English>Prev rail item state</English>
Expand All @@ -44,6 +47,7 @@
<Polish>Poprzedni tryb akcesoria na szynie</Polish>
<French>Mode de l'accessoire sur rail précèdent</French>
<Turkish>Önceki ray aksesuarı</Turkish>
<Italian>Stato precedente dell'oggetto sulla slitta</Italian>
</Key>
<Key ID="STR_CBA_accessory_railPrev_tooltip">
<English>Cycles to the previous mode available for your rail slot attachment</English>
Expand All @@ -55,6 +59,7 @@
<Polish>Przełącza na poprzedni tryb akcesoria na szynie</Polish>
<French>Passe au précèdent mode disponible de votre accessoire sur rail</French>
<Turkish>Ray aksesuarınızı önceki moda geçirir</Turkish>
<Italian>Passa alla modalità precedente del tuo accessorio sulla slitta</Italian>
</Key>
<Key ID="STR_CBA_accessory_opticNext">
<English>Next optics state</English>
Expand All @@ -66,6 +71,7 @@
<Polish>Następny tryb optyki</Polish>
<French>Mode de l'optique suivant</French>
<Turkish>Sonraki nişangah modu</Turkish>
<Italian>Stato successivo dell'ottica</Italian>
</Key>
<Key ID="STR_CBA_accessory_opticNext_tooltip">
<English>Cycles to the next mode available for your optics slot attachment</English>
Expand All @@ -77,6 +83,7 @@
<Polish>Przełącza na następny dostępny tryb optyki</Polish>
<French>Passe au prochain mode disponible de votre optique</French>
<Turkish>Varolan nişangahınızı sonraki moduna geçirir</Turkish>
<Italian>Passa alla modalità successiva della tua ottica</Italian>
</Key>
<Key ID="STR_CBA_accessory_opticPrev">
<English>Prev optics state</English>
Expand All @@ -88,6 +95,7 @@
<Polish>Poprzedni tryb optyki</Polish>
<French>Mode de l'optique sur rail précèdent</French>
<Turkish>Önceki nişangah modu</Turkish>
<Italian>Stato precedente dell'ottica</Italian>
</Key>
<Key ID="STR_CBA_accessory_opticPrev_tooltip">
<English>Cycles to the previous mode available for your optics slot attachment</English>
Expand All @@ -99,6 +107,7 @@
<Polish>Przełącza na poprzedni dostępny tryb optyki</Polish>
<French>Passe au précèdent mode disponible de votre optique</French>
<Turkish>Varolan nişangahınızı önceki moduna geçirir</Turkish>
<Italian>Passa alla modalità precedenta della tua ottica</Italian>
</Key>
</Package>
</Project>
3 changes: 3 additions & 0 deletions addons/ai/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class CfgVehicles {
class B_TargetSoldier;
class CBA_B_InvisibleTarget: B_TargetSoldier {
scope = 2;
scopeArsenal = 0;
model = QPATHTOF(InvisibleTarget.p3d);
icon = "CBA_iconInvisibleTarget";

Expand All @@ -11,6 +12,7 @@ class CfgVehicles {
class O_TargetSoldier;
class CBA_O_InvisibleTarget: O_TargetSoldier {
scope = 2;
scopeArsenal = 0;
model = QPATHTOF(InvisibleTarget.p3d);
icon = "CBA_iconInvisibleTarget";

Expand All @@ -20,6 +22,7 @@ class CfgVehicles {
class I_TargetSoldier;
class CBA_I_InvisibleTarget: I_TargetSoldier {
scope = 2;
scopeArsenal = 0;
model = QPATHTOF(InvisibleTarget.p3d);
icon = "CBA_iconInvisibleTarget";

Expand Down
1 change: 1 addition & 0 deletions addons/ai/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<French>Community Base Addons - Intelligence artificielle</French>
<Polish>Community Base Addons - Sztuczna Inteligencja</Polish>
<Turkish>Community Base Addons - Yapay Zeka</Turkish>
<Italian>Community Base Addons - Intelligenza Artificiale</Italian>
</Key>
</Package>
</Project>
1 change: 1 addition & 0 deletions addons/arrays/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<French>Community Base Addons - Tableaux</French>
<Polish>Community Base Addons - Tablice</Polish>
<Turkish>Community Base Addons - Diziler</Turkish>
<Italian>Community Base Addons - Array</Italian>
</Key>
</Package>
</Project>
1 change: 1 addition & 0 deletions addons/common/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class CfgFunctions {

class Inventory {
PATHTO_FNC(addWeapon);
PATHTO_FNC(addWeaponWithoutItems);
PATHTO_FNC(addMagazine);
PATHTO_FNC(addItem);
PATHTO_FNC(compatibleMagazines);
Expand Down
2 changes: 1 addition & 1 deletion addons/common/fnc_addPlayerAction.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Author:
*/

params ["_actionArray"];
TRACE_1(_this);
TRACE_1("",_this);

private _return = if (isDedicated) then {
WARNING("Function ran on a dedicated server. Function only usable on a client. Action: " + str _actionArray);
Expand Down
81 changes: 81 additions & 0 deletions addons/common/fnc_addWeaponWithoutItems.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#include "script_component.hpp"
/* ----------------------------------------------------------------------------
Function: CBA_fnc_addWeaponWithoutItems
Description:
Adds weapon to unit without attachments and without taking a magazine.
Does not work on vehicles.
Attempts to keep magazine ids for unrelated magazines.
Parameters:
_unit - Unit to add the weapon to <OBEJCT>
_weapon - Weapon to add <STRING>
Returns:
Nothing.
Examples:
(begin example)
[player, "arifle_mx_F"] CBA_fnc_addWeaponWithoutItems;
(end)
Author:
commy2
---------------------------------------------------------------------------- */

params ["_unit", "_weapon"];

// config case
private _compatibleMagazines = [_weapon, true] call CBA_fnc_compatibleMagazines;

private _uniform = uniformContainer _unit;
private _uniformMagazines = magazinesAmmoCargo _uniform select {
(_x select 0) in _compatibleMagazines // also config case
};

private _vest = vestContainer _unit;
private _vestMagazines = magazinesAmmoCargo _vest select {
(_x select 0) in _compatibleMagazines
};

private _backpack = backpackContainer _unit;
private _backpackMagazines = magazinesAmmoCargo _backpack select {
(_x select 0) in _compatibleMagazines
};

{
_unit removeMagazines _x;
} forEach _compatibleMagazines;

_unit addWeapon _weapon;

if (primaryWeapon _unit == _weapon) then {
removeAllPrimaryWeaponItems _unit;
};

if (secondaryWeapon _unit == _weapon) then {
// 'removeAllSecondaryWeaponItems' does not exist
{
_unit removeSecondaryWeaponItem _x;
} forEach secondaryWeaponItems _unit;
};

if (handgunWeapon _unit == _weapon) then {
removeAllHandgunItems _unit;
};

{
_x params ["_magazine", "_ammo"];
_uniform addMagazineAmmoCargo [_magazine, 1, _ammo];
} forEach _uniformMagazines;

{
_x params ["_magazine", "_ammo"];
_vest addMagazineAmmoCargo [_magazine, 1, _ammo];
} forEach _vestMagazines;

{
_x params ["_magazine", "_ammo"];
_backpack addMagazineAmmoCargo [_magazine, 1, _ammo];
} forEach _backpackMagazines;
40 changes: 25 additions & 15 deletions addons/common/fnc_compatibleMagazines.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Description:
Parameters:
_weapon - Weapon configName or config
_allMuzzles - Get magazines for all muzzles on this weapon (default: false)
Example:
(begin example)
Expand All @@ -22,33 +23,42 @@ Author:
---------------------------------------------------------------------------- */
SCRIPT(compatibleMagazines);

params [["_weapon", "", ["", configNull]]];
params [["_weapon", "", ["", configNull]], ["_allMuzzles", false, [false]]];

if (_weapon isEqualType "") then {
_weapon = configFile >> "CfgWeapons" >> _weapon;
};

private _cacheKey = str _weapon;
if (_cacheKey == "") exitWith { ERROR_1("Weapon Does Not Exist %1",_this); [] };

private _cacheKey = format ["%1#%2",_weapon,_allMuzzles];
if (isNil QGVAR(magNamespace)) then { GVAR(magNamespace) = call CBA_fnc_createNamespace; };

private _returnMags = GVAR(magNamespace) getVariable _cacheKey;

if (isNil "_returnMags") then {
_returnMags = getArray (_weapon >> "magazines");
{
private _wellConfig = configFile >> "CfgMagazineWells" >> _x;
if (_allMuzzles) then {
_returnMags = []; // get all mags from all muzzles
{
_returnMags append getArray _x;
} forEach configProperties [_wellConfig, "isArray _x", false];
} forEach (getArray (_weapon >> "magazineWell"));

private _cfgMagazines = configFile >> "CfgMagazines";
_returnMags = _returnMags select {isClass (_cfgMagazines >> _x)};
_returnMags = _returnMags apply {configName (_cfgMagazines >> _x)};
_returnMags = _returnMags arrayIntersect _returnMags;
if (_x == "this") then {
_returnMags append (_weapon call CBA_fnc_compatibleMagazines);
} else {
_returnMags append ((_weapon >> _x) call CBA_fnc_compatibleMagazines);
};
} forEach getArray (_weapon >> "muzzles");
_returnMags = _returnMags arrayIntersect _returnMags;
} else {
_returnMags = getArray (_weapon >> "magazines"); // get mags just for a specific muzzle
{
private _wellConfig = configFile >> "CfgMagazineWells" >> _x;
{
_returnMags append getArray _x;
} forEach configProperties [_wellConfig, "isArray _x", false];
} forEach (getArray (_weapon >> "magazineWell"));

private _cfgMagazines = configFile >> "CfgMagazines";
_returnMags = _returnMags select {isClass (_cfgMagazines >> _x)};
_returnMags = _returnMags apply {configName (_cfgMagazines >> _x)};
_returnMags = _returnMags arrayIntersect _returnMags;
};
GVAR(magNamespace) setVariable [_cacheKey, _returnMags];
};

Expand Down
2 changes: 1 addition & 1 deletion addons/common/fnc_getMuzzles.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Returns:
Examples:
(begin example)
_muzzles = "M4A1_RCO_GL" call CBA_fnc_determineMuzzles
_muzzles = "M4A1_RCO_GL" call CBA_fnc_getMuzzles
-> ["M4_ACOG_Muzzle", "M203Muzzle"]
(end)
Expand Down
2 changes: 1 addition & 1 deletion addons/common/fnc_removePlayerAction.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Author:
*/

params ["_actionIndex"];
TRACE_1(_this);
TRACE_1("",_this);

private _return = if (isDedicated) then {
WARNING("Function ran on a dedicated server. Function only usable on a client. Index was: " + str _actionIndex);
Expand Down
4 changes: 4 additions & 0 deletions addons/common/init_perFrameHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ GVAR(waitUntilAndExecArray) = [];

// per frame handler system
[QFUNC(onFrame), {
SCRIPT(onFrame);
private _tickTime = diag_tickTime;
call FUNC(missionTimePFH);

Expand Down Expand Up @@ -103,6 +104,7 @@ if (isMultiplayer) then {
if (isServer) then {
// multiplayer server
[QFUNC(missionTimePFH), {
SCRIPT(missionTimePFH_server);
if (time != GVAR(lastTime)) then {
CBA_missionTime = CBA_missionTime + (_tickTime - GVAR(lastTickTime));
GVAR(lastTime) = time; // used to detect paused game
Expand All @@ -126,6 +128,7 @@ if (isMultiplayer) then {
GVAR(lastTickTime) = diag_tickTime; // prevent time skip on clients

[QFUNC(missionTimePFH), {
SCRIPT(missionTimePFH_client);
if (time != GVAR(lastTime)) then {
CBA_missionTime = CBA_missionTime + (_tickTime - GVAR(lastTickTime));
GVAR(lastTime) = time; // used to detect paused game
Expand All @@ -148,6 +151,7 @@ if (isMultiplayer) then {
} else {
// single player
[QFUNC(missionTimePFH), {
SCRIPT(missionTimePFH_sp);
if (time != GVAR(lastTime)) then {
CBA_missionTime = CBA_missionTime + (_tickTime - GVAR(lastTickTime)) * accTime;
GVAR(lastTime) = time; // used to detect paused game
Expand Down
9 changes: 9 additions & 0 deletions addons/common/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,22 @@
<French>Community Base Addons - Composants communs</French>
<Polish>Community Base Addons - Ogólne Komponenty</Polish>
<Turkish>Community Base Addons - Ortak Bileşenler</Turkish>
<Italian>Community Base Addons - Componenti Comuni</Italian>
</Key>
<Key ID="STR_cba_common_need_mission_start">
<English>You must first start a mission.</English>
<German>Sie müssen zuerst eine Mission starten.</German>
<French>Vous devez d'abord commencer une mission.</French>
<Polish>Należy najpierw uruchomić misję.</Polish>
<Turkish>Önce bir görev başlatmalısınız.</Turkish>
<Japanese>ミッションを開始しておく必要があります。</Japanese>
<Italian>Prima deve far partire una missione.</Italian>
</Key>
<Key ID="STR_cba_common_WeaponsCategory">
<English>CBA Weapons</English>
<German>CBA Waffen</German>
<Polish>CBA Bronie</Polish>
<Italian>Armi CBA</Italian>
</Key>
</Package>
</Project>
Loading

0 comments on commit 10a90d9

Please sign in to comment.