Skip to content

Commit 7d378ef

Browse files
BoGuuSimon ArledalSimZorJawshyJason2605
authored
Cleanup P1 (6.0.0) (#346)
* Begin cleanup * Cleanup - Part 2 * Cleanup - Part 3 * Pass Travis - Emma * Cleanup Part 4 * Cleanup Part 5 * Travis Pass * Cleanup Part 6 * Cleanup (#311) * UPDATE: Actionkeyhandler variable type privates instead of array type * UPDATE: Arrest Action Function * UPDATE: fn_buyLicense.sqf * UPDATE: Fish Catching function * UPDATE * Actually * UPDATED: Fish Catching * UPDATED: Fish * Some more * Cleanup fetchPlayerHouses * Resolve merge conflict * _unit cannot be nil * Update fn_processAction.sqf * Update fn_corpse.sqf * Update fn_catchFish.sqf * Update fn_dropFishingNet.sqf * Update fn_healHospital.sqf * Update fn_impoundAction.sqf * Update fn_newsBroadcast.sqf * Update fn_soundDevice.sqf * Update fn_setFuel.sqf * Update fn_repairDoor.sqf * 75/91 files reviewed * Further improvements * Last fixes * String using variable rather then constant Co-authored-by: Simon Arledal <SimZor@users.noreply.github.com> Co-authored-by: SimZor <arledal.simon@gmail.com> Co-authored-by: Joshua R <jawshy@twofactorauth.org> Co-authored-by: Jason Hall <jasonhall96686@yahoo.com> Co-authored-by: Jason_000 <Jason2605@users.noreply.github.com> Co-authored-by: DomT602 <32492434+DomT602@users.noreply.github.com> Co-authored-by: Dom <dom_thomas@hotmail.co.uk>
1 parent 6a68df3 commit 7d378ef

93 files changed

Lines changed: 16194 additions & 15815 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
1-
#include "..\..\script_macros.hpp"
2-
/*
3-
File: fn_arrestAction.sqf
4-
Author:
5-
6-
Description:
7-
Arrests the targeted person.
8-
*/
9-
private ["_unit","_id"];
10-
_unit = param [0,objNull,[objNull]];
11-
if (isNull _unit) exitWith {}; //Not valid
12-
if (isNil "_unit") exitWith {}; //Not Valid
13-
if (!(_unit isKindOf "CAManBase")) exitWith {}; //Not a unit
14-
if (!isPlayer _unit) exitWith {}; //Not a human
15-
if (!(_unit getVariable "restrained")) exitWith {}; //He's not restrained.
16-
if (!((side _unit) in [civilian,independent])) exitWith {}; //Not a civ
17-
18-
if (life_HC_isActive) then {
19-
[getPlayerUID _unit,_unit,player,false] remoteExecCall ["HC_fnc_wantedBounty",HC_Life];
20-
} else {
21-
[getPlayerUID _unit,_unit,player,false] remoteExecCall ["life_fnc_wantedBounty",RSERV];
22-
};
23-
24-
if (isNull _unit) exitWith {}; //Not valid
25-
detach _unit;
26-
[_unit,false] remoteExecCall ["life_fnc_jail",_unit];
27-
[0,"STR_NOTF_Arrested_1",true, [_unit getVariable ["realname",name _unit], profileName]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
28-
29-
if (LIFE_SETTINGS(getNumber,"player_advancedLog") isEqualTo 1) then {
30-
if (LIFE_SETTINGS(getNumber,"battlEye_friendlyLogging") isEqualTo 1) then {
31-
advanced_log = format [localize "STR_DL_AL_Arrested_BEF",_unit getVariable ["realname",name _unit]];
32-
} else {
33-
advanced_log = format [localize "STR_DL_AL_Arrested",profileName,(getPlayerUID player),_unit getVariable ["realname",name _unit]];
34-
};
35-
publicVariableServer "advanced_log";
36-
};
1+
#include "..\..\script_macros.hpp"
2+
/*
3+
File: fn_arrestAction.sqf
4+
Author:
5+
6+
Description:
7+
Arrests the targeted person.
8+
*/
9+
params [
10+
["_unit", objNull, [objNull]]
11+
];
12+
13+
if (isNull _unit || {!isPlayer _unit}) exitWith {}; //Not valid
14+
if !(_unit getVariable "restrained") exitWith {}; //He's not restrained.
15+
if !((side _unit) in [civilian,independent]) exitWith {}; //Not a civ
16+
17+
if (life_HC_isActive) then {
18+
[getPlayerUID _unit,_unit,player,false] remoteExecCall ["HC_fnc_wantedBounty",HC_Life];
19+
} else {
20+
[getPlayerUID _unit,_unit,player,false] remoteExecCall ["life_fnc_wantedBounty",RSERV];
21+
};
22+
23+
detach _unit;
24+
[_unit,false] remoteExecCall ["life_fnc_jail",_unit];
25+
[0,"STR_NOTF_Arrested_1",true, [_unit getVariable ["realname",name _unit], profileName]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
26+
27+
if (LIFE_SETTINGS(getNumber,"player_advancedLog") isEqualTo 1) then {
28+
if (LIFE_SETTINGS(getNumber,"battlEye_friendlyLogging") isEqualTo 1) then {
29+
advanced_log = format [localize "STR_DL_AL_Arrested_BEF",_unit getVariable ["realname",name _unit]];
30+
} else {
31+
advanced_log = format [localize "STR_DL_AL_Arrested",profileName,(getPlayerUID player),_unit getVariable ["realname",name _unit]];
32+
};
33+
publicVariableServer "advanced_log";
34+
};

Altis_Life.Altis/core/actions/fn_buyLicense.sqf

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
Description:
77
Called when purchasing a license. May need to be revised.
88
*/
9-
private ["_type","_varName","_displayName","_sideFlag","_price"];
10-
_type = _this select 3;
9+
params ["", "", "", "_type"];
1110

1211
if (!isClass (missionConfigFile >> "Licenses" >> _type)) exitWith {}; //Bad entry?
13-
_displayName = M_CONFIG(getText,"Licenses",_type,"displayName");
14-
_price = M_CONFIG(getNumber,"Licenses",_type,"price");
15-
_sideFlag = M_CONFIG(getText,"Licenses",_type,"side");
16-
_varName = LICENSE_VARNAME(_type,_sideFlag);
12+
private _displayName = M_CONFIG(getText,"Licenses",_type,"displayName");
13+
private _price = M_CONFIG(getNumber,"Licenses",_type,"price");
14+
private _sideFlag = M_CONFIG(getText,"Licenses",_type,"side");
15+
private _varName = LICENSE_VARNAME(_type,_sideFlag);
1716

1817
if (CASH < _price) exitWith {hint format [localize "STR_NOTF_NE_1",[_price] call life_fnc_numberText,localize _displayName];};
1918
CASH = CASH - _price;

Altis_Life.Altis/core/actions/fn_captureHideout.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ private _hideout = (nearestObjects[getPosATL player,_hideoutObjs,25]) select 0;
1515
private _group = _hideout getVariable ["gangOwner",grpNull];
1616

1717
if (isNil {group player getVariable "gang_name"}) exitWith {titleText[localize "STR_GNOTF_CreateGang","PLAIN"];};
18-
if (_group == group player) exitWith {titleText[localize "STR_GNOTF_Controlled","PLAIN"]};
18+
if (_group isEqualTo group player) exitWith {titleText[localize "STR_GNOTF_Controlled","PLAIN"]};
1919
if ((_hideout getVariable ["inCapture",false])) exitWith {hint localize "STR_GNOTF_onePersonAtATime";};
2020

2121
private "_action";
Lines changed: 43 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,43 @@
1-
#include "..\..\script_macros.hpp"
2-
/*
3-
File: fn_catchFish.sqf
4-
Author: Bryan "Tonic" Boardwine
5-
6-
Description:
7-
Catches a fish that is near by.
8-
*/
9-
private ["_fish","_type","_typeName"];
10-
_fish = [_this,0,objNull,[objNull]] call BIS_fnc_param;
11-
if (isNull _fish) exitWith {}; //Object passed is null?
12-
if (player distance _fish > 3.5) exitWith {};
13-
14-
switch (true) do {
15-
case ((typeOf _fish) isEqualTo "Salema_F"): {_typeName = localize "STR_ANIM_Salema"; _type = "salema_raw";};
16-
case ((typeOf _fish) isEqualTo "Ornate_random_F") : {_typeName = localize "STR_ANIM_Ornate"; _type = "ornate_raw";};
17-
case ((typeOf _fish) isEqualTo "Mackerel_F") : {_typeName = localize "STR_ANIM_Mackerel"; _type = "mackerel_raw";};
18-
case ((typeOf _fish) isEqualTo "Tuna_F") : {_typeName = localize "STR_ANIM_Tuna"; _type = "tuna_raw";};
19-
case ((typeOf _fish) isEqualTo "Mullet_F") : {_typeName = localize "STR_ANIM_Mullet"; _type = "mullet_raw";};
20-
case ((typeOf _fish) isEqualTo "CatShark_F") : {_typeName = localize "STR_ANIM_Catshark"; _type = "catshark_raw";};
21-
case ((typeOf _fish) isEqualTo "Turtle_F") : {_typeName = localize "STR_ANIM_Turtle"; _type = "turtle_raw";};
22-
default {_type = ""};
23-
};
24-
25-
if (_type isEqualTo "") exitWith {}; //Couldn't get a type
26-
27-
if ([true,_type,1] call life_fnc_handleInv) then {
28-
deleteVehicle _fish;
29-
titleText[format [(localize "STR_NOTF_Fishing"),_typeName],"PLAIN"];
30-
};
1+
#include "..\..\script_macros.hpp"
2+
/*
3+
File: fn_catchFish.sqf
4+
Author: Bryan "Tonic" Boardwine
5+
6+
Description:
7+
Catches a fish that is near by.
8+
*/
9+
params [
10+
["_fish", objNull, [objNull]]
11+
];
12+
13+
//--- Fish is null or distance to fish is more than 3.5 metres
14+
if (isNull _fish || {player distance _fish > 3.5}) exitWith {};
15+
16+
//--- Set Fish Information
17+
private _fishInfo = switch typeOf _fish do {
18+
case "Salema_F": {["STR_ANIM_Salema", "salema_raw"]};
19+
case "Ornate_random_F": {["STR_ANIM_Ornate", "ornate_raw"]};
20+
case "Mackerel_F": {["STR_ANIM_Mackerel", "mackerel_raw"]};
21+
case "Tuna_F": {["STR_ANIM_Tuna", "tuna_raw"]};
22+
case "Mullet_F": {["STR_ANIM_Mullet", "mullet_raw"]};
23+
case "CatShark_F": {["STR_ANIM_Catshark", "catshark_raw"]};
24+
case "Turtle_F": {["STR_ANIM_Turtle", "turtle_raw"]};
25+
default {["", ""]};
26+
};
27+
28+
//--- Sort out array
29+
_fishInfo params ["_fishName", "_fishType"];
30+
31+
//--- No fishtype
32+
if (_fishType isEqualTo "") exitWith {}; //Couldn't get a type
33+
34+
//--- Localize name of fish
35+
private _fishName = localize _fishName;
36+
37+
//--- Add fish into inventory
38+
if ([true,_type,1] call life_fnc_handleInv) then {
39+
//--- Delete fish in water
40+
deleteVehicle _fish;
41+
42+
titleText [format [localize "STR_NOTF_Fishing", _fishName], "PLAIN"];
43+
};
Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
#include "..\..\script_macros.hpp"
2-
/*
3-
File: fn_dpFinish.sqf
4-
Author: Bryan "Tonic" Boardwine
5-
6-
Description:
7-
Finishes the DP Mission and calculates the money earned based
8-
on distance between A->B
9-
*/
10-
private ["_dp","_dis","_price"];
11-
_dp = [_this,0,objNull,[objNull]] call BIS_fnc_param;
12-
life_delivery_in_progress = false;
13-
life_dp_point = nil;
14-
_dis = round((getPos life_dp_start) distance (getPos _dp));
15-
_price = round(1.7 * _dis);
16-
17-
["DeliverySucceeded",[format [(localize "STR_NOTF_Earned_1"),[_price] call life_fnc_numberText]]] call bis_fnc_showNotification;
18-
life_cur_task setTaskState "Succeeded";
19-
player removeSimpleTask life_cur_task;
20-
CASH = CASH + _price;
21-
[0] call SOCK_fnc_updatePartial;
1+
#include "..\..\script_macros.hpp"
2+
/*
3+
File: fn_dpFinish.sqf
4+
Author: Bryan "Tonic" Boardwine
5+
6+
Description:
7+
Finishes the DP Mission and calculates the money earned based
8+
on distance between A->B
9+
*/
10+
params [
11+
["_dp", objNull, [objNull]]
12+
];
13+
14+
life_delivery_in_progress = false;
15+
life_dp_point = nil;
16+
private _dis = round((getPosATL life_dp_start) distance (getPosATL _dp));
17+
private _price = round(1.7 * _dis);
18+
19+
["DeliverySucceeded",[format [(localize "STR_NOTF_Earned_1"),[_price] call life_fnc_numberText]]] call bis_fnc_showNotification;
20+
life_cur_task setTaskState "Succeeded";
21+
player removeSimpleTask life_cur_task;
22+
CASH = CASH + _price;
23+
[0] call SOCK_fnc_updatePartial;

Altis_Life.Altis/core/actions/fn_dropFishingNet.sqf

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,41 @@
55
Description:
66
Drops a virtual fishing net from the boat.
77
*/
8-
private ["_fish","_type","_typeName"];
9-
if (!(vehicle player isKindOf "Ship")) exitWith {};
10-
_fish = (nearestObjects[getPos vehicle player,["Fish_Base_F"],20]);
8+
private _vehicle = vehicle player;
9+
if !(_vehicle isKindOf "Ship") exitWith {};
10+
private _fish = nearestObjects[getPosASL _vehicle,["Fish_Base_F"],20];
1111
life_net_dropped = true;
1212
titleText[localize "STR_NOTF_NetDrop","PLAIN"];
1313
sleep 5;
14-
if (_fish isEqualTo []) exitWith {titleText[localize "STR_NOTF_NetDropFail","PLAIN"]; life_net_dropped = false;};
14+
if (_fish isEqualTo []) exitWith {
15+
titleText[localize "STR_NOTF_NetDropFail","PLAIN"];
16+
life_net_dropped = false;
17+
};
18+
1519
{
1620
if (_x isKindOf "Fish_Base_F") then {
17-
switch (true) do {
18-
case ((typeOf _x) isEqualTo "Salema_F"): {_typeName = localize "STR_ANIM_Salema"; _type = "salema_raw";};
19-
case ((typeOf _x) isEqualTo "Ornate_random_F") : {_typeName = localize "STR_ANIM_Ornate"; _type = "ornate_raw";};
20-
case ((typeOf _x) isEqualTo "Mackerel_F") : {_typeName = localize "STR_ANIM_Mackerel"; _type = "mackerel_raw";};
21-
case ((typeOf _x) isEqualTo "Tuna_F") : {_typeName = localize "STR_ANIM_Tuna"; _type = "tuna_raw";};
22-
case ((typeOf _x) isEqualTo "Mullet_F") : {_typeName = localize "STR_ANIM_Mullet"; _type = "mullet_raw";};
23-
case ((typeOf _x) isEqualTo "CatShark_F") : {_typeName = localize "STR_ANIM_Catshark"; _type = "catshark_raw";};
24-
default {_type = "";};
21+
private _fishInfo = switch (typeOf _x) do {
22+
case "Salema_F": {["STR_ANIM_Salema", "salema_raw"]};
23+
case "Ornate_random_F": {["STR_ANIM_Ornate", "ornate_raw"]};
24+
case "Mackerel_F": {["STR_ANIM_Mackerel", "mackerel_raw"]};
25+
case "Tuna_F": {["STR_ANIM_Tuna", "tuna_raw"]};
26+
case "Mullet_F": {["STR_ANIM_Mullet", "mullet_raw"]};
27+
case "CatShark_F": {["STR_ANIM_Catshark", "catshark_raw"]};
28+
default {["", ""]};
2529
};
2630

31+
_fishInfo params ["_fishName", "_fishType"];
32+
_fishName = localize _fishName;
33+
2734
sleep 3;
2835

29-
if ([true,_type,1] call life_fnc_handleInv) then {
36+
if ([true, _fishType, 1] call life_fnc_handleInv) then {
3037
deleteVehicle _x;
31-
titleText[format [(localize "STR_NOTF_Fishing"),_typeName],"PLAIN"];
38+
titleText[format [(localize "STR_NOTF_Fishing"),_fishName],"PLAIN"];
3239
};
3340
};
34-
} forEach (_fish);
41+
true
42+
} count _fish;
3543

3644
sleep 1.5;
3745
titleText[localize "STR_NOTF_NetUp","PLAIN"];
Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
#include "..\..\script_macros.hpp"
2-
/*
3-
File: fn_escortAction.sqf
4-
Author: Bryan "Tonic" Boardwine
5-
6-
Description: Attaches the desired person(_unit) to the player(player) and "escorts them".
7-
*/
8-
private ["_unit"];
9-
_unit = [_this,0,objNull,[objNull]] call BIS_fnc_param;
10-
11-
if (!isNull(player getVariable ["escortingPlayer",objNull])) exitWith {};
12-
if (isNil "_unit" || isNull _unit || !isPlayer _unit) exitWith {};
13-
if (!(side _unit in [civilian,independent])) exitWith {};
14-
if (player distance _unit > 3) exitWith {};
15-
16-
_unit attachTo [player,[0.1,1.1,0]];
17-
player setVariable ["escortingPlayer",_unit];
18-
player setVariable ["isEscorting",true];
19-
_unit setVariable ["transporting",false,true];
20-
_unit setVariable ["Escorting",true,true];
21-
player reveal _unit;
22-
23-
[_unit] spawn {
24-
_unit = _this select 0;
25-
waitUntil {(!(_unit getVariable ["Escorting",false]))};
26-
player setVariable ["escortingPlayer",nil];
27-
player setVariable ["isEscorting",false];
28-
};
1+
#include "..\..\script_macros.hpp"
2+
/*
3+
File: fn_escortAction.sqf
4+
Author: Bryan "Tonic" Boardwine
5+
6+
Description: Attaches the desired person(_unit) to the player(player) and "escorts them".
7+
*/
8+
params [
9+
["_unit", objNull, [objNull]]
10+
];
11+
12+
if (!isNull (player getVariable ["escortingPlayer",objNull])) exitWith {};
13+
if (isNull _unit || {!isPlayer _unit}) exitWith {};
14+
if !(side _unit in [civilian,independent]) exitWith {};
15+
if (player distance _unit > 3) exitWith {};
16+
17+
_unit attachTo [player, [0.1,1.1,0]];
18+
player setVariable ["escortingPlayer", _unit];
19+
player setVariable ["isEscorting", true];
20+
21+
[_unit] spawn {
22+
params [
23+
["_unit", objNull, [objNull]]
24+
];
25+
waitUntil {!(_unit getVariable ["Escorting",false])};
26+
27+
player setVariable ["escortingPlayer",nil];
28+
player setVariable ["isEscorting",false];
29+
};

0 commit comments

Comments
 (0)