Skip to content

Commit 29c689b

Browse files
committed
Removed duplicate spawn scopes
addAction already runs code in a scheduled environment, so spawning it again via {[] spawn function} is unneccessary. Removed some hard links to files.
1 parent 2113a3c commit 29c689b

File tree

12 files changed

+86
-87
lines changed

12 files changed

+86
-87
lines changed

source/functions/initHQ/fn_HQaddactions.sqf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
params ["_hq"];
22

3-
_hq addaction ["<t color='#ff00ff'>Player stats</t>",{_this spawn duws_fnc_info}, "", 0, true, true, "", "_this == player"];
3+
_hq addaction ["<t color='#ff00ff'>Player stats</t>",duws_fnc_info, "", 0, true, true, "", "_this == player"];
44
_hq addaction ["<t color='#15ff00'>Request units</t>",{_this call duws_fnc_request}, "", 0, true, true, "", "_this == player"];
5-
_hq addaction ["<t color='#ffb700'>Squad manager</t>",{_this spawn duws_fnc_squadmng}, "", 0, true, true, "", "_this == player"];
6-
_hq addaction ["<t color='#ffb700'>FOB manager</t>",{_this spawn duws_fnc_fobmanageropen}, "", 0, true, true, "", "_this == player"];
5+
_hq addaction ["<t color='#ffb700'>Squad manager</t>",duws_fnc_squadmng, "", 0, true, true, "", "_this == player"];
6+
_hq addaction ["<t color='#ffb700'>FOB manager</t>",duws_fnc_fobmanageropen, "", 0, true, true, "", "_this == player"];
77
if (isServer) then {
8-
_hq addaction ["<t color='#00b7ff'>Rest (wait/save)</t>", {[]spawn duws_fnc_savegame}, "", 0, true, true, "", "_this == player"];
8+
_hq addaction ["<t color='#00b7ff'>Rest (wait/save)</t>", duws_fnc_savegame, "", 0, true, true, "", "_this == player"];
99
};
1010

