Browse Source

Add isDoctor check to ace actions, added comments

m3ales 4 years ago
parent
commit
3aded1c02c

+ 1 - 0
addons - Copy/RD501_Main/XEH_preInit.sqf

@@ -133,5 +133,6 @@ macro_prep_xeh(medical_ccp\fnc_incrementStitchProgress.sqf,incrementStitchProgre
 macro_prep_xeh(medical_ccp\fnc_deployCCP.sqf,deployCCP)
 macro_prep_xeh(medical_ccp\fnc_deployCCPLocal.sqf,deployCCPLocal)
 macro_prep_xeh(medical_ccp\fnc_deployCCPServer.sqf,deployCCPServer)
+macro_prep_xeh(medical_ccp\fnc_isDoctor.sqf,isDoctor)
 
 diag_log "RD501 PREP Complete";

+ 17 - 0
addons - Copy/RD501_Main/functions/medical_ccp/fnc_canBandageNearbyCCP.sqf

@@ -1,6 +1,23 @@
+/*
+ * Author: M3ales
+ *
+ * Arguments:
+ * Unit
+ * Return Value:
+ * True if eligable to use bandage all action
+ *
+ * Example:
+ * [cursorTarget, player, []] call rd501_fnc_canBandageNearbyCCP
+ *
+ * Public: No
+ */
+
 params [
 	"_target", 
 	"_player", 
 	"_params"
 ];
 
+alive _target &&
+_player call rd501_fnc_checkInsideCCP &&
+_player call rd501_fnc_isDoctor

+ 17 - 0
addons - Copy/RD501_Main/functions/medical_ccp/fnc_canStitchNearbyCCP.sqf

@@ -1,6 +1,23 @@
+/*
+ * Author: M3ales
+ *
+ * Arguments:
+ * Unit
+ * Return Value:
+ * True if eligable to use stitch all action
+ *
+ * Example:
+ * [cursorTarget, player, []] call rd501_fnc_canStitchNearbyCCP
+ *
+ * Public: No
+ */
+
 params [
 	"_target", 
 	"_player", 
 	"_params"
 ];
 
+alive _target &&
+_player call rd501_fnc_checkInsideCCP &&
+_player call rd501_fnc_isDoctor

+ 14 - 0
addons - Copy/RD501_Main/functions/medical_ccp/fnc_checkInsideCCP.sqf

@@ -1,3 +1,17 @@
+/*
+ * Author: M3ales
+ *
+ * Arguments:
+ * Unit to check for
+ * Return Value:
+ * True if inside the bounds of a given structure
+ *
+ * Example:
+ * [player] call rd501_fnc_checkInsideCCP
+ *
+ * Public: No
+ */
+
 params ["_unit"];
 
 private _fnc_check = {

+ 18 - 3
addons - Copy/RD501_Main/functions/medical_ccp/fnc_deployCCPLocal.sqf

@@ -1,16 +1,31 @@
-params["_ccp"];
+/*
+ * Author: M3ales
+ *
+ * Adds the ace interaction options to the local machine, exits if its a dedicated serverCommand
+ *
+ * Arguments:
+ * CCP Building
+ * Return Value:
+ * None
+ *
+ * Example:
+ * [cursorTarget] call rd501_fnc_deployCCPLocal
+ *
+ * Public: No
+ */
 
+params["_ccp"];
 
 if(isDedicated) exitWith {};
 
 _action = ["rd501_medical_ccp_bandageAll", "Bandage All Patients", "", {
 	params ["_target", "_player", "_params"];
 		[_player, _target, 20] call rd501_fnc_bandageAllNearbyCCP;
-	}, {true}] call ace_interact_menu_fnc_createAction;
+	}, rd501_fnc_canBandageNearbyCCP] call ace_interact_menu_fnc_createAction;
 [_ccp, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;
 
 _action = ["rd501_medical_ccp_stitchAll", "Stitch All Patients", "", {
 	params ["_target", "_player", "_params"];
 		[_player, _target, 20] call rd501_fnc_stitchAllWoundsNearbyCCP;
-	}, {true}] call ace_interact_menu_fnc_createAction;
+	}, rd501_fnc_canStitchNearbyCCP, {[]}, ] call ace_interact_menu_fnc_createAction;
 [_ccp, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;

+ 16 - 0
addons - Copy/RD501_Main/functions/medical_ccp/fnc_deployCCPServer.sqf

@@ -1,3 +1,19 @@
+/*
+ * Author: M3ales
+ *
+ * Replaces the given target object with the CCP object, and adds an ace interact on JIP
+ *
+ * Arguments:
+ * Target Object
+ * Return Value:
+ * None
+ *
+ * Example:
+ * [cursorTarget] call rd501_fnc_deployCCPServer
+ *
+ * Public: No
+ */
+
 params["_target"];
 
 _position = position _target;

+ 14 - 0
addons - Copy/RD501_Main/functions/medical_ccp/fnc_deployCcp.sqf

@@ -1,3 +1,17 @@
+/*
+ * Author: M3ales
+ *
+ * Arguments:
+ * Unit
+ * Return Value:
+ * True if eligable to use bandage action
+ *
+ * Example:
+ * [cursorTarget, player, []] call rd501_fnc_canBandageNearbyCCP
+ *
+ * Public: No
+ */
+
 params ["_target", "_player", "_params"];
 
 ["rd501_medical_ccp_deployCCPServer", [_target]] call CBA_fnc_serverEvent;

+ 15 - 0
addons - Copy/RD501_Main/functions/medical_ccp/fnc_incrementBandageProgress.sqf

@@ -1,3 +1,18 @@
+/*
+ * Author: M3ales
+ *
+ * Arguments:
+ * Building or object to increment variable on
+ * The player who is performing the action
+ * Return Value:
+ * None
+ *
+ * Example:
+ * [cursorTarget, player] call rd501_fnc_incrementBandageProgress
+ *
+ * Public: No
+ */
+
 params["_origin", "_healer"];
 _progress = _origin getVariable["rd501_medical_ccp_bandageProgress", -1];
 if(_progress >= 0) then {

+ 15 - 0
addons - Copy/RD501_Main/functions/medical_ccp/fnc_incrementStitchProgress.sqf

@@ -1,3 +1,18 @@
+/*
+ * Author: M3ales
+ *
+ * Arguments:
+ * Building or object to increment variable on
+ * The player who is performing the action
+ * Return Value:
+ * None
+ *
+ * Example:
+ * [cursorTarget, player] call rd501_fnc_incrementStitchProgress
+ *
+ * Public: No
+ */
+
 params["_origin", "_healer"];
 _progress = _origin getVariable["rd501_medical_ccp_stitchProgress", -1];
 if(_progress >= 0) then {

+ 18 - 0
addons - Copy/RD501_Main/functions/medical_ccp/fnc_isDoctor.sqf

@@ -0,0 +1,18 @@
+/*
+ * Author: M3ales
+ *
+ * Arguments:
+ * Player or unit to check
+ * Return Value:
+ * True if they are a doctor (medical level 2+), false otherwise
+ *
+ * Example:
+ * [player] call rd501_fnc_isDoctor
+ *
+ * Public: No
+ */
+
+params["_unit"];
+
+private _class = _unit getVariable ["ace_medical_medicClass", parseNumber (_unit getUnitTrait "medic")];
+_class >= 2

+ 14 - 0
addons - Copy/RD501_Main/functions/medical_ccp/fnc_stitchAllWounds.sqf

@@ -1,3 +1,17 @@
+/*
+ * Author: M3ales
+ *
+ * Arguments:
+ * The player who is performing the action
+ * The player who is being healed
+ * Return Value:
+ * None
+ *
+ * Example:
+ * [player, player] call rd501_fnc_stitchAllWounds
+ *
+ * Public: No
+ */
 
 params["_healer","_patient"];
 

+ 3 - 3
addons - Copy/RD501_Main/functions/medical_ccp/fnc_valueProgressBar.sqf

@@ -17,12 +17,12 @@
  * None
  *
  * Example:
- * [5, [], {Hint "Finished!"}, {hint "Failure!"}, "My Title"] call ace_common_fnc_progressBar
+ * ["rd501_medical_ccp_stitchProgress", [], {Hint "Finished!"}, {hint "Failure!"}, "My Title"] call rd501_fnc_valueProgressBar
  *
  * Public: Yes
  */
 
-params ["_progressVar", "_building", "_args", "_onFinish", "_onFail", ["_localizedTitle", ""], ["_condition", {true}], ["_exceptions", []]];
+params ["_progressVar","_progressCompleteVar", "_building", "_args", "_onFinish", "_onFail", ["_localizedTitle", ""], ["_condition", {true}], ["_exceptions", []]];
 
 private _player = ACE_player;
 
@@ -44,7 +44,7 @@ _ctrlPos set [1, ((0 + 29 * ace_common_settingProgressBarLocation) * ((((safezon
 (uiNamespace getVariable "ace_common_ctrlProgressBarTitle") ctrlCommit 0;
 
 [{
-    (_this select 0) params ["_progressVar","_args", "_onFinish", "_onFail", "_condition", "_player", "_building", "_exceptions"];
+    (_this select 0) params ["_progressVar", "_progressCompleteVar", "_args", "_onFinish", "_onFail", "_condition", "_player", "_building", "_exceptions"];
 
     private _progress = _building getVariable[_progressVar, -1];
     private _errorCode = -1;