Epoch/Sources/epoch_code/compile/EPOCH_chopWood.sqf

60 lines
1.6 KiB
Plaintext
Raw Normal View History

2015-12-07 16:24:52 +00:00
/*
Author: Aaron Clark - EpochMod.com
Contributors:
Description:
Epoch Chopwood function
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_code/compile/EPOCH_chopWood.sqf
*/
private["_currentPos", "_object", "_type", "_objects", "_sel_object"];
2015-09-14 20:55:36 +00:00
_currentPos = player modelToWorld[0, 5, 0];
if !(surfaceIsWater _currentPos) then {
_currentPos = ATLtoASL _currentPos;
};
_objects = lineIntersectsObjs[eyePos player, _currentPos, player, objNull, true, 2];
_object = objNull;
_type = 0;
_config = 'CfgEpochClient' call EPOCH_returnConfig;
{
2016-01-28 19:36:35 +00:00
_str = str _x;
2015-12-07 16:24:52 +00:00
_sel_object = _x;
2016-01-28 19:36:35 +00:00
_findStart = _str find ": ";
2015-09-14 20:55:36 +00:00
if (_findStart != -1) then{
2016-01-28 19:36:35 +00:00
_start = _findStart + 2;
_end = (_str find ".") - _start;
_p3dName = _str select[_start, _end];
// diag_log format ["DEBUG: _p3dName %1",_p3dName];
if (_p3dName find " " != -1) then {
(_p3dName splitString " ") joinString "_"; // replace spaces with underscores
};
_finalConfig = (_config >> "WorldInteractions" >> (_p3dName + "_p3d"));
if (getNumber(_finalConfig >> "tree") == 1) then{
2015-09-14 20:55:36 +00:00
_object = _sel_object;
};
2016-01-28 19:36:35 +00:00
if (getNumber(_finalConfig >> "bush") == 1) then{
2015-09-14 20:55:36 +00:00
_type = 1;
_object = _sel_object;
};
};
if !(isNull _object) exitWith {};
}foreach _objects;
if (!isNull _object) then {
if (alive _object) then {
2015-12-23 17:38:11 +00:00
[_object,_type,player,EPOCH_personalToken] remoteExec ["EPOCH_server_knockDownTree",2];
2015-09-14 20:55:36 +00:00
};
2015-12-07 16:24:52 +00:00
};