1111
if (!isServer) then {

source/functions/initHQ/fn_guards.sqf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@ params ["_centerPos","_hq"];
22

33
// Create the guards
44
_groupGuard = createGroup WEST;
5-
_hqGuard1 = _groupGuard createUnit [Blufor_Rifleman, _centerPos, [], 0, "FORM"];
5+
_hqGuard1 = _groupGuard createUnit [Blufor_Rifleman, _centerPos, [], 0, "FORM"];
66
_hqGuard1 setpos [(_centerPos select 0)-6.5, (_centerPos select 1)-1.6];
77
_hqGuard1 setdir 270;
88
[_hqGuard1,"STAND","FULL"] call BIS_fnc_ambientAnimCombat;
99

10-
_hqGuard2 = _groupGuard createUnit [Blufor_Rifleman, _centerPos, [], 0, "FORM"];
10+
_hqGuard2 = _groupGuard createUnit [Blufor_Rifleman, _centerPos, [], 0, "FORM"];
1111
_hqGuard2 setpos [(_centerPos select 0)-6.5, (_centerPos select 1)-4.7];
1212
_hqGuard2 setdir 270;
1313
[_hqGuard2,"STAND_IA","FULL"] call BIS_fnc_ambientAnimCombat;
1414

15-
_hqGuard3 = _groupGuard createUnit [Blufor_Teamleader, _centerPos, [], 0, "FORM"];
15+
_hqGuard3 = _groupGuard createUnit [Blufor_Teamleader, _centerPos, [], 0, "FORM"];
1616
_hqGuard3 setpos [(_centerPos select 0), (_centerPos select 1)-7.58];
1717
_hqGuard3 setdir 180;
1818
[_hqGuard3,"LEAN","FULL"] call BIS_fnc_ambientAnimCombat;
1919

20-
_hqGuard4 = _groupGuard createUnit [Blufor_Rifleman_AT, _centerPos, [], 0, "FORM"];
20+
_hqGuard4 = _groupGuard createUnit [Blufor_Rifleman_AT, _centerPos, [], 0, "FORM"];
2121
_hqGuard4 setpos [(_centerPos select 0), (_centerPos select 1)-9];
2222
_hqGuard4 setdir 0;
2323
[_hqGuard4,"STAND","FULL"] call BIS_fnc_ambientAnimCombat;
2424

2525
// patrolling guard
2626
_groupPatrol = createGroup WEST;
27-
_hqGuard5 = _groupPatrol createUnit [Blufor_Grenadier, _centerPos, [], 0, "FORM"];
27+
_hqGuard5 = _groupPatrol createUnit [Blufor_Grenadier, _centerPos, [], 0, "FORM"];
2828
_hqGuard5 setpos [(_centerPos select 0)+10, (_centerPos select 1)+10];
2929

3030
_groupPatrol setCombatMode "YELLOW";
@@ -36,19 +36,19 @@ _wp setWaypointSpeed "LIMITED";
3636
_wp = _groupPatrol addWaypoint [[(_centerPos select 0)-10, (_centerPos select 1)+10], 0];
3737
_wp setWaypointType "MOVE";
3838
_wp setWaypointBehaviour "SAFE";
39-
_wp setWaypointSpeed "LIMITED";
40-
39+
_wp setWaypointSpeed "LIMITED";
40+
4141
_wp = _groupPatrol addWaypoint [[(_centerPos select 0)-10, (_centerPos select 1)-10], 0];
4242
_wp setWaypointType "MOVE";
4343
_wp setWaypointBehaviour "SAFE";
44-
_wp setWaypointSpeed "LIMITED";
44+
_wp setWaypointSpeed "LIMITED";
4545

4646
_wp = _groupPatrol addWaypoint [[(_centerPos select 0)+10, (_centerPos select 1)-10], 0];
4747
_wp setWaypointType "MOVE";
48-
48+
4949
_wp = _groupPatrol addWaypoint [[(_centerPos select 0)+10, (_centerPos select 1)+10], 0];
5050
_wp setWaypointType "CYCLE";
5151
_wp setWaypointBehaviour "SAFE";
5252
_wp setWaypointSpeed "LIMITED";
5353

54-
_hq addAction ["<t color='#ff0066'>Replace Guards (20CP)</t>", "initHQ\reguard.sqf", [_groupGuard, _groupPatrol, _centerPos, _hq], 0, true, true, "", "_this == player"];
54+
_hq addAction ["<t color='#ff0066'>Replace Guards (20CP)</t>", {_this call DUWS_fnc_reguard}, [_groupGuard, _groupPatrol, _centerPos, _hq], 0, true, true, "", "_this == player"];

source/functions/initHQ/fn_guardsFOB.sqf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@ if (isnil _size) then {_size = 500};
44

55
// Create the guards
66
_groupGuard = createGroup WEST;
7-
_hqGuard1 = _groupGuard createUnit [Blufor_Rifleman, _centerPos, [], 0, "FORM"];
7+
_hqGuard1 = _groupGuard createUnit [Blufor_Rifleman, _centerPos, [], 0, "FORM"];
88
_hqGuard1 setpos [(_centerPos select 0)-6.5, (_centerPos select 1)-1.6];
99
_hqGuard1 setdir 270;
1010
[_hqGuard1,"STAND","FULL"] call BIS_fnc_ambientAnimCombat;
1111

12-
_hqGuard2 = _groupGuard createUnit [Blufor_Rifleman, _centerPos, [], 0, "FORM"];
12+
_hqGuard2 = _groupGuard createUnit [Blufor_Rifleman, _centerPos, [], 0, "FORM"];
1313
_hqGuard2 setpos [(_centerPos select 0)-6.5, (_centerPos select 1)-4.7];
1414
_hqGuard2 setdir 270;
1515
[_hqGuard2,"WATCH","FULL"] call BIS_fnc_ambientAnimCombat;
1616

17-
_hqGuard3 = _groupGuard createUnit [Blufor_Teamleader, _centerPos, [], 0, "FORM"];
17+
_hqGuard3 = _groupGuard createUnit [Blufor_Teamleader, _centerPos, [], 0, "FORM"];
1818
_hqGuard3 setpos [(_centerPos select 0), (_centerPos select 1)-7.58];
1919
_hqGuard3 setdir 180;
2020
[_hqGuard3,"LEAN","FULL"] call BIS_fnc_ambientAnimCombat;
2121

22-
_hqGuard4 = _groupGuard createUnit [Blufor_Rifleman_AT, _centerPos, [], 0, "FORM"];
22+
_hqGuard4 = _groupGuard createUnit [Blufor_Rifleman_AT, _centerPos, [], 0, "FORM"];
2323
_hqGuard4 setpos [(_centerPos select 0), (_centerPos select 1)-9];
2424
_hqGuard4 setdir 0;
2525
[_hqGuard4,"STAND","FULL"] call BIS_fnc_ambientAnimCombat;
2626

2727
// patrolling guard
2828
_groupPatrol = createGroup WEST;
29-
_hqGuard5 = _groupPatrol createUnit [Blufor_Grenadier, _centerPos, [], 0, "FORM"];
29+
_hqGuard5 = _groupPatrol createUnit [Blufor_Grenadier, _centerPos, [], 0, "FORM"];
3030
_hqGuard5 setpos [(_centerPos select 0)+10, (_centerPos select 1)+10];
3131

3232
_groupPatrol setCombatMode "YELLOW";
@@ -38,12 +38,12 @@ _wp setWaypointSpeed "LIMITED";
3838
_wp = _groupPatrol addWaypoint [[(_centerPos select 0)-10, (_centerPos select 1)+10], 0];
3939
_wp setWaypointType "MOVE";
4040
_wp setWaypointBehaviour "SAFE";
41-
_wp setWaypointSpeed "LIMITED";
41+
_wp setWaypointSpeed "LIMITED";
4242

4343
_wp = _groupPatrol addWaypoint [[(_centerPos select 0)-10, (_centerPos select 1)-10], 0];
4444
_wp setWaypointType "MOVE";
4545
_wp setWaypointBehaviour "SAFE";
46-
_wp setWaypointSpeed "LIMITED";
46+
_wp setWaypointSpeed "LIMITED";
4747

4848
_wp = _groupPatrol addWaypoint [[(_centerPos select 0)+10, (_centerPos select 1)-10], 0];
4949
_wp setWaypointType "MOVE";
@@ -53,4 +53,4 @@ _wp setWaypointType "CYCLE";
5353
_wp setWaypointBehaviour "SAFE";
5454
_wp setWaypointSpeed "LIMITED";
5555

56-
_fob addAction ["<t color='#ff0066'>Replace Guards (15CP)</t>", "initHQ\reguardFOB.sqf", [_groupGuard, _groupPatrol, _centerPos, _fob], 0, true, true, "", "_this == player"];
56+
_fob addAction ["<t color='#ff0066'>Replace Guards (15CP)</t>", {_this call DUWS_fnc_reguardFOB}, [_groupGuard, _groupPatrol, _centerPos, _fob], 0, true, true, "", "_this == player"];

source/functions/missions/fn_sabotage_mission.sqf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ _markerstr2 setMarkerShape "ELLIPSE";
2121
str(_markername2) setMarkerBrush "SolidBorder";
2222
str(_markername2) setMarkerColor "ColorBrown";
2323
str(_markername2) setMarkerSize [_radius, _radius];
24-
str(_markername2) setMarkerAlpha 0.3;
24+
str(_markername2) setMarkerAlpha 0.3;
2525

26-
// create TOWER
26+
// create TOWER
2727
_tower = createVehicle ["Land_dp_transformer_F", _MissionPos, [], 0, "NONE"];
2828
_tower addEventHandler ["HandleDamage", {0}];
29-
_tower addaction ["Sabotage", {_this call duws_fnc_sabotage_success;},[_missionPos,_mission_name,_markername,_markername2]];
29+
_tower addaction ["Sabotage", duws_fnc_sabotage_success,[_missionPos,_mission_name,_markername,_markername2]];
3030

3131
// TASK AND NOTIFICATION
3232
_VARtaskgeneratedName = format["tsksabot%1%2",round(_MissionPos select 0),round(_Missionpos select 1)]; // generate variable name for task
@@ -35,7 +35,7 @@ _VARtaskgeneratedName = format["tsksabot%1%2",round(_MissionPos select 0),round(
3535
//_taskhandle setSimpleTaskDescription ["The enemy is using a power supply somewhere in this area. We need you to find it and sabotage it. It will allow us to have a bit of better intel on our enemies.",_mission_name,""];
3636
//_taskhandle setSimpleTaskDestination (getMarkerPos str(_markername));
3737

38-
[west, "_taskhandle", ["The enemy is using a power supply somewhere in this area. We need you to find it and sabotage it. It will allow us to have a bit of better intel on our enemies.", "Sabotage"], objNull, true] call BIS_fnc_taskCreate;
38+
[west, "_taskhandle", ["The enemy is using a power supply somewhere in this area. We need you to find it and sabotage it. It will allow us to have a bit of better intel on our enemies.", "Sabotage"], objNull, true] call BIS_fnc_taskCreate;
3939

4040
if (!ismultiplayer) then {
4141
[] spawn duws_fnc_autoSave;
@@ -51,4 +51,4 @@ sleep 1;
5151
[_randompos, _radius] call duws_fnc_createoppatrol;
5252
[_missionpos, 15] call duws_fnc_createoppatrol; // <-- around target
5353
sleep 10;
54-
[_missionpos, 15] call duws_fnc_createoppatrol; // <-- around target
54+
[_missionpos, 15] call duws_fnc_createoppatrol; // <-- around target

source/functions/pFLIR/fn_livefeed.sqf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// pFLIRenable = player addaction ["<t color='#a9ff59'>Activate FLIR</t>",{_this spawn duws_fnc_livefeed},"", 0,false,true,"","_target == _this"];
1+
// pFLIRenable = player addaction ["<t color='#a9ff59'>Activate FLIR</t>",duws_fnc_livefeed,"", 0,false,true,"","_target == _this"];
22

33
// pflir aim
44
trucPIPtarget = "Land_Sack_F" createVehicle ([0,0,0]); // PAS OUBLIER DE SUPPRIMER LE TRUC
@@ -31,20 +31,20 @@ switch (_actualStance) do
3131
BIS_liveFeed attachTo [player,[0,1,0.85]];
3232
trucPIPtarget attachTo [player,[0,2000,0.85]];
3333
};
34-
34+
3535
case "PRONE":
3636
{
3737
BIS_liveFeed attachTo [player,[0,1,0.25]];
3838
trucPIPtarget attachTo [player,[0,2000,0.25]];
39-
};
39+
};
4040

4141
};
4242

4343
// add action to disable FLIR
4444
sleep 1;
4545

46-
pFLIRdisable = player addaction ["<t color='#a9ff59'>Deactivate FLIR</t>",{_this spawn duws_fnc_livefeedexit},"", 0,false,true,"","_target == _this"];
47-
PlayerKilledEH2 = player addEventHandler ["killed", {[] spawn duws_fnc_livefeedexit}]; //removes screen from hud
46+
pFLIRdisable = player addaction ["<t color='#a9ff59'>Deactivate FLIR</t>",duws_fnc_livefeedexit,"", 0,false,true,"","_target == _this"];
47+
PlayerKilledEH2 = player addEventHandler ["killed", duws_fnc_livefeedexit]; //removes screen from hud
4848

4949

5050

@@ -65,12 +65,12 @@ if (!pFlirActivated) exitWith {};
6565
BIS_liveFeed attachTo [player,[0,1,0.85]];
6666
trucPIPtarget attachTo [player,[0,2000,0.85]];
6767
};
68-
68+
6969
case "PRONE":
7070
{
7171
BIS_liveFeed attachTo [player,[0,1,0.25]];
7272
trucPIPtarget attachTo [player,[0,2000,0.25]];
73-
};
73+
};
7474

7575
};
76-
};
76+
};

source/functions/pFLIR/fn_livefeed1.sqf

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// pFLIRenable = player addaction ["<t color='#a9ff59'>Activate FLIR</t>",{_this spawn duws_fnc_livefeed1},"", 0,false,true,"","_target == _this"];
1+
// pFLIRenable = player addaction ["<t color='#a9ff59'>Activate FLIR</t>",duws_fnc_livefeed1,"", 0,false,true,"","_target == _this"];
22

33
// pflir aim
44
trucPIPtarget = "Land_Sack_F" createVehicle ([0,0,0]); // PAS OUBLIER DE SUPPRIMER LE TRUC
@@ -31,19 +31,19 @@ switch (_actualStance) do
3131
BIS_liveFeed attachTo [player,[0,1,0.85]];
3232
trucPIPtarget attachTo [player,[0,2000,0.85]];
3333
};
34-
34+
3535
case "PRONE":
3636
{
3737
BIS_liveFeed attachTo [player,[0,1,0.25]];
3838
trucPIPtarget attachTo [player,[0,2000,0.25]];
39-
};
39+
};
4040

4141
};
4242

4343
// add action to disable FLIR
4444
sleep 1;
4545

46-
pFLIRdisable = player addaction ["<t color='#a9ff59'>Deactivate FLIR</t>",{_this spawn duws_fnc_livefeedexit},"", 0,false,true,"","_target == _this"];
46+
pFLIRdisable = player addaction ["<t color='#a9ff59'>Deactivate FLIR</t>",duws_fnc_livefeedexit,"", 0,false,true,"","_target == _this"];
4747
PlayerKilledEH2 = player addEventHandler ["killed", {[] spawn duws_fnc_livefeedexit}]; //removes screen from hud
4848

