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

Safemode - add public setWeaponSafety function #7092

Merged
merged 14 commits into from
Oct 8, 2019

Conversation

AndreasBrostrom
Copy link
Contributor

@AndreasBrostrom AndreasBrostrom commented Jul 6, 2019

When merged this pull request will:

  • Added safeWeapon function allowing the weapon to be set on safe if it is not.

A tiny function i use to set people's weapons on safe at spawn and respawn. So here is a little donation.

@Dystopian
Copy link
Contributor

maybe this function should get true/false parameter and lock/unlock accordingly?

@AndreasBrostrom
Copy link
Contributor Author

Like that idea two
I make sure to add that to the function as well.

@AndreasBrostrom
Copy link
Contributor Author

Note: Not tested cause I'm on traveling foot.

Can be checked code wise anyways. if the solution for the bool param is agreeable.

@AndreasBrostrom
Copy link
Contributor Author

All done

@commy2 commy2 added the kind/feature Release Notes: **ADDED:** label Jul 15, 2019
@commy2 commy2 added this to the 3.13.0 milestone Jul 15, 2019
@commy2 commy2 self-assigned this Jul 15, 2019
@commy2
Copy link
Contributor

commy2 commented Jul 15, 2019

  • Should the function be named setWeaponSafety?
  • There is no reason for the user not to set muzzle to currentMuzzle _unit, therefore I think this should not be argument of the function, but just a variable set to currentMuzzle _unit.

@AndreasBrostrom
Copy link
Contributor Author

  • Should the function be named setWeaponSafety?

Yes agree.

  • There is no reason for the user not to set muzzle to currentMuzzle _unit, therefore I think this should not be argument of the function, but just a variable set to currentMuzzle _unit.

Agree with this two.
Added it cause it was in the other function.

@commy2
Copy link
Contributor

commy2 commented Jul 15, 2019

For the internal function it is used to switch back to the last muzzle. It is needed, because you can turn off safety with F. Otherwise it would switch to the primary muzzle from the secondary muzzle for example in addition to unlocking the weapon, which feels weird. Not needed for this public function though.

@commy2
Copy link
Contributor

commy2 commented Jul 15, 2019

_weapon should be kept as argument. _muzzle cannot be converted to config case like this, and it is not needed, because currentMuzzle reports config case already.

@AndreasBrostrom
Copy link
Contributor Author

Test in progress

AndreasBrostrom and others added 2 commits July 16, 2019 23:21
Co-Authored-By: commy2 <commy-2@gmx.de>
Co-Authored-By: commy2 <commy-2@gmx.de>
@AndreasBrostrom
Copy link
Contributor Author

Tested and did some final fixes to the script.

Testprotocol:

  • Line used [player, currentWeapon player, true] call ace_safemode_fnc_setWeaponSafety & [player, currentWeapon player, false] call ace_safemode_fnc_setWeaponSafety
  • Tested manually applied function via debug menu
  • Tested trigger set and unset safemode.

@veteran29
Copy link
Member

veteran29 commented Aug 31, 2019

If this function is used for something like eg. "safestart" (locking the weapon on game start) and the unit does not have weapon it will try to lock "empty" weapon.

Maybe it would be wise to add:
if (_weapon == "") exitWith {};

Unsafing the "empty" weapon results in an error .

Co-Authored-By: Filip Maciejewski <veteran29@users.noreply.github.com>
@PabstMirror PabstMirror changed the title Safeweapon Safemode - add public setWeaponSafety function Oct 8, 2019
@PabstMirror PabstMirror merged commit b514541 into acemod:master Oct 8, 2019
@AndreasBrostrom AndreasBrostrom deleted the safeweapon branch November 25, 2019 21:16
@PabstMirror PabstMirror modified the milestones: 3.13.0, 3.13.0-temp2 Dec 30, 2019
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.

6 participants