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

Use getUnitTrait for medics, engineers and EOD #5246

Merged
merged 2 commits into from
Jun 10, 2017
Merged

Use getUnitTrait for medics, engineers and EOD #5246

merged 2 commits into from
Jun 10, 2017

Conversation

kymckay
Copy link
Member

@kymckay kymckay commented Jun 4, 2017

When merged this pull request will:

  • Make the functions which check whether units are medics, engineers or explosive specialists use the newer getUnitTrait command which makes them compatible with use of setUnitTrait and not purely checking the config

@kymckay kymckay added the kind/enhancement Release Notes: **IMPROVED:** label Jun 4, 2017
@kymckay kymckay added this to the 3.10.0 milestone Jun 4, 2017
@@ -19,7 +19,7 @@

params ["_unit", ["_medicN", 1]];

private _class = _unit getVariable [QGVAR(medicClass), getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "attendant")];
private _class = _unit getVariable [QGVAR(medicClass), _unit getUnitTrait "medic"];
Copy link
Contributor

Choose a reason for hiding this comment

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

_class should be number, not bool

someone in public slack was talking about using config attendant =2 to set doctors
it's not the prettiest code, but something like this should support that

private _class = _unit getVariable QGVAR(medicClass);
if (isNil "_class") then {
    if (_unit getUnitTrait "medic") then {
        _class = 1 max getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "attendant");
    } else{
        _class = 0;
    };
};

Copy link
Member Author

Choose a reason for hiding this comment

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

Are we sure we want to support that since afaik the game itself treats the attendant property as a boolean?

Copy link
Member Author

Choose a reason for hiding this comment

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

It might be better to introduce an extra config property to support doctors that way (although, are doctors even relevant in the current medical code?)

Copy link
Contributor

@Phyma Phyma Jun 4, 2017

Choose a reason for hiding this comment

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

ACE_common_fnc_getUnitTrait that will check all traits and "attendats"? Input of what you need to check. This will also help later if we decide to implement more types of medics, engineers and more.
Thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

I think that should be done in medical-rewrite, as we can afford to change things there that would otherwise be backwards-incompatible.

@kymckay
Copy link
Member Author

kymckay commented Jun 4, 2017

I didn't add the code for attendant being set to 2 as I'm unsure about whether we want to do that, but fixed the incorrect boolean

@PabstMirror
Copy link
Contributor

Could replace the attendant = 2; config with

class Extended_Init_EventHandlers {
    class x_doctorUnitType {
        class makeDoctor {
            init = "(_this select 0) setVariable ["ace_medical_medicClass", 2]";
        };
    };
};

@kymckay kymckay merged commit a53f68a into master Jun 10, 2017
@kymckay kymckay deleted the use-traits branch June 10, 2017 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Release Notes: **IMPROVED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants