Skip to content

Commit

Permalink
Added ace arsenal support, fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
xhabit committed May 1, 2018
1 parent 3de3bf8 commit b36c91d
Show file tree
Hide file tree
Showing 7 changed files with 183 additions and 79 deletions.
1 change: 1 addition & 0 deletions co30_Domination.Altis/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ ATTENTION: Domination.sql file (execute with Heidi) and domination-custom.ini fi
- Changed: Using player vehicle var name as references is broken if the game thinks that a player is a "Error: No unit", use allPlayers instead of d_player_entities (maybe one day BI will fix)
- Changed: Better check if a unit is a player as isPlayer scripting command returns false if a player is a "Error: No unit"
- Changed: You no longer need to put the playable units var names into d_player_entities or d_entities_tt_blufor/d_entities_tt_opfor in x_init\fn_preinit.sqf anymore. The var names are still needed just not in those arrays anymore
- Changed: When ace is found use ace arsenal instead of BI virtual arsenal (works also for ranked mode except uniforms and items for now)

3.90
ATTENTION: ALL mission.sqm files have changed
Expand Down
2 changes: 1 addition & 1 deletion co30_Domination.Altis/x_client/x_f/fn_arsenal_mod.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ private _findmodfnc = {
} forEach _ar;
_ar = _ar - [-1];
bis_fnc_arsenal_data set [_forEachIndex, _ar];
} forEach bis_fnc_arsenal_data;
} forEach bis_fnc_arsenal_data;
12 changes: 10 additions & 2 deletions co30_Domination.Altis/x_client/x_f/fn_inventoryopened.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@ private _box = param [1];
if (_box getVariable ["d_player_ammobox", false]) then {
_box spawn {
if (!d_with_ranked) then {
["Open", true] call bis_fnc_arsenal;
if (!d_with_ace) then {
["Open", true] call bis_fnc_arsenal;
} else {
[player, player, true] call ace_arsenal_fnc_openBox;
};
} else {
["Open", [nil, _this]] call bis_fnc_arsenal;
if (!d_with_ace) then {
["Open", [nil, _this]] call bis_fnc_arsenal;
} else {
[player, player, true] call ace_arsenal_fnc_openBox;

This comment has been minimized.

Copy link
@dedmen

dedmen May 1, 2018

This opens a full arsenal. With all items available. Which shouldn't be the case for ranked right?
Btw instead of d_with_ace you can just check the ace_arsenal variable. it will be true when the addon is there and nil otherwise.

This comment has been minimized.

Copy link
@dedmen

dedmen May 1, 2018

You should pass false here and rather add the virtual items to the player.
#1 (comment)

};
};
};
true
Expand Down
1 change: 1 addition & 0 deletions co30_Domination.Altis/x_client/x_f/fn_weaponcargo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ __TRACE_1("","d_all_p_a_boxes")
__TRACE_1("","_vec")

if (!d_with_ranked) then {
if (d_with_ace) exitWith {};
_vec spawn {
waitUntil {time > 0};

Expand Down
235 changes: 161 additions & 74 deletions co30_Domination.Altis/x_client/x_f/fn_weaponcargo_ranked.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,86 +15,173 @@ while {alive _vec} do {
clearItemCargo _vec;
clearBackpackCargo _vec;

_vec setVariable ["bis_addVirtualWeaponCargo_cargo", [[], [], [], []]];

_old_rank = rank player;

if (!d_with_ace) then {
_vec setVariable ["bis_addVirtualWeaponCargo_cargo", [[], [], [], []]];

waitUntil {time > 0};
private _helperar = [];
private _curar = d_misc_store getVariable (_old_rank + "_RIFLES");
__TRACE_1("RIFLES","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("RIFLES","_helperar")

_curar = d_misc_store getVariable (_old_rank + "_LAUNCHERS");
__TRACE_1("LAUNCHERS","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("LAUNCHERS","_helperar")
_curar = d_misc_store getVariable (_old_rank + "_PISTOLS");
__TRACE_1("PISTOLS","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("PISTOLS","_helperar")
[_vec, _helperar, false, false] call BIS_fnc_addVirtualWeaponCargo;

_helperar = [];
_curar = d_all_magazines;
__TRACE_1("Mags","_curar")
_helperar resize (count _curar);
{
_helperar set [_forEachIndex, _x # 0];
} forEach _curar;
__TRACE_1("Mags","_helperar")
[_vec, _helperar, false, false] call BIS_fnc_addVirtualMagazineCargo;

waitUntil {time > 0};
private _helperar = [];
private _curar = d_misc_store getVariable (_old_rank + "_RIFLES");
__TRACE_1("RIFLES","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("RIFLES","_helperar")
_helperar = [];
_curar = d_misc_store getVariable (_old_rank + "_OPTICS");
__TRACE_1("OPTICS","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("OPTICS","_helperar")
_curar = d_misc_store getVariable (_old_rank + "_MUZZLES");
__TRACE_1("MUZZLES","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("MUZZLES","_helperar")
_curar = d_misc_store getVariable (_old_rank + "_UNIFORMS");
__TRACE_1("UNIFORMS","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("UNIFORMS","_helperar")
_curar = d_misc_store getVariable (_old_rank + "_ITEMS");
__TRACE_1("ITEMS","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("ITEMS","_helperar")
[_vec, _helperar, false, false] call BIS_fnc_addVirtualItemCargo;

_curar = d_misc_store getVariable (_old_rank + "_LAUNCHERS");
__TRACE_1("LAUNCHERS","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("LAUNCHERS","_helperar")
_curar = d_misc_store getVariable (_old_rank + "_PISTOLS");
__TRACE_1("PISTOLS","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("PISTOLS","_helperar")
[_vec, _helperar, false, false] call BIS_fnc_addVirtualWeaponCargo;
_helperar = [];
_curar = d_backpackclasses;
__TRACE_1("Backpacks","_curar")
_helperar resize (count _curar);
{
_helperar set [_forEachIndex, _x];
} forEach _curar;
__TRACE_1("Backpacks","_helperar")
[_vec, _helperar, false, false] call BIS_fnc_addVirtualBackpackCargo;
} else {
private _ref = uiNamespace getVariable "ace_arsenal_configItems";

This comment has been minimized.

Copy link
@dedmen

dedmen May 1, 2018

You are modifying a static variable. After anyone runs your mission all their ACE arsenals will be broken till game restart. That's a very bad idea.


private _helperar = [];
private _curar = d_misc_store getVariable (_old_rank + "_RIFLES");
__TRACE_1("RIFLES","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("RIFLES","_helperar")
(_ref # 0) set [0, _helperar];

_curar = d_misc_store getVariable (_old_rank + "_LAUNCHERS");
__TRACE_1("LAUNCHERS","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("LAUNCHERS","_helperar")
(_ref # 0) set [1, _helperar];

_curar = d_misc_store getVariable (_old_rank + "_PISTOLS");
__TRACE_1("PISTOLS","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("PISTOLS","_helperar")
(_ref # 0) set [2, _helperar];

_helperar = [];
_curar = d_all_magazines;
__TRACE_1("Mags","_curar")
_helperar resize (count _curar);
{
_helperar set [_forEachIndex, _x # 0];
} forEach _curar;
__TRACE_1("Mags","_helperar")
[_vec, _helperar, false, false] call BIS_fnc_addVirtualMagazineCargo;
_helperar = [];
_curar = d_all_magazines;
__TRACE_1("Mags","_curar")
_helperar resize (count _curar);
{
_helperar set [_forEachIndex, _x # 0];
} forEach _curar;
__TRACE_1("Mags","_helperar")
_ref set [2, _helperar];

_helperar = [];
_curar = d_misc_store getVariable (_old_rank + "_OPTICS");
__TRACE_1("OPTICS","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("OPTICS","_helperar")
_curar = d_misc_store getVariable (_old_rank + "_MUZZLES");
__TRACE_1("MUZZLES","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("MUZZLES","_helperar")
_curar = d_misc_store getVariable (_old_rank + "_UNIFORMS");
__TRACE_1("UNIFORMS","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("UNIFORMS","_helperar")
_curar = d_misc_store getVariable (_old_rank + "_ITEMS");
__TRACE_1("ITEMS","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("ITEMS","_helperar")
[_vec, _helperar, false, false] call BIS_fnc_addVirtualItemCargo;
_helperar = [];
_curar = d_misc_store getVariable (_old_rank + "_OPTICS");
__TRACE_1("OPTICS","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("OPTICS","_helperar")
(_ref # 1) set [0, _helperar];

_curar = d_misc_store getVariable (_old_rank + "_MUZZLES");
__TRACE_1("MUZZLES","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("MUZZLES","_helperar")
(_ref # 1) set [2, _helperar];

// currently no uniforms and items when ace is used... Simply because other format
_curar = d_misc_store getVariable (_old_rank + "_UNIFORMS");
__TRACE_1("UNIFORMS","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("UNIFORMS","_helperar")
_curar = d_misc_store getVariable (_old_rank + "_ITEMS");
__TRACE_1("ITEMS","_curar")
{
_helperar pushBack (_x # 0);
false
} count _curar;
__TRACE_1("ITEMS","_helperar")

_helperar = [];
_curar = d_backpackclasses;
__TRACE_1("Backpacks","_curar")
_helperar resize (count _curar);
{
_helperar set [_forEachIndex, _x];
} forEach _curar;
__TRACE_1("Backpacks","_helperar")
[_vec, _helperar, false, false] call BIS_fnc_addVirtualBackpackCargo;
_helperar = [];
_curar = d_backpackclasses;
__TRACE_1("Backpacks","_curar")
_helperar resize (count _curar);
{
_helperar set [_forEachIndex, _x];
} forEach _curar;
__TRACE_1("Backpacks","_helperar")
_ref set [6, _helperar];
};
};
sleep 2.32;
};
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@ _control lbSetColor [_index, [1, 1, 0, 0.8]];
(_dispx displayCtrl 1030) ctrlSetText format [localize "STR_DOM_MISSIONSTRING_693", d_current_ai_num, d_max_ai];

if (!d_with_ranked) then {
_unit addAction [localize "STR_DOM_MISSIONSTRING_1585", {["Open",[true,nil,param [0]]] call bis_fnc_arsenal}, [], -1, false, true, "", "true", 3];
private _code = if (!d_with_ace) then {
{["Open",[true,nil,param [0]]] call bis_fnc_arsenal}
} else {
{[param [0], param [0], true] call ace_arsenal_fnc_openBox}
};
_unit addAction [localize "STR_DOM_MISSIONSTRING_1585", _code, [], -1, false, true, "", "true", 3];
};

#ifndef __TT__
Expand Down
4 changes: 3 additions & 1 deletion co30_Domination.Altis/x_client/x_setupplayer.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,9 @@ player addEventhandler ["WeaponAssembled", {

{_x call d_fnc_initvec; false} count vehicles;

["Preload"] call bis_fnc_arsenal;
if (!d_with_ace) then {
["Preload"] call bis_fnc_arsenal;
};

if (!d_with_ranked && {d_arsenal_mod == 0}) then {
if (d_ifa3lite) then {
Expand Down

0 comments on commit b36c91d

Please sign in to comment.