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 Update (SAM Splint) #6412

Closed
wants to merge 31 commits into from
Closed

Medical Update (SAM Splint) #6412

wants to merge 31 commits into from

Conversation

mgkid3310
Copy link
Contributor

@mgkid3310 mgkid3310 commented Jun 28, 2018

When merged this pull request will:

  • Add SAM Splint item
  • Splint can be used when there is no active bleeding in selected part
  • The Splint heals the part's damage temporally
  • By healing damage, forced walk or aim shake is removed while this splint is applied
  • Splint is broken & removed when the selected part is hit or bleeding has started, or time limit expires
  • When Splint is removed(broken), the previously healed damage is added to current state
  • Splint is useful when medical option 'heal hitpoint with bandage' is turned off or don't have time for bandage but need to run (can use splint on tourniquet applied limb)

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

@mgkid3310
Copy link
Contributor Author

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?

@mgkid3310
Copy link
Contributor Author

nah, found & fixed all tabs


#include "script_component.hpp"

private _target = _this select 0;
Copy link
Contributor

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 {
Copy link
Contributor

@dedmen dedmen Jun 28, 2018

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.

Copy link
Contributor Author

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 {
Copy link
Contributor

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"];
Copy link
Contributor

Choose a reason for hiding this comment

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

use private keyword.

Copy link
Contributor Author

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";
Copy link
Contributor

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};
Copy link
Contributor

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 {
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor Author

@mgkid3310 mgkid3310 Jun 28, 2018

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).

Copy link
Contributor

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];
Copy link
Contributor

Choose a reason for hiding this comment

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

_dagage?

Copy link
Contributor Author

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 {
Copy link
Contributor

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

Copy link
Contributor Author

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"];
Copy link
Contributor

@dedmen dedmen Jun 28, 2018

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 = "";;
Copy link
Contributor

Choose a reason for hiding this comment

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

double semicolon

@mgkid3310
Copy link
Contributor Author

Shall we carry on with cast or take some pause here?

@mgkid3310
Copy link
Contributor Author

mgkid3310 commented Jun 29, 2018

cast removed & made splint last longer

#include "script_component.hpp"

private _target = _this select 0;
private _part = _this select 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

params?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed with last commit

@@ -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;
Copy link
Contributor Author

@mgkid3310 mgkid3310 Jun 30, 2018

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.

@mgkid3310
Copy link
Contributor Author

Any reviews done yet?

@thojkooi thojkooi self-assigned this Jul 7, 2018
@thojkooi thojkooi added kind/feature Release Notes: **ADDED:** status/review-pending labels Jul 7, 2018
@thojkooi
Copy link
Contributor

thojkooi commented Jul 7, 2018

I will review shortly.

@dedmen
Copy link
Contributor

dedmen commented Jul 24, 2018

I agree. Split the Splint/UI stuff into seperate PR's.
That would make it easier/faster to merge Splint. And I want Splint :3
Do we need a model/icon before merging this?
If so I'd do it.

https://cdn2.bigcommerce.com/server500/rd4j7/product_images/uploaded_images/samcombopkg-sm.jpg
https://cdn.shopify.com/s/files/1/0219/5816/products/sam_splint_grande.jpg?v=1434902164
https://www.narescue.com/sam-splint-ii

I'd just go for
https://www.narescue.com/media/catalog/product/cache/1/image/1200x1200/9df78eab33525d08d6e5fb8d27136e95/5/0/50-1005_c.jpg
as model and
https://www.narescue.com/media/catalog/product/cache/1/image/1200x1200/9df78eab33525d08d6e5fb8d27136e95/5/0/50-1005_a.jpg
as icon? Of course self made and not just copied from that site ^^
Or would you prefer the direct front view as icon? But i think that would make it harder to identify as a small icon without a unique silhouette

@mgkid3310
Copy link
Contributor Author

@dedmen Well it would be a great help if you work on model & icons. Those works would be better to proceed on your preference.
And about spliting the PR, would it be better to close this and start 2 new PRs?

@dedmen
Copy link
Contributor

dedmen commented Jul 24, 2018

I'd say leave splint here. And just remove the changes for the UI and add that in a seperate PR.
I'll do the model then. Maybe even tomorrow will see how I have time.

@mgkid3310
Copy link
Contributor Author

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).

@mgkid3310
Copy link
Contributor Author

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.

@thojkooi
Copy link
Contributor

This would need to target the medical_rewrite branch. We can introduce these new treatment options as part of that project.

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.

@mgkid3310 mgkid3310 changed the title Medical Update (Splint, Cast, etc.) Medical Update (SAM Splint) Jul 24, 2018
@mgkid3310
Copy link
Contributor Author

@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";
Copy link
Contributor

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).

Copy link
Member

@TheMagnetar TheMagnetar Jul 25, 2018

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

Copy link
Contributor Author

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'?

Copy link
Contributor Author

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.

@dedmen
Copy link
Contributor

dedmen commented Jul 25, 2018

Model done I'd say. Just texture on it maybe tomorrow or weekend and then it's done.
Do you think that angle is enough? It should be opened a bit as it's lying on the ground out of it's packaging. On the top side you'll have the usage instructions.
Measurements are the same as the real SAM Splint II

@@ -357,6 +385,7 @@ class ACE_Medical_Actions {
items[] = {};
treatmentTime = 2.5;
callbackSuccess = QUOTE(DFUNC(actionRemoveTourniquet));
treatmentType = "TourniquetOff";
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@mgkid3310
Copy link
Contributor Author

@dedmen Model looks cool, can't wait for the textured version!

@thojkooi
Copy link
Contributor

thojkooi commented Jul 25, 2018

merge this on current medical first

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.

@mgkid3310
Copy link
Contributor Author

@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));
Copy link
Contributor

@dedmen dedmen Jul 26, 2018

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.

Copy link
Member

@TheMagnetar TheMagnetar Jul 26, 2018

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@dedmen dedmen Jul 27, 2018

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>
Copy link
Contributor

@dedmen dedmen Jul 27, 2018

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

@dedmen
Copy link
Contributor

dedmen commented Jul 28, 2018

p3d/ace_splint_co go in medical/data
_x_ca goes into medical/ui/items


ace_splint.zip

Don't really like the inventory icon.
My other idea was
splint_x_ca
But that doesn't look good ingame

@mgkid3310
Copy link
Contributor Author

I'm not 100% sure if I've set hiddenSelectionsTextures correctly

@dedmen
Copy link
Contributor

dedmen commented Jul 28, 2018

Leave it away. It doesn't have any selections.
If you want it to be placeable in Eden/Zeus you also need a CfgVehicles entry.

@mgkid3310 mgkid3310 closed this Dec 31, 2018
@dedmen
Copy link
Contributor

dedmen commented Dec 31, 2018

Why close?

@mgkid3310
Copy link
Contributor Author

Oh forgot to comment the reason
Since there's not much progress in the work and I'm working on other part, I had to remove the forked repo and create a new one, removing the changes. I do have the code in my harddrive, so I'll work on implementing the changes to medical rewrite later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Release Notes: **ADDED:** status/review-pending
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants