mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
initial
This commit is contained in:
parent
a417ea87d3
commit
a849f04f75
1
addons/gps/$PBOPREFIX$
Normal file
1
addons/gps/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\gps
|
17
addons/gps/CfgEventHandlers.hpp
Normal file
17
addons/gps/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
class Extended_PreStart_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preStart));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||
};
|
||||
};
|
4
addons/gps/XEH_PREP.hpp
Normal file
4
addons/gps/XEH_PREP.hpp
Normal file
@ -0,0 +1,4 @@
|
||||
PREP(getError);
|
||||
PREP(getOffset);
|
||||
PREP(getPos);
|
||||
PREP(getSatLocations);
|
3
addons/gps/XEH_postInit.sqf
Normal file
3
addons/gps/XEH_postInit.sqf
Normal file
@ -0,0 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
11
addons/gps/XEH_preInit.sqf
Normal file
11
addons/gps/XEH_preInit.sqf
Normal file
@ -0,0 +1,11 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP_RECOMPILE_START;
|
||||
#include "XEH_PREP.hpp"
|
||||
PREP_RECOMPILE_END;
|
||||
|
||||
// #include "initSettings.sqf"
|
||||
|
||||
ADDON = true;
|
3
addons/gps/XEH_preStart.sqf
Normal file
3
addons/gps/XEH_preStart.sqf
Normal file
@ -0,0 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#include "XEH_PREP.hpp"
|
18
addons/gps/config.cpp
Normal file
18
addons/gps/config.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define COLOUR 8.0
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
name = COMPONENT_NAME;
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_common"};
|
||||
author = ECSTRING(common,ACETeam);
|
||||
authors[] = {"Brett Mayson"};
|
||||
url = ECSTRING(main,URL);
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
40
addons/gps/functions/fnc_getError.sqf
Normal file
40
addons/gps/functions/fnc_getError.sqf
Normal file
@ -0,0 +1,40 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: Brett Mayson
|
||||
* Get GPS error level
|
||||
*
|
||||
* This number does not have any real world correlation
|
||||
*
|
||||
* Arguments:
|
||||
* Object with GPS <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Error <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* [_unit] call ace_gps_fnc_getError
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
params [
|
||||
["_object", ACE_player, [objNull]]
|
||||
];
|
||||
|
||||
if (time < (_object getVariable [QGVAR(errorCacheExpire), -1])) exitWith {
|
||||
_object getVariable [QGVAR(errorCache), 0];
|
||||
};
|
||||
|
||||
private _points = [_object] call FUNC(getSatLocations);
|
||||
private _src = getPos _object;
|
||||
_src set [2, 1.3];
|
||||
_src = AGLtoASL _src;
|
||||
private _error = 0;
|
||||
{
|
||||
_error = _error + count lineIntersectsSurfaces [_src, AGLtoASL _x, _object, objNull, true, 3];
|
||||
} forEach _points;
|
||||
|
||||
_object setVariable [QGVAR(errorCache), _error];
|
||||
_object setVariable [QGVAR(errorCacheExpire), time + 0.5];
|
||||
|
||||
_error
|
44
addons/gps/functions/fnc_getOffset.sqf
Normal file
44
addons/gps/functions/fnc_getOffset.sqf
Normal file
@ -0,0 +1,44 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: Brett Mayson
|
||||
* Get GPS position with random error
|
||||
*
|
||||
* This number does not have any real world correlation
|
||||
*
|
||||
* Arguments:
|
||||
* Object with GPS <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Error <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* [_unit] call ace_gps_fnc_getPos
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
params [
|
||||
["_object", ACE_player, [objNull]]
|
||||
];
|
||||
|
||||
if (time < (_object getVariable [QGVAR(offsetCacheExpire), -1])) exitWith {
|
||||
_object getVariable [QGVAR(offsetCache), [0, 0]];
|
||||
};
|
||||
|
||||
private _error = [_object] call FUNC(getError);
|
||||
if (_error == 0) exitWith { [0,0] };
|
||||
|
||||
private _seed = floor (dayTime * 10);
|
||||
|
||||
private _pos = getPos _object;
|
||||
_pos deleteAt 2;
|
||||
_pos set [0, floor (_pos#0 / 100)];
|
||||
_pos set [1, floor (_pos#1 / 100)];
|
||||
|
||||
private _distance = (_seed random _pos) * _error;
|
||||
private _direction = (_error random _pos) * 360;
|
||||
|
||||
_object setVariable [QGVAR(offsetCache), [_distance, _direction]];
|
||||
_object setVariable [QGVAR(offsetCacheExpire), time + 3];
|
||||
|
||||
[_distance, _direction]
|
24
addons/gps/functions/fnc_getPos.sqf
Normal file
24
addons/gps/functions/fnc_getPos.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: Brett Mayson
|
||||
* Get GPS position with random error
|
||||
*
|
||||
* This number does not have any real world correlation
|
||||
*
|
||||
* Arguments:
|
||||
* Object with GPS <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Error <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* [_unit] call ace_gps_fnc_getPos
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
params [
|
||||
["_object", ACE_player, [objNull]]
|
||||
];
|
||||
|
||||
_object getPos ([_object] call FUNC(getOffset));
|
28
addons/gps/functions/fnc_getSatLocations.sqf
Normal file
28
addons/gps/functions/fnc_getSatLocations.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: Brett Mayson
|
||||
* Get "satellite" locations for simulating gps inaccuracy
|
||||
*
|
||||
* Arguments:
|
||||
* Object with GPS <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Locations <ARRAY>
|
||||
*
|
||||
* Example:
|
||||
* [_unit] call ace_gps_fnc_getSatLocations
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
params [
|
||||
["_object", ACE_player, [objNull]]
|
||||
];
|
||||
|
||||
private _points = [];
|
||||
for "_i" from 0 to 5 do {
|
||||
private _point = _object getPos [800, _i * 60];
|
||||
_point set [2, 500];
|
||||
_points pushBack _point;
|
||||
};
|
||||
_points
|
1
addons/gps/functions/script_component.hpp
Normal file
1
addons/gps/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\gps\script_component.hpp"
|
17
addons/gps/script_component.hpp
Normal file
17
addons/gps/script_component.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
#define COMPONENT gps
|
||||
#define COMPONENT_BEAUTIFIED GPS
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
// #define DEBUG_MODE_FULL
|
||||
// #define DISABLE_COMPILE_CACHE
|
||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||
|
||||
#ifdef DEBUG_ENABLED_GPS
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SETTINGS_GPS
|
||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_GPS
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
Loading…
Reference in New Issue
Block a user