mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Common - Use hashmap variable for canDig surfaces (#9147)
* Common - Use hashmap variable for canDig surfaces * Update XEH_preInit.sqf * Update fnc_canDig.sqf * Update fnc_canDig.sqf
This commit is contained in:
parent
f67957cdde
commit
cac223c6ec
@ -59,6 +59,16 @@ GVAR(hexArray) = [
|
||||
"F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF"
|
||||
];
|
||||
|
||||
GVAR(canDigSurfaces) = createHashMapFromArray [
|
||||
["int_concrete",false],["int_pavement_exp",false],["int_solidwood_exp",false],["tiling",false],["roof_tiles",false],["stony",false],
|
||||
["wavymetal",false],["int_wood",false],["int_tiles",false],["softwood_exp",false],["int_concrete_exp",false],["tiles_int",false],
|
||||
["metalplate_exp",false],["int_metalplate_exp",false],["steel_exp",false],["metal",false],["int_lino_exp",false],["metal_int",false],
|
||||
["wavymetal_exp",false],["int_metal",false],["asphalt_exp",false],["pavement_exp",false],["gridmetal_exp",false],
|
||||
["rooftiles_exp",false],["rock",false],["int_mat_exp",false],["wood_int",false],["concrete_int",false],["tarmac",false],["wood",false],
|
||||
["roof_tin",false],["lino_exp",false],["concrete",false],["int_softwood_exp",false], ["concrete_exp",false],["stones_exp",false],
|
||||
["forest_exp",true],["snow",true],["grasstall_exp",true],["grass",true]
|
||||
];
|
||||
|
||||
isHC = !hasInterface && !isDedicated; // deprecated because no tag
|
||||
missionNamespace setVariable ["ACE_isHC", ACE_isHC];
|
||||
uiNamespace setVariable ["ACE_isHC", ACE_isHC];
|
||||
|
@ -4,34 +4,36 @@
|
||||
* Checks if the player can dig on the surface below (enough dust).
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 0: Unit or Position (2d/3d) <OBJECT><ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* Can Dig <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [ACE_player] call ace_common_fnc_canDig
|
||||
* [[1000,2000]] call ace_common_fnc_canDig
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_unit"];
|
||||
params ["_input"];
|
||||
|
||||
private _posASL = getPosASL _unit;
|
||||
private _posASL = _input;
|
||||
|
||||
if ((getPosATL _unit) select 2 > 0.05 || // Walking on objects, such as buildings, pavements, etc.
|
||||
if ((_input isEqualType objNull) && {
|
||||
_posASL = getPosASL _input;
|
||||
(getPosATL _unit) select 2 > 0.05 || // Walking on objects, such as buildings, pavements, etc.
|
||||
{surfaceIsWater _posASL} // posATL in low water (not as low to allow awalking) is negative
|
||||
) exitWith {false};
|
||||
}) exitWith {false};
|
||||
|
||||
private _surfaceClass = (surfaceType _posASL) select [1];
|
||||
private _config = configFile >> "CfgSurfaces" >> _surfaceClass;
|
||||
private _surfaceType = getText (_config >> "soundEnviron");
|
||||
private _surfaceDust = getNumber (_config >> "dust");
|
||||
|
||||
TRACE_2("Surface",_surfaceType,_surfaceDust);
|
||||
TRACE_3("",_surfaceClass,getText (_config >> "soundEnviron"),getNumber (_config >> "dust"));
|
||||
|
||||
if (isNumber (_config >> "ACE_canDig")) then {
|
||||
(getNumber (_config >> "ACE_canDig")) == 1 // return
|
||||
} else {
|
||||
!(_surfaceType in DIG_SURFACE_BLACKLIST) && {(_surfaceDust >= 0.1) || {_surfaceType in DIG_SURFACE_WHITELIST}} // return
|
||||
private _surfaceType = getText (_config >> "soundEnviron");
|
||||
GVAR(canDigSurfaces) getOrDefault [_surfaceType, getNumber (_config >> "dust") >= 0.1, true] // return
|
||||
};
|
||||
|
@ -15,18 +15,3 @@
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
|
||||
|
||||
#define DIG_SURFACE_BLACKLIST [ \
|
||||
"concrete", "concrete_exp", "concrete_int", "int_concrete", "int_concrete_exp", \
|
||||
"pavement_exp", "int_pavement_exp", \
|
||||
"tiling", "tiles_int", "int_tiles", \
|
||||
"roof_tin", "roof_tiles", "rooftiles_exp", \
|
||||
"tarmac", "asphalt_exp", \
|
||||
"stones_exp", "rock", "stony", \
|
||||
"metal", "gridmetal_exp", "metalplate_exp", "int_metalplate_exp", "metal_int", "wavymetal", "wavymetal_exp", "int_metal", "steel_exp", \
|
||||
"lino_exp", "int_lino_exp", "int_mat_exp", \
|
||||
"wood", "wood_int", "int_wood", "softwood_exp", "int_softwood_exp", "int_solidwood_exp" \
|
||||
]
|
||||
|
||||
#define DIG_SURFACE_WHITELIST ["grass", "grasstall_exp", "forest_exp", "snow"]
|
||||
|
Loading…
Reference in New Issue
Block a user