@@ 39,6 39,8 @@ VAR(_enemy_sides) = [_ao select AO_SIDE]
VAR(_all_contacts) = [];
// Used to prevent duplicate entries (todo, not heuristic enough?)
VAR(_all_contacts_keys) = [];
+// Keeps the greatest knowsAbout value for each contact
+VAR(_all_contacts_knowledge) = [];
{
VAR(_grp) = _x select PAWN_GROUP;
// We want _all_contacts to be able to be considered a set, so make sure
@@ 52,10 54,20 @@ VAR(_all_contacts_keys) = [];
if (_side in _enemy_sides) then
{
VAR(_obj) = _x select 4;
- if !(_obj in _all_contacts_keys) then
+ VAR(_knows_aboot) = _grp knowsAbout _obj;
+ VAR(_idx) = _all_contacts_keys find _obj;
+ if (_idx == -1) then
{
_all_contacts pushBack _x;
_all_contacts_keys pushBack _obj;
+ _all_contacts_knowledge pushBack _knows_aboot;
+ }
+ else
+ {
+ if ((_all_contacts_knowledge select _idx) < _knows_aboot) then
+ {
+ _all_contacts_knowledge set [_idx, _knows_aboot];
+ };
};
};
};
@@ 65,27 77,52 @@ VAR(_all_contacts_keys) = [];
forEach _pawns;
LOGVAR(_all_contacts);
-VAR(_new_contacts) = [];
+if (missionNamespace getVariable ["INEPT_param_EnableContactReveal", true]) then
+{
+// This is an overly-complicated way of sharing knowledge with groups who are
+// far away from the contact. Otherwise they get spooked over something that is
+// none of their worry. Idealliy, they wouldn't but ...
+#define DISTANCE_STOP 400
+#define DISTANCE_DROPOFF 600
+ {
+ VAR(_grp) = _x select PAWN_GROUP;
+ VAR(_grp_pos) = [_x] call INEPT_fnc_getPawnPos;
+ {
+ VAR(_contact_unit) = _x select 4;
+ VAR(_knowledge) = _all_contacts_knowledge select _forEachIndex;
+ VAR(_dist) = _contact_unit distance (_grp_pos);
+ _knowledge = _knowledge * (1 - ((0 max ((_dist - DISTANCE_STOP) / DISTANCE_DROPOFF)) min 1));
+ if ((_knowledge > 0) and {_knowledge > (_grp knowsAbout _contact_unit)}) then
+ {
+ LOGMSG("Elevated knowledge");
+ LOGVAR(_grp);
+ LOGVAR(_contact_unit);
+ LOGVAR(_knowledge);
+ _grp reveal [_contact_unit, _knowledge];
+ };
+ }
+ forEach _all_contacts;
+ }
+ forEach _pawns;
+};
// Use the same value for CONTACT_LASTSEEN in all new contacts we create here,
// even if we get suspended for a bit in the middle of execution
VAR(_current_time) = time;
-while {!(_all_contacts isEqualTo [])} do
-{
- VAR(_contact) = _all_contacts call BIS_fnc_arrayPop;
- LOGVAR(_contact);
- VAR(_pos) = _contact select 0;
- VAR(_unit) = _contact select 4;
- // When we spot a dead thing, we mark it with this property so that we
- // don't confirm the same kill twice. We need to ensure the property is not
- // set here in case people re-enter a vehicle that was previously damaged
- // or a body becomes reanimated
- _unit setVariable [KILL_CHECKED_PROP, nil];
- VAR(_new_contact) = [_unit, _pos, _current_time] call INEPT_fnc_contactFromUnit;
- LOGVAR(_new_contact);
- _new_contacts pushBack _new_contact;
-};
+VAR(_new_contacts) =
+ [ _all_contacts
+ , {
+ VAR(_pos) = _x select 0;
+ VAR(_unit) = _x select 4;
+ // When we spot a dead thing, we mark it with this property so that we
+ // don't confirm the same kill twice. We need to ensure the property is not
+ // set here in case people re-enter a vehicle that was previously damaged
+ // or a body becomes reanimated
+ _unit setVariable [KILL_CHECKED_PROP, nil];
+ [_unit, _pos, _current_time] call INEPT_fnc_contactFromUnit
+ }
+ ] call INEPT_fnc_applyToAll;
LOGVAR(_new_contacts);