Skip to content
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

General - Fix stability issues and add new functionality #71

Merged
merged 4 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion framework/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@

## cleanup
- [X] Move images from rsc\data to folders inside components
- [ ] Add Readme to each module <!-- @LIST_TODO: Add a README to each of the modules -->
- [X] Add Readme to each module
- [ ] Cleanup ui files <!-- @LIST_TODO: Do a big cleanup of all ui classes -->
- [ ] Follow ACE Code rules and remove sleeps, spawns etc. Get everything unscheduled:
https://ace3.acemod.org/wiki/development/arma-3-scheduler-and-our-practices.html <!-- @LIST_TODO: Try to make as much of the code unscheduled as possible -->
Expand Down
20 changes: 20 additions & 0 deletions framework/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# Changelog v2.1.1.61 => v2.1.1.62
*Reverted back to v2.1.1.58*

## Added
- Added function to set a random loadout for a unit using a specified loadoutfile in 3den and zeus
- Added function to set a crate loadout for a crate using a specified logistics file in 3den and zeus
- Added a script log viewer to the CMF menu
- Added `PATHTO` family of macros
- Added shots fired statistic to AAR
- Added `cmf_common_fnc_displayAddInitEvent` function

# Changed
- Changed how ui elements are included. it now uses a master include file in the ui directory
- Changed how zeus/curator modules are registered
- Renamed all curator functions to reflect the change
- Changed so logistics crates will always be carryable / draggable regardless of weight

# Fixed
- Fixed bug where vehicle rallypoints were placeable for everyone

# Changelog v2.1.1.60 => v2.1.1.61
## Fixed
- Fixed bug with ace action on crates being broken
Expand Down
4 changes: 3 additions & 1 deletion framework/components/aar/functions/fn_endMission.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ EFUNC(inline_aar,endMission) = {
_statsText = _statsText + format["<t align='left' color='#888888'>Your Enemy Kills:</t> <t align='right' color='#888888'>%1</t><br/>", (player getVariable [QGVAR(stats_E_kills), 0])];
_statsText = _statsText + format["<t align='left' color='#888888'>Your Friendly Kills:</t> <t align='right' color='#888888'>%1</t><br/>", (player getVariable [QGVAR(stats_F_kills), 0])];
_statsText = _statsText + format["<t align='left' color='#888888'>Your Civilian Kills:</t> <t align='right' color='#888888'>%1</t><br/>", (player getVariable [QGVAR(stats_C_kills), 0])];
_statsText = _statsText + format["<t align='left' color='#888888'>Shots Fired:</t> <t align='right' color='#888888'>%1</t><br/>", (player getVariable [QGVAR(stats_shots_fired), 0])];
// @TODO: Make sure to save stats incase of a rejip

while { player getVariable QGVAR(spectatorStatus) } do {
hintSilent parseText _statsText;
Expand Down Expand Up @@ -177,7 +179,7 @@ EFUNC(inline_aar,endMission) = {
private _EHIndex = addMissionEventHandler ["EntityCreated", {
params ["_entity"];

if ((typeof _entity) isEqualTo "ModuleEndMission_F") then {
if ((typeof _entity) isEqualTo "ModuleEndMission_F" && local _entity) then {
deleteVehicle _entity;
[] spawn EFUNC(inline_aar,endMission);
};
Expand Down
10 changes: 5 additions & 5 deletions framework/components/aar/functions/fn_record.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* None
*
* Example:
* call cmf_aar_fnc_record
* [] call cmf_aar_fnc_record
*
* Public: No
*/
Expand All @@ -22,7 +22,7 @@ if (!isServer) exitWith { };
addMissionEventHandler ["EntityCreated", {
params ["_entity"];

if ((_entity in allUnits || _entity in allMapMarkers || _entity in vehicles) && { !isNull _entity }) then {
if ((_entity in allUnits || _entity in allMapMarkers || _entity in vehicles) && !isNull _entity) then {
_entity addEventHandler ["Fired", {
params ["_unit", "_weapon", "", "", "", "", "_projectile"];

Expand All @@ -45,10 +45,10 @@ addMissionEventHandler ["EntityCreated", {

_this spawn {
/* Get title of mission */
private _missionTitle = if (!isNil QGVAR(safestart_title)) then {
GVAR(safestart_title)
private _missionTitle = if (!isNil { missionNameSpace getVariable QGVAR(safestart_title) }) then {
missionNameSpace getVariable QGVAR(safestart_title)
} else {
[getMissionConfigValue ['IntelBriefingName', briefingName]] call EFUNC(common,hexToASCII);
[getMissionConfigValue ['IntelBriefingName', briefingName]] call cmf_utility_fnc_hexToASCII;
};

/* Set base AAR data (and overwrite any old data) */
Expand Down
57 changes: 32 additions & 25 deletions framework/components/aar/functions/fn_stats.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,40 @@
*/
SCRIPT(stats);

if (!isServer) exitWith { };

addMissionEventHandler ["EntityKilled", {
/* Track deaths */
if (isPlayer (_this select 0)) then {
private _deaths = (_this select 0) getVariable [QGVAR(stats_deaths), -1];
(_this select 0) setVariable [QGVAR(stats_deaths), _deaths, true];
};
if (isServer) then {
addMissionEventHandler ["EntityKilled", {
/* Track deaths */
if (isPlayer (_this select 0)) then {
private _deaths = (_this select 0) getVariable [QGVAR(stats_deaths), -1];
(_this select 0) setVariable [QGVAR(stats_deaths), _deaths + 1, true];
};

/* Don't count suicides as kills */
if ((_this select 1) isEqualTo (_this select 0)) exitWith { };
/* Don't count suicides as kills */
if ((_this select 1) isEqualTo (_this select 0)) exitWith { };

/* Track kills */
if (isPlayer (_this select 1) && { (_this select 0) isKindOf "Man" }) then {
if (([side (_this select 1), side group (_this select 0)] call BIS_fnc_sideIsEnemy) && { (side group (_this select 0) != civilian) }) exitWith {
private _kills = (_this select 1) getVariable [QGVAR(stats_E_kills), 0];
(_this select 1) setVariable [QGVAR(stats_E_kills), _kills + 1, true];
};
/* Track kills */
if (isPlayer (_this select 1) && (_this select 0) isKindOf "Man") then {
switch (true) do {
case (([side (_this select 1), side group (_this select 0)] call BIS_fnc_sideIsEnemy) && (side group (_this select 0) != civilian)): {
private _kills = (_this select 1) getVariable [QGVAR(stats_E_kills), 0];
(_this select 1) setVariable [QGVAR(stats_E_kills), _kills + 1, true];
};

if (([side (_this select 1), side group (_this select 0)] call BIS_fnc_sideIsFriendly) && { (side group (_this select 0) != civilian) }) exitWith {
private _kills = (_this select 1) getVariable [QGVAR(stats_F_kills), 0];
(_this select 1) setVariable [QGVAR(stats_F_kills), _kills + 1, true];
};
case (([side (_this select 1), side group (_this select 0)] call BIS_fnc_sideIsFriendly) && (side group (_this select 0) != civilian)): {
private _kills = (_this select 1) getVariable [QGVAR(stats_F_kills), 0];
(_this select 1) setVariable [QGVAR(stats_F_kills), _kills + 1, true];
};

if (side group (_this select 0) isEqualTo civilian) exitWith {
private _kills = (_this select 1) getVariable [QGVAR(stats_C_kills), 0];
(_this select 1) setVariable [QGVAR(stats_C_kills), _kills + 1, true];
case (side group (_this select 0) == civilian): {
private _kills = (_this select 1) getVariable [QGVAR(stats_C_kills), 0];
(_this select 1) setVariable [QGVAR(stats_C_kills), _kills + 1, true];
};
};
};
};
}];
}];
} else {
player addEventHandler ["Fired", {
private _shots = player getVariable [QGVAR(stats_shots_fired), 0];
player setVariable [QGVAR(stats_shots_fired), _shots + 1, true];
}];
};
4 changes: 2 additions & 2 deletions framework/components/ai/functions/fn_hostage.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ GVAR(hostage_followPlayerFNC) = {

private _getSeat = [vehicle _target] call ace_captives_fnc_findEmptyNonFFVCargoSeat;
_getSeat params ["_cargoIndex"];
if (_cargoIndex isEqualTo -1) exitWith {};
if (_cargoIndex == -1) exitWith {};

_hostage assignAsCargoIndex [vehicle _target, _cargoIndex];
[_hostage] orderGetIn true;
Expand All @@ -89,7 +89,7 @@ private _followAction = [QGVAR(hostageFollow), "Follow Me!", "",
GVAR(hostage_followPlayerFNC),
{
isNull ((_this select 0) getVariable [QGVAR(hostage_owner), objNull]) &&
{ !((_this select 0) getVariable ["ace_captives_isHandcuffed", false]) }
!((_this select 0) getVariable ["ace_captives_isHandcuffed", false])
}
] call ace_interact_menu_fnc_createAction;

Expand Down
6 changes: 3 additions & 3 deletions framework/components/ai/functions/fn_reinforce.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ if (!isServer) exitWith {};
_thisArgs params ["_reinforceGroup"];
params ["", "_shareGroup", "_target"];

if (_reinforceGroup getVariable [QGVAR(reinforce_disableGroup), false]) exitWith { };
if ((group _target) getVariable [QGVAR(reinforce_disableTarget), false]) exitWith { };
if (_reinforceGroup getVariable [QGVAR(reinforce_disableGroup), false]) exitWith {};
if ((group _target) getVariable [QGVAR(reinforce_disableTarget), false]) exitWith {};

if ( (leader _reinforceGroup distance leader _shareGroup) < SETTING(reinforceRange) && { _reinforceGroup != _shareGroup && { !(_reinforceGroup getVariable [QGVAR(reinforce_targetGroup), grpNull] isEqualTo _shareGroup) && { side _reinforceGroup isEqualTo side _shareGroup } } }) then {
if ( (leader _reinforceGroup distance leader _shareGroup) < SETTING(reinforceRange) && _reinforceGroup != _shareGroup && !(_reinforceGroup getVariable [QGVAR(reinforce_targetGroup), grpNull] isEqualTo _shareGroup) && side _reinforceGroup isEqualTo side _shareGroup ) then {
LOG_2("%1 reinforcing %2(TaskRush)", groupId _reinforceGroup, groupId _shareGroup);

[_reinforceGroup, 200, 15, [], getPos _target, false] spawn lambs_wp_fnc_taskRush;
Expand Down
3 changes: 2 additions & 1 deletion framework/components/common/XEH_PREP.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ PREP(stripUnit);
PREP(versionCompare);
PREP(zeusHint);
PREP(acreRestore);
PREP(chatHandler);
PREP(chatHandler);
PREP(displayAddInitEvent);
9 changes: 0 additions & 9 deletions framework/components/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ cmf_player removeDiarySubject "Statistics";
/* Remove team diary */
cmf_player removeDiarySubject "Units";

/* Create notification colors */
GVAR(notificationColors) = createHashMapFromArray [
["DEFAULT", [0.69, 0.69, 0.69, 0.50]],
["INFO", [0.00, 0.75, 0.75, 0.50]],
["DEBUG", [0.99, 0.42, 0.98, 0.50]],
["WARNING", [0.78, 0.78, 0.00, 0.50]],
["ERROR", [0.81, 0.20, 0.17, 0.50]]
];

/* Create sub category for radios */
[(call acre_api_fnc_getAllRadios) select 0, "Radios", "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\call_ca.paa", 1] call ace_arsenal_fnc_addRightPanelButton;

Expand Down
9 changes: 9 additions & 0 deletions framework/components/common/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,14 @@ ACE_maxWeightDrag = 1500;
/* Disable CTAB on ground vehicles */
cTab_vehicleClass_has_FBCB2 = [];

/* Create notification colors */
GVAR(notificationColors) = createHashMapFromArray [
["DEFAULT", [0.69, 0.69, 0.69, 0.50]],
["INFO", [0.00, 0.75, 0.75, 0.50]],
["DEBUG", [0.99, 0.42, 0.98, 0.50]],
["WARNING", [0.78, 0.78, 0.00, 0.50]],
["ERROR", [0.81, 0.20, 0.17, 0.50]]
];

/* Handle connection and disconnection messages */
call FUNC(chatHandler);
2 changes: 2 additions & 0 deletions framework/components/common/functions/fn_acreRestore.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
params ["_newUnit", "_oldUnit"];

if (isNull _oldUnit) exitWith { };

private _oldPTT = cmf_player getVariable [QGVAR(ACREPTT), call acre_api_fnc_getMultiPushToTalkAssignment];
private _oldRadios = ([_oldUnit] call acre_sys_core_fnc_getGear) select { ([_x] call acre_api_fnc_getBaseRadio) != "" };
private _newRadios = ([_newUnit] call acre_sys_core_fnc_getGear) select { ([_x] call acre_api_fnc_getBaseRadio) != "" };
Expand Down
45 changes: 45 additions & 0 deletions framework/components/common/functions/fn_displayAddInitEvent.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include "script_component.hpp"
/*
* Author: Eric
* Attaches a display / dialog init event
*
* Arguments:
* 0: IDD <NUMBER>
* 1: Callback <CODE>
* 2: Arguments <ANY>
*
* Return Value:
* CBA PerFramehandler Handle <NUMBER>
*
* Example:
* [313, { hint str _this }, ["foo", "bar"]] call cmf_common_fnc_displayAddInitEvent
*
* Public: Yes
*/
params ["_idd", "_callback", ["_args", []]];

private _displayInitEvent = {
params ["_self", "_idd", "_callback", "_args"];

[findDisplay _idd, _args] call _callback;

[
{ isNull findDisplay (_this select 1) },
{
params ["_self"];

[
{ !isNull findDisplay (_this select 1) },
_self,
_this
] call CBA_fnc_waitUntilAndExecute;
},
_this
] call CBA_fnc_waitUntilAndExecute;
};

[
{ !isNull findDisplay (_this select 1) },
_displayInitEvent,
[_displayInitEvent, _idd, _callback, _args]
] call CBA_fnc_waitUntilAndExecute;
25 changes: 14 additions & 11 deletions framework/components/curator/XEH_PREP.sqf
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#include "script_component.hpp"

PREP(setLivesModule);
PREP(forceArsenalModule);
PREP(ammoboxModule);
PREP(resetKosherRoleModule);
PREP(kosherForceCloseModule);
PREP(disableFreezeTime);
PREP(toggleSpectatorModule);
PREP(addRallypointModule);
PREP(removeRallypointModule);
PREP(setLives);
PREP(forceArsenal);
PREP(setAmmobox);
PREP(setUnitParameters);
PREP(forceCloseArsenal);
PREP(toggleFreezeTime);
PREP(toggleSpectator);
PREP(enableRallypoints);
PREP(disableRallypoints);
PREP(setPhase);
PREP(addCutoffPhase);
PREP(removeCutoffPhase);
PREP(randomLoadout);
PREP(setCrateLoadout);
PREP(playerInfo);
PREP(safestartPhases);
PREP(safestartCutoffPhases);
PREP(initDisplayCurator);
Loading