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

Hit Reactions - Add weapon dropping on arm hit #9539

Merged
merged 95 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
e956401
Create fnc_checkWeaponDrop.sqf
SpicyBagpipes Oct 19, 2023
3e82dbe
Update fnc_checkWeaponDrop.sqf
SpicyBagpipes Oct 19, 2023
ff791e8
Create XEH_postInit.sqf
SpicyBagpipes Oct 19, 2023
bbd0425
Update XEH_postInit.sqf
SpicyBagpipes Oct 19, 2023
d17fbab
Update XEH_postInit.sqf
SpicyBagpipes Oct 19, 2023
6672cae
Update fnc_checkWeaponDrop.sqf
SpicyBagpipes Oct 19, 2023
25d7efc
fix spelling issue
SpicyBagpipes Oct 19, 2023
6eef8de
Update initSettings.sqf
SpicyBagpipes Oct 19, 2023
23aaef0
Update stringtable.xml
SpicyBagpipes Oct 19, 2023
94862e5
Update fnc_checkWeaponDrop.sqf
SpicyBagpipes Oct 19, 2023
cfed434
Update initSettings.sqf
SpicyBagpipes Oct 19, 2023
5b8549b
Add weapon drop chance setting
SpicyBagpipes Oct 19, 2023
ae7dafc
Update XEH_postInit.sqf
SpicyBagpipes Oct 19, 2023
e52e3da
Update CfgEventHandlers.hpp
SpicyBagpipes Oct 19, 2023
816ca8b
Update XEH_PREP.hpp
SpicyBagpipes Oct 19, 2023
adbe1e4
Update stringtable.xml
SpicyBagpipes Oct 19, 2023
5e144fb
Update initSettings.sqf
SpicyBagpipes Oct 19, 2023
523ca8f
Update XEH_postInit.sqf
SpicyBagpipes Oct 19, 2023
bdb061c
Update initSettings.sqf
SpicyBagpipes Oct 19, 2023
d65d102
Update stringtable.xml
SpicyBagpipes Oct 19, 2023
bb451d5
Update XEH_postInit.sqf
SpicyBagpipes Oct 19, 2023
375a6ca
add arm hit chance
SpicyBagpipes Oct 19, 2023
98dae26
Update stringtable.xml
SpicyBagpipes Oct 19, 2023
d625edf
Update addons/hitreactions/functions/fnc_checkWeaponDrop.sqf
SpicyBagpipes Oct 19, 2023
7a9a857
Update addons/hitreactions/functions/fnc_checkWeaponDrop.sqf
SpicyBagpipes Oct 19, 2023
21a1dc2
appearance stuff
SpicyBagpipes Oct 19, 2023
d565544
Merge branch 'weapondropping' of https://github.com/SpicyBagpipes/ACE…
SpicyBagpipes Oct 19, 2023
477f8f6
Update addons/hitreactions/initSettings.sqf
SpicyBagpipes Oct 19, 2023
6f8bb00
Update addons/hitreactions/functions/fnc_checkWeaponDrop.sqf
SpicyBagpipes Oct 19, 2023
dcb0cf1
kjw's poor arithmetic
SpicyBagpipes Oct 19, 2023
17c2213
Update fnc_checkWeaponDrop.sqf
SpicyBagpipes Oct 20, 2023
14028a2
remove systemchat debug
SpicyBagpipes Oct 20, 2023
840c043
Update fnc_checkWeaponDrop.sqf
SpicyBagpipes Oct 20, 2023
6b18a9f
Merge branch 'acemod:master' into weapondropping
SpicyBagpipes Oct 20, 2023
e6447c9
Update XEH_postInit.sqf
SpicyBagpipes Oct 20, 2023
ea0698d
Update fnc_checkWeaponDrop.sqf
SpicyBagpipes Oct 20, 2023
dbf40b9
Merge branch 'acemod:master' into weapondropping
SpicyBagpipes Oct 20, 2023
e935308
Merge branch 'weapondropping' of https://github.com/SpicyBagpipes/ACE…
SpicyBagpipes Oct 20, 2023
4fcc152
Early exit, wait for clear
SpicyBagpipes Oct 20, 2023
dcd69dd
Merge branch 'acemod:master' into weapondropping
SpicyBagpipes Oct 21, 2023
e4b74af
Make default setting 0
SpicyBagpipes Oct 21, 2023
371ed19
Merge branch 'acemod:master' into weapondropping
SpicyBagpipes Oct 26, 2023
6d91309
Update script_component.hpp
SpicyBagpipes Oct 26, 2023
46877eb
Update XEH_postInit.sqf
SpicyBagpipes Oct 26, 2023
2dc4d44
Update script_component.hpp
SpicyBagpipes Oct 26, 2023
4d32294
Merge branch 'acemod:master' into weapondropping
SpicyBagpipes Oct 26, 2023
1257723
Update XEH_postInit.sqf
SpicyBagpipes Oct 26, 2023
db18064
Update XEH_postInit.sqf
SpicyBagpipes Oct 26, 2023
1cd79d9
Update addons/hitreactions/functions/fnc_checkWeaponDrop.sqf
LinkIsGrim Oct 26, 2023
9b86655
Merge branch 'acemod:master' into weapondropping
SpicyBagpipes Oct 26, 2023
cf7550c
Update XEH_postInit.sqf
SpicyBagpipes Oct 26, 2023
797baeb
Update XEH_preInit.sqf
SpicyBagpipes Oct 26, 2023
9061e0d
Update fnc_checkWeaponDrop.sqf
SpicyBagpipes Oct 26, 2023
d3b47b9
Update addons/hitreactions/XEH_preInit.sqf
SpicyBagpipes Oct 29, 2023
587c394
Merge branch 'acemod:master' into weapondropping
SpicyBagpipes Oct 30, 2023
47791a1
Merge branch 'acemod:master' into weapondropping
SpicyBagpipes Nov 5, 2023
5f0ae2f
Update hitreactions.md
SpicyBagpipes Nov 5, 2023
b65834c
Merge branch 'acemod:master' into weapondropping
SpicyBagpipes Nov 6, 2023
4f303cc
Update hitreactions.md
SpicyBagpipes Nov 6, 2023
6077c63
Merge branch 'acemod:master' into weapondropping
SpicyBagpipes Nov 7, 2023
c2afe43
Update addons/hitreactions/functions/fnc_checkWeaponDrop.sqf
SpicyBagpipes Nov 10, 2023
1f9a7ab
Update addons/hitreactions/functions/fnc_checkWeaponDrop.sqf
SpicyBagpipes Nov 10, 2023
50f22e7
Merge branch 'acemod:master' into weapondropping
SpicyBagpipes Nov 10, 2023
ffc70ac
Update addons/hitreactions/initSettings.sqf
LinkIsGrim Nov 11, 2023
3a31c0b
Merge branch 'acemod:master' into weapondropping
SpicyBagpipes Nov 11, 2023
2a54f40
Update XEH_postInit.sqf
SpicyBagpipes Nov 11, 2023
677d5da
Update addons/hitreactions/XEH_postInit.sqf
SpicyBagpipes Nov 11, 2023
3301d4b
Update addons/hitreactions/XEH_postInit.sqf
SpicyBagpipes Nov 11, 2023
500f663
Update addons/hitreactions/functions/fnc_checkWeaponDrop.sqf
SpicyBagpipes Nov 11, 2023
bfbbda1
Update addons/hitreactions/functions/fnc_checkWeaponDrop.sqf
SpicyBagpipes Nov 11, 2023
12411fa
Update XEH_postInit.sqf
SpicyBagpipes Nov 11, 2023
38a0b12
Update XEH_postInit.sqf
SpicyBagpipes Nov 11, 2023
0c6366c
Update fnc_checkWeaponDrop.sqf
SpicyBagpipes Nov 11, 2023
30847ed
Spacing fixes
johnb432 Nov 11, 2023
3086c84
Update addons/hitreactions/XEH_postInit.sqf
SpicyBagpipes Mar 26, 2024
e2b616b
Merge branch 'master' into pr/9539
SpicyBagpipes Mar 26, 2024
b2815c7
Take _hitEntity into account if exists
SpicyBagpipes Mar 26, 2024
f0172c3
Update fnc_checkWeaponDrop.sqf
SpicyBagpipes Mar 26, 2024
e875c46
Minor component cleanup
johnb432 Apr 1, 2024
a22264f
Removed gun hits, added double hit detection
johnb432 Apr 1, 2024
acba3d7
Decouple AI and player probabilities
SpicyBagpipes Apr 1, 2024
0e5de88
Tweaks and fixes
johnb432 Apr 1, 2024
2c81ee7
Update XEH_PREP.hpp
johnb432 Apr 2, 2024
c7b5299
Add missing param
johnb432 May 29, 2024
8e0e0c6
Merge branch 'master' into pr/9539
johnb432 May 29, 2024
0209029
Fixed bugged state AI are in after using TakeWeapon
johnb432 May 29, 2024
f23c3b1
Fixes and cleanup
johnb432 May 29, 2024
039e061
Made API clear, moved undroppable to config entry
johnb432 May 29, 2024
6617010
Update fnc_checkWeaponDrop.sqf
johnb432 May 29, 2024
fa8b707
Check for Zeus RC and avoid `setUnitLoadout`
johnb432 Jun 1, 2024
768a84e
Expand `addWeapon`'s capabilities
johnb432 Jun 1, 2024
de8b7f0
Cleaned up `addWeapon`
johnb432 Jun 1, 2024
55c468a
Removed weapon replacement as it's apparently not necessary
johnb432 Jun 1, 2024
7670840
Defined undefined variable
johnb432 Jun 1, 2024
0a4c56b
Merge branch 'master' into pr/9539
johnb432 Jun 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions addons/hitreactions/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
#include "script_component.hpp"

