Skip to content

Commit

Permalink
Merge pull request #81 from gruppe-adler/rename-modlues-sorry
Browse files Browse the repository at this point in the history
various fixes, moved & icon'ed modules
  • Loading branch information
Fusselwurm authored Jul 20, 2020
2 parents 12a3412 + 0ec4763 commit bc6337e
Show file tree
Hide file tree
Showing 29 changed files with 50 additions and 69 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ vehicles | ["C_Van_01_fuel_F", "C_Hatchback_01_F", "C_Offroad_02

## 3DEN modules

### add exclusion zone
### exclusion zone

Blacklist an area for civs by syncing it to a trigger.

### add population zone
### population zone

Whitelist an area for civs by syncing it to a trigger.

Expand Down Expand Up @@ -176,7 +176,7 @@ Parameter | Explanation
backpacks | Array - All classnames of clothes that civilians may wear.
probability | Number - Probability that civilian will wear a backpack. Default: 0.5.

### grad_civs_voyage_fnc_setVehicles
### grad_civs_cars_fnc_setVehicles
Sets all vehicles that civilians may drive. Overwrites value from CBA settings. Execute globally

#### Syntax
Expand All @@ -197,17 +197,17 @@ Parameter | Explanation
debugCivState | Bool - Debug mode on/off.


### grad_civs_legacy_fnc_addExclusionZone and grad_civs_legacy_fnc_addPopulationZone
### grad_civs_common_fnc_addExclusionZone and grad_civs_common_fnc_addPopulationZone

Prevent civilians from entering areas.

Optionally whitelist areas using `[_area] call grad_civs_legacy_fnc_addPopulationZone` , then forbid parts of them using `[_area] call grad_civs_legacy_fnc_addExclusionZone` .
Optionally whitelist areas using `[_area] call grad_civs_common_fnc_addPopulationZone` , then forbid parts of them using `[_area] call grad_civs_common_fnc_addExclusionZone` .

*known issues: pathing through area is not checked. To minimize that problem, define exclusionZones with large diameter.*

#### Syntax

`[_trigger] call grad_civs_legacy_fnc_addExclusionZone;`
`[_trigger] call grad_civs_common_fnc_addExclusionZone;`

## Development

Expand Down
16 changes: 8 additions & 8 deletions addons/legacy/CfgVehicles.hpp → addons/common/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ class CfgVehicles
};
class ModuleDescription {};
};
class GVAR(addPopulationZone): Module_F
class GVAR(PopulationZone): Module_F
{
scope = 2; // visible in editor
displayName = "add population zone";
icon = ""; // Map icon. Delete this entry to use the default icon
displayName = "population zone";
icon = QPATHTOF(ui\icon_module_population_zone_ca.paa);
category = QEGVAR(main,modules);
function = QFUNC(module_addPopulationZone);
function = QFUNC(module_populationZone);
functionPriority = 0; // first to execute
isGlobal = 1;
isTriggerActivated = 0;
Expand All @@ -29,13 +29,13 @@ class CfgVehicles
sync[] = {}; // Array of synced entities (can contain base classes)
};
};
class GVAR(addExclusionZone): Module_F
class GVAR(ExclusionZone): Module_F
{
scope = 2; // visible in editor
displayName = "add exclusion zone";
icon = ""; // Map icon. Delete this entry to use the default icon
displayName = "exclusion zone";
icon = QPATHTOF(ui\icon_module_exclusion_zone_ca.paa);
category = QEGVAR(main,modules);
function = QFUNC(module_addExclusionZone);
function = QFUNC(module_exclusionZone);
functionPriority = 0; // first to execute
isGlobal = 1;
isTriggerActivated = 0;
Expand Down
11 changes: 10 additions & 1 deletion addons/common/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
PREP(addExclusionZone);
PREP(addPopulationZone);
PREP(augmentStateMachine);
PREP(registerCivTaskType);
PREP(civGetState);
PREP(clearExclusionZones);
PREP(clearPopulationZones);
PREP(getExclusionZones);
PREP(getPopulationZones);
PREP(isInPopulatedZone);
PREP(module_exclusionZone);
PREP(module_populationZone);
PREP(parseCsv);
PREP(registerCivTaskType);
1 change: 1 addition & 0 deletions addons/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ class CfgPatches {
};

#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ private _populationZones = [] call FUNC(getPopulationZones);
private _exclusionZones = [] call FUNC(getExclusionZones);

private _inAnyPopulationZone = if (count _populationZones == 0) then {
true
true; // "there is no population zone" defaults to "*everywhere* is population zone"
} else {
// TODO uhm… how about [] findIf {} != -1 ?
[_populationZones, {_position inArea (_this#0)}] call FUNC(arrayContains)
_populationZones findIf {_position inArea _x} != -1;
};
if (!_inAnyPopulationZone) exitWith {false};

private _inAnyExclusionZone = [_exclusionZones, {_position inArea (_this#0)}] call FUNC(arrayContains);
private _inAnyExclusionZone = _exclusionZones findIf {_position inArea (_x)} != -1;

!_inAnyExclusionZone
6 changes: 4 additions & 2 deletions addons/common/functions/fnc_parseCsv.sqf
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#include "..\script_component.hpp"

/*
parse list of strings
parse list of strings into an array. tolerates arrays, will return input value in that case
*/
params [
["_rawValue", "", [""]]
["_rawValue", "", ["", []]]
];

if (_rawValue isEqualType []) exitWith { _rawValue };

private _delimiter = ",";

private _firstChar = _rawValue select [0, 1];
Expand Down
Binary file not shown.
Binary file not shown.
6 changes: 0 additions & 6 deletions addons/gta/functions/fnc_registerPlayerTheftHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,3 @@ player addEventHandler [
[GVAR(stolenVehiclePfh)] call CBA_fnc_removePerFrameHandler;
}
];


// TEST
//["grad_civs_vehicleTheft", {
// systemChat format ["%1 has been stolen by %2", _this#0, _this#1];
//}] call CBA_fnc_addEventHandler;
10 changes: 0 additions & 10 deletions addons/legacy/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
PREP(addCivInteractions);
PREP(addExclusionZone);
PREP(addPopulationZone);
PREP(arrayContains);
PREP(checkHonkingOnCivilian);
PREP(checkWeaponOnCivilianPerception);
PREP(checkWeaponOnCivilianPointer);
PREP(clearCurrentlyThinking);
PREP(clearExclusionZones);
PREP(clearPopulationZones);
PREP(compare);
PREP(customActivity_reverse);
PREP(deleteIfDamaged);
Expand All @@ -27,9 +22,7 @@ PREP(forceEmotionSpeed);
PREP(forcePanicSpeed);
PREP(formatNowPlusSeconds);
PREP(getCurrentlyThinking);
PREP(getExclusionZones);
PREP(getGlobalCivs);
PREP(getPopulationZones);
PREP(handleAnimation);
PREP(handleGestureGo);
PREP(handleGestureStop);
Expand All @@ -43,11 +36,8 @@ PREP(interact_carryOnAction);
PREP(interact_carryOnCondition);
PREP(isInDistanceFromOtherPlayers);
PREP(isInHouse);
PREP(isInPopulatedZone);
PREP(isPlayerHonking);
PREP(mapMarkers);
PREP(module_addExclusionZone);
PREP(module_addPopulationZone);
PREP(nowPlusSeconds);
PREP(playerLoop);
PREP(reverse_abort);
Expand Down
1 change: 0 additions & 1 deletion addons/legacy/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ class CfgPatches {
};

#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
13 changes: 0 additions & 13 deletions addons/legacy/functions/fnc_arrayContains.sqf

This file was deleted.

2 changes: 1 addition & 1 deletion addons/legacy/functions/fnc_findSpawnPosition.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private _result = {
[_allPlayers, _candidate, _minDistance] call FUNC(isInDistanceFromOtherPlayers)
}
&& {
[getPos _candidate] call FUNC(isInPopulatedZone)
[getPos _candidate] call EFUNC(common,isInPopulatedZone)
}
) exitWith {
LOG_1("found spawn position %1", _candidate);
Expand Down
2 changes: 1 addition & 1 deletion addons/legacy/functions/fnc_handleAnimation.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

params ["_unit", "_animation"];

systemChat format["_animation: %1", _animation];
// systemChat format["_animation: %1", _animation];

if ((toLower _animation) in ["gesturefreeze", "ace_gestures_hold", "ace_gestures_holdstandlowered"]) exitWith {
[_unit] call FUNC(handleGestureStop);
Expand Down
4 changes: 2 additions & 2 deletions addons/legacy/functions/fnc_setupZeusModules.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
};
private _marker = _areaMarkersAtPos select (_minDistanceAndIndex#1);

[_marker] call FUNC(addExclusionZone);
[_marker] call EFUNC(common,addExclusionZone);
_marker setMarkerBrushLocal "BORDER";
_marker setMarkerColorLocal "ColorUNKNOWN";
}
Expand All @@ -44,7 +44,7 @@
};
private _marker = _areaMarkersAtPos select (_minDistanceAndIndex#1);

[_marker] call FUNC(addPopulationZone);
[_marker] call EFUNC(common,addPopulationZone);
_marker setMarkerBrushLocal "BORDER";
_marker setMarkerColorLocal "ColorCIV";
}
Expand Down
12 changes: 6 additions & 6 deletions addons/patrol/functions/fnc_taskPatrol.spec.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
["a civilian",
{
call grad_civs_legacy_fnc_clearExclusionZones;
call grad_civs_common_fnc_clearExclusionZones;
private _group = createGroup [civilian, true];
_group setCombatMode "GREEN";
private _pos = [0, 0, 0];
Expand Down Expand Up @@ -98,15 +98,15 @@

private _trgW = createTrigger ["EmptyDetector", (getPos _civ) vectorAdd [-250, 150, 0]];
_trgW setTriggerArea [150, 250, 0, true];
[_trgW] call grad_civs_legacy_fnc_addExclusionZone;
[_trgW] call grad_civs_common_fnc_addExclusionZone;

private _trgS = createTrigger ["EmptyDetector", (getPos _civ) vectorAdd [0, -250, 0]];
_trgS setTriggerArea [200, 150, 0, true];
[_trgS] call grad_civs_legacy_fnc_addExclusionZone;
[_trgS] call grad_civs_common_fnc_addExclusionZone;

private _trgE = createTrigger ["EmptyDetector", (getPos _civ) vectorAdd [250, 150, 0]];
_trgE setTriggerArea [150, 250, 0, true];
[_trgE] call grad_civs_legacy_fnc_addExclusionZone;
[_trgE] call grad_civs_common_fnc_addExclusionZone;

[_civ]
},
Expand Down Expand Up @@ -134,7 +134,7 @@
format ["waypoint %1 at %2 is not in exclusion zone at %3 (%4)", _forEachIndex, _x, getPos _exclusionZone, triggerArea _exclusionZone]
] call grad_testing_fnc_assertFalse;
} forEach _waypointPositions;
} forEach (call grad_civs_legacy_fnc_getExclusionZones);
} forEach (call grad_civs_common_fnc_getExclusionZones);
}
],
["will avoid crossing exclusion zones",
Expand All @@ -145,7 +145,7 @@
]
]
],
grad_civs_legacy_fnc_clearExclusionZones
grad_civs_common_fnc_clearExclusionZones
]
],
{
Expand Down
2 changes: 1 addition & 1 deletion addons/patrol/functions/fnc_taskPatrolFindWaypoint.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ for "_i" from 1 to _maxTries do {
_searchPosition
};

private _inPopulatedZone = [_searchPosition] call EFUNC(legacy,isInPopulatedZone);
private _inPopulatedZone = [_searchPosition] call EFUNC(common,isInPopulatedZone);
if (_inPopulatedZone) exitWith {
LOG_1("position %1 is not in exclusionzone, return it", _searchPosition);
_waypointPosition = _searchPosition;
Expand Down
10 changes: 5 additions & 5 deletions addons/patrol/functions/fnc_taskPatrolFindWaypoints.spec.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
{
private _trgW = createTrigger ["EmptyDetector", [-250, 150, 0]];
_trgW setTriggerArea [150, 250, 0, true];
[_trgW] call grad_civs_legacy_fnc_addExclusionZone;
[_trgW] call grad_civs_common_fnc_addExclusionZone;

private _trgS = createTrigger ["EmptyDetector", [0, -250, 0]];
_trgS setTriggerArea [200, 150, 0, true];
[_trgS] call grad_civs_legacy_fnc_addExclusionZone;
[_trgS] call grad_civs_common_fnc_addExclusionZone;

private _trgE = createTrigger ["EmptyDetector", [250, 150, 0]];
_trgE setTriggerArea [150, 250, 0, true];
[_trgE] call grad_civs_legacy_fnc_addExclusionZone;
[_trgE] call grad_civs_common_fnc_addExclusionZone;
},
[
["when a patrol path is created",
Expand All @@ -37,7 +37,7 @@
format ["waypoint %1 at %2 is not in exclusion zone at %3 (%4)", _forEachIndex, _x, getPos _exclusionZone, triggerArea _exclusionZone]
] call grad_testing_fnc_assertFalse;
} forEach _positions;
} forEach (call grad_civs_legacy_fnc_getExclusionZones);
} forEach (call grad_civs_common_fnc_getExclusionZones);
}
],
["will avoid crossing exclusion zones",
Expand All @@ -48,7 +48,7 @@
]
]
],
grad_civs_legacy_fnc_clearExclusionZones
grad_civs_common_fnc_clearExclusionZones
] call grad_testing_fnc_executeTest;

["GIVEN a point and no exclusion zones WHEN a patrol path is created",
Expand Down
4 changes: 2 additions & 2 deletions addons/transit/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CfgVehicles
{
scope = 2; // visible in editor
displayName = "Transit Traffic Source";
icon = ""; // Map icon. Delete this entry to use the default icon
icon = QPATHTOF(ui\icon_module_transit_source_ca.paa);
category = QEGVAR(main,modules);
function = QFUNC(module_transitSource);
functionPriority = 0; // first to execute
Expand Down Expand Up @@ -64,7 +64,7 @@ class CfgVehicles
{
scope = 2; // visible in editor
displayName = "Transit Traffic Sink";
icon = ""; // Map icon. Delete this entry to use the default icon
icon = QPATHTOF(ui\icon_module_transit_sink_ca.paa);
category = QEGVAR(main,modules);
function = QFUNC(module_transitSink);
functionPriority = 0; // first to execute
Expand Down
Binary file added addons/transit/ui/icon_module_transit_sink_ca.paa
Binary file not shown.
Binary file not shown.

0 comments on commit bc6337e

Please sign in to comment.