-
Notifications
You must be signed in to change notification settings - Fork 735
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 Update (SAM Splint) #6412
Conversation
circleci reports that there are tabs at the end of line in some files, but I can't find them. Can someone help me with this? |
nah, found & fixed all tabs |
|
||
#include "script_component.hpp" | ||
|
||
private _target = _this select 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use params
|
||
if (!(_joint isEqualTo [])) then { | ||
{ | ||
if ((_x select 3) < CBA_missionTime) then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use select
to remove them. instead of looping.. Also I think you are skipping every element after the one you deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was pretty dumb for some reason while coding that file. Thanks for letting me know XP
private _joint = _target getVariable [QGVAR(jointTreatment), []]; | ||
private _itemCount = 0; | ||
|
||
if (!(_joint isEqualTo [])) then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the outermost () aren't needed. And are usually also not used
@@ -226,6 +226,69 @@ private _treatmentTime = if (isNumber (_config >> "treatmentTime")) then { | |||
["isNotInside", "isNotSwimming"] | |||
] call EFUNC(common,progressBar); | |||
|
|||
// add current action to display list | |||
private ["_medicalLevel", "_treatmentType", "_partName", "_itemClass", "_action", "_treatment"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use private
keyword.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated code, but not sure this is what you meant. Plz check it out.
// add current action to display list | ||
private ["_medicalLevel", "_treatmentType", "_partName", "_itemClass", "_action", "_treatment"]; | ||
|
||
_medicalLevel = "Basic"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
["Advanced", "Basic"] select (GVAR(level) >= 2)
|
||
params ["_caller", "_target", "_selectionName", "_className", "_items"]; | ||
|
||
if (count _items == 0) exitWith {false}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_items isEqualTo []
just as you used previously.
// if ((_cast select _part select 0) > 0) exitWith {false}; | ||
|
||
private _removeItem = _items select 0; | ||
if (local _target) then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't CBA targetEvent do that internally already? not sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about that either. I just referenced from other functions in ACE Medical for that. Maybe for optimization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checked out, and CBA targetEvent does actually run local event without creating network traffic when there's no remote target. Shall I fix that on all other scripts? All treatment~
files also used if (local _target)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not worth fixing the others. Medical rewrite will do that anyway
_target setVariable [QGVAR(samSplint), _sam, true]; | ||
|
||
// _cast set [_part, [CBA_missionTime, _damage select _part]]; | ||
_dagage set [_part, 0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_dagage
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_damage
... Dumb mistype
|
||
private _sam = _target getVariable [QGVAR(samSplint), [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]]; | ||
|
||
if (_sam select _part select 0 isEqualTo _timeOld) then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does sam
stand for? Looks like it should be called splint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was for SAM Splint, but fixed anyway
|
||
#include "script_component.hpp" | ||
|
||
params ["_target", "_part", "_timeOld"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taking 3 arguments but header says only 2.
Not sure if this is what dedmen meant, but well...
@@ -258,6 +251,8 @@ switch (_selectionName) do { | |||
}; | |||
}; | |||
|
|||
private _action = ""; | |||
private _treatment = "";; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double semicolon
Shall we carry on with cast or take some pause here? |
cast removed & made splint last longer |
#include "script_component.hpp" | ||
|
||
private _target = _this select 0; | ||
private _part = _this select 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
params
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed with last commit
addons/medical/XEH_postInit.sqf
Outdated
@@ -26,6 +26,9 @@ GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"]; | |||
[QGVAR(treatmentIVLocal), DFUNC(treatmentIVLocal)] call CBA_fnc_addEventHandler; | |||
[QGVAR(treatmentTourniquetLocal), DFUNC(treatmentTourniquetLocal)] call CBA_fnc_addEventHandler; | |||
[QGVAR(actionPlaceInBodyBag), FUNC(actionPlaceInBodyBag)] call CBA_fnc_addEventHandler; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is adding eventhandler with FUNC() makes error? Not sure why bodybag action is registered that way.
Any reviews done yet? |
I will review shortly. |
I agree. Split the Splint/UI stuff into seperate PR's. https://cdn2.bigcommerce.com/server500/rd4j7/product_images/uploaded_images/samcombopkg-sm.jpg I'd just go for |
@dedmen Well it would be a great help if you work on model & icons. Those works would be better to proceed on your preference. |
I'd say leave splint here. And just remove the changes for the UI and add that in a seperate PR. |
Removed UI works, but left SAM splint display on medical menu (like tourniquet). Due to merge conflict concerns, I'll start UI PR after this splint work is finished (merged or closed). |
ps. This PR does need test if the splint works fine. I couldn't test this in binarized condition (don't know how to pack addon binarized). I believe there won't be any mistake while porting this feature, but I wish to remove any chance of problem. |
This would need to target the This would mean a bit more work to adapt this PR, due to a lot of restructuring that happened on the medical rewrite branch, but otherwise it will just be wasted effort to continue development against the master branch. |
@thojkooi I'm also looking foward for medical rewrite and have will to port this to the rewrite project, but since this feature was originally written based on current medical system, I thought it would be better to merge this on current medical first, then port into medical rewrite. |
callbackSuccess = QUOTE(DFUNC(treatmentSAMSplint)); | ||
treatmentType = "Others"; | ||
treatmentDisplay = "Applying SAM Splint"; | ||
condition = "[_this select 1, _this select 2] call ace_medical_fnc_canTreatSAMSplint"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could just be call ace_medical_fnc_canTreatSAMSplint
and let _this be passed implicitly. Rather than taking it apart (select
) and then putting it back together (the array) just to take it apart again inside the function (params
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or condition = QFUNC(canTreatSAMSplint);
and the same with callBackSuccess = QFUNC(treatmentSAMSplint);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Roger, will have this fixed by tonight. Would it be better to use 'private _target = _this select 1' since the caller (0th item of _this array) or just accept all 4 items via 'params'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used QUOTE([ARR_2(_this select 1, _this select 2)] call FUNC(canTreatSAMSplint));
, similar to tourniquet and other treatments.
Model done I'd say. Just texture on it maybe tomorrow or weekend and then it's done. |
@@ -357,6 +385,7 @@ class ACE_Medical_Actions { | |||
items[] = {}; | |||
treatmentTime = 2.5; | |||
callbackSuccess = QUOTE(DFUNC(actionRemoveTourniquet)); | |||
treatmentType = "TourniquetOff"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These still belong to the UI part don't they?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, forgot those. Will remove them tonight.
@dedmen Model looks cool, can't wait for the textured version! |
I doubt we will. I feel it's wasted effort on everyone's part. I think this PR will address some concerns addressed in #6458 for the medical rewrite, and we should focus on that. For reference; the medical rewrite is gaining a lot of momentum and we are putting a lot of effort into it to get it out of the door sooner rather than later. I'm talking months, at most. I'm happy to discuss that further on Slack though. |
@thojkooi Well I do understand that medical RW has some concerns about its system, but I think this could be a nice chance to test out splint system. And moreover, since AFAIK the treatment functions act similar to current medical system, the works done here to adapt the functions won't be a whole waste. Sure some part will be wasted, but most will carry on to rewrite. |
treatmentType = "Others"; | ||
treatmentDisplay = "Applying SAM Splint"; | ||
condition = "[_this select 1, _this select 2] call ace_medical_fnc_canTreatSAMSplint"; | ||
condition = QUOTE([ARR_2(_this select 1, _this select 2)] call FUNC(canTreatSAMSplint)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's still the same as before ^^ Just harder to read now.
My main gripe was the useless performance waste here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I commented before, this is easier to read and does not suffer from the performance waste
condition = QFUNC(canTreatSAMSplint);
callbackSuccess = QFUNC(treatmentSAMSplint);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well it's now fixed that way. BTW, isn't QFUNC different from QUOTE(DFUNC(..))? AFAIK DFUNC has something different from FUNC about debugging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And would it be better to accept variables via _this select 1
rather than params
? the 0th item isn't used, so accepting that via params
doesn't look so optimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, isn't QFUNC different from QUOTE(DFUNC(..))?
https://github.com/acemod/ACE3/blob/master/addons/main/script_macros.hpp#L15
And would it be better to accept variables via _this select 1 rather than params?
no it won't. 2 binary commands are worse than 1 unary command. If you name the first variable ""
it's skipped very fast.
@@ -3,8 +3,9 @@ | |||
* Check if can treat Splint | |||
* | |||
* Arguments: | |||
* 0: The patient <OBJECT> | |||
* 1: SelectionName <STRING> | |||
* 1: The caller (not used, can pass nil) <OBJECT> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say remove the (not used, can pass nil)
part.
Also this should be argument 0 not 1
IMO it's good to have caller
here. Makes it easily extendable later. In case someone comes up with a requirement on the caller. Telling people to pass nil would make that a more complicated task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Roger, will fix that. Would it be better to skip the caller with "" or just accept to _caller for later extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't really make a difference I think.
I'm not 100% sure if I've set hiddenSelectionsTextures correctly |
Leave it away. It doesn't have any selections. |
Why close? |
Oh forgot to comment the reason |
When merged this pull request will:
Notice1: SAM Splint and Orthogonal Cast item has no icon & model yet. Need someone to work on this.
Notice2: This is ported from my personal ACE expansion, so there may be mistakes while porting the code. May need some inspection with it. This is the link to the original code: https://github.com/Hush1234/kg_optic/tree/master/addons/orbis_ace3_medical_config