GVAR(armComponents) = [
"leftshoulder",
"rightshoulder",
"lefthand",
"leftforearm",
"leftarmroll",
"rightforearm",
"rightarmroll",
"righthand",
"rightarm"
];

["ace_firedNonPlayer", {
SpicyBagpipes marked this conversation as resolved.
Show resolved Hide resolved
params ["", "", "", "", "", "", "_projectile"];
private _willDrop = (random 1) > GVAR(weaponDropChanceGunHit);
if (!_willDrop) exitWith {};
private _willDropGun = (random 1) > GVAR(weaponDropChanceGunHit);
private _willDropArm = (random 1) > GVAR(weaponDropChanceArmHit);
if (!(_willDropGun && _willDropArm)) exitWith {};
SpicyBagpipes marked this conversation as resolved.
Show resolved Hide resolved
_projectile addEventHandler ["HitPart", {
params ["_projectile", "_hitEntity", "_projectileOwner", "_pos", "_velocity", "_normal", "_components", "_radius" ,"_surfaceType"];
[_surfaceType, _components, _pos] call FUNC(checkWeaponDrop);
Expand All @@ -12,8 +25,9 @@

["ace_firedPlayer", {
params ["", "", "", "", "", "", "_projectile"];
private _willDrop = (random 1) > GVAR(weaponDropChanceGunHit);
if (!_willDrop) exitWith {};
private _willDropGun = (random 1) > GVAR(weaponDropChanceGunHit);
private _willDropArm = (random 1) > GVAR(weaponDropChanceArmHit);
if (!(_willDropGun && _willDropArm)) exitWith {};
SpicyBagpipes marked this conversation as resolved.
Show resolved Hide resolved
_projectile addEventHandler ["HitPart", {
params ["_projectile", "_hitEntity", "_projectileOwner", "_pos", "_velocity", "_normal", "_components", "_radius" ,"_surfaceType"];
[_surfaceType, _components, _pos] call FUNC(checkWeaponDrop);
Expand Down
6 changes: 4 additions & 2 deletions addons/hitreactions/functions/fnc_checkWeaponDrop.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@

params ["_surfaceType", "_components", "_position"];

if (!(_surfaceType isEqualTo "" && _components isEqualTo [])) exitWith {}; // Could be potential for edge cases here however couldn't find any from testing.
if (!(_surfaceType isEqualTo "" && _components findAny GVAR(armComponents) isEqualTo -1)) exitWith {}; // Could be potential for edge cases here however couldn't find any from testing.

private _unit = nearestObject [_pos, "CAManBase"];
SpicyBagpipes marked this conversation as resolved.
Show resolved Hide resolved
private _weapon = currentWeapon _unit;

if (_weapon in GVAR(undroppableGuns)) exitWith {};
SpicyBagpipes marked this conversation as resolved.
Show resolved Hide resolved
private _unit = nearestObject [_pos, "CAManBase"];

private _thrownGun = _unit call ace_common_fnc_throwWeapon;
SpicyBagpipes marked this conversation as resolved.
Show resolved Hide resolved
[
{
Expand Down
8 changes: 8 additions & 0 deletions addons/hitreactions/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,11 @@ private _category = [LELSTRING(common,categoryUncategorized), QUOTE(COMPONENT_BE
[0, 1, 0.5, 1],
SpicyBagpipes marked this conversation as resolved.
Show resolved Hide resolved
1
] call CBA_fnc_addSetting;

[
QGVAR(weaponDropChanceArmHit), "SLIDER",
LSTRING(weaponDropChanceArmHit_displayName),
_category,
[0, 1, 0.5, 1],
SpicyBagpipes marked this conversation as resolved.
Show resolved Hide resolved
1
] call CBA_fnc_addSetting;
SpicyBagpipes marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions addons/hitreactions/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@
<Key ID="STR_ACE_HitReactions_weaponDropChanceGunHit_displayName">
<English>Chance of Weapon Drop on Gun Hit. 0 to disable.</English>
SpicyBagpipes marked this conversation as resolved.
Show resolved Hide resolved
</Key>
<Key ID="STR_ACE_HitReactions_weaponDropChanceArmHit_displayName">
<English>Chance of Weapon Drop on Arm Hit. 0 to disable.</English>
SpicyBagpipes marked this conversation as resolved.
Show resolved Hide resolved
</Key>
</Package>
</Project>