Skip to content

Commit

Permalink
Merge pull request #4 from CBATeam/master
Browse files Browse the repository at this point in the history
Update from original
  • Loading branch information
classicarma authored May 6, 2018
2 parents f97f7b9 + b062cd5 commit f36d58a
Show file tree
Hide file tree
Showing 275 changed files with 3,304 additions and 2,208 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Community Base Addons
[![](https://travis-ci.org/CBATeam/CBA_A3.svg?style=flat-square)](https://travis-ci.org/CBATeam/CBA_A3)
[![](https://img.shields.io/badge/Changelog--orange.svg?style=flat-square)](https://github.com/CBATeam/CBA_A3/issues?q=milestone%3A3.4.1+is%3Aclosed)
[![](https://img.shields.io/badge/Release-3.4.1-blue.svg?style=flat-square)](https://github.com/CBATeam/CBA_A3/releases/tag/v3.4.1.170912)
[![](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=milestone%3A3.7+is%3Aclosed)
[![](https://img.shields.io/badge/Release-3.7.0-blue.svg?style=flat-square)](https://github.com/CBATeam/CBA_A3/releases/tag/v3.7.0.180430)
[![](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 All @@ -23,17 +23,17 @@ cba_diagnostic_enable_logging.pbo | Enables additional logging (Dev Tool)

### CBA Caching

CBA implements a cache for all `compile preProcessFile`'d scripts (incl `CfgFunctions`, BIS functions module, etc), and for all XEH events on `CfgVehicle` classes. This cache is stored in the `uiNamespace` and is therefore available throughout the whole lifetime of the running game (game start, till terminate game). Each class is only cached once, while mission and `campaignConfigfile` events are evaluated every mission, but also only once per `CfgVehicle` class.
CBA implements a cache for all `compile preProcessFile`'d scripts and for all XEH events on `CfgVehicle` classes. This cache is stored in the `uiNamespace` and is therefore available throughout the whole lifetime of the running game (game start, till terminate game). Each class is only cached once, while mission and `campaignConfigfile` events are evaluated every mission, but also only once per `CfgVehicle` class.

The performance gains are seen in feature rich mods like ACE3 which rely heavily on scripting to make their features possible.
Some of these functionalities cause long loading times for the game, switching missions, islands and switching from the editor back to the game.
After the first mission load functions will be cached and loading times for functions will be comparable with the vanilla game.
At the start of the game functions will be cached and loading times for functions will be comparable with the vanilla game.

`cba_cache_disable.pbo` is an optional addon that can disable this if you need it. However it makes mods slower by disabling CBA's function and script compilation cache, as well as the XEH cache. It is useful during development, since script changes will take effect without restarting the entire game.

## Known Issues

* CBA Keybindings require a mission to be initialized to function properly. This includes working in the main menu of Arma 3. Commandline parameters like `-world=empty` or `-skipIntro` will cause Keybinding to work ONLY in-game but NOT in the main menu.
* CBA Keybindings and Settings require a mission to be initialized to function properly. This includes working in the main menu of Arma 3. Commandline parameters like `-world=empty` or `-skipIntro` will cause Keybindings and Settings to work ONLY in-game but NOT in the main menu.

## License

Expand Down
8 changes: 4 additions & 4 deletions addons/accessory/XEH_preInitClient.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "XEH_PREP.sqf"

["CBA Accessory Functions", "MRT_SwitchItemNextClass_R", [localize LSTRING(railNext),localize LSTRING(railNext_tooltip)], {[1,"next"] call FUNC(switchAttachment)}, {}, [38, [false, true, false]]] call cba_fnc_addKeybind; //default ctrl + L
["CBA Accessory Functions", "MRT_SwitchItemPrevClass_R", [localize LSTRING(railPrev),localize LSTRING(railPrev_tooltip)], {[1,"prev"] call FUNC(switchAttachment)}, {}, [38, [true, false, false]]] call cba_fnc_addKeybind; //default shift + L
["CBA Accessory Functions", "MRT_SwitchItemNextClass_O", [localize LSTRING(opticNext),localize LSTRING(opticNext_tooltip)], {[2,"next"] call FUNC(switchAttachment)}, {}, [181, [false, true, false]]] call cba_fnc_addKeybind; //default ctlr + NUM-/
["CBA Accessory Functions", "MRT_SwitchItemPrevClass_O", [localize LSTRING(opticPrev),localize LSTRING(opticPrev_tooltip)], {[2,"prev"] call FUNC(switchAttachment)}, {}, [181, [true, false, false]]] call cba_fnc_addKeybind; //default shift + NUM-/
["CBA Accessory Functions", "MRT_SwitchItemNextClass_R", [LSTRING(railNext), LSTRING(railNext_tooltip)], {[1, "next"] call FUNC(switchAttachment)}, {}, [38, [false, true, false]]] call CBA_fnc_addKeybind; //default ctrl + L
["CBA Accessory Functions", "MRT_SwitchItemPrevClass_R", [LSTRING(railPrev), LSTRING(railPrev_tooltip)], {[1, "prev"] call FUNC(switchAttachment)}, {}, [38, [true, false, false]]] call CBA_fnc_addKeybind; //default shift + L
["CBA Accessory Functions", "MRT_SwitchItemNextClass_O", [LSTRING(opticNext), LSTRING(opticNext_tooltip)], {[2, "next"] call FUNC(switchAttachment)}, {}, [181, [false, true, false]]] call CBA_fnc_addKeybind; //default ctlr + NUM-/
["CBA Accessory Functions", "MRT_SwitchItemPrevClass_O", [LSTRING(opticPrev), LSTRING(opticPrev_tooltip)], {[2, "prev"] call FUNC(switchAttachment)}, {}, [181, [true, false, false]]] call CBA_fnc_addKeybind; //default shift + NUM-/
2 changes: 1 addition & 1 deletion addons/accessory/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CfgPatches {
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"CBA_main"};
authors[] = {"da12thMonkey","Robalo","Tupolov"};
authors[] = {"da12thMonkey", "Robalo", "Tupolov"};
version = VERSION;
versionDesc = "MRT Attachment Functions";
};
Expand Down
8 changes: 4 additions & 4 deletions addons/accessory/fnc_switchAttachment.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Author:
---------------------------------------------------------------------------- */
#include "script_component.hpp"

params ["_itemType","_switchTo"];
params ["_itemType", "_switchTo"];

private ["_currWeaponType","_currItem","_switchItem"];
private ["_currWeaponType", "_currItem", "_switchItem"];
private _unit = call CBA_fnc_currentUnit;
private _cw = currentWeapon _unit;

Expand Down Expand Up @@ -67,9 +67,9 @@ if (!isNil "_switchItem") then {
_unit addSecondaryWeaponItem _switchItem;
};
};
private _switchItemHintText = (__cfgWeapons >> _switchItem >> "MRT_SwitchItemHintText") call bis_fnc_getcfgdata;
private _switchItemHintText = (__cfgWeapons >> _switchItem >> "MRT_SwitchItemHintText") call BIS_fnc_getCfgData;
if (!isNil "_switchItemHintText") then {
hintSilent format ["%1",_switchItemHintText];
hintSilent format ["%1", _switchItemHintText];
};
playSound "click";
["CBA_attachmentSwitched", [_unit, _currItem, _switchItem, _currWeaponType]] call CBA_fnc_localEvent;
Expand Down
9 changes: 9 additions & 0 deletions addons/accessory/script_component.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
#define COMPONENT accessory
#include "\x\cba\addons\main\script_mod.hpp"

#ifdef DEBUG_ENABLED_ACCESSORY
#define DEBUG_MODE_FULL
#endif

#ifdef DEBUG_SETTINGS_ACCESSORY
#define DEBUG_SETTINGS DEBUG_SETTINGS_ACCESSORY
#endif

#include "\x\cba\addons\main\script_macros.hpp"
9 changes: 9 additions & 0 deletions addons/accessory/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,63 @@
<Japanese>Community Base Addons - アクセサリー機能</Japanese>
<Chinese>社群基礎模組 - 附件功能</Chinese>
<Chinesesimp>社群基础模组 - 附件功能</Chinesesimp>
<Russian>Community Base Addons - Функционал Аксессуаров</Russian>
</Key>
<Key ID="STR_CBA_accessory_railNext">
<English>Next rail item state</English>
<Japanese>レイル アイテムを次モード</Japanese>
<Chinese>下個導軌物品狀態</Chinese>
<Chinesesimp>下个导轨物品状态</Chinesesimp>
<Russian>Следующее состояние приспособления на оружии</Russian>
</Key>
<Key ID="STR_CBA_accessory_railNext_tooltip">
<English>Cycles to the next mode available for your rail slot attachment</English>
<Japanese>アタッチメントのレイル アイテムを次のモードに変更します</Japanese>
<Chinese>循環切換到下個可用的導軌物品模式</Chinese>
<Chinesesimp>循环切换到下个可用的导轨物品模式</Chinesesimp>
<Russian>Переключает на следующий режим, доступный для приспособления на планке</Russian>
</Key>
<Key ID="STR_CBA_accessory_railPrev">
<English>Prev rail item state</English>
<Japanese>レイル アイテムを前モード</Japanese>
<Chinese>上個導軌物品狀態</Chinese>
<Chinesesimp>上个导轨物品状态</Chinesesimp>
<Russian>Предыдущее состояние приспособления на планке</Russian>
</Key>
<Key ID="STR_CBA_accessory_railPrev_tooltip">
<English>Cycles to the previous mode available for your rail slot attachment</English>
<Japanese>アタッチメントのレイル アイテムを前のモードに変更します</Japanese>
<Chinese>循環切換到上個可用的導軌物品模式</Chinese>
<Chinesesimp>循环切换到上个可用的导轨物品模式</Chinesesimp>
<Russian>Переключает на предыдущий режим, доступный для приспособления на планке</Russian>
</Key>
<Key ID="STR_CBA_accessory_opticNext">
<English>Next optics state</English>
<Japanese>照準器を次モード</Japanese>
<Chinese>下個瞄鏡模式</Chinese>
<Chinesesimp>下个瞄镜模式</Chinesesimp>
<Russian>Следующий режим оптики</Russian>
</Key>
<Key ID="STR_CBA_accessory_opticNext_tooltip">
<English>Cycles to the next mode available for your optics slot attachment</English>
<Japanese>アタッチメントの照準器アイテムを次のモードに変更します</Japanese>
<Chinese>循環切換到下個可用的瞄鏡模式</Chinese>
<Chinesesimp>循环切换到下个可用的瞄镜模式</Chinesesimp>
<Russian>Переключает на следующий режим доступный для оптики на оружии</Russian>
</Key>
<Key ID="STR_CBA_accessory_opticPrev">
<English>Prev optics state</English>
<Japanese>照準器を前モード</Japanese>
<Chinese>上個瞄鏡模式</Chinese>
<Chinesesimp>上个瞄镜模式</Chinesesimp>
<Russian>Предыдущее состояние оптики</Russian>
</Key>
<Key ID="STR_CBA_accessory_opticPrev_tooltip">
<English>Cycles to the previous mode available for your optics slot attachment</English>
<Japanese>アタッチメントの照準器アイテムを前のモードに変更します</Japanese>
<Chinese>循環切換到上個可用的瞄鏡模式</Chinese>
<Chinesesimp>循环切换到上个可用的瞄镜模式</Chinesesimp>
<Russian>Переключает на предыдущий режим доступный для оптики на оружии</Russian>
</Key>
</Package>
</Project>
63 changes: 10 additions & 53 deletions addons/ai/CfgFunctions.hpp
Original file line number Diff line number Diff line change
@@ -1,56 +1,13 @@
// -----------------------------------------------------------------------------
// Automatically generated by 'functions_config.rb'
// DO NOT MANUALLY EDIT THIS FILE!
// -----------------------------------------------------------------------------

class CfgFunctions
{
class CBA
{
class Ai
{
// CBA_fnc_addWaypoint
class addWaypoint
{
description = "A function used to add a waypoint to a group. Parameters: - Group (Group or Object) - Position (XYZ, Object, Location or Group) Optional: - Radius (Scalar) - Waypoint Type (String) - Behaviour (String) - Combat Mode (String) - Speed Mode (String) - Formation (String) - Code To Execute at Each Waypoint (String) - TimeOut at each Waypoint (Array [Min, Med, Max]) - Waypoint Completion Radius (Scalar) Example: [this, this, 300, ""MOVE"", ""AWARE"", ""YELLOW"", ""FULL"", ""STAG COLUMN"", ""this spawn CBA_fnc_searchNearby"", [3,6,9]] Returns: Waypoint Author: Rommel";
file = "\x\cba\addons\ai\fnc_addWaypoint.sqf";
};
// CBA_fnc_clearWaypoints
class clearWaypoints
{
description = "A function used to correctly clear all waypoints from a group.";
file = "\x\cba\addons\ai\fnc_clearWaypoints.sqf";
};
// CBA_fnc_searchNearby
class searchNearby
{
description = "A function for a group to search a nearby building. Parameters: Group (Group or Object) Example: [group player] spawn CBA_fnc_searchNearby Returns: Nil Author: Rommel";
file = "\x\cba\addons\ai\fnc_searchNearby.sqf";
};
// CBA_fnc_taskAttack
class taskAttack
{
description = "A function for a group to attack a parsed location. Parameters: - Group (Group or Object) - Position (XYZ, Object, Location or Group) Optional: - Search Radius (Scalar) Example: [group player, getpos (player findNearestEnemy player), 100] call CBA_fnc_taskAttack Returns: Nil Author: Rommel";
file = "\x\cba\addons\ai\fnc_taskAttack.sqf";
};
// CBA_fnc_taskDefend
class taskDefend
{
description = "A function for a group to defend a parsed location. Groups will mount nearby static machine guns, and bunker in nearby buildings. They may also patrol the radius unless otherwise specified. Parameters: - Group (Group or Object) Optional: - Position (XYZ, Object, Location or Group) - Defend Radius (Scalar) - Building Size Threshold (Integer, default 2) - Can patrol (boolean) Example: [this] call CBA_fnc_taskDefend Returns: Nil Author: Rommel";
file = "\x\cba\addons\ai\fnc_taskDefend.sqf";
};
// CBA_fnc_taskPatrol
class taskPatrol
{
description = "A function for a group to randomly patrol a parsed radius and location. Parameters: - Group (Group or Object) Optional: - Position (XYZ, Object, Location or Group) - Radius (Scalar) - Waypoint Count (Scalar) - Waypoint Type (String) - Behaviour (String) - Combat Mode (String) - Speed Mode (String) - Formation (String) - Code To Execute at Each Waypoint (String) - TimeOut at each Waypoint (Array [Min, Med, Max]) Example: [this, getmarkerpos ""objective1""] call CBA_fnc_taskPatrol [this, this, 300, 7, ""MOVE"", ""AWARE"", ""YELLOW"", ""FULL"", ""STAG COLUMN"", ""this spawn CBA_fnc_searchNearby"", [3,6,9]] call CBA_fnc_taskPatrol;";
file = "\x\cba\addons\ai\fnc_taskPatrol.sqf";
};
// CBA_fnc_taskSearchArea
class taskSearchArea
{
description = "A function used to have AI search a given marker or trigger area indefinitely. Includes random building searches.";
file = "\x\cba\addons\ai\fnc_taskSearchArea.sqf";
};
class CfgFunctions {
class CBA {
class Ai {
PATHTO_FNC(addWaypoint);
PATHTO_FNC(clearWaypoints);
PATHTO_FNC(searchNearby);
PATHTO_FNC(taskAttack);
PATHTO_FNC(taskDefend);
PATHTO_FNC(taskPatrol);
PATHTO_FNC(taskSearchArea);
};
};
};
1 change: 0 additions & 1 deletion addons/ai/CfgWaypoints.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

class CfgWaypoints {
class A3 { // called "Advanced"
class CBA_Task_Garrison {
Expand Down
2 changes: 1 addition & 1 deletion addons/ai/fnc_addWaypoint.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Optional:
Example:
(begin example)
[this, this, 300, "MOVE", "AWARE", "YELLOW", "FULL", "STAG COLUMN", "this spawn CBA_fnc_searchNearby", [3,6,9]] call CBA_fnc_addWaypoint
[this, this, 300, "MOVE", "AWARE", "YELLOW", "FULL", "STAG COLUMN", "this spawn CBA_fnc_searchNearby", [3, 6, 9]] call CBA_fnc_addWaypoint
(end)
Returns:
Expand Down
4 changes: 2 additions & 2 deletions addons/ai/fnc_clearWaypoints.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ Author:
---------------------------------------------------------------------------- */
#include "script_component.hpp"
params [["_group", grpNull, [grpNull,objNull]]];
params [["_group", grpNull, [grpNull, objNull]]];
_group = _group call CBA_fnc_getGroup;

private _waypoints = waypoints _group;
{
// Waypoint index changes with each deletion, so don't delete _x
deleteWaypoint [_group,0];
deleteWaypoint [_group, 0];
} forEach _waypoints;

// Create a self-deleting waypoint at the leader position to halt all planned movement (based on old waypoints)
Expand Down
9 changes: 4 additions & 5 deletions addons/ai/fnc_searchNearby.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ if !(local _group) exitWith {}; // Don't create waypoints on each machine
private _building = nearestBuilding (leader _group);
if ((leader _group) distanceSqr _building > 250e3) exitwith {};

[_group,_building] spawn {
params ["_group","_building"];
[_group, _building] spawn {
params ["_group", "_building"];
private _leader = leader _group;

// Add a waypoint to regroup after the search
_group lockWP true;
private _wp = _group addWaypoint [getPos _leader, 0, currentWaypoint _group];
private _cond = "({unitReady _x || !(alive _x)} count thisList) == count thisList";
private _comp = format ["this setFormation '%1'; this setBehaviour '%2'; deleteWaypoint [group this, currentWaypoint (group this)];",formation _group,behaviour _leader];
_wp setWaypointStatements [_cond,_comp];
private _comp = format ["this setFormation '%1'; this setBehaviour '%2'; deleteWaypoint [group this, currentWaypoint (group this)];", formation _group, behaviour _leader];
_wp setWaypointStatements [_cond, _comp];

// Prepare group to search
_group setBehaviour "Combat";
Expand Down Expand Up @@ -67,6 +67,5 @@ if ((leader _group) distanceSqr _building > 250e3) exitwith {};
};
} forEach _units;
};

_group lockWP false;
};
4 changes: 2 additions & 2 deletions addons/ai/fnc_taskAttack.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Optional:
Example:
(begin example)
[group player, getpos (player findNearestEnemy player), 100] call CBA_fnc_taskAttack
[group player, getPos (player findNearestEnemy player), 100] call CBA_fnc_taskAttack
(end)
Returns:
Expand All @@ -27,7 +27,7 @@ Author:

#include "script_component.hpp"

params ["_group","_position", ["_radius",0], ["_override",false]];
params ["_group", "_position", ["_radius", 0], ["_override", false]];

_group = _group call CBA_fnc_getGroup;
if !(local _group) exitWith {}; // Don't create waypoints on each machine
Expand Down
Loading

0 comments on commit f36d58a

Please sign in to comment.