Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Medical Blood - Add source of blooddrop to events #9102

Merged
merged 3 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions addons/medical_blood/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand Down
9 changes: 5 additions & 4 deletions addons/medical_blood/functions/fnc_createBlood.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,26 @@
* 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;

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
2 changes: 1 addition & 1 deletion addons/medical_blood/functions/fnc_onBleeding.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
4 changes: 2 additions & 2 deletions addons/medical_blood/functions/fnc_spurt.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ 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);

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);
};
};