Sandbags surfaces update (#4971)

* Use private keyword, move surface blacklist to script_component.hpp

* Check height above terrain

* Add Tanoa surfaces, Check if in water

* Use 'dust' config entry to determine surface, Add common canDig (checks dustyness)

* Re-enable compile cache

* Revert to surface blacklist with dust as fallback

* Move surface blacklist to script_component because SQF validator complains
This commit is contained in:
jonpas 2017-03-15 16:11:37 +01:00 committed by PabstMirror
parent 9e27960b86
commit b31abee4fd
6 changed files with 53 additions and 26 deletions

View File

@ -13,6 +13,7 @@ PREP(ASLToPosition);
PREP(binarizeNumber);
PREP(blurScreen);
PREP(cachedCall);
PREP(canDig);
PREP(canGetInPosition);
PREP(canInteractWith);
PREP(changeProjectileDirection);

View File

@ -0,0 +1,31 @@
/*
* Author: Ruthberg, commy2
* Checks if the player can dig on the surface below (enough dust).
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* Can Dig <BOOL>
*
* Example:
* [ACE_player] call ace_common_fnc_canDig
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
private _posASL = getPosASL _unit;
if ((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};
private _surfaceClass = (surfaceType _posASL) select [1];
private _surfaceType = getText (configFile >> "CfgSurfaces" >> _surfaceClass >> "soundEnviron");
private _surfaceDust = getNumber (configFile >> "CfgSurfaces" >> _surfaceClass >> "dust");
TRACE_2("Surface",_surfaceType,_surfaceDust);
!(_surfaceType in DIG_SURFACE_BLACKLIST) && {_surfaceDust >= 0.1}

View File

@ -19,3 +19,16 @@
#define VERSION_CONFIG_COMMON VERSION_CONFIG;\
versionDesc = "ACE 3";\
versionAct = QUOTE(call COMPILE_FILE(init_versionTooltip))
#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" \
]

View File

@ -1,9 +1,9 @@
/*
* Author: Ruthberg, commy2
* Checks if the player can deploy a sandbag
* Checks if the player can deploy a sandbag.
*
* Arguments:
* None
* 0: Unit <OBJECT>
*
* Return Value:
* Can deploy <BOOL>
@ -15,15 +15,8 @@
*/
#include "script_component.hpp"
#define SURFACE_BLACKLIST ["water", "concrete", "tarmac", "wood", "metal", "roof_tin", "roof_tiles", "wood_int", "concrete_int", "tiles_int", "metal_int", "stony", "rock", "int_concrete", "int_tiles", "int_wood", "tiling", "wavymetal", "int_metal"]
params ["_unit"];
if !("ACE_Sandbag_empty" in items _unit) exitWith {false};
private ["_surfaceClass", "_surfaceType"];
_surfaceClass = (surfaceType getPosASL _unit) select [1];
_surfaceType = getText (configFile >> "CfgSurfaces" >> _surfaceClass >> "soundEnviron");
!(_surfaceType in SURFACE_BLACKLIST)
_unit call EFUNC(common,canDig)

View File

@ -29,14 +29,12 @@ _unit removeItem "ACE_Sandbag_empty";
params ["_unit"];
private ["_position", "_direction", "_sandBag"];
_position = getPosASL GVAR(sandBag);
_direction = getDir GVAR(sandBag);
private _position = getPosASL GVAR(sandBag);
private _direction = getDir GVAR(sandBag);
deleteVehicle GVAR(sandBag);
_sandBag = createVehicle ["ACE_SandbagObject", [0, 0, 0], [], 0, "NONE"];
private _sandBag = createVehicle ["ACE_SandbagObject", [0, 0, 0], [], 0, "NONE"];
_sandBag setPosASL _position;
_sandBag setDir _direction;

View File

@ -1,6 +1,6 @@
/*
* Author: Ruthberg, commy2, esteldunedain
* Checks if a unit can dig a trench
* Checks if a unit can dig a trench.
*
* Arguments:
* 0: Unit <OBJECT>
@ -15,17 +15,8 @@
*/
#include "script_component.hpp"
#define SURFACE_BLACKLIST ["water", "concrete", "tarmac", "wood", "metal", "roof_tin", "roof_tiles", "wood_int", "concrete_int", "tiles_int", "metal_int", "stony", "rock", "int_concrete", "int_tiles", "int_wood", "tiling", "wavymetal", "int_metal"]
params ["_unit"];
if !("ACE_EntrenchingTool" in items _unit) exitWith {false};
// Can't dig trench if above ground level
if ((getPosATL _unit) select 2 > 0.05) exitWith {false};
private _surfaceClass = (surfaceType getPosASL _unit) select [1];
private _surfaceType = getText (configFile >> "CfgSurfaces" >> _surfaceClass >> "soundEnviron");
TRACE_1("",_surfaceType);
!(_surfaceType in SURFACE_BLACKLIST)
_unit call EFUNC(common,canDig)