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

Captives - Blindfold captive units #9361

Merged
merged 15 commits into from Sep 24, 2023

Conversation

mrschick
Copy link
Contributor

@mrschick mrschick commented Sep 4, 2023

When merged this pull request will:

  • Add an interaction that puts a Contact DLC blindfold from one's own inventory onto a captive unit;
  • If the captive unit already has some form of goggles on they will be preserved by being moved to the capturer's inventory before being replaced with a blindfold;

@PabstMirror
Copy link
Contributor

PabstMirror commented Sep 4, 2023

ace_goggles_effects is a user setting
we could make this only show if setting is forced on by mission/server
or just always show and know that it might not have any real effect

@mrschick
Copy link
Contributor Author

mrschick commented Sep 4, 2023

I guess showing it only when the setting is forced would cause it to not work on most servers, since I doubt many communities force that setting or would start doing so in response to this feature.
IMO it's best to always show it and accept that it won't have an effect if users disable their goggle effects, which I guess very few would do anyway.

addons/captives/functions/fnc_canBlindfoldCaptive.sqf Outdated Show resolved Hide resolved
addons/captives/functions/fnc_canBlindfoldCaptive.sqf Outdated Show resolved Hide resolved
addons/captives/functions/fnc_canBlindfoldCaptive.sqf Outdated Show resolved Hide resolved
addons/captives/functions/fnc_canBlindfoldCaptive.sqf Outdated Show resolved Hide resolved
addons/captives/functions/fnc_canBlindfoldCaptive.sqf Outdated Show resolved Hide resolved
addons/captives/functions/fnc_canEscortCaptive.sqf Outdated Show resolved Hide resolved
addons/captives/functions/fnc_doBlindfoldCaptive.sqf Outdated Show resolved Hide resolved
addons/captives/stringtable.xml Outdated Show resolved Hide resolved
if the capturer's inventory cannot contain the captive's goggles, move them to the captive's inventory, if that also can't fit them, drop them on the ground.
I speak German and Italian fluently and can also infer the proper sentence structure and conjugations in French/Spanish/Portuguese, the other eastern languages are completely foreign to me though and I have to trust Google/DeepL.
@PabstMirror
Copy link
Contributor

I don't like the user text box setting for classes
I think it's going to be confusing for most mission makers
have to worry about capitilization

I would rather just goto a config based lookup with e724b3e

@johnb432
Copy link
Contributor

johnb432 commented Sep 6, 2023

I don't like the user text box setting for classes I think it's going to be confusing for most mission makers have to worry about capitilization

I would rather just goto a config based lookup with e724b3e

We can easily convert to config case, but I agree - such a setting is not necessary imo.

@mrschick
Copy link
Contributor Author

mrschick commented Sep 7, 2023

I don't like the user text box setting for classes I think it's going to be confusing for most mission makers have to worry about capitilization

I would rather just goto a config based lookup with e724b3e

When you wrote "make this config based?" I first assumed you meant CBA Settings, wasn't familiar enough with config overriding to make the correct connection.
IMO it's not really confusing, also takes control over what is a blindfold away from the mission designer and gives it exclusively to modders.
Though I can see how, security risks considered, it's ultimately the cleanest option. I'll just copy your implementation 👍🏻

@mrschick
Copy link
Contributor Author

mrschick commented Sep 7, 2023

I implemented @PabstMirror's changes, everything seems to work as intended except for the item dropping if neither inventory can hold the captive's previous goggles, not yet sure what broke it 🤔

@Mike-MF
Copy link
Member

Mike-MF commented Sep 7, 2023

Additionally during testing, I blindfolded a captive yet canBlindfoldCaptive returns true. I can essentially just keep switching out blindfolds over and over.

@johnb432
Copy link
Contributor

johnb432 commented Sep 7, 2023

I implemented @PabstMirror's changes, everything seems to work as intended except for the item dropping if neither inventory can hold the captive's previous goggles, not yet sure what broke it 🤔

Because CBA_fnc_dropItem can only drop items that are within a unit's inventory, of which goggles aren't part of.

Copy link
Contributor

@johnb432 johnb432 left a comment

Choose a reason for hiding this comment

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

My suggestion includes some minor formatting changes and fixes (such as item dropping on ground if inventories are full). However, also included is an action allowing the removal of blindfolds on captive units.


If my suggestion is accepted, the following function would still need to be added in its own file:

#include "script_component.hpp"
/*
 * Author: johnb43
 * Checks if caller can remove blindfold from the captive.
 *
 * Arguments:
 * 0: Caller (player) <OBJECT>
 * 1: Target <OBJECT>
 *
 * Return Value:
 * Can remove blindfold <BOOL>
 *
 * Example:
 * [player, cursorTarget] call ace_captives_fnc_canRemoveBlindfoldCaptive
 *
 * Public: No
 */

params ["_unit", "_target"];

// Alive, handcuffed, not being escorted, and target is wearing a blindfold
(_target getVariable [QGVAR(isHandcuffed), false]) &&
{isNull (attachedTo _target)} &&
{alive _target} &&
{isNull objectParent _unit} &&
{isNull objectParent _target} &&
{(goggles _target) in GVAR(blindfolds)}

addons/captives/CfgVehicles.hpp Outdated Show resolved Hide resolved
addons/captives/CfgVehicles.hpp Show resolved Hide resolved
addons/captives/functions/fnc_canBlindfoldCaptive.sqf Outdated Show resolved Hide resolved
addons/captives/functions/fnc_canBlindfoldCaptive.sqf Outdated Show resolved Hide resolved
addons/captives/functions/fnc_doBlindfoldCaptive.sqf Outdated Show resolved Hide resolved
addons/captives/XEH_PREP.hpp Show resolved Hide resolved
addons/captives/stringtable.xml Show resolved Hide resolved
@mrschick
Copy link
Contributor Author

mrschick commented Sep 7, 2023

Because CBA_fnc_dropItem can only drop items that are within a unit's inventory, of which goggles aren't part of.

That's what I thought too, but it worked without issues 2 days ago, with the drop animation and everything.

@mrschick
Copy link
Contributor Author

mrschick commented Sep 7, 2023

Additionally during testing, I blindfolded a captive yet canBlindfoldCaptive returns true. I can essentially just keep switching out blindfolds over and over.

True, I guess that could be avoided by also checking if the captive already has a blindfold on.

@jonpas jonpas added the kind/feature Release Notes: **ADDED:** label Sep 7, 2023
@johnb432
Copy link
Contributor

johnb432 commented Sep 8, 2023

True, I guess that could be avoided by also checking if the captive already has a blindfold on.

This suggestion implements that exactly:
#9361 (comment)

mrschick and others added 2 commits September 9, 2023 16:39
Co-Authored-By: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-Authored-By: johnb432 <58661205+johnb432@users.noreply.github.com>
@mrschick
Copy link
Contributor Author

mrschick commented Sep 9, 2023

My suggestion includes some minor formatting changes and fixes (such as item dropping on ground if inventories are full). However, also included is an action allowing the removal of blindfolds on captive units.

@johnb432 Didn't see the need for a "remove blindfold" interaction initially because it can be removed almost as quickly by accessing the captive's inventory. Will gladly implement your provided code though, since it's a quicker way to retain blindfolds when freeing captives.

Changed the formatting of fnc_doBlindfoldCaptive.sqf around a bit to be more in line with other functions, especially the original can/doEscortCaptive. Tested and everything works as intended, there was just a tiny oversight where the blindfold wasn't removed from _target after dropping it to the ground 👍🏻

My suggestion can probably be optimised, as some of the code is identical.

True, though I don't think this is critical enough to require its own function, maybe it can be done outside the if/else. Alternatively there might be some combination of vanilla functions to move the goggles to inventory and drop them with the CBA function, will try some things out.

mrschick and others added 2 commits September 9, 2023 19:12
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Copy link
Contributor

@LinkIsGrim LinkIsGrim left a comment

Choose a reason for hiding this comment

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

I think we can allow blindfolding in vehicles in a follow-up PR.

@LinkIsGrim LinkIsGrim added this to the 3.16.0 milestone Sep 24, 2023
@LinkIsGrim LinkIsGrim changed the title Captives - Add interaction to blindfold a captive unit using Contact DLC blindfolds Captives - Blindfold captive units Sep 24, 2023
@LinkIsGrim LinkIsGrim merged commit 11bc269 into acemod:master Sep 24, 2023
5 checks passed
@rautamiekka
Copy link
Contributor

I think we can allow blindfolding in vehicles in a follow-up PR.

I don't see why it shouldn't be, sounds like a totally arbitrary restriction.

Hell, it would allow for transportation of ppl in an enclosed vehicle and blindfold them before disembarking if you didn't remember to do it before heading out.

@mrschick
Copy link
Contributor Author

Agreed, could have been done in this PR even.

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
Development

Successfully merging this pull request may close these issues.

None yet

7 participants