Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Commit

Permalink
Revert "Revert "Fix for static weapon tracking""
Browse files Browse the repository at this point in the history
This reverts commit 2198f71.
  • Loading branch information
alexcroox committed Jan 7, 2017
1 parent 2198f71 commit 97b0c74
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 28 deletions.
1 change: 1 addition & 0 deletions addons/main/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ GVAR(extensionName) = "r3_extension";
GVAR(extensionSeparator) = "";
GVAR(playerSavedIds) = [];
GVAR(maxUnitCountPerEvent) = 25;
GVAR(maxMarkerCountPerEvent) = 10;

// Frequency of unit movement logging (seconds)
GVAR(insertFrequencyInfantry) = 1;
Expand Down
2 changes: 1 addition & 1 deletion addons/main/functions/fnc_eventGetIn.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ params [
["_unit", objNull]
];

if (GVAR(noPlayers)) exitWith {};
if (GVAR(noPlayers) || !GVAR(logEvents)) exitWith {};

if (_unit isEqualTo objNull) exitWith {};

Expand Down
2 changes: 1 addition & 1 deletion addons/main/functions/fnc_eventGetOut.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ params [
["_unit", objNull]
];

if (GVAR(noPlayers)) exitWith {};
if (GVAR(noPlayers) || !GVAR(logEvents)) exitWith {};

if (_unit isEqualTo objNull) exitWith {};

Expand Down
2 changes: 2 additions & 0 deletions addons/main/functions/fnc_eventHit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ params [
["_attacker", objNull]
];

if (GVAR(noPlayers) || !GVAR(logEvents)) exitWith {};

_victim setVariable ["lastAttacker", _attacker, false];
2 changes: 1 addition & 1 deletion addons/main/functions/fnc_eventIncomingMissile.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ params [
["_attacker", objNull]
];

if (GVAR(noPlayers)) exitWith {};
if (GVAR(noPlayers) || !GVAR(logEvents)) exitWith {};

if (_victim isEqualTo objNull) exitWith {};

Expand Down
2 changes: 1 addition & 1 deletion addons/main/functions/fnc_eventKilled.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ params [
["_attacker", objNull]
];

if (GVAR(noPlayers)) exitWith {};
if (GVAR(noPlayers) || !GVAR(logEvents)) exitWith {};

// Handle respawnOnStart
if (_victim == objNull) exitWith {};
Expand Down
2 changes: 2 additions & 0 deletions addons/main/functions/fnc_eventPlayerConnect.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ params [
["_jip", false]
];

if !(GVAR(logEvents)) exitWith {};

if (_uid == "") exitWith {};

// We only want to show notifications for JIP players
Expand Down
2 changes: 2 additions & 0 deletions addons/main/functions/fnc_eventPlayerDisconnect.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ params [
["_uid", ""]
];

if !(GVAR(logEvents)) exitWith {};

if (_uid == "") exitWith {};

private _json = format['{"id": "%1"}', _uid];
Expand Down
2 changes: 1 addition & 1 deletion addons/main/functions/fnc_eventRespawned.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ params [
["_oldEntity", objNull]
];

if (GVAR(noPlayers)) exitWith {};
if (GVAR(noPlayers) || !GVAR(logEvents)) exitWith {};

// We only want to handle ai or players respawning
if ( (_newEntity isEqualTo ObjNull) or !(getObjectType _newEntity isEqualTo 8) ) exitWith {};
Expand Down
2 changes: 1 addition & 1 deletion addons/main/functions/fnc_eventUnconscious.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ params [
["_state", FALSE]
];

if (GVAR(noPlayers)) exitWith {};
if (GVAR(noPlayers) || !GVAR(logEvents)) exitWith {};

// Let's debounce multiple unconscious events firing for this unit
private _lastUnconsciousTime = _unit getVariable ["lastUnconscious", 0];
Expand Down
16 changes: 16 additions & 0 deletions addons/main/functions/fnc_trackMarkers.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#include "script_component.hpp"
private _functionLogName = "AAR > trackMarkers";

// We have a string length limit with our database extension so we need to break up
// large amounts of markers into multiple calls
private _markerCount = 0;
private _markerData = "";

// Loop through all markers on the map
Expand Down Expand Up @@ -69,6 +72,19 @@ private _markerData = "";
// Combine this marker's data with our current running marker data
_markerData = [[_markerData, _singleMarkerData], _seperator] call CBA_fnc_join;

_markerCount = _markerCount + 1;

// If we've reached our limit for the number of units in a single db entry lets flush and continue
if (_markerCount == GVAR(maxMarkerCountPerEvent)) then {

// Save details to db
private _markerDataJsonArray = format["[%1]", _markerData];
["markers", _markerDataJsonArray] call FUNC(dbInsertEvent);

_markerCount = 0;
_markerData = "";
};

} forEach allMapMarkers;

// Send the json to our extension for saving to the db
Expand Down
32 changes: 11 additions & 21 deletions addons/main/functions/fnc_trackVehicles.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private _movementData = "";
if (count crew _x > 0) then {

// Are we asking for ground vehicles and does this vehicle drive?
if ( _trackVehicleType == "ground" && !(_x isKindOf "Car" || _x isKindOf "Tank" || _x isKindOf "Boat_F") ) exitWith {};
if ( _trackVehicleType == "ground" && !(_x isKindOf "Car" || _x isKindOf "Tank" || _x isKindOf "Boat_F" || _x isKindOf "Ship_F" || _x isKindOf "StaticWeapon") ) exitWith {};

// Are we tracking air vehicles and does this vehicle fly?
if ( _trackVehicleType == "air" && !(_x isKindOf "Helicopter" || _x isKindOf "Plane") ) exitWith {};
Expand All @@ -52,6 +52,7 @@ private _movementData = "";
private _vehicleIconPathRaw = getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "icon");
private _splitIconPath = _vehicleIconPathRaw splitString "\.";
private _vehicleIconName = _vehicleIconPathRaw;

if (count _splitIconPath > 2) then {
_vehicleIconName = _splitIconPath select (count _splitIconPath - 2);
};
Expand All @@ -61,33 +62,22 @@ private _movementData = "";

if (_this isKindOf "Heli_Attack_01_base_F" || _this isKindOf "Heli_Attack_02_base_F" || _this isKindOf "Heli_Attack_03_base_F") exitWith { "iconHelicopterAttack" };
if (_this isKindOf "Heli_Transport_01_base_F" || _this isKindOf "Heli_Transport_02_base_F" || _this isKindOf "Heli_Transport_03_base_F") exitWith { "iconHelicopterTransport" };
if (_this isKindOf "Plane_CAS_01_base_F") exitWith { "iconPlaneAttack" };
if (_this isKindOf "Plane_CAS_02_base_F") exitWith { "iconPlaneAttack" };
if (_this isKindOf "Plane_CAS_03_base_F") exitWith { "iconPlaneAttack" };
if (_this isKindOf "APC_Tracked_03_base_F") exitWith { "iconAPC" };
if (_this isKindOf "APC_Tracked_02_base_F") exitWith { "iconAPC" };
if (_this isKindOf "APC_Tracked_01_base_F") exitWith { "iconAPC" };
if (_this isKindOf "Truck_01_base_F") exitWith { "iconTruck" };
if (_this isKindOf "Truck_02_base_F") exitWith { "iconTruck" };
if (_this isKindOf "Truck_03_base_F") exitWith { "iconTruck" };
if (_this isKindOf "MRAP_01_base_F") exitWith { "iconMRAP" };
if (_this isKindOf "MRAP_02_base_F") exitWith { "iconMRAP" };
if (_this isKindOf "MRAP_03_base_F") exitWith { "iconMRAP" };
if (_this isKindOf "MBT_01_arty_base_F") exitWith { "iconTankArtillery" };
if (_this isKindOf "MBT_02_arty_base_F") exitWith { "iconTankArtillery" };
if (_this isKindOf "MBT_03_arty_base_F") exitWith { "iconTankArtillery" };
if (_this isKindOf "MBT_01_base_F") exitWith { "iconTank" };
if (_this isKindOf "MBT_02_base_F") exitWith { "iconTank" };
if (_this isKindOf "MBT_03_base_F") exitWith { "iconTank" };
if (_this isKindOf "Plane_CAS_01_base_F" || _this isKindOf "Plane_CAS_02_base_F" || _this isKindOf "Plane_CAS_03_base_F") exitWith { "iconPlaneAttack" };
if (_this isKindOf "APC_Tracked_01_base_F" || _this isKindOf "APC_Tracked_02_base_F" || _this isKindOf "APC_Tracked_03_base_F") exitWith { "iconAPC" };
if (_this isKindOf "Truck_01_base_F" || _this isKindOf "Truck_02_base_F" || _this isKindOf "Truck_03_base_F") exitWith { "iconTruck" };
if (_this isKindOf "MRAP_01_base_F" || _this isKindOf "MRAP_02_base_F" || _this isKindOf "MRAP_03_base_F") exitWith { "iconMRAP" };
if (_this isKindOf "MBT_01_arty_base_F" || _this isKindOf "MBT_02_arty_base_F" || _this isKindOf "MBT_03_arty_base_F") exitWith { "iconTankArtillery" };
if (_this isKindOf "MBT_01_base_F" || _this isKindOf "MBT_02_base_F" || _this isKindOf "MBT_03_base_F") exitWith { "iconTank" };
if (_this isKindOf "StaticCannon") exitWith { "iconStaticCannon" };
if (_this isKindOf "StaticAAWeapon") exitWith { "iconStaticAA" };
if (_this isKindOf "StaticATWeapon") exitWith { "iconStaticAT" };
if (_this isKindOf "StaticMGWeapon") exitWith { "iconStaticMG" };
if (_this isKindOf "StaticWeapon") exitWith { "iconStaticWeapon" };
if (_this isKindOf "StaticGrenadeLauncher") exitWith { "iconStaticGL" };

if (_this isKindOf "Steerable_Parachute_F" || _this isKindOf "NonSteerable_Parachute_F") exitWith { "iconParachute" };
if (_this isKindOf "Boat_F") exitWith { "iconBoat" };

// Fallbacks
if (_this isKindOf "Boat_F" || _this isKindOf "Ship_F") exitWith { "iconBoat" };
if (_this isKindOf "Truck_F") exitWith { "iconTruck" };
if (_this isKindOf "Tank" || _this isKindOf "Tank_F") exitWith { "iconTank" };
if (_this isKindOf "Car" || _this isKindOf "Car_F") exitWith { "iconCar" };
Expand Down
2 changes: 1 addition & 1 deletion addons/main/script_mod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#define MAJOR 1
#define MINOR 0
#define PATCHLVL 6
#define PATCHLVL 7
#define BUILD 0

#define VERSION MAJOR.MINOR.PATCHLVL.BUILD
Expand Down

0 comments on commit 97b0c74

Please sign in to comment.