2015-12-15 22:43:26 +00:00
|
|
|
/*
|
|
|
|
Author: Aaron Clark - EpochMod.com
|
|
|
|
|
|
|
|
Contributors:
|
|
|
|
|
|
|
|
Description:
|
|
|
|
Performs damage related effects
|
|
|
|
|
|
|
|
Licence:
|
|
|
|
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
|
|
|
|
|
|
|
|
Github:
|
2016-06-13 16:54:19 +00:00
|
|
|
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/environment/EPOCH_client_bitePlayer.sqf
|
2015-12-15 22:43:26 +00:00
|
|
|
|
|
|
|
Example:
|
2016-05-23 20:01:40 +00:00
|
|
|
_dog call EPOCH_client_bitePlayer;
|
2015-12-15 22:43:26 +00:00
|
|
|
|
|
|
|
Parameter(s):
|
2016-06-15 00:58:22 +00:00
|
|
|
_unit: OBJECT - attacker
|
2015-12-15 22:43:26 +00:00
|
|
|
|
|
|
|
Returns:
|
|
|
|
NOTHING
|
|
|
|
*/
|
2016-09-01 02:20:07 +00:00
|
|
|
//[[[cog import generate_private_arrays ]]]
|
|
|
|
private ["_animConfigArray","_animationEffect","_animationEffectGlobal","_bleedAmount","_bleedChance","_bloodpAmount","_bloodpChance","_canSee","_cfgObjectInteraction","_distance","_fatigueChance","_handle","_handles","_ppEffect","_say3dsoundsConfig","_selectedMove","_selectedSound","_soundConfigArray","_soundEffect","_soundEffectGlobal","_switchMovehandlerConfig","_toxicChance"];
|
|
|
|
//[[[end]]]
|
2016-06-15 00:58:22 +00:00
|
|
|
params [["_unit",objNull],["_target",player]];
|
|
|
|
if (isNull _unit && isNull _target) exitWith {};
|
|
|
|
if !(_target isEqualTo player) then {
|
|
|
|
// re to other player
|
|
|
|
[_unit,_target] remoteExec ["EPOCH_client_bitePlayer", _target];
|
|
|
|
} else {
|
2015-12-15 22:43:26 +00:00
|
|
|
|
2016-06-15 00:58:22 +00:00
|
|
|
if !(isNull _unit && alive _unit) then {
|
2015-09-14 20:55:36 +00:00
|
|
|
|
2016-06-15 00:58:22 +00:00
|
|
|
_cfgObjectInteraction = (('CfgObjectInteractions' call EPOCH_returnConfig) >> (typeOf _unit));
|
|
|
|
if (isClass _cfgObjectInteraction) then {
|
2016-07-05 19:15:42 +00:00
|
|
|
|
2016-06-15 00:58:22 +00:00
|
|
|
_distance = getNumber (_cfgObjectInteraction >> "distance");
|
|
|
|
_toxicChance = getNumber (_cfgObjectInteraction >> "toxicChance");
|
2016-07-05 19:15:42 +00:00
|
|
|
_bleedChance = getNumber (_cfgObjectInteraction >> "bleedChance");
|
2016-06-15 00:58:22 +00:00
|
|
|
_bloodpChance = getNumber (_cfgObjectInteraction >> "bloodpChance");
|
|
|
|
_fatigueChance = getNumber (_cfgObjectInteraction >> "fatigueChance");
|
|
|
|
_bleedAmount = getNumber (_cfgObjectInteraction >> "bleedAmount");
|
|
|
|
_bloodpAmount = getNumber (_cfgObjectInteraction >> "bloodpAmount");
|
2016-07-05 19:15:42 +00:00
|
|
|
|
2016-06-15 00:58:22 +00:00
|
|
|
_soundConfigArray = getArray (_cfgObjectInteraction >> "soundEffect");
|
2016-07-06 19:35:20 +00:00
|
|
|
_soundEffect = "";
|
2016-06-15 00:58:22 +00:00
|
|
|
if !(_soundConfigArray isEqualTo []) then {
|
|
|
|
_soundEffect = selectRandom _soundConfigArray;
|
|
|
|
};
|
|
|
|
_soundEffectGlobal = getNumber (_cfgObjectInteraction >> "soundEffectGlobal");
|
|
|
|
_animConfigArray = getArray (_cfgObjectInteraction >> "animationEffect");
|
2016-07-06 19:35:20 +00:00
|
|
|
_animationEffect = "";
|
2016-06-15 00:58:22 +00:00
|
|
|
if !(_animConfigArray isEqualTo []) then {
|
|
|
|
_animationEffect = selectRandom _animConfigArray;
|
|
|
|
};
|
|
|
|
_animationEffectGlobal = getNumber (_cfgObjectInteraction >> "animationEffectGlobal");
|
|
|
|
_canSee = call compile (getText (_cfgObjectInteraction >> "canSee"));
|
2016-09-01 02:20:07 +00:00
|
|
|
_ppEffect = getArray (_cfgObjectInteraction >> "ppEffect");
|
2015-09-14 20:55:36 +00:00
|
|
|
|
2016-07-05 18:22:14 +00:00
|
|
|
if ((_unit distance player) < _distance && _canSee) then {
|
|
|
|
|
|
|
|
_say3dsoundsConfig = 'CfgSay3Dhandler' call EPOCH_returnConfig;
|
|
|
|
_switchMovehandlerConfig = 'CfgSwitchMovehandler' call EPOCH_returnConfig;
|
2016-05-23 20:01:40 +00:00
|
|
|
|
2016-07-05 18:22:14 +00:00
|
|
|
if (_soundEffect isEqualType []) then {
|
|
|
|
_soundEffect params ["_soundEffectFinal",["_soundEffectRange",0]];
|
|
|
|
playSound3D [_soundEffectFinal, _unit, false, getPosASL _unit, 1, 1, _soundEffectRange];
|
|
|
|
} else {
|
|
|
|
_selectedSound = (_say3dsoundsConfig >> _soundEffect);
|
|
|
|
if (isClass _selectedSound) then {
|
|
|
|
_unit say3D _soundEffect;
|
|
|
|
if (_soundEffectGlobal isEqualTo 1) then {
|
|
|
|
[player, _unit, _soundEffect, Epoch_personalToken] remoteExec ["EPOCH_server_handle_say3D",2];
|
|
|
|
};
|
2016-06-15 00:58:22 +00:00
|
|
|
};
|
|
|
|
};
|
2016-05-23 20:01:40 +00:00
|
|
|
|
2016-07-05 18:22:14 +00:00
|
|
|
_selectedMove = (_switchMovehandlerConfig >> _animationEffect);
|
|
|
|
if (isClass _selectedMove) then {
|
|
|
|
_unit switchMove _animationEffect;
|
|
|
|
if (_animationEffectGlobal isEqualTo 1) then {
|
|
|
|
[player, _animationEffect, Epoch_personalToken, _unit] remoteExec ["EPOCH_server_handle_switchMove",2];
|
|
|
|
};
|
2016-06-15 00:58:22 +00:00
|
|
|
};
|
2016-05-23 20:01:40 +00:00
|
|
|
|
2016-07-05 18:22:14 +00:00
|
|
|
if (random 1 < _toxicChance) then {
|
|
|
|
EPOCH_playerToxicity = (EPOCH_playerToxicity + (random(100 - EPOCH_playerImmunity))) min 100;
|
|
|
|
};
|
|
|
|
if (random 1 < _bleedChance) then {
|
|
|
|
player setBleedingRemaining((getBleedingRemaining player) + _bleedAmount);
|
|
|
|
};
|
|
|
|
if (random 1 < _bloodpChance) then {
|
|
|
|
EPOCH_playerBloodP = (EPOCH_playerBloodP + (_bloodpAmount + (EPOCH_playerBloodP - 100))) min 190;
|
2016-09-01 02:20:07 +00:00
|
|
|
if !(_ppEffect isEqualTo []) then {
|
|
|
|
_ppEffect spawn EPOCH_fnc_spawnEffects;
|
2016-06-15 00:58:22 +00:00
|
|
|
};
|
2015-09-14 20:55:36 +00:00
|
|
|
};
|
2016-07-05 18:22:14 +00:00
|
|
|
if (random 1 < _fatigueChance) then {
|
|
|
|
player setFatigue 1;
|
|
|
|
};
|
2016-06-15 00:58:22 +00:00
|
|
|
};
|
2015-09-14 20:55:36 +00:00
|
|
|
};
|
|
|
|
};
|
2015-12-15 22:43:26 +00:00
|
|
|
};
|