-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #510 from Ansible2/master
Update Release To 0.9
- Loading branch information
Showing
254 changed files
with
13,311 additions
and
2,932 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* ---------------------------------------------------------------------------- | ||
Function: BLWK_fnc_pathing_checkGroupStatus | ||
Description: | ||
Checks if a group is still alive. | ||
Parameters: | ||
0: _groupToCheck : <GROUP> - The group to check over | ||
Returns: | ||
<BOOL> - true if active, false if not | ||
Examples: | ||
(begin example) | ||
_isActive = [_group] call BLWK_fnc_pathing_checkGroupStatus; | ||
(end) | ||
Author(s): | ||
Ansible2 // Cipher | ||
---------------------------------------------------------------------------- */ | ||
scriptName "BLWK_fnc_pathing_checkGroupStatus"; | ||
|
||
params ["_groupToCheck"]; | ||
|
||
// check if it was deleted | ||
if (isNull _groupToCheck) exitWith { | ||
[["Found that ",_groupToCheck," is a null group"],false] call KISKA_fnc_log; | ||
false | ||
}; | ||
|
||
// check if anyone is in it | ||
private _groupUnits = units _groupToCheck; | ||
if (_groupUnits isEqualTo []) exitWith { | ||
[["Found that ",_groupToCheck," is an empty group"],false] call KISKA_fnc_log; | ||
false | ||
}; | ||
|
||
// check if anyone is alive | ||
private _aliveIndex = _groupUnits findIf {alive _x}; | ||
if (_aliveIndex != -1) exitWith { | ||
true | ||
}; | ||
|
||
|
||
false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* ---------------------------------------------------------------------------- | ||
Function: BLWK_fnc_pathing_checkLeaderVelocity | ||
Description: | ||
Checks the velocity of a unit to see if they are currently moving. | ||
Parameters: | ||
0: _unit : <OBJECT> - The group to check over | ||
Returns: | ||
<BOOL> - true if any velocity is detected, otherwise false | ||
Examples: | ||
(begin example) | ||
_isActive = [_unit] call BLWK_fnc_pathing_checkLeaderVelocity; | ||
(end) | ||
Author(s): | ||
Ansible2 // Cipher | ||
---------------------------------------------------------------------------- */ | ||
params ["_unit"]; | ||
|
||
if (isNull _unit OR {!alive _unit}) exitWith { | ||
false | ||
}; | ||
|
||
// forward/backward velocity is the most telling of movement | ||
private _leaderVelocity = (velocityModelSpace _unit) select 0; | ||
|
||
// if leader is stationary | ||
if (_leaderVelocity isEqualTo 0) exitWith { | ||
false | ||
}; | ||
|
||
|
||
true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* ---------------------------------------------------------------------------- | ||
Function: BLWK_fnc_pathing_detailedStuckCheck | ||
Description: | ||
If a units leader was detected as not moving in BLWK_fnc_pathing_checkLeaderVelocity | ||
this will do further checks that make sure a unit actually should be teleported | ||
to "unstick" them. | ||
Needs to be run in scheduled environment. | ||
Parameters: | ||
0: _unit : <OBJECT> - The unit to handle | ||
Returns: | ||
<BOOL> - true if unit is stuck, false if not | ||
Examples: | ||
(begin example) | ||
_needsToBeReset = [_unit] call BLWK_fnc_pathing_detailedStuckCheck; | ||
(end) | ||
Author(s): | ||
Ansible2 // Cipher | ||
---------------------------------------------------------------------------- */ | ||
scriptName "BLWK_fnc_pathing_detailedStuckCheck"; | ||
|
||
params ["_unit"]; | ||
|
||
// don't mess with vehicle units | ||
if (!isNull (objectParent _unit)) exitWith {false}; | ||
|
||
private _currentPosition = getPosWorld _unit; | ||
|
||
sleep 20; | ||
|
||
// exit if all units are dead | ||
if !([_groupToCheck] call BLWK_fnc_pathing_checkGroupStatus) exitWith { | ||
[[_groupToCheck," failed secondary group status check..."],false] call KISKA_fnc_log; | ||
false | ||
}; | ||
|
||
private _needsReset = true; | ||
// if the leader fails the velocity check again | ||
if !([_unit] call BLWK_fnc_pathing_checkLeaderVelocity) then { | ||
[[_groupToCheck," failed secondary velocity status check..."],false] call KISKA_fnc_log; | ||
|
||
// check if there is enough difference in their position to justify not reseting them | ||
private _positionDifference = (getPosWorld _unit) vectorDiff _currentPosition; | ||
[["Checking position differences for group ", _groupToCheck,"... Position differences are: ",_positionDifference],false] call KISKA_fnc_log; | ||
_positionDifference apply { | ||
// check to make sure there was some significant movement in the unit on any axis | ||
if ((abs _x) > 0.5) exitWith { | ||
[[_groupToCheck," found a position axis that passed..."],false] call KISKA_fnc_log; | ||
_needsReset = false; | ||
}; | ||
}; | ||
} else { | ||
[[_groupToCheck," had immediate velocity check that passed."],false] call KISKA_fnc_log; | ||
_needsReset = false; | ||
}; | ||
|
||
|
||
_needsReset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* ---------------------------------------------------------------------------- | ||
Function: BLWK_fnc_pathing_mainLoop | ||
Description: | ||
AI enemies sometimes get stuck an refuse to move or just rotate while | ||
decding how to proceed. Often in urban environments. | ||
During the main loop, if the leader has a velocity of zero, he will then | ||
be given 10 seconds to have a meaningful movement on any axis before | ||
being teleported to a random spawn location. | ||
Hopefully this resets his pathing. | ||
Parameters: | ||
0: _groupToCheck : <OBJECT OR GROUP> - The unit or group to add to check over | ||
1: _timeBetweenChecks : <NUMBER> - How often to check the unit leader's velocity | ||
Returns: | ||
NOTHING | ||
Examples: | ||
(begin example) | ||
[myGroup,25] spawn BLWK_fnc_pathing_mainLoop; | ||
(end) | ||
Author(s): | ||
Ansible2 // Cipher | ||
---------------------------------------------------------------------------- */ | ||
#define RESET_POSITION\ | ||
_groupLeader setPos ([BLWK_mainCrate, 75, 120, 2, 0] call BIS_fnc_findSafePos);\ | ||
sleep 1;\ | ||
[_groupLeader,position BLWK_mainCrate] remoteExecCall ["move",_groupLeader]; | ||
|
||
#define LOOP_VAR_NAME "BLWK_runPathingLoop" | ||
#define SCRIPT_NAME "BLWK_fnc_pathing_mainLoop" | ||
scriptName SCRIPT_NAME; | ||
|
||
|
||
if (!canSuspend) exitWith { | ||
["Should be run in scheduled environment, exiting to scheduled...",true] call KISKA_fnc_log; | ||
_this spawn BLWK_fnc_pathing_mainLoop; | ||
}; | ||
|
||
params [ | ||
["_groupToCheck",objNull,[grpNull,objNull]], | ||
["_timeBetweenChecks",25,[123]] | ||
]; | ||
|
||
|
||
if (isNull _groupToCheck) exitWith { | ||
["_groupToCheck is null. Exiting...",true] call KISKA_fnc_log; | ||
}; | ||
|
||
// follower units won't likely get stuck as their primary goal is to join the formation at all cost | ||
if (_groupToCheck isEqualType objNull) then { | ||
_groupToCheck = group _groupToCheck; | ||
}; | ||
|
||
private _groupLeader = leader _groupToCheck; | ||
if (!alive _groupLeader) exitWith { | ||
["_groupLeader is null. Exiting...",true] call KISKA_fnc_log; | ||
}; | ||
|
||
|
||
_groupToCheck setVariable [LOOP_VAR_NAME,true]; | ||
while {sleep _timeBetweenChecks; true} do { | ||
|
||
if (!(isNull _groupToCheck) AND {!(_groupToCheck getVariable [LOOP_VAR_NAME,false])}) exitWith { | ||
[["Loop var for group ",_groupToCheck," was set to false. Exiting..."],false] call KISKA_fnc_log; | ||
}; | ||
|
||
if !([_groupToCheck] call BLWK_fnc_pathing_checkGroupStatus) exitWith { | ||
[["Found that ",_groupToCheck," failed group status check. Exiting..."],false] call KISKA_fnc_log; | ||
_groupToCheck setVariable [LOOP_VAR_NAME,nil]; | ||
}; | ||
|
||
_groupLeader = leader _groupToCheck; | ||
|
||
// checks for units that walk aways from play area | ||
if (isNull (objectParent _groupLeader) AND {(_groupLeader distance2D BLWK_playAreaCenter) >= BLWK_maxDistanceFromPlayArea}) then { | ||
[["_groupLeader ",_groupLeader," appears to have walked too far from the play area and will be reset"],true] call KISKA_fnc_log; | ||
RESET_POSITION | ||
} else { | ||
|
||
if !([_groupLeader] call BLWK_fnc_pathing_checkLeaderVelocity) then { | ||
[["_groupLeader ",_groupLeader," failed velocity check at point 1"],false] call KISKA_fnc_log; | ||
|
||
if ([_groupLeader] call BLWK_fnc_pathing_detailedStuckCheck) then { | ||
[["_groupLeader ",_groupLeader," failed detailted stuck check at point 1"],false] call KISKA_fnc_log; | ||
RESET_POSITION | ||
}; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* ---------------------------------------------------------------------------- | ||
Function: BLWK_fnc_addAllowDamageEH | ||
Description: | ||
In order to avoid setting and reseting the allowDamage to false for certain | ||
items when they change locality (are picked up for example), this eventhandler | ||
will be added to any object from the shop (and the main crate) that don't allow | ||
damage. | ||
Parameters: | ||
0: _object : <OBJECT> - The object to add the eventhandler to | ||
Returns: | ||
NOTHING | ||
Examples: | ||
(begin example) | ||
[anObject] call BLWK_fnc_addAllowDamageEH; | ||
(end) | ||
Author(s): | ||
Ansible2 // Cipher | ||
---------------------------------------------------------------------------- */ | ||
scriptName "BLWK_fnc_addAllowDamageEH"; | ||
|
||
if (!hasInterface) exitWith {}; | ||
|
||
params ["_object"]; | ||
|
||
if (isNull _object) exitWith { | ||
["_object was null, event handler will not be added, exiting...",true] call KISKA_fnc_log; | ||
nil | ||
}; | ||
|
||
_object addEventHandler ["LOCAL",{ | ||
params ["_object"]; | ||
_object allowDamage false; | ||
}]; | ||
|
||
|
||
nil |
Oops, something went wrong.