Skip to content

Commit

Permalink
#130 - Terrain sorting (#131)
Browse files Browse the repository at this point in the history
* #130 - Terrain sorting

* Update fn_terrainSort.sqf

* Update fn_terrainSort.sqf

* Forgot to add strings ;)

* Add to CfgFunctions

* Default

* Whitelisted Terrain Sorting Function (SpyGlass) (#133)

* Terrain Sorting Function - Whitelisted (SpyGlass)

* Shit...

* shit

* Alphabetical order and remove serv_wanted_remove

* Grrflicts

* Going to explode.
  • Loading branch information
BoGuu committed Oct 18, 2016
1 parent b492d53 commit 7344c21
Show file tree
Hide file tree
Showing 18 changed files with 87 additions and 61 deletions.
1 change: 1 addition & 0 deletions Altis_Life.Altis/Functions.hpp
Expand Up @@ -205,6 +205,7 @@ class Life_Client_Core {
class searchPosEmpty {};
class simDisable {};
class stripDownPlayer {};
class terrainSort {};
class tazeSound {};
class teleport {};
class whereAmI {};
Expand Down
6 changes: 3 additions & 3 deletions Altis_Life.Altis/config/Config_SpyGlass.hpp

Large diffs are not rendered by default.

30 changes: 17 additions & 13 deletions Altis_Life.Altis/core/actions/fn_captureHideout.sqf
Expand Up @@ -6,16 +6,20 @@
Description:
Blah blah.
*/
private ["_group","_hideout","_action","_cpRate","_cP","_progressBar","_title","_titleText","_ui","_flagTexture"];
_altisArray = ["Land_u_Barracks_V2_F","Land_i_Barracks_V2_F"];
_tanoaArray = ["Land_School_01_F","Land_Warehouse_03_F","Land_House_Small_02_F"];
private _hideoutObjs = ALTIS_TANOA(_altisArray,_tanoaArray);
_hideout = (nearestObjects[getPosATL player,_hideoutObjs,25]) select 0;
_group = _hideout getVariable ["gangOwner",grpNull];
private _altisArray = ["Land_u_Barracks_V2_F","Land_i_Barracks_V2_F"];
private _tanoaArray = ["Land_School_01_F","Land_Warehouse_03_F","Land_House_Small_02_F"];

private _hideoutObjs = [[["Altis", _altisArray], ["Tanoa", _tanoaArray]]] call life_fnc_terrainSort;

private _hideout = (nearestObjects[getPosATL player,_hideoutObjs,25]) select 0;
private _group = _hideout getVariable ["gangOwner",grpNull];

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

private "_action";
private "_cpRate";
if (!isNull _group) then {
_gangName = _group getVariable ["gang_name",""];
_action = [
Expand All @@ -35,14 +39,14 @@ life_action_inUse = true;

//Setup the progress bar
disableSerialization;
_title = localize "STR_GNOTF_Capturing";
private _title = localize "STR_GNOTF_Capturing";
"progressBar" cutRsc ["life_progress","PLAIN"];
_ui = uiNamespace getVariable "life_progress";
_progressBar = _ui displayCtrl 38201;
_titleText = _ui displayCtrl 38202;
private _ui = uiNamespace getVariable "life_progress";
private _progressBar = _ui displayCtrl 38201;
private _titleText = _ui displayCtrl 38202;
_titleText ctrlSetText format ["%2 (1%1)...","%",_title];
_progressBar progressSetPosition 0.01;
_cP = 0.01;
private _cP = 0.01;

for "_i" from 0 to 1 step 0 do {
if (animationState player != "AinvPknlMstpSnonWnonDnon_medic_1") then {
Expand Down Expand Up @@ -76,7 +80,7 @@ if (life_interrupted) exitWith {life_interrupted = false; titleText[localize "ST
life_action_inUse = false;

titleText[localize "STR_GNOTF_Captured","PLAIN"];
_flagTexture = [
private _flagTexture = [
"\A3\Data_F\Flags\Flag_red_CO.paa",
"\A3\Data_F\Flags\Flag_green_CO.paa",
"\A3\Data_F\Flags\Flag_blue_CO.paa",
Expand All @@ -89,4 +93,4 @@ _flagTexture = [
_this select 0 setFlagTexture _flagTexture;
[[0,1],"STR_GNOTF_CaptureSuccess",true,[name player,(group player) getVariable "gang_name"]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
_hideout setVariable ["inCapture",false,true];
_hideout setVariable ["gangOwner",group player,true];
_hideout setVariable ["gangOwner",group player,true];
5 changes: 3 additions & 2 deletions Altis_Life.Altis/core/civilian/fn_jailMe.sqf
Expand Up @@ -40,7 +40,8 @@ for "_i" from 0 to 1 step 0 do {
player forceWalk true;
};

private _escDist = ALTIS_TANOA(60,145);
private _escDist = [[["Altis", 60], ["Tanoa", 145]]] call life_fnc_terrainSort;

if (player distance (getMarkerPos "jail_marker") > _escDist) exitWith {
_esc = true;
};
Expand Down Expand Up @@ -101,4 +102,4 @@ switch (true) do {
};
};

player forceWalk false; // Enable running & jumping
player forceWalk false; // Enable running & jumping

This comment has been minimized.

Copy link
@Jawshy

Jawshy Oct 19, 2016

Contributor

No newline at end of file 👺

8 changes: 5 additions & 3 deletions Altis_Life.Altis/core/cop/fn_fedCamDisplay.sqf
Expand Up @@ -13,9 +13,11 @@ params [
"_mode"
];

_altisArray = [16019.5,16952.9,0];
_tanoaArray = [11074.2,11501.5,0.00137329];
private _pos = ALTIS_TANOA(_altisArray,_tanoaArray);
private _altisArray = [16019.5,16952.9,0];
private _tanoaArray = [11074.2,11501.5,0.00137329];

private _pos = [[["Altis", _altisArray], ["Tanoa", _tanoaArray]]] call life_fnc_terrainSort;

private _dome = nearestObject [_pos,"Land_Dome_Big_F"];

if (!isPiPEnabled) exitWith {hint localize "STR_Cop_EnablePiP";};
Expand Down
7 changes: 4 additions & 3 deletions Altis_Life.Altis/core/fn_initCiv.sqf
Expand Up @@ -7,9 +7,10 @@
Initializes the civilian.
*/
private "_spawnPos";
_altisArray = ["Land_i_Shop_01_V1_F","Land_i_Shop_01_V2_F","Land_i_Shop_01_V3_F","Land_i_Shop_02_V1_F","Land_i_Shop_02_V2_F","Land_i_Shop_02_V3_F"];
_tanoaArray = ["Land_House_Small_01_F"];
private _spawnBuildings = ALTIS_TANOA(_altisArray,_tanoaArray);

private _altisArray = ["Land_i_Shop_01_V1_F","Land_i_Shop_01_V2_F","Land_i_Shop_01_V3_F","Land_i_Shop_02_V1_F","Land_i_Shop_02_V2_F","Land_i_Shop_02_V3_F"];
private _tanoaArray = ["Land_House_Small_01_F"];
private _spawnBuildings = [[["Altis", _altisArray], ["Tanoa", _tanoaArray]]] call life_fnc_terrainSort;

civ_spawn_1 = nearestObjects[getMarkerPos "civ_spawn_1", _spawnBuildings,350];
civ_spawn_2 = nearestObjects[getMarkerPos "civ_spawn_2", _spawnBuildings,350];
Expand Down
3 changes: 1 addition & 2 deletions Altis_Life.Altis/core/fn_setupStationService.sqf
@@ -1,4 +1,3 @@
#define ALTIS_TANOA(var1,var2) if (worldName == "Altis") then {var1} else {var2}
/*
File: fn_setupStationService.sqf
Author: NiiRoZz
Expand Down Expand Up @@ -151,7 +150,7 @@ private _tanoaPositions = [
[11637.2,13052.8,-0.228891]
];

private _stationPositions = ALTIS_TANOA(_altisPositions,_tanoaPositions);
private _stationPositions = [[["Altis", _altisArray], ["Tanoa", _tanoaArray]]] call life_fnc_terrainSort;

{
private _pump = nearestObjects [_x,["Land_fs_feed_F","Land_FuelStation_01_pump_F","Land_FuelStation_02_pump_F"],5] select 0;
Expand Down
8 changes: 4 additions & 4 deletions Altis_Life.Altis/core/functions/fn_actionKeyHandler.sqf
Expand Up @@ -61,10 +61,10 @@ if ((_curObject isKindOf "B_supplyCrate_F" || _curObject isKindOf "Box_IND_Grena
};
};

private _vaultHouse = ALTIS_TANOA("Land_Research_house_V1_F","Land_Medevac_house_V1_F");
_altisArray = [16019.5,16952.9,0];
_tanoaArray = [11074.2,11501.5,0.00137329];
private _pos = ALTIS_TANOA(_altisArray,_tanoaArray);
private _vaultHouse = [[["Altis", "Land_Research_house_V1_F"], ["Tanoa", "Land_Medevac_house_V1_F"]]] call life_fnc_terrainSort;
private _altisArray = [16019.5,16952.9,0];
private _tanoaArray = [11074.2,11501.5,0.00137329];
private _pos = [[["Altis", _altisArray], ["Tanoa", _tanoaArray]]] call life_fnc_terrainSort;

if (_curObject isKindOf "House_F" && {player distance _curObject < 12} || ((nearestObject [_pos,"Land_Dome_Big_F"]) isEqualTo _curObject || (nearestObject [_pos,_vaultHouse]) isEqualTo _curObject)) exitWith {
[_curObject] call life_fnc_houseMenu;
Expand Down
24 changes: 24 additions & 0 deletions Altis_Life.Altis/core/functions/fn_terrainSort.sqf
@@ -0,0 +1,24 @@
/*
File: fn_terrainSort.sqf (TO BE CHANGED)

This comment has been minimized.

Copy link
@Jawshy

Jawshy Oct 19, 2016

Contributor

Why not change it now rather than later?

Author: BoGuu
Description:
Gah.
*/


if !(params[["_dictionary",[],[[],0,""]]]) exitWith {};

scopeName "main";

{
if (worldName == _x select 0) then {
(_x select 1) breakOut "main";
};
} count _dictionary;

switch (typeOf (_array select 0 select 1)) do {
case "ARRAY": {[]};
case "STRING": {""};
case "SCALAR": {-1};
};
10 changes: 5 additions & 5 deletions Altis_Life.Altis/core/housing/fn_houseMenu.sqf
Expand Up @@ -46,10 +46,10 @@ if (_curTarget in life_hideoutBuildings) exitWith {

if (_curTarget isKindOf "House_F" && playerSide isEqualTo west) exitWith {

private _vaultHouse = ALTIS_TANOA("Land_Research_house_V1_F","Land_Medevac_house_V1_F");
_altisArray = [16019.5,16952.9,0];
_tanoaArray = [11074.2,11501.5,0.00137329];
private _pos = ALTIS_TANOA(_altisArray,_tanoaArray);
private _vaultHouse = [[["Altis", "Land_Research_house_V1_F"], ["Tanoa", "Land_Medevac_house_V1_F"]]] call life_fnc_terrainSort;
private _altisArray = [16019.5,16952.9,0];
private _tanoaArray = [11074.2,11501.5,0.00137329];
private _pos = [[["Altis", _altisArray], ["Tanoa", _tanoaArray]]] call life_fnc_terrainSort;

if ((nearestObject [_pos,"Land_Dome_Big_F"]) isEqualTo _curTarget || (nearestObject [_pos,_vaultHouse]) isEqualTo _curTarget) then {

Expand Down Expand Up @@ -183,4 +183,4 @@ if (!(_curTarget in life_vehicles) || isNil {_curTarget getVariable "house_owner
};

};
};
};
8 changes: 4 additions & 4 deletions Altis_Life.Altis/core/items/fn_blastingCharge.sqf
Expand Up @@ -17,10 +17,10 @@ if (west countSide playableUnits < (LIFE_SETTINGS(getNumber,"minimum_cops"))) ex
hint format [localize "STR_Civ_NotEnoughCops",(LIFE_SETTINGS(getNumber,"minimum_cops"))];
};

private _vaultHouse = ALTIS_TANOA("Land_Research_house_V1_F","Land_Medevac_house_V1_F");
_altisArray = [16019.5,16952.9,0];
_tanoaArray = [11074.2,11501.5,0.00137329];
private _pos = ALTIS_TANOA(_altisArray,_tanoaArray);
private _vaultHouse = [[["Altis", "Land_Research_house_V1_F"], ["Tanoa", "Land_Medevac_house_V1_F"]]] call life_fnc_terrainSort;
private _altisArray = [16019.5,16952.9,0];
private _tanoaArray = [11074.2,11501.5,0.00137329];
private _pos = [[["Altis", _altisArray], ["Tanoa", _tanoaArray]]] call life_fnc_terrainSort;

if ((nearestObject [_pos,_vaultHouse]) getVariable ["locked",true]) exitWith {hint localize "STR_ISTR_Blast_Exploit"};
if (!([false,"blastingcharge",1] call life_fnc_handleInv)) exitWith {}; //Error?
Expand Down
8 changes: 4 additions & 4 deletions Altis_Life.Altis/core/items/fn_boltcutter.sqf
Expand Up @@ -9,10 +9,10 @@
private ["_building","_door","_doors","_cpRate","_title","_progressBar","_titleText","_cp","_ui"];
_building = param [0,objNull,[objNull]];

private _vaultHouse = ALTIS_TANOA("Land_Research_house_V1_F","Land_Medevac_house_V1_F");
_altisArray = [16019.5,16952.9,0];
_tanoaArray = [11074.2,11501.5,0.00137329];
private _pos = ALTIS_TANOA(_altisArray,_tanoaArray);
private _vaultHouse = [[["Altis", "Land_Research_house_V1_F"], ["Tanoa", "Land_Medevac_house_V1_F"]]] call life_fnc_terrainSort;
private _altisArray = [16019.5,16952.9,0];
private _tanoaArray = [11074.2,11501.5,0.00137329];
private _pos = [[["Altis", _altisArray], ["Tanoa", _tanoaArray]]] call life_fnc_terrainSort;

if (isNull _building) exitWith {};
if (!(_building isKindOf "House_F")) exitWith {hint localize "STR_ISTR_Bolt_NotNear";};
Expand Down
6 changes: 3 additions & 3 deletions Altis_Life.Altis/core/shops/fn_virt_buy.sqf
Expand Up @@ -16,9 +16,9 @@ _diff = [_type,parseNumber(_amount),life_carryWeight,life_maxWeight] call life_f
_amount = parseNumber(_amount);
if (_diff <= 0) exitWith {hint localize "STR_NOTF_NoSpace"};
_amount = _diff;
_altisArray = ["Land_u_Barracks_V2_F","Land_i_Barracks_V2_F"];
_tanoaArray = ["Land_School_01_F","Land_Warehouse_03_F","Land_House_Small_02_F"];
private _hideoutObjs = ALTIS_TANOA(_altisArray,_tanoaArray);
private _altisArray = ["Land_u_Barracks_V2_F","Land_i_Barracks_V2_F"];
private _tanoaArray = ["Land_School_01_F","Land_Warehouse_03_F","Land_House_Small_02_F"];
private _hideoutObjs = [[["Altis", _altisArray], ["Tanoa", _tanoaArray]]] call life_fnc_terrainSort;
_hideout = (nearestObjects[getPosATL player,_hideoutObjs,25]) select 0;
if ((_price * _amount) > CASH && {!isNil "_hideout" && {!isNil {group player getVariable "gang_bank"}} && {(group player getVariable "gang_bank") <= _price * _amount}}) exitWith {hint localize "STR_NOTF_NotEnoughMoney"};
if ((time - life_action_delay) < 0.2) exitWith {hint localize "STR_NOTF_ActionDelay";};
Expand Down
8 changes: 4 additions & 4 deletions Altis_Life.Altis/core/shops/fn_weaponShopBuySell.sqf
Expand Up @@ -29,9 +29,9 @@ if ((uiNamespace getVariable ["Weapon_Shop_Filter",0]) isEqualTo 1) then {
hint parseText format [localize "STR_Shop_Weapon_Sold",_itemInfo select 1,[_price] call life_fnc_numberText];
[nil,(uiNamespace getVariable ["Weapon_Shop_Filter",0])] call life_fnc_weaponShopFilter; //Update the menu.
} else {
_altisArray = ["Land_u_Barracks_V2_F","Land_i_Barracks_V2_F"];
_tanoaArray = ["Land_School_01_F","Land_Warehouse_03_F","Land_House_Small_02_F"];
private _hideoutObjs = ALTIS_TANOA(_altisArray,_tanoaArray);
private _altisArray = ["Land_u_Barracks_V2_F","Land_i_Barracks_V2_F"];
private _tanoaArray = ["Land_School_01_F","Land_Warehouse_03_F","Land_House_Small_02_F"];
private _hideoutObjs = [[["Altis", _altisArray], ["Tanoa", _tanoaArray]]] call life_fnc_terrainSort;
private _hideout = (nearestObjects[getPosATL player,_hideoutObjs,25]) select 0;
if (!isNil "_hideout" && {!isNil {group player getVariable "gang_bank"}} && {(group player getVariable "gang_bank") >= _price}) then {
_action = [
Expand Down Expand Up @@ -71,4 +71,4 @@ if ((uiNamespace getVariable ["Weapon_Shop_Filter",0]) isEqualTo 1) then {
};
};
[0] call SOCK_fnc_updatePartial;
[] call life_fnc_saveGear;
[] call life_fnc_saveGear;
3 changes: 0 additions & 3 deletions Altis_Life.Altis/script_macros.hpp
Expand Up @@ -53,6 +53,3 @@
preprocessFile "SpyGlass\endoftheline.sqf"; \
sleep 2.5; \
failMission "SpyGlass";

//Map Macros
#define ALTIS_TANOA(var1,var2) if (worldName == "Altis") then {var1} else {var2}
2 changes: 1 addition & 1 deletion Altis_Life.Altis/stringtable.xml
Expand Up @@ -11680,4 +11680,4 @@
<German>%1 - %2 hat $%3 auf sein Konto eingezahlt. Bank-Konto: $%4 Bargeld: $%5</German>
</Key>
</Package>
</Project>
</Project>

This comment has been minimized.

Copy link
@Jawshy

Jawshy Oct 19, 2016

Contributor

No newline at end of file 👺

This comment has been minimized.

Copy link
@setoy

setoy Oct 19, 2016

Contributor

Just curious: Is a newline at the end of file required or should it be avoided? And if not, why isn't it?

This comment has been minimized.

Copy link
@Jawshy

Jawshy Oct 19, 2016

Contributor

Not required, but it is a good practice to do so. Same concept with whitespace (if () and casing (worldName).

This comment has been minimized.

Copy link
@setoy

setoy Oct 19, 2016

Contributor

Alright, thanks. Because in most of the files a newline is not present and in a few PRs, new lines even got removed. Mhmm..

8 changes: 4 additions & 4 deletions life_server/init.sqf
Expand Up @@ -178,10 +178,10 @@ publicVariable "TON_fnc_playtime_values_request";


/* Setup the federal reserve building(s) */
private _vaultHouse = ALTIS_TANOA("Land_Research_house_V1_F","Land_Medevac_house_V1_F");
_altisArray = [16019.5,16952.9,0];
_tanoaArray = [11074.2,11501.5,0.00137329];
private _pos = ALTIS_TANOA(_altisArray,_tanoaArray);
private _vaultHouse = [[["Altis", "Land_Research_house_V1_F"], ["Tanoa", "Land_Medevac_house_V1_F"]]] call life_fnc_terrainSort;
private _altisArray = [16019.5,16952.9,0];
private _tanoaArray = [11074.2,11501.5,0.00137329];
private _pos = [[["Altis", _altisArray], ["Tanoa", _tanoaArray]]] call life_fnc_terrainSort;

_dome = nearestObject [_pos,"Land_Dome_Big_F"];
_rsb = nearestObject [_pos,_vaultHouse];
Expand Down
3 changes: 0 additions & 3 deletions life_server/script_macros.hpp
Expand Up @@ -58,6 +58,3 @@
#define M_CONFIG(TYPE,CFG,CLASS,ENTRY) TYPE(missionConfigFile >> CFG >> CLASS >> ENTRY)
#define BASE_CONFIG(CFG,CLASS) inheritsFrom(configFile >> CFG >> CLASS)
#define LIFE_SETTINGS(TYPE,SETTING) TYPE(missionConfigFile >> "Life_Settings" >> SETTING)

//Map Macros
#define ALTIS_TANOA(var1,var2) if (worldName isEqualTo "Altis") then {var1} else {var2}

0 comments on commit 7344c21

Please sign in to comment.