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

Added surgicalKit treatment #1392

Merged
merged 6 commits into from
May 28, 2015
Merged
Show file tree
Hide file tree
Changes from 4 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
5 changes: 3 additions & 2 deletions addons/medical/ACE_Medical_Treatments.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,9 @@ class ACE_Medical_Actions {
items[] = {"ACE_surgicalKit"};
treatmentLocations[] = {QGVAR(useLocation_SurgicalKit)};
requiredMedic = QGVAR(medicSetting_SurgicalKit);
treatmentTime = 10;
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_surgicalKit));
treatmentTime = "(count ((_this select 1) getVariable ['ACE_Medical_bandagedWounds', []]) * 5)";
callbackSuccess = "";
callbackProgress = QUOTE(DFUNC(treatmentAdvanced_surgicalKit_onProgress));
itemConsumed = QGVAR(consumeItem_SurgicalKit);
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"} }};
Expand Down
1 change: 1 addition & 0 deletions addons/medical/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ PREP(treatmentAdvanced_fullHeal);
PREP(treatmentAdvanced_fullHealLocal);
PREP(treatmentAdvanced_medication);
PREP(treatmentAdvanced_medicationLocal);
PREP(treatmentAdvanced_surgicalKit_onProgress);
PREP(treatmentBasic_bandage);
PREP(treatmentBasic_bloodbag);
PREP(treatmentBasic_bloodbagLocal);
Expand Down
22 changes: 20 additions & 2 deletions addons/medical/functions/fnc_treatment.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "script_component.hpp"

private ["_caller", "_target", "_selectionName", "_className", "_config", "_medicRequired", "_items", "_locations", "_return", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems", "_consumeItems", "_condition", "_displayText", "_wpn"];
private ["_caller", "_target", "_selectionName", "_className", "_config", "_medicRequired", "_items", "_locations", "_return", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems", "_consumeItems", "_condition", "_displayText", "_wpn", "_treatmentTime", "_treatmentTimeConfig"];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_treatmentTime is twice in the private array

_caller = _this select 0;
_target = _this select 1;
_selectionName = _this select 2;
Expand Down Expand Up @@ -174,8 +174,26 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then {
[_caller, _callerAnim] call EFUNC(common,doAnimation);
};

//Get treatment time
if (isNumber (_config >> "treatmentTime")) then {
_treatmentTime = getNumber (_config >> "treatmentTime");
} else {
if (isText (_config >> "treatmentTime")) then {
_treatmentTimeConfig = getText(_config >> "treatmentTime");
if (isnil _treatmentTimeConfig) then {
_treatmentTimeConfig = compile _treatmentTimeConfig;
} else {
_treatmentTimeConfig = missionNamespace getvariable _treatmentTimeConfig;
};
if (typeName _treatmentTimeConfig == "SCALAR") then {
_treatmentTime = _treatmentTimeConfig;
} else {
_treatmentTime = [_caller, _target, _selectionName, _className] call _treatmentTimeConfig;
};
};
};

// Start treatment
_treatmentTime = getNumber (_config >> "treatmentTime");
[
_treatmentTime,
[_caller, _target, _selectionName, _className, _items, _usersOfItems],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Author: BaerMitUmlaut
* Handles treatment via surgical kit per frame.
*
* Public: No
*/

#include "script_component.hpp"

private ["_args", "_target", "_caller", "_elapsedTime", "_totalTime", "_bandagedWounds"];
_args = _this select 0;
_caller = _args select 0;
_target = _args select 1;
_elapsedTime = _this select 1;
_totalTime = _this select 2;

_bandagedWounds = _target getVariable [QGVAR(bandagedWounds), []];

//In case two people stitch up one patient and the last wound has already been closed we can stop already
if (count _bandagedWounds == 0) exitWith {false};

//Has enough time elapsed that we can close another wound?
if ((_totalTime - _elapsedTime) <= (((count _bandagedWounds) - 1) * 5)) then {
_bandagedWounds deleteAt 0;
_target setVariable [QGVAR(bandagedWounds), _bandagedWounds, true];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tabs. Please replace by 4 spaces

};

true