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 - Add Enable Setting #9593

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft

Conversation

LinkIsGrim
Copy link
Contributor

@LinkIsGrim LinkIsGrim commented Oct 27, 2023

When merged this pull request will:

  • Remove "Disabled" item conversion setting from Medical Treatment.
  • Add backup empty item replacement to Medical Engine if Medical Treatment isn't loaded.
  • Add intercepting of heal orders to replace items, preventing vanilla heals by AI.
  • Remove CfgActions overwrites for healing.

TODO:

  • Figure out what to do with the rest of the actions (reimplement via scripting?)
  • Add the setting itself
  • Change all checks for medical being loaded for medical being enabled instead

IMPORTANT

  • If the contribution affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
  • Development Guidelines are read, understood and applied.
  • Title of this PR uses our standard template Component - Add|Fix|Improve|Change|Make|Remove {changes}.

@LinkIsGrim LinkIsGrim added the kind/feature Release Notes: **ADDED:** label Oct 27, 2023
@LinkIsGrim
Copy link
Contributor Author

On a side note, this could be used by Medical AI to implement on-demand healing via the command menu.

@johnb432
Copy link
Contributor

johnb432 commented Apr 20, 2024

If you first injure a unit, then select said unit using the SL vanilla menu, then press 6 and order the unit to "Treat yourself", the command will be ACTION. It will fail the check, allowing the unit to use the vanilla aid kit. We unfortunately can't filter out ACTION commands, as they are used for other stuff too (e.g. checking subordinates' inventories).

@LinkIsGrim
Copy link
Contributor Author

If you first injure a unit. then select said unit using the SL vanilla menu, then press 6 and order the unit to "Treat yourself", the command will be ACTION. It will fail the check, allowing the unit to use the vanilla aid kit. We unfortunately can't filter out ACTION commands, as they are used for other stuff too (e.g. checking subordinates' inventories).

We could use waitUntilAndExecute checking for unit starting a healing animation

@rautamiekka
Copy link
Contributor

We could use waitUntilAndExecute checking for unit starting a healing animation

Or the AnimChanged and/or AnimStateChanged EH's.

Return value of HandleHeal is ignored, but AISFinishHeal works
@johnb432
Copy link
Contributor

Found a better solution (at least for SP, I can't test in MP atm).

@johnb432
Copy link
Contributor

@LinkIsGrim What do you mean by

Figure out what to do with the rest of the actions (reimplement via scripting?)

@LinkIsGrim
Copy link
Contributor Author

Any of the vanilla scroll wheel actions that have anything to do with healing (especially those that don't require inventory items) will need to be disabled/hidden whenever medical is enabled, but need to be able to be reenabled without a game restart.

@johnb432
Copy link
Contributor

johnb432 commented Jul 25, 2024

(especially those that don't require inventory items)

Do you have any examples of this?


On a side note, this could be used by Medical AI to implement on-demand healing via the command menu.

I've been thinking about this for a while. At the moment the AI automatically requests a medic when they are safe and injured:

[GVAR(stateMachine), "Safe", "HealSelf", LINKFUNC(canRequestMedic), LINKFUNC(requestMedic), "RequestMedic"] call CBA_statemachine_fnc_addTransition;

Medic only heals if he's safe. Trying to overwrite the safe behaviour is imo a bad idea.

The only thing you could easily influence is the order of healing of each unit:

_healQueue pushBack _this;

When using the command menu, we could insert the unit to be healed at the beginning on the queue, so the to be healed unit would be prioritised.

The problem is, I don't know how to edit the command menu options. As it stands, you'll be able to use the "Treat" command once on an injured or medic, then it's removed because the unit in questions doesn't have any vanilla treatment items anymore. We'd need to edit the command menu "Treat" commands to take both Vanilla and ACE medical items into account.

EDIT: Looks like we can edit the command menu options easily, but I'm not sure if it will allow us to edit it in the way we need to.

@Dystopian
Copy link
Contributor

Do you have any examples of this?

Heal at medical vehicle maybe.

@johnb432
Copy link
Contributor

johnb432 commented Jul 25, 2024

Heal at medical vehicle maybe.

Thanks. I tested and unfortunately HandleHeal doesn't trigger when a unit is ordered to heal themselves at a vehicle (see https://feedback.bistudio.com/T183117). Even if it did, we can use AISFinishHeal to finish the treatment we can force the animation to finish (which apparently is when the unit is healed), but there is no way of overriding if the EH should heal or not, which is problematic in this case, as there are no items to replace, which normally interrupts the action (return value not working was reported in https://feedback.bistudio.com/T182892).

At this point I don't know what else to do. Adding https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#AnimChanged EH to every single unit and check if they go into a healing animation wouldn't help, because healing at vehicles remains a problem (maybe the previous method of making the unit leaving the group and rejoining it would work, haven't tested it).


I've taken a look at editing the commanding menu and I don't think it's possible to edit it in a way we'd want to. We only get a very limited selection of expressions we can use for the condition (https://community.bistudio.com/wiki/Arma_3:_Communication_Menu#Simple_expressions). I tried to add an expression entry in the config (https://community.bistudio.com/wiki/showCommandingMenu), but that doesn't seem to do anything.

@johnb432
Copy link
Contributor

johnb432 commented Jul 28, 2024

At this point I don't know what else to do.

Actually I do: We ignore it. The current ACE medical system also can't prevent units healing themselves that way.

Any of the vanilla scroll wheel actions that have anything to do with healing (especially those that don't require inventory items) will need to be disabled/hidden whenever medical is enabled, but need to be able to be reenabled without a game restart.

As far as I'm aware, nothing of the sort remains in the medical system. The command menu is, as far as I can tell, not possible to edit the way we'd need to.

if !(GETEGVAR(medical,enabled,false)) exitWith {
// Call manually (see CfgFunctions.hpp)
// https://community.bistudio.com/wiki/Arma_3:_Functions_Library#Config_Levels
["postInit", didJIP] spawn BIS_fnc_reviveInit;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Won't this break SOG/Endgame/whatever?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know, it's something to investigate. SOG doesn't seem to set the function to not run in postInit, but it might do something somewhere else.
As it is, it's probably a bad idea, so definitely will need to find a better solution.

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