4949

@@ -65,12 +65,12 @@ if (!pFlirActivated) exitWith {};
6565
BIS_liveFeed attachTo [player,[0,1,0.85]];
6666
trucPIPtarget attachTo [player,[0,2000,0.85]];
6767
};
68-
68+
6969
case "PRONE":
7070
{
7171
BIS_liveFeed attachTo [player,[0,1,0.25]];
7272
trucPIPtarget attachTo [player,[0,2000,0.25]];
73-
};
73+
};
7474

7575
};
76-
};
76+
};

source/functions/pFLIR/fn_livefeedexit.sqf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ player removeEventHandler ["killed",PlayerKilledEH2];
88

99
sleep 2;
1010

11-
waitUntil {alive player};
12-
pFLIRenable = player addaction ["<t color='#a9ff59'>Enable FLIR</t>",{_this spawn duws_fnc_livefeed},"", 0,false,true,"","_target == _this"]; //original last line in script
11+
waitUntil {alive player};
12+
pFLIRenable = player addaction ["<t color='#a9ff59'>Enable FLIR</t>",duws_fnc_livefeed,"", 0,false,true,"","_target == _this"]; //original last line in script
1313

14-
PlayerKilledEH3 = player addEventHandler ["respawn",{player addaction ["<t color='#a9ff59'>Enable FLIR</t>",{_this spawn duws_fnc_livefeed},"", 0,false,true,"","_target == _this"]}];
14+
PlayerKilledEH3 = player addEventHandler ["respawn",{player addaction ["<t color='#a9ff59'>Enable FLIR</t>",duws_fnc_livefeed,"", 0,false,true,"","_target == _this"]}];
1515

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
player addaction ["<t color='#ffb700'>Squad manager</t>",{_this spawn duws_fnc_squadmng}, "", 0, true, true, "", "_this == player"];
2-
3-
4-
5-
6-
7-
1+
player addaction ["<t color='#ffb700'>Squad manager</t>",duws_fnc_squadmng, "", 0, true, true, "", "_this == player"];
2+
3+
4+
5+
6+

source/functions/support/fn_fob.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ _fob = "Land_Cargo_HQ_V1_F" createVehicle _foundPickupPos;
7575
_fob remoteExecCall ["DUWS_fnc_fob_addAction", 0, true];
7676

7777
// For fortifying
78-
_fob addaction ["<t color='#ff0000'>Fortify FOB(4CP)</t>","_this spawn duws_fnc_fortifyFOB", [(getpos _fob), _fob], 0, true, true, "", "_this == player"];
78+
_fob addaction ["<t color='#ff0000'>Fortify FOB(4CP)</t>",duws_fnc_fortifyFOB, [(getpos _fob), _fob], 0, true, true, "", "_this == player"];
7979

8080
[_foundPickupPos, _size] call duws_fnc_createpatrol;
8181
[_foundPickupPos, _size] call duws_fnc_createpatrol;
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
_this addaction ["<t color='#ff00ff'>Player stats</t>",{_this spawn duws_fnc_info}, "", 0, true, true, "", "_this == player"];
2-
_this addaction ["<t color='#15ff00'>Request ammobox drop(2CP)</t>",{_this spawn duws_fnc_fob_ammobox}, "", 0, true, true, "", "_this == player"];
3-
_this addaction ["<t color='#ffb700'>Squad manager</t>",{_this spawn duws_fnc_squadmng}, "", 0, true, true, "", "_this == player"];
4-
_this addaction ["<t color='#ffb700'>FOB manager</t>",{_this spawn duws_fnc_fobmanageropen}, "", 0, true, true, "", "_this == player"];
1+
_this addaction ["<t color='#ff00ff'>Player stats</t>",duws_fnc_info, "", 0, true, true, "", "_this == player"];
2+
_this addaction ["<t color='#15ff00'>Request ammobox drop(2CP)</t>",duws_fnc_fob_ammobox, "", 0, true, true, "", "_this == player"];
3+
_this addaction ["<t color='#ffb700'>Squad manager</t>",duws_fnc_squadmng, "", 0, true, true, "", "_this == player"];
4+
_this addaction ["<t color='#ffb700'>FOB manager</t>",duws_fnc_fobmanageropen, "", 0, true, true, "", "_this == player"];
55
if (support_armory_available) then {
6-
_this addaction ["<t color='#ff0066'>Armory (VA)</t>","bisArsenal.sqf", "", 0, true, true, "", "_this == player"];
6+
_this addaction ["<t color='#ff0066'>Armory (VA)</t>",{[] call duws_fnc_bisArsenal}, "", 0, true, true, "", "_this == player"];
77
};
88
if (isServer) then {
9-
_this addaction ["<t color='#00b7ff'>Rest (wait/save)</t>",{[]spawn duws_fnc_savegame}, "", 0, true, true, "", "_this == player"];
9+
_this addaction ["<t color='#00b7ff'>Rest (wait/save)</t>",duws_fnc_savegame, "", 0, true, true, "", "_this == player"];
1010
} else {
11-
_this addaction ["<t color='#00b7ff'>Rest</t>",{[] spawn duws_fnc_savegameClient}, "", 0, true, true, "", "_this == player"];
11+
_this addaction ["<t color='#00b7ff'>Rest</t>",duws_fnc_savegameClient, "", 0, true, true, "", "_this == player"];
1212
};

0 commit comments

Comments
 (0)