mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'master' of https://github.com/acemod/ACE3 into 340weaponselectcleanup
This commit is contained in:
commit
e3b926296f
@ -1,3 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
["backpackOpened", DFUNC(backpackOpened)] call EFUNC(common,addEventHandler);
|
||||
["backpackOpened", {_this call FUNC(backpackOpened)}] call EFUNC(common,addEventHandler);
|
||||
|
@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Someone opened your backpack. Play sound and camshake. Execute locally.
|
||||
*
|
||||
* Someone opened your backpack. Execute locally.
|
||||
*
|
||||
* Argument:
|
||||
* Arguments:
|
||||
* 0: Who accessed your inventory? (Object)
|
||||
* 1: Unit that wields the backpack (Object)
|
||||
* 2: The backpack object (Object)
|
||||
*
|
||||
* Return value:
|
||||
* None.
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_sounds", "_position"];
|
||||
|
||||
params ["_target", "_backpack"];
|
||||
|
||||
// do cam shake if the target is the player
|
||||
@ -20,7 +21,8 @@ if ([_target] call EFUNC(common,isPlayer)) then {
|
||||
addCamShake [4, 0.5, 5];
|
||||
};
|
||||
|
||||
// play a rustling sound
|
||||
// play a zipper sound effect
|
||||
private ["_sounds", "_position"];
|
||||
|
||||
_sounds = [
|
||||
/*"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss",
|
||||
@ -32,8 +34,7 @@ _sounds = [
|
||||
QUOTE(PATHTO_R(sounds\zip_out.wav))
|
||||
];
|
||||
|
||||
_position = _target modelToWorldVisual (_target selectionPosition "Spine3");
|
||||
_position = _position call EFUNC(common,positionToASL);
|
||||
_position = AGLToASL (_target modelToWorldVisual (_target selectionPosition "Spine3"));
|
||||
|
||||
playSound3D [
|
||||
_sounds select floor random count _sounds,
|
||||
|
@ -1,23 +1,24 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Check if the given backpack is an actual backpack that can store items. Parachute, static weapon packs, etc. will return false.
|
||||
*
|
||||
* Check if the given backpack is an actual backpack that can store items. Parachute backpacks will return false for example.
|
||||
* Arguments:
|
||||
* 0: Backpack <OBJECT, STRING>
|
||||
*
|
||||
* Argument:
|
||||
* 0: A backpack (Object or String)
|
||||
* Return Value:
|
||||
* Boolean <BOOL>
|
||||
*
|
||||
* Return value:
|
||||
* Boolean (Bool)
|
||||
* Public: Yes
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_config"];
|
||||
params ["_backpack"];
|
||||
|
||||
if (typeName _backpack == "OBJECT") then {
|
||||
_backpack = typeOf _backpack;
|
||||
};
|
||||
|
||||
private "_config";
|
||||
_config = configFile >> "CfgVehicles" >> _backpack;
|
||||
|
||||
getText (_config >> "vehicleClass") == "backpacks" && {getNumber (_config >> "maximumLoad") > 0}
|
||||
getText (_config >> "vehicleClass") == "backpacks" && {getNumber (_config >> "maximumLoad") > 0} // return
|
||||
|
@ -1,17 +1,19 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Handle the open inventory event. Camshake and sound on target client.
|
||||
*
|
||||
* Handle the open inventory event. Display message on target client.
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Backpack <OBJECT>
|
||||
*
|
||||
* Argument:
|
||||
* Input from "InventoryOpened" eventhandler
|
||||
*
|
||||
* Return value:
|
||||
* Return Value:
|
||||
* false. Always open the inventory dialog. (Bool)
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit","_backpack"];
|
||||
params ["_unit", "_backpack"];
|
||||
|
||||
// exit if the target is not a real backpack, i.e. parachute, static weapon bag etc.
|
||||
if !([_backpack] call FUNC(isBackpack)) exitWith {false};
|
||||
|
@ -6,6 +6,7 @@
|
||||
* 0: Item Classname <STRING>
|
||||
* 1: Vehicle <OBJECT>
|
||||
* 2: Amount <NUMBER> (default: 1)
|
||||
* 3: Show Hint <BOOL> (default: false)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -18,7 +19,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_position", "_item", "_i"];
|
||||
params ["_itemClass", "_vehicle", ["_amount", 1]];
|
||||
params ["_itemClass", "_vehicle", ["_amount", 1], ["_showHint", false, [false]] ];
|
||||
TRACE_3("params",_itemClass,_vehicle,_amount);
|
||||
|
||||
_position = getPos _vehicle;
|
||||
@ -29,12 +30,12 @@ for "_i" from 1 to _amount do {
|
||||
_item = createVehicle [_itemClass, _position, [], 0, "CAN_COLLIDE"];
|
||||
|
||||
// Load item or delete it if no space left
|
||||
if !([_item, _vehicle] call FUNC(loadItem)) exitWith {
|
||||
if !([_item, _vehicle, _showHint] call FUNC(loadItem)) exitWith {
|
||||
TRACE_1("no room to load item - deleting",_item);
|
||||
deleteVehicle _item;
|
||||
};
|
||||
TRACE_1("Item Loaded",_item);
|
||||
|
||||
|
||||
// Invoke listenable event
|
||||
["cargoAddedByClass", [_itemClass, _vehicle, _amount]] call EFUNC(common,globalEvent);
|
||||
};
|
||||
|
@ -5,6 +5,7 @@
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
* 1: Vehicle <OBJECT>
|
||||
* 2: Show Hint <BOOL> (default: true)
|
||||
*
|
||||
* Return value:
|
||||
* Object loaded <BOOL>
|
||||
@ -18,7 +19,7 @@
|
||||
|
||||
private ["_loaded", "_space", "_itemSize"];
|
||||
|
||||
params ["_item", "_vehicle"];
|
||||
params ["_item", "_vehicle", ["_showHint", true, [true]] ];
|
||||
TRACE_2("params",_item,_vehicle);
|
||||
|
||||
if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {
|
||||
@ -46,7 +47,9 @@ private ["_itemName", "_vehicleName"];
|
||||
_itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName");
|
||||
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
|
||||
|
||||
["displayTextStructured", [[localize LSTRING(LoadedItem), _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
|
||||
if (_showHint) then {
|
||||
["displayTextStructured", [[localize LSTRING(LoadedItem), _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
|
||||
};
|
||||
|
||||
// Invoke listenable event
|
||||
["cargoLoaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
|
||||
|
@ -25,7 +25,7 @@ if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {
|
||||
};
|
||||
|
||||
// drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled))
|
||||
if ((!([_target] call EFUNC(common,isAlive))) || {(_unit distance _target) > 10}) then {
|
||||
if (!alive _target || {_unit distance _target > 10}) then {
|
||||
[_unit, _target] call FUNC(dropObject_carry);
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
@ -25,7 +25,7 @@ if !(_unit getVariable [QGVAR(isDragging), false]) exitWith {
|
||||
};
|
||||
|
||||
// drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled))
|
||||
if ((!([_target] call EFUNC(common,isAlive))) || {(_unit distance _target) > 10}) then {
|
||||
if (!alive _target || {_unit distance _target > 10}) then {
|
||||
[_unit, _target] call FUNC(dropObject);
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
@ -26,7 +26,7 @@ if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {
|
||||
};
|
||||
|
||||
// same as dragObjectPFH, checks if object is deleted or dead OR (target moved away from carrier (weapon disasembled))
|
||||
if ((!([_target] call EFUNC(common,isAlive))) || {(_unit distance _target) > 10}) then {
|
||||
if (!alive _target || {_unit distance _target > 10}) then {
|
||||
[_unit, _target] call FUNC(dropObject);
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
@ -26,7 +26,7 @@ if !(_unit getVariable [QGVAR(isDragging), false]) exitWith {
|
||||
};
|
||||
|
||||
// same as dragObjectPFH, checks if object is deleted or dead OR (target moved away from carrier (weapon disasembled))
|
||||
if ((!([_target] call EFUNC(common,isAlive))) || {(_unit distance _target) > 10}) then {
|
||||
if (!alive _target || {_unit distance _target > 10}) then {
|
||||
[_unit, _target] call FUNC(dropObject);
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
class CfgAmmo {
|
||||
class FlareCore;
|
||||
class FlareBase: FlareCore {
|
||||
|
@ -1,19 +1,20 @@
|
||||
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE( call COMPILE_FILE(XEH_preInit) );
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE( call COMPILE_FILE(XEH_postInit) );
|
||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_FiredBIS_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
clientFiredBIS = QUOTE( _this call FUNC(throwGrenade) );
|
||||
firedBIS = QUOTE(_this call FUNC(throwGrenade));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -1,9 +1,6 @@
|
||||
|
||||
class CfgVehicles {
|
||||
class NATO_Box_Base;
|
||||
class EAST_Box_Base;
|
||||
class IND_Box_Base;
|
||||
class Box_NATO_Support_F;
|
||||
|
||||
class Box_NATO_Grenades_F: NATO_Box_Base {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_HandFlare_White,12);
|
||||
@ -12,6 +9,7 @@ class CfgVehicles {
|
||||
};
|
||||
};
|
||||
|
||||
class EAST_Box_Base;
|
||||
class Box_East_Grenades_F: EAST_Box_Base {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_HandFlare_Yellow,12);
|
||||
@ -20,6 +18,7 @@ class CfgVehicles {
|
||||
};
|
||||
};
|
||||
|
||||
class IND_Box_Base;
|
||||
class Box_IND_Grenades_F: IND_Box_Base {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_HandFlare_Yellow,12);
|
||||
@ -28,6 +27,7 @@ class CfgVehicles {
|
||||
};
|
||||
};
|
||||
|
||||
class Box_NATO_Support_F;
|
||||
class ACE_Box_Misc: Box_NATO_Support_F {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_HandFlare_White,12);
|
||||
|
@ -1,21 +1,26 @@
|
||||
|
||||
class CfgWeapons {
|
||||
class GrenadeLauncher;
|
||||
|
||||
class Throw: GrenadeLauncher {
|
||||
muzzles[] += {"ACE_HandFlare_WhiteMuzzle", "ACE_HandFlare_RedMuzzle", "ACE_HandFlare_GreenMuzzle", "ACE_HandFlare_YellowMuzzle", "ACE_M84Muzzle"};
|
||||
muzzles[] += {"ACE_HandFlare_WhiteMuzzle","ACE_HandFlare_RedMuzzle","ACE_HandFlare_GreenMuzzle","ACE_HandFlare_YellowMuzzle","ACE_M84Muzzle"};
|
||||
|
||||
class ThrowMuzzle;
|
||||
class ACE_HandFlare_WhiteMuzzle: ThrowMuzzle {
|
||||
magazines[] = {"ACE_HandFlare_White"};
|
||||
};
|
||||
|
||||
class ACE_HandFlare_RedMuzzle: ThrowMuzzle {
|
||||
magazines[] = {"ACE_HandFlare_Red"};
|
||||
};
|
||||
|
||||
class ACE_HandFlare_GreenMuzzle: ThrowMuzzle {
|
||||
magazines[] = {"ACE_HandFlare_Green"};
|
||||
};
|
||||
|
||||
class ACE_HandFlare_YellowMuzzle: ThrowMuzzle {
|
||||
magazines[] = {"ACE_HandFlare_Yellow"};
|
||||
};
|
||||
|
||||
class ACE_M84Muzzle: ThrowMuzzle {
|
||||
magazines[] = {"ACE_M84"};
|
||||
};
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
["flashbangExplosion", DFUNC(flashbangExplosionEH)] call EFUNC(common,addEventHandler);
|
||||
["flashbangExplosion", {_this call FUNC(flashbangExplosionEH)}] call EFUNC(common,addEventHandler);
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
@ -21,4 +21,4 @@ GVAR(flashbangPPEffectCC) ppEffectForceInNVG true;
|
||||
[] call FUNC(nextMode);
|
||||
},
|
||||
{false},
|
||||
[9, [false, false, false]], false] call cba_fnc_addKeybind; //8 Key
|
||||
[9, [false, false, false]], false] call CBA_fnc_addKeybind; //8 Key
|
||||
|
@ -15,13 +15,14 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_affected", "_strength", "_posGrenade", "_angleDiff", "_light", "_losCount", "_dirToUnitVector", "_eyeDir", "_eyePos"];
|
||||
params ["_grenade"];
|
||||
|
||||
private ["_affected", "_strength", "_posGrenade", "_eyePos", "_losCount", "_eyeDir", "_dirToUnitVector", "_angleDiff", "_light"];
|
||||
|
||||
_affected = _grenade nearEntities ["CAManBase", 20];
|
||||
|
||||
{
|
||||
if ((local _x) && {alive _x}) then {
|
||||
if (local _x && {alive _x}) then {
|
||||
|
||||
_strength = 1 - ((_x distance _grenade) min 15) / 15;
|
||||
|
||||
@ -30,16 +31,19 @@ _affected = _grenade nearEntities ["CAManBase", 20];
|
||||
if (_x != ACE_player) then {
|
||||
//must be AI
|
||||
[_x, true] call EFUNC(common,disableAI);
|
||||
_x setSkill ((skill _x) / 50);
|
||||
|
||||
_x setSkill (skill _x / 50);
|
||||
|
||||
[{
|
||||
params ["_unit"];
|
||||
|
||||
//Make sure we don't enable AI for unconscious units
|
||||
if (!(_unit getVariable ["ace_isunconscious", false])) then {
|
||||
if !(_unit getVariable ["ace_isUnconscious", false]) then {
|
||||
[_unit, false] call EFUNC(common,disableAI);
|
||||
};
|
||||
|
||||
_unit setSkill (skill _unit * 50);
|
||||
}, [_x], (7 * _strength)] call EFUNC(common,waitAndExecute);
|
||||
}, [_x], 7 * _strength] call EFUNC(common,waitAndExecute);
|
||||
} else {
|
||||
//Do effects for player
|
||||
// is there line of sight to the grenade?
|
||||
@ -49,7 +53,7 @@ _affected = _grenade nearEntities ["CAManBase", 20];
|
||||
|
||||
//Check for line of sight (check 4 points in case grenade is stuck in an object or underground)
|
||||
_losCount = {
|
||||
(!lineIntersects [(_posGrenade vectorAdd _x), _eyePos, _grenade, ACE_player])
|
||||
!lineIntersects [_posGrenade vectorAdd _x, _eyePos, _grenade, ACE_player]
|
||||
} count [[0,0,0], [0,0,0.2], [0.1, 0.1, 0.1], [-0.1, -0.1, 0.1]];
|
||||
|
||||
TRACE_1("Line of sight count (out of 4)",_losCount);
|
||||
@ -57,9 +61,9 @@ _affected = _grenade nearEntities ["CAManBase", 20];
|
||||
_strength = _strength / 10;
|
||||
};
|
||||
|
||||
//Add ace_hearing ear ringing sound effect
|
||||
if ((isClass (configFile >> "CfgPatches" >> "ACE_Hearing")) && {_strength > 0}) then {
|
||||
[_x, (20 * _strength)] call EFUNC(hearing,earRinging);
|
||||
// add ace_hearing ear ringing sound effect
|
||||
if (isClass (configFile >> "CfgPatches" >> "ACE_Hearing") && {_strength > 0}) then {
|
||||
[_x, 20 * _strength] call EFUNC(hearing,earRinging);
|
||||
};
|
||||
|
||||
// account for people looking away by slightly
|
||||
@ -68,16 +72,16 @@ _affected = _grenade nearEntities ["CAManBase", 20];
|
||||
_dirToUnitVector = _eyePos vectorFromTo _posGrenade;
|
||||
_angleDiff = acos (_eyeDir vectorDotProduct _dirToUnitVector);
|
||||
|
||||
//From 0-45deg, full effect
|
||||
// from 0-45deg, full effect
|
||||
if (_angleDiff > 45) then {
|
||||
_strength = _strength - _strength * ((_angleDiff - 45) / 120);
|
||||
};
|
||||
|
||||
TRACE_1("Final strength for player",_strength);
|
||||
|
||||
//Add ace_medical pain effect:
|
||||
if ((isClass (configFile >> "CfgPatches" >> "ACE_Medical")) && {_strength > 0.1}) then {
|
||||
[ACE_player, (_strength / 2)] call EFUNC(medical,adjustPainLevel);
|
||||
// add ace_medical pain effect:
|
||||
if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {_strength > 0.1}) then {
|
||||
[ACE_player, _strength / 2] call EFUNC(medical,adjustPainLevel);
|
||||
};
|
||||
|
||||
// create flash to illuminate environment
|
||||
@ -87,14 +91,14 @@ _affected = _grenade nearEntities ["CAManBase", 20];
|
||||
_light setLightColor [1,1,1];
|
||||
_light setLightDayLight true;
|
||||
|
||||
//Delete the light after 0.1 seconds
|
||||
// delete the light after 0.1 seconds
|
||||
[{
|
||||
params ["_light"];
|
||||
deleteVehicle _light;
|
||||
}, [_light], 0.1] call EFUNC(common,waitAndExecute);
|
||||
|
||||
// blind player
|
||||
if (_strength > 0.1 && hasInterface) then {
|
||||
if (hasInterface && {_strength > 0.1}) then {
|
||||
GVAR(flashbangPPEffectCC) ppEffectEnable true;
|
||||
GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,(0.8 + _strength) min 1,[1,1,1,0],[0,0,0,1],[0,0,0,0]];
|
||||
GVAR(flashbangPPEffectCC) ppEffectCommit 0.01;
|
||||
@ -102,14 +106,15 @@ _affected = _grenade nearEntities ["CAManBase", 20];
|
||||
//PARTIALRECOVERY - start decreasing effect over ACE_time
|
||||
[{
|
||||
params ["_strength"];
|
||||
|
||||
GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]];
|
||||
GVAR(flashbangPPEffectCC) ppEffectCommit (10 * _strength);
|
||||
}, [_strength], (7 * _strength), 0] call EFUNC(common,waitAndExecute);
|
||||
}, [_strength], 7 * _strength] call EFUNC(common,waitAndExecute);
|
||||
|
||||
//FULLRECOVERY - end effect
|
||||
[{
|
||||
GVAR(flashbangPPEffectCC) ppEffectEnable false;
|
||||
}, [], (17 * _strength)] call EFUNC(common,waitAndExecute);
|
||||
}, [], 17 * _strength] call EFUNC(common,waitAndExecute);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -14,6 +14,7 @@
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_projectile"];
|
||||
|
||||
if (alive _projectile) then {
|
||||
@ -21,5 +22,6 @@ if (alive _projectile) then {
|
||||
|
||||
private "_affected";
|
||||
_affected = _projectile nearEntities ["CAManBase", 50];
|
||||
|
||||
["flashbangExplosion", _affected, [_projectile]] call EFUNC(common,targetEvent);
|
||||
};
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
class ACE_Settings {
|
||||
class GVAR(minDamageToTrigger) {
|
||||
//Minimum mamage needed to trigger falling down while moving. Set to -1 to disable completely.
|
||||
|
@ -1,39 +1,52 @@
|
||||
// by commy2
|
||||
/*
|
||||
* Author: commy2
|
||||
* Adds reactions to a unit that was hit. EH only runs where to unit is local. Adds screams, falling down, falling from ladders, ejecting from static weapons and camshake for players
|
||||
*
|
||||
* Arguments:
|
||||
* 0: unit <OBJECT>
|
||||
* 1: firer <OBJECT>
|
||||
* 2: damage taken <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_firer", "_damage"];
|
||||
|
||||
// exit if system is disabled
|
||||
if (GVAR(minDamageToTrigger) == -1) exitWith {};
|
||||
|
||||
// don't fall after minor damage
|
||||
if (_damage < GVAR(minDamageToTrigger)) exitWith {};
|
||||
|
||||
// don't fall on collision damage
|
||||
if (_unit == _firer) exitWith {};
|
||||
|
||||
//Exit if system disabled:
|
||||
if (GVAR(minDamageToTrigger) == -1) exitWith {};
|
||||
|
||||
// cam shake for player
|
||||
// camshake for player
|
||||
if (_unit == ACE_player) then {
|
||||
addCamShake [3, 5, _damage + random 10];
|
||||
};
|
||||
|
||||
// play scream sound
|
||||
if (!isNil QUOTE(EFUNC(medical,playInjuredSound))) then {
|
||||
[_unit] call EFUNC(medical,playInjuredSound);
|
||||
};
|
||||
|
||||
private "_vehicle";
|
||||
_vehicle = vehicle _unit;
|
||||
|
||||
// handle static weapons
|
||||
if (_vehicle isKindOf "StaticWeapon") exitwith {
|
||||
if (_vehicle isKindOf "StaticWeapon") exitWith {
|
||||
if (!alive _unit) then {
|
||||
_unit action ["Eject", _vehicle];
|
||||
unassignVehicle _unit;
|
||||
};
|
||||
};
|
||||
|
||||
// don't fall after minor damage
|
||||
if (_damage < GVAR(minDamageToTrigger)) exitWith {};
|
||||
|
||||
// play sound
|
||||
if (!isNil QUOTE(EFUNC(medical,playInjuredSound))) then {
|
||||
[_unit] call EFUNC(medical,playInjuredSound);
|
||||
};
|
||||
|
||||
//Don't do animations if in a vehicle (looks weird and animations never reset):
|
||||
// don't do animations if in a vehicle (looks weird and animations never reset):
|
||||
if (_vehicle != _unit) exitWith {};
|
||||
|
||||
// this checks most things, so it doesn't mess with being inside vehicles or while dragging etc.
|
||||
@ -54,40 +67,52 @@ _velocity = vectorMagnitude velocity _unit;
|
||||
if (_velocity < 2) exitWith {};
|
||||
|
||||
// get correct animation by weapon
|
||||
private ["_isPlayer", "_isRunning", "_anim"];
|
||||
private "_anim";
|
||||
|
||||
_isPlayer = [_unit] call EFUNC(common,isPlayer);
|
||||
_isRunning = _velocity > 4;
|
||||
call {
|
||||
private "_weapon";
|
||||
_weapon = currentWeapon _unit;
|
||||
|
||||
_anim = switch (currentWeapon _unit) do {
|
||||
case (""): {"AmovPercMsprSnonWnonDf_AmovPpneMstpSnonWnonDnon"};
|
||||
case (primaryWeapon _unit): {
|
||||
if !(_isPlayer) exitWith {"AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"};
|
||||
|
||||
[
|
||||
["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning,
|
||||
["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning,
|
||||
"AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDleft",
|
||||
"AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDright"
|
||||
] select floor random 4;
|
||||
if (_weapon == "") exitWith {
|
||||
_anim = "AmovPercMsprSnonWnonDf_AmovPpneMstpSnonWnonDnon"
|
||||
};
|
||||
case (handgunWeapon _unit): {
|
||||
if !(_isPlayer) exitWith {"AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon"};
|
||||
|
||||
[
|
||||
"AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon",
|
||||
"AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon",
|
||||
"AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDleft",
|
||||
"AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDright"
|
||||
] select floor random 4;
|
||||
if (_weapon == primaryWeapon _unit) exitWith {
|
||||
if ([_unit] call EFUNC(common,isPlayer)) then {
|
||||
private "_isRunning";
|
||||
_isRunning = _velocity > 4;
|
||||
|
||||
_anim = [
|
||||
["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning,
|
||||
["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning,
|
||||
"AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDleft",
|
||||
"AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDright"
|
||||
] select floor random 4;
|
||||
} else {
|
||||
_anim = "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon";
|
||||
};
|
||||
};
|
||||
default {""};
|
||||
|
||||
if (_weapon == handgunWeapon _unit) exitWith {
|
||||
if ([_unit] call EFUNC(common,isPlayer)) then {
|
||||
_anim = [
|
||||
"AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon",
|
||||
"AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon",
|
||||
"AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDleft",
|
||||
"AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDright"
|
||||
] select floor random 4;
|
||||
} else {
|
||||
_anim = "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon";
|
||||
};
|
||||
};
|
||||
|
||||
_anim = "";
|
||||
};
|
||||
|
||||
// exit if no animation for this weapon exists, i.E. binocular or rocket launcher
|
||||
// exit if no animation for this weapon exists, i.e. binocular or rocket launcher
|
||||
if (_anim == "") exitWith {};
|
||||
|
||||
// don't mess with transitions. don't fall then.
|
||||
if ([_unit] call EFUNC(common,inTransitionAnim)) exitWith {};
|
||||
|
||||
[_unit, _anim, 2] call EFUNC(common,doAnimation);
|
||||
if !([_unit] call EFUNC(common,inTransitionAnim)) then {
|
||||
[_unit, _anim, 2] call EFUNC(common,doAnimation);
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
clientInit = QUOTE(call COMPILE_FILE(XEH_post_initClient));
|
||||
serverInit = QUOTE(call COMPILE_FILE(XEH_post_initServer));
|
||||
};
|
||||
};
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||
};
|
||||
};
|
||||
|
24
addons/noradio/XEH_postInit.sqf
Normal file
24
addons/noradio/XEH_postInit.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
// unmute unit if that player disconnects
|
||||
if (isServer) then {
|
||||
addMissionEventHandler ["HandleDisconnect", {
|
||||
[_this select 0, "isPlayer"] call EFUNC(common,unmuteUnit);
|
||||
}];
|
||||
};
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
// mutes/unmutes units when the player changes
|
||||
["playerChanged", {
|
||||
params ["_newPlayer", "_oldPlayer"];
|
||||
|
||||
// mute the new player
|
||||
[_newPlayer, "isPlayer"] call EFUNC(common,muteUnit);
|
||||
|
||||
// unmute the old player
|
||||
if (alive _oldPlayer) then {
|
||||
[_oldPlayer, "isPlayer"] call EFUNC(common,unmuteUnit);
|
||||
};
|
||||
}] call EFUNC(common,addEventhandler);
|
@ -1,27 +0,0 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
/*
|
||||
[{
|
||||
if (!isNull ACE_player) then {
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
|
||||
[ACE_player, "isPlayer"] call EFUNC(common,muteUnit);
|
||||
};
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
*/
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
// Mutes/unmutes units when the player changes
|
||||
["playerChanged", {
|
||||
EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer);
|
||||
|
||||
// On player change mute the new player
|
||||
[_newPlayer, "isPlayer"] call EFUNC(common,muteUnit);
|
||||
|
||||
// Unmute the old player
|
||||
if (alive _oldPlayer) then {
|
||||
[_oldPlayer, "isPlayer"] call EFUNC(common,unmuteUnit);
|
||||
};
|
||||
}] call EFUNC(common,addEventhandler);
|
@ -1,6 +0,0 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
addMissionEventHandler ["HandleDisconnect", {
|
||||
[_this select 0, "isPlayer"] call EFUNC(common,unmuteUnit);
|
||||
}];
|
@ -1,12 +1,12 @@
|
||||
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit) );
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
clientInit = QUOTE( call COMPILE_FILE(XEH_postInit) );
|
||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||
};
|
||||
};
|
||||
|
@ -7,8 +7,7 @@ if (!hasInterface) exitWith {};
|
||||
//["Soldier", {_player = ACE_player; if (currentWeapon _player in (_player getVariable [QGVAR(safedWeapons), []])) then {[false] call FUNC(setSafeModeVisual)}] call EFUNC(common,addInfoDisplayEventHandler);
|
||||
//@todo addEventHandler infoDisplayChanged with select 1 == "Soldier"
|
||||
|
||||
|
||||
// Add keybinds
|
||||
// add keybinds
|
||||
["ACE3 Weapons", QGVAR(safeMode), localize LSTRING(SafeMode),
|
||||
{
|
||||
// Conditions: canInteract
|
||||
@ -21,4 +20,4 @@ if (!hasInterface) exitWith {};
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[41, [false, true, false]], false] call cba_fnc_addKeybind;
|
||||
[41, [false, true, false]], false] call CBA_fnc_addKeybind;
|
||||
|
@ -20,10 +20,10 @@
|
||||
// don't immediately switch back
|
||||
if (inputAction "nextWeapon" > 0) exitWith {};
|
||||
|
||||
private ["_safedWeapons", "_condition", "_statement", "_id", "_picture"];
|
||||
|
||||
params ["_unit", "_weapon", "_muzzle"];
|
||||
|
||||
private ["_safedWeapons", "_picture"];
|
||||
|
||||
_safedWeapons = _unit getVariable [QGVAR(safedWeapons), []];
|
||||
|
||||
if (_weapon in _safedWeapons) exitWith {
|
||||
@ -35,47 +35,39 @@ _safedWeapons pushBack _weapon;
|
||||
_unit setVariable [QGVAR(safedWeapons), _safedWeapons];
|
||||
|
||||
if (_unit getVariable [QGVAR(actionID), -1] == -1) then {
|
||||
_condition = {
|
||||
params ["", "_caller"];
|
||||
if (
|
||||
[_caller] call EFUNC(common,canUseWeapon)
|
||||
&& {
|
||||
if (currentMuzzle _caller in (_caller getVariable [QGVAR(safedWeapons), []])) then {
|
||||
if (inputAction "nextWeapon" > 0) exitWith {
|
||||
[_this select 1, currentWeapon _caller, currentMuzzle _caller] call FUNC(unlockSafety);
|
||||
false
|
||||
};
|
||||
true
|
||||
} else {false}
|
||||
}
|
||||
) then {
|
||||
// player hud
|
||||
[false] call FUNC(setSafeModeVisual);
|
||||
true
|
||||
} else {
|
||||
// player hud
|
||||
[true] call FUNC(setSafeModeVisual);
|
||||
false
|
||||
}
|
||||
};
|
||||
|
||||
_statement = {
|
||||
params ["", "_caller"];
|
||||
[_caller, currentWeapon _caller, currentMuzzle _caller] call FUNC(unlockSafety);
|
||||
};
|
||||
|
||||
//_id = [_unit, format ["<t color=""#FFFF00"" >%1</t>", localize LSTRING(TakeOffSafety)], "DefaultAction", _condition, {}, {true}, _statement, 10] call EFUNC(common,addActionMenuEventHandler);
|
||||
_id = [_unit, "DefaultAction", _condition, {}] call EFUNC(common,addActionEventHandler);
|
||||
|
||||
_unit setVariable [QGVAR(actionID), _id];
|
||||
_unit setVariable [QGVAR(actionID), [
|
||||
_unit, "DefaultAction", {
|
||||
if (
|
||||
[_this select 1] call EFUNC(common,canUseWeapon)
|
||||
&& {
|
||||
if (currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(safedWeapons), []])) then {
|
||||
if (inputAction "nextWeapon" > 0) exitWith {
|
||||
[_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call FUNC(unlockSafety);
|
||||
false
|
||||
};
|
||||
true
|
||||
} else {false}
|
||||
}
|
||||
) then {
|
||||
// player hud
|
||||
[false] call FUNC(setSafeModeVisual);
|
||||
true
|
||||
} else {
|
||||
// player hud
|
||||
[true] call FUNC(setSafeModeVisual);
|
||||
false
|
||||
};
|
||||
}, {}
|
||||
] call EFUNC(common,addActionEventHandler)];
|
||||
};
|
||||
|
||||
if ((typeName _muzzle) == (typeName "")) then {
|
||||
_unit selectWeapon _muzzle; //_weapon
|
||||
if (typeName _muzzle == "STRING") then {
|
||||
_unit selectWeapon _muzzle;
|
||||
};
|
||||
|
||||
// play fire mode selector sound
|
||||
[_unit, _weapon, _muzzle] call FUNC(playChangeFiremodeSound);
|
||||
|
||||
// show info box
|
||||
_picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");
|
||||
[localize LSTRING(PutOnSafety), _picture] call EFUNC(common,displayTextPicture);
|
||||
|
@ -16,23 +16,28 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_sound", "_position"];
|
||||
|
||||
params ["_unit", "_weapon"];
|
||||
|
||||
private ["_sound", "_position"];
|
||||
|
||||
_sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound");
|
||||
|
||||
if (count _sound == 0) exitWith {
|
||||
if (_sound isEqualTo []) exitWith {
|
||||
playSound "ACE_Sound_Click";
|
||||
};
|
||||
|
||||
// add file extension
|
||||
if ({(toLower (_sound select 0) find _x == (count toArray (_sound select 0) - count toArray _x) - 1)} count [".wav", ".ogg", ".wss"] == 0) then {
|
||||
_sound set [0, (_sound select 0) + ".wss"];
|
||||
};
|
||||
|
||||
_position = _unit modelToWorldVisual (_unit selectionPosition "RightHand");
|
||||
_position set [2, (_position select 2) + ((getPosASLW _unit select 2) - (getPosATL _unit select 2) max 0)];
|
||||
// get position where to play the sound (position of the weapon)
|
||||
_position = AGLToASL (_unit modelToWorldVisual (_unit selectionPosition "RightHand"));
|
||||
|
||||
_sound params ["_filename", ["_volume", 1], ["_soundPitch", 1], ["_distance", 0]];
|
||||
|
||||
if (_filename == "") exitWith {
|
||||
playSound "ACE_Sound_Click";
|
||||
};
|
||||
|
||||
// add file extension .wss as default
|
||||
if !(toLower (_filename select [count _filename - 4]) in [".wav", ".ogg", ".wss"]) then {
|
||||
_filename = format ["%1.wss", _filename];
|
||||
};
|
||||
|
||||
playSound3D [_filename, objNull, false, _position, _volume, _soundPitch, _distance];
|
||||
|
@ -15,17 +15,17 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_control", "_config"];
|
||||
|
||||
params ["_show"];
|
||||
|
||||
disableSerialization;
|
||||
|
||||
private "_control";
|
||||
_control = (uiNamespace getVariable ["ACE_dlgSoldier", displayNull]) displayCtrl 187;
|
||||
|
||||
if (isNull _control) exitWith {};
|
||||
|
||||
if (_show) then {
|
||||
private "_config";
|
||||
_config = configFile >> "RscInGameUI" >> "RscUnitInfoSoldier" >> "WeaponInfoControlsGroupLeft" >> "controls" >> "CA_ModeTexture";
|
||||
|
||||
_control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")];
|
||||
|
@ -17,24 +17,19 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_safedWeapons", "_id", "_picture"];
|
||||
|
||||
params ["_unit", "_weapon", "_muzzle"];
|
||||
|
||||
private ["_safedWeapons", "_picture"];
|
||||
|
||||
_safedWeapons = _unit getVariable [QGVAR(safedWeapons), []];
|
||||
_safedWeapons deleteAt (_safedWeapons find _weapon);
|
||||
|
||||
if (_weapon in _safedWeapons) then {
|
||||
_safedWeapons = _safedWeapons - [_weapon];
|
||||
_unit setVariable [QGVAR(safedWeapons), _safedWeapons];
|
||||
|
||||
_unit setVariable [QGVAR(safedWeapons), _safedWeapons];
|
||||
|
||||
if (count _safedWeapons == 0) then {
|
||||
_id = _unit getVariable [QGVAR(actionID), -1];
|
||||
|
||||
//[_unit, "DefaultAction", _id] call EFUNC(common,removeActionMenuEventHandler);
|
||||
[_unit, "DefaultAction", _id] call EFUNC(common,removeActionEventHandler);
|
||||
_unit setVariable [QGVAR(actionID), -1];
|
||||
};
|
||||
// remove action if all weapons have put their safety on
|
||||
if (_safedWeapons isEqualTo []) then {
|
||||
[_unit, "DefaultAction", _unit getVariable [QGVAR(actionID), -1]] call EFUNC(common,removeActionEventHandler);
|
||||
_unit setVariable [QGVAR(actionID), -1];
|
||||
};
|
||||
|
||||
_unit selectWeapon _muzzle;
|
||||
@ -74,5 +69,6 @@ if (inputAction "nextWeapon" > 0) then {
|
||||
// player hud
|
||||
[true] call FUNC(setSafeModeVisual);
|
||||
|
||||
// show info box
|
||||
_picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");
|
||||
[localize LSTRING(TookOffSafety), _picture] call EFUNC(common,displayTextPicture);
|
||||
|
Loading…
Reference in New Issue
Block a user