From 196c69725b21c3e0aaf23d53be363be97131058e Mon Sep 17 00:00:00 2001 From: Ansible2 Date: Sun, 9 Jul 2023 00:06:04 -0600 Subject: [PATCH] (#642): renamed event functions for hit and killed enemies --- .../fn_event_hitEnemy.sqf} | 15 +++--- .../fn_event_killedEnemy.sqf} | 18 ++++--- .../fn_stdEnemyHitEvent.sqf | 53 ------------------- .../fn_stdEnemyHitEventLocal.sqf | 36 ------------- .../fn_stdEnemyKilledEvent.sqf | 48 ----------------- Headers/descriptionEXT/functions.hpp | 12 +++-- 6 files changed, 25 insertions(+), 157 deletions(-) rename Functions/{Wave Type Libraries/Standard Wave Library/fn_handleHitEventPlayer.sqf => Events/fn_event_hitEnemy.sqf} (81%) rename Functions/{Wave Type Libraries/Standard Wave Library/fn_handleKillEventPlayer.sqf => Events/fn_event_killedEnemy.sqf} (77%) delete mode 100644 Functions/Wave Type Libraries/Standard Wave Library/fn_stdEnemyHitEvent.sqf delete mode 100644 Functions/Wave Type Libraries/Standard Wave Library/fn_stdEnemyHitEventLocal.sqf delete mode 100644 Functions/Wave Type Libraries/Standard Wave Library/fn_stdEnemyKilledEvent.sqf diff --git a/Functions/Wave Type Libraries/Standard Wave Library/fn_handleHitEventPlayer.sqf b/Functions/Events/fn_event_hitEnemy.sqf similarity index 81% rename from Functions/Wave Type Libraries/Standard Wave Library/fn_handleHitEventPlayer.sqf rename to Functions/Events/fn_event_hitEnemy.sqf index 3766c93b..23574336 100644 --- a/Functions/Wave Type Libraries/Standard Wave Library/fn_handleHitEventPlayer.sqf +++ b/Functions/Events/fn_event_hitEnemy.sqf @@ -1,5 +1,5 @@ /* ---------------------------------------------------------------------------- -Function: BLWK_fnc_stdEnemyHitEventPlayer +Function: BLWK_fnc_event_hitEnemy Description: Executes from an enemy's hit eventhandler. The message is sent from whomever @@ -7,8 +7,6 @@ Description: This is what will add the points to a player and create a hit marker. - Executed from the event added by "BLWK_fnc_stdEnemyHitEventLocal" - Parameters: 0: _hitUnit : - The unit hit 1: _damage : - The numerical damage done to a unit (for points/hit markers) @@ -19,16 +17,15 @@ Returns: Examples: (begin example) // from hit event - [_hitUnit,_damage] remoteExecCall ["BLWK_fnc_handleHitEventPlayer",_instigator]; + [_hitUnit,_damage] remoteExecCall ["BLWK_fnc_event_hitEnemy",_instigator]; (end) Author(s): Hilltop(Willtop) & omNomios, - Modified by: Ansible2 // Cipher + Modified by: Ansible2 ---------------------------------------------------------------------------- */ -#define SCRIPT_NAME "BLWK_fnc_handleHitEventPlayer" -scriptName SCRIPT_NAME; +scriptName "BLWK_fnc_event_hitEnemy"; if !(hasInterface) exitWith {}; @@ -52,4 +49,6 @@ if (missionNamespace getVariable ["BLWK_isAircraftGunner",false]) then { private _points = round (BLWK_pointsForHit + _damagePoints); [_points] call BLWK_fnc_addPoints; [_hitUnit,_points] call BLWK_fnc_createHitMarker; -}; \ No newline at end of file +}; + +nil diff --git a/Functions/Wave Type Libraries/Standard Wave Library/fn_handleKillEventPlayer.sqf b/Functions/Events/fn_event_killedEnemy.sqf similarity index 77% rename from Functions/Wave Type Libraries/Standard Wave Library/fn_handleKillEventPlayer.sqf rename to Functions/Events/fn_event_killedEnemy.sqf index 9c055ebb..45a22e00 100644 --- a/Functions/Wave Type Libraries/Standard Wave Library/fn_handleKillEventPlayer.sqf +++ b/Functions/Events/fn_event_killedEnemy.sqf @@ -7,8 +7,6 @@ Description: This is what will add the points to a player and create a hit marker. - Executed from the event added by "BLWK_fnc_stdEnemyKilledEvent" - Parameters: 0: _killedUnit : - The unit killed 1: _isVehicle : - True if anything other then a man unit (tank,car,etc.) @@ -19,15 +17,14 @@ Returns: Examples: (begin example) // from hit event - [_killedUnit] remoteExecCall ["BLWK_fnc_handleKillEventPlayer",_instigator]; - + [_killedUnit] remoteExecCall ["BLWK_fnc_event_killedEnemy",_instigator]; (end) Author(s): Hilltop(Willtop) & omNomios, - Modified by: Ansible2 // Cipher + Modified by: Ansible2 ---------------------------------------------------------------------------- */ -scriptName "BLWK_fnc_handleKillEventPlayer"; +scriptName "BLWK_fnc_event_killedEnemy"; if !(hasInterface) exitWith {}; @@ -44,10 +41,15 @@ if (isNull _killedUnit) exitWith { private _points = [_killedUnit] call BLWK_fnc_getPointsForKill; // aircraft gunners get limited points -if (missionNamespace getVariable ["BLWK_isAircraftGunner",false] AND {!_isVehicle}) then { - +if ( + (missionNamespace getVariable ["BLWK_isAircraftGunner",false]) AND + (!_isVehicle) +) then { _points = round (_points / 4); }; [_points] call BLWK_fnc_addPoints; [_killedUnit,_points,true] call BLWK_fnc_createHitMarker; + + +nil diff --git a/Functions/Wave Type Libraries/Standard Wave Library/fn_stdEnemyHitEvent.sqf b/Functions/Wave Type Libraries/Standard Wave Library/fn_stdEnemyHitEvent.sqf deleted file mode 100644 index d7795df0..00000000 --- a/Functions/Wave Type Libraries/Standard Wave Library/fn_stdEnemyHitEvent.sqf +++ /dev/null @@ -1,53 +0,0 @@ -/* ---------------------------------------------------------------------------- -Function: BLWK_fnc_stdEnemyHitEvent - -Description: - Executes the code in the standard enemy's hit event for adding points to player. - - Parameters are that of the normal HIT eventhandler. - - Executed from the event added by "BLWK_fnc_addStdEnemyManEHs" - -Parameters: - 0: _unit : - Object the event handler is assigned to - 1: _source : - Object that caused the damage – contains unit in case of collisions (not used) - 2: _damage : - Level of damage caused by the hit - 3: _instigator : - Person who pulled the trigger - -Returns: - NOTHING - -Examples: - (begin example) - - _this call BLWK_fnc_stdEnemyHitEvent; - - (end) - -Author(s): - Hilltop(Willtop) & omNomios, - Modified by: Ansible2 // Cipher ----------------------------------------------------------------------------- */ -if !(hasInterface) exitWith {}; - -private _instigator = _this select 3; - -if (_instigator isEqualTo player) then { - private _unit = _this select 0; - - // aircraft gunners get limited points - if (missionNamespace getVariable ["BLWK_isAircraftGunner",false]) then { - [1] call BLWK_fnc_addPoints; - [_unit,1] call BLWK_fnc_createHitMarker; - } else { - // multiply by damage - private _damagePoints = BLWK_pointsMultiForDamage * (_this select 2); - if (_damagePoints > BLWK_maxPointsForDamage) then { - _damagePoints = BLWK_maxPointsForDamage; - }; - - private _points = round (BLWK_pointsForHit + _damagePoints); - [_points] call BLWK_fnc_addPoints; - [_unit,_points] call BLWK_fnc_createHitMarker; - }; -}; \ No newline at end of file diff --git a/Functions/Wave Type Libraries/Standard Wave Library/fn_stdEnemyHitEventLocal.sqf b/Functions/Wave Type Libraries/Standard Wave Library/fn_stdEnemyHitEventLocal.sqf deleted file mode 100644 index 426034b7..00000000 --- a/Functions/Wave Type Libraries/Standard Wave Library/fn_stdEnemyHitEventLocal.sqf +++ /dev/null @@ -1,36 +0,0 @@ -/* ---------------------------------------------------------------------------- -Function: BLWK_fnc_stdEnemyHitEventLocal - -Description: - Executes the code in the standard enemy's hit event for adding points to player. - - Parameters are that of the normal HIT eventhandler. - - Executed from the event added by "BLWK_fnc_addStdEnemyManEHs" - -Parameters: - 0: _unit : - Object the event handler is assigned to - 1: _source : - Object that caused the damage – contains unit in case of collisions (not used) - 2: _damage : - Level of damage caused by the hit - 3: _instigator : - Person who pulled the trigger - -Returns: - NOTHING - -Examples: - (begin example) - - _this call BLWK_fnc_stdEnemyHitEventLocal; - - (end) - -Author(s): - Hilltop(Willtop) & omNomios, - Modified by: Ansible2 // Cipher ----------------------------------------------------------------------------- */ -params ["_hitUnit", "_source", "_damage", "_instigator"]; - -if (!(isNull _instigator) AND {isPlayer _instigator}) then { - // show a player hit points and add them to there score - [_hitUnit,_damage] remoteExecCall ["BLWK_fnc_handleHitEventPlayer",_instigator]; -}; \ No newline at end of file diff --git a/Functions/Wave Type Libraries/Standard Wave Library/fn_stdEnemyKilledEvent.sqf b/Functions/Wave Type Libraries/Standard Wave Library/fn_stdEnemyKilledEvent.sqf deleted file mode 100644 index 5159bac2..00000000 --- a/Functions/Wave Type Libraries/Standard Wave Library/fn_stdEnemyKilledEvent.sqf +++ /dev/null @@ -1,48 +0,0 @@ -#include "..\..\..\Headers\String Constants.hpp" -/* ---------------------------------------------------------------------------- -Function: BLWK_fnc_stdEnemyKilledEvent - -Description: - Executes the code in the standard enemy man killed event - for adding points to players and markers. - - Executed from the event added by "BLWK_fnc_addStdEnemyManEHs" - -Parameters: - 0: _killedUnit : - Object the event handler is assigned to - 1: _killer : - Object that killed _killedUnit – contains unit itself in case of collisions (not used) - 2: _instigator : - Person who pulled the trigger - 3: _useEffects : - same as useEffects in setDamage alt syntax (not used) - - -Returns: - NOTHING - -Examples: - (begin example) - - _this call BLWK_fnc_stdEnemyKilledEvent; - - (end) - -Author(s): - Hilltop(Willtop) & omNomios, - Modified by: Ansible2 // Cipher ----------------------------------------------------------------------------- */ -params ["_killedUnit", "_killer", "_instigator", "_useEffects"]; - -if (!(isNull _instigator) AND {isPlayer _instigator}) then { - // show a player hit points and add them to there score - [_killedUnit] remoteExecCall ["BLWK_fnc_handleKillEventPlayer",_instigator]; -}; - -// spawn the next in queue -if (clientOwner isEqualTo BLWK_theAIHandlerOwnerID) then { - // if the spawn queue is not empty - if !((missionNamespace getVariable [STANDARD_ENEMY_INFANTRY_QUEUE,[]]) isEqualTo []) then { - [STANDARD_ENEMY_INFANTRY_QUEUE,"_this call BLWK_fnc_stdEnemyManCreateCode"] call BLWK_fnc_createFromQueue; - }; -}; - - -[[_killedUnit]] remoteExecCall ["removeFromRemainsCollector",2]; diff --git a/Headers/descriptionEXT/functions.hpp b/Headers/descriptionEXT/functions.hpp index d1894021..4ce88878 100644 --- a/Headers/descriptionEXT/functions.hpp +++ b/Headers/descriptionEXT/functions.hpp @@ -482,6 +482,14 @@ class BLWK {}; }; + class Events + { + file = "Functions\Wave Type Libraries\Events"; + class event_killedEnemy + {}; + class event_hitEnemy + {}; + }; class StandardWaveLibrary { @@ -492,10 +500,6 @@ class BLWK {}; class handleDefectorWave {}; - class handleKillEventPlayer - {}; - class handleHitEventPlayer - {}; class handleStandardWave {}; class stdEnemyHitEvent