2015-03-10 21:01:46 +00:00
|
|
|
/*
|
|
|
|
* 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
|
2015-06-16 04:59:21 +00:00
|
|
|
#define FENCE_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", "ace_concertinawire"]
|
2015-01-28 17:51:42 +00:00
|
|
|
|
2015-04-15 23:32:47 +00:00
|
|
|
#define FENCE_P3DS ["mil_wiredfence_f.p3d","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 {
|
2015-04-15 23:32:47 +00:00
|
|
|
//If the fence has configEntry we can check it directly
|
|
|
|
_returnValue = _typeOf in FENCE_TYPENAMES;
|
2015-01-28 09:22:39 +00:00
|
|
|
} else {
|
2015-03-10 21:01:46 +00:00
|
|
|
_typeOf = toLower (str _object); //something like "123201: wall_indfnc_9.p3d"
|
|
|
|
{
|
2015-04-15 23:32:47 +00:00
|
|
|
if ((_typeOf find _x) != -1) exitWith {
|
2015-03-10 21:01:46 +00:00
|
|
|
_returnValue = true;
|
|
|
|
};
|
2015-04-15 23:32:47 +00:00
|
|
|
} forEach FENCE_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
|