ACE3/addons/logistics_wirecutter/functions/fnc_isFence.sqf

44 lines
1.5 KiB
Plaintext
Raw Normal View History

/*
* Author: PabstMirror
* Checks if object is a fence. Should work on any fence type, even (typeof == "").
* Call is fairly expensive because of all of the string checking.
*
* Arguments:
* 0: An Object To Test <OBJECT>
*
* Return Value:
* Is it a fence <BOOL>
*
* Example:
* [aFence] call ace_logistics_wirecutter_fnc_isFence
*
* Public: No
*/
2015-01-28 09:22:39 +00:00
#include "script_component.hpp"
2015-01-28 17:51:42 +00:00
//find is case sensitive, so keep everything lowercase
#define FENCE_A3_TYPENAMES ["land_net_fence_4m_f", "land_net_fence_8m_f", "land_net_fenced_8m_f", "land_new_wiredfence_5m_f", "land_new_wiredfence_10m_dam_f", "land_new_wiredfence_10m_f", "land_pipe_fence_4m_f", "land_pipe_fence_4mnolc_f", "land_sportground_fence_f", "land_wired_fence_4m_f", "land_wired_fence_4md_f", "land_wired_fence_8m_f", "land_wired_fence_8md_f", "land_razorwire_f"]
#define FENCE_A3_P3DS ["mil_wiredfence_f.p3d"]
#define FENCE_AIA_TYPENAMES []
#define FENCE_AIA_P3DS ["wall_indfnc_3.p3d", "wall_indfnc_9.p3d", "wall_indfnc_corner.p3d", "pletivo_wired.p3d", "wall_fen1_5.p3d"]
2015-01-28 09:22:39 +00:00
private ["_typeOf", "_returnValue"];
PARAMS_1(_object);
2015-02-01 17:56:54 +00:00
_typeOf = toLower (typeOf _object);
2015-01-28 09:22:39 +00:00
_returnValue = false;
if (_typeOf != "") then {
_returnValue = _typeOf in (FENCE_A3_TYPENAMES + FENCE_AIA_TYPENAMES);
2015-01-28 09:22:39 +00:00
} else {
_typeOf = toLower (str _object); //something like "123201: wall_indfnc_9.p3d"
{
if ((_typeOf find _x) != -1) then {
_returnValue = true;
};
} forEach (FENCE_A3_P3DS + FENCE_AIA_P3DS);
2015-01-28 09:22:39 +00:00
};
2015-01-28 17:51:42 +00:00
2015-01-28 09:22:39 +00:00
_returnValue