-
Notifications
You must be signed in to change notification settings - Fork 157
Port ACE's Status Effects to CBA #1809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e4db621
Port status effects to CBA
DartRuffian 4060c07
Add todos, fix includes and function names
DartRuffian 6b3e2c7
Port binNumber / toBitMask
DartRuffian afa4aa9
Port isModLoaded, add disableCollision SE
DartRuffian 4729d81
Port endRadioTransmission
DartRuffian fc64e5a
Add engine blocking
DartRuffian 6b48108
Add runAtSettingsInitialized array
DartRuffian eeb037b
Fix using ace vcar
DartRuffian 9299d96
Fix requiredAddons
DartRuffian 90c8fb6
Clear array after running
DartRuffian bc8777a
Fix status effects, fix setting check, fix debug macro
DartRuffian 3bc3647
Add statuses for disableNVG/TIEquipment
DartRuffian c58dea8
Move toBitMask to bitwise
DartRuffian 1bf1c7b
Add missing entries to main requiredAddons
DartRuffian cd410b8
Apply suggestions from code review
DartRuffian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #include "script_component.hpp" | ||
| /* ---------------------------------------------------------------------------- | ||
| Function: CBA_fnc_toBitMask | ||
| Description: | ||
| Convert an array of booleans into a number. | ||
| Takes Input <ARRAY of BOOLs> (limited to float precision) | ||
|
|
||
| Parameters: | ||
| _input - Array of bools (0 index is least significant bit) <ARRAY> | ||
|
|
||
| Returns: | ||
| Bitmask <NUMBER> | ||
|
|
||
| Examples | ||
| (begin example) | ||
| [[true, false]] call CBA_fnc_toBitmask | ||
| (end) | ||
|
|
||
| Author: | ||
| commy2 | ||
| ---------------------------------------------------------------------------- */ | ||
| SCRIPT(toBitMask); | ||
| params [["_input", [], [[]]]]; | ||
|
|
||
| private _result = 0; | ||
| { | ||
| if (_x) then {_result = _result + 2 ^ _forEachIndex}; | ||
| } forEach _input; | ||
|
|
||
| _result; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| #include "script_component.hpp" | ||
| /* ---------------------------------------------------------------------------- | ||
| Function: CBA_fnc_binarizeNumber | ||
| Description: | ||
| Get a binary equivalent of a decimal number. | ||
|
|
||
| Parameters: | ||
| _number - Decimal Number <NUMBER> | ||
| _minLength - Minimum length of the returned Array, note: returned array can be larger (optional, default: 8)<NUMBER> | ||
|
|
||
| Returns: | ||
| Booleans <ARRAY> | ||
|
|
||
| Examples | ||
| (begin example) | ||
| [5, 5] call CBA_fnc_binarizeNumber | ||
| (end) | ||
|
|
||
| Author: | ||
| commy2 | ||
| ---------------------------------------------------------------------------- */ | ||
| SCRIPT(binarizeNumber); | ||
| params [ | ||
| ["_number", nil, [0]], | ||
| ["_minLength", 8, [0]] | ||
| ]; | ||
|
|
||
| if (isNil "_number") exitWith { [] }; | ||
|
|
||
| _number = round _number; | ||
|
|
||
| private _array = []; | ||
| _array resize _minLength; | ||
|
|
||
| for "_index" from 0 to (_minLength - 1) do { | ||
| _array set [_index, false]; | ||
| }; | ||
|
|
||
| private _index = 0; | ||
|
|
||
| while {_number > 0} do { | ||
| private _rest = _number mod 2; | ||
| _number = floor (_number / 2); | ||
|
|
||
| _array set [_index, _rest == 1]; | ||
| _index = _index + 1; | ||
| }; | ||
|
|
||
| _array; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #include "script_component.hpp" | ||
| /* ---------------------------------------------------------------------------- | ||
| Function: CBA_fnc_endRadioTransmission | ||
|
|
||
| Description: | ||
| End radio transmissions of addons TFAR and ACRE2. TFAR v0.9.x, ACRE Public Beta 2.0.3.571, TFAR v1.0.-1.x | ||
|
|
||
| Parameters: | ||
| None | ||
|
|
||
| Returns: | ||
| None | ||
|
|
||
| Examples: | ||
| (begin example) | ||
| [] call CBA_fnc_endRadioTransmission | ||
| (end) | ||
|
|
||
| Author: | ||
| commy2 | ||
| ---------------------------------------------------------------------------- */ | ||
| SCRIPT(endRadioTransmission); | ||
|
|
||
| ["CBA_endRadioTransmissions"] call CBA_fnc_localEvent; | ||
| ["ace_endRadioTransmissions"] call CBA_fnc_localEvent; // Ported from ACE | ||
|
|
||
| // ACRE | ||
| if ("acre_main" call CBA_fnc_isModLoaded) then { | ||
| [-1] call acre_sys_core_fnc_handleMultiPttKeyPressUp; | ||
| [0] call acre_sys_core_fnc_handleMultiPttKeyPressUp; | ||
| [1] call acre_sys_core_fnc_handleMultiPttKeyPressUp; | ||
| [2] call acre_sys_core_fnc_handleMultiPttKeyPressUp; | ||
| }; | ||
|
|
||
| // TFAR | ||
| if ("task_force_radio" call CBA_fnc_isModLoaded) then { | ||
| if ("tfar_core" call CBA_fnc_isModLoaded) exitWith { // Beta TFAR, exit to avoid script errors from legacy functions not existing | ||
| ([] call CBA_fnc_currentUnit) call TFAR_fnc_releaseAllTangents; | ||
| }; | ||
| [] call TFAR_fnc_onSwTangentReleased; | ||
| [] call TFAR_fnc_onAdditionalSwTangentReleased; | ||
| [] call TFAR_fnc_onLRTangentReleased; | ||
| [] call TFAR_fnc_onAdditionalLRTangentReleased; | ||
| [] call TFAR_fnc_onDDTangentReleased; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #include "script_component.hpp" | ||
| /* ---------------------------------------------------------------------------- | ||
| Function: CBA_fnc_isModLoaded | ||
| Description: | ||
| Check in CfgPatches if an addon is loaded | ||
|
|
||
| Parameters: | ||
| _modName - Classname of the mod in CfgPatches <STRING> | ||
|
|
||
| Returns: | ||
| True if addon is loaded, otherwise false <BOOL> | ||
|
|
||
| Examples | ||
| (begin example) | ||
| "class" call CBA_fnc_isModLoaded | ||
| (end) | ||
|
|
||
| Authors: | ||
| Glowbal, Grim | ||
| ---------------------------------------------------------------------------- */ | ||
| SCRIPT(isModLoaded); | ||
| params [["_modName", "", [""]]]; | ||
|
|
||
| GVAR(isModLoadedCache) getOrDefaultCall [toLowerANSI _modName, { isClass (configFile >> "CfgPatches" >> _modName) }, true] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| x\cba\addons\statuseffects |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| class Extended_PreInit_EventHandlers { | ||
| class ADDON { | ||
| init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); | ||
| }; | ||
| }; | ||
|
|
||
| class Extended_PostInit_EventHandlers { | ||
| class ADDON { | ||
| init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); | ||
| }; | ||
| }; | ||
|
|
||
| class Extended_Engine_EventHandlers { | ||
| class All { | ||
| ADDON = QUOTE(call FUNC(handleEngine)); | ||
| }; | ||
| }; | ||
| class Extended_Respawn_EventHandlers { | ||
| class All { | ||
| class GVAR(statusEffect) { | ||
| respawn = QUOTE(call FUNC(respawnEH)); | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| class Extended_Local_EventHandlers { | ||
| class All { | ||
| class GVAR(statusEffect) { | ||
| local = QUOTE(call FUNC(localEH)); | ||
| }; | ||
| }; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| class CfgFunctions { | ||
| class CBA { | ||
| class StatusEffects { | ||
| PATHTO_FNC(addStatusEffectType); | ||
| PATHTO_FNC(getStatusEffect); | ||
| PATHTO_FNC(setStatusEffect); | ||
| }; | ||
| }; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| PREP(handleEngine); | ||
| PREP(localEH); | ||
| PREP(resetVariables); | ||
| PREP(respawnEH); | ||
| PREP(sendEffects); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.