Medical Blood - Add source of blooddrop to events (#9102)

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
BrettMayson 2023-02-01 05:03:44 -06:00 committed by GitHub
parent b4005bca43
commit f83a2df4b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 10 deletions

View File

@ -9,10 +9,10 @@ if (isServer) then {
GVAR(bloodDrops) = [];
[QGVAR(bloodDropCreated), {
params ["_bloodDrop"];
params ["_bloodDrop", "_source"];
// Add to created queue with format: [expire time, blood object]
private _index = GVAR(bloodDrops) pushBack [CBA_missionTime + GVAR(bloodLifetime), _bloodDrop];
// Add to created queue with format: [expire time, blood object, source unit]
private _index = GVAR(bloodDrops) pushBack [CBA_missionTime + GVAR(bloodLifetime), _bloodDrop, _source];
if (count GVAR(bloodDrops) >= GVAR(maxBloodObjects)) then {
(GVAR(bloodDrops) deleteAt 0) params ["", "_deletedBloodDrop"];

View File

@ -7,18 +7,19 @@
* Arguments:
* 0: Blood Drop Type <STRING>
* 1: Position <ARRAY>
* 2: Source <OBJECT>
*
* Return Value:
* Blood Drop <OBJECT>
*
* Example:
* ["blooddrop_2", getPos player] call ace_medical_blood_fnc_createBlood
* ["blooddrop_2", getPos player, player] call ace_medical_blood_fnc_createBlood
*
* Public: No
*/
params ["_type", "_position"];
TRACE_2("Creating blood",_type,_position);
params ["_type", "_position", "_source"];
TRACE_3("Creating blood",_type,_position,_source);
private _model = GVAR(models) getVariable _type;
@ -26,6 +27,6 @@ private _bloodDrop = createSimpleObject [_model, [0, 0, 0]];
_bloodDrop setDir random 360;
_bloodDrop setPos _position;
[QGVAR(bloodDropCreated), _bloodDrop] call CBA_fnc_serverEvent;
[QGVAR(bloodDropCreated), [_bloodDrop, _source]] call CBA_fnc_serverEvent;
_bloodDrop

View File

@ -35,5 +35,5 @@ if (CBA_missionTime > (_unit getVariable [QGVAR(nextTime), -10])) then {
_position set [2, 0];
private _bloodDrop = ["blooddrop_1", "blooddrop_2", "blooddrop_3", "blooddrop_4"] select floor (_bloodLoss min 3);
[_bloodDrop, _position] call FUNC(createBlood);
[_bloodDrop, _position, _unit] call FUNC(createBlood);
};

View File

@ -27,7 +27,7 @@ private _distanceBetweenDrops = DISTANCE_BETWEEN_DROPS * _damage;
private _offset = OFFSET + _distanceBetweenDrops;
private _position = _unit getPos [_offset, _direction];
["blooddrop_2", _position, _direction] call FUNC(createBlood);
["blooddrop_2", _position, _unit] call FUNC(createBlood);
private _dropAmount = ceil (MAXIMUM_DROPS * _damage);
TRACE_2("Spurting blood",_dropAmount,_damage);
@ -35,6 +35,6 @@ TRACE_2("Spurting blood",_dropAmount,_damage);
if (_dropAmount > 1) then {
for "_i" from 2 to _dropAmount do {
_position = _position getPos [_distanceBetweenDrops, _direction];
["blooddrop_1", _position, _direction] call FUNC(createBlood);
["blooddrop_1", _position, _unit] call FUNC(createBlood);
};
};