manual merge

This commit is contained in:
commy2
2015-09-28 21:06:40 +02:00
125 changed files with 1235 additions and 2165 deletions

View File

@ -1,3 +1,3 @@
#include "script_component.hpp" #include "script_component.hpp"
["backpackOpened", DFUNC(backpackOpened)] call EFUNC(common,addEventHandler); ["backpackOpened", {_this call FUNC(backpackOpened)}] call EFUNC(common,addEventHandler);

View File

@ -1,18 +1,19 @@
/* /*
* Author: commy2 * Author: commy2
* Someone opened your backpack. Play sound and camshake. Execute locally.
* *
* Someone opened your backpack. Execute locally. * Arguments:
*
* Argument:
* 0: Who accessed your inventory? (Object) * 0: Who accessed your inventory? (Object)
* 1: Unit that wields the backpack (Object) * 1: Unit that wields the backpack (Object)
* 2: The backpack object (Object) * 2: The backpack object (Object)
* *
* Return value: * Return Value:
* None. * None
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_sounds", "_position"];
params ["_target", "_backpack"]; params ["_target", "_backpack"];
// do cam shake if the target is the player // 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]; addCamShake [4, 0.5, 5];
}; };
// play a rustling sound // play a zipper sound effect
private ["_sounds", "_position"];
_sounds = [ _sounds = [
/*"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss", /*"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss",
@ -32,8 +34,7 @@ _sounds = [
QUOTE(PATHTO_R(sounds\zip_out.wav)) QUOTE(PATHTO_R(sounds\zip_out.wav))
]; ];
_position = _target modelToWorldVisual (_target selectionPosition "Spine3"); _position = AGLToASL (_target modelToWorldVisual (_target selectionPosition "Spine3"));
_position = _position call EFUNC(common,positionToASL);
playSound3D [ playSound3D [
_sounds select floor random count _sounds, _sounds select floor random count _sounds,

View File

@ -1,23 +1,24 @@
/* /*
* Author: commy2 * 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: * Return Value:
* 0: A backpack (Object or String) * Boolean <BOOL>
* *
* Return value: * Public: Yes
* Boolean (Bool)
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_config"];
params ["_backpack"]; params ["_backpack"];
if (typeName _backpack == "OBJECT") then { if (typeName _backpack == "OBJECT") then {
_backpack = typeOf _backpack; _backpack = typeOf _backpack;
}; };
private "_config";
_config = configFile >> "CfgVehicles" >> _backpack; _config = configFile >> "CfgVehicles" >> _backpack;
getText (_config >> "vehicleClass") == "backpacks" && {getNumber (_config >> "maximumLoad") > 0} getText (_config >> "vehicleClass") == "backpacks" && {getNumber (_config >> "maximumLoad") > 0} // return

View File

@ -1,13 +1,15 @@
/* /*
* Author: commy2 * 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: * Return Value:
* Input from "InventoryOpened" eventhandler
*
* Return value:
* false. Always open the inventory dialog. (Bool) * false. Always open the inventory dialog. (Bool)
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -6,6 +6,7 @@
* 0: Item Classname <STRING> * 0: Item Classname <STRING>
* 1: Vehicle <OBJECT> * 1: Vehicle <OBJECT>
* 2: Amount <NUMBER> (default: 1) * 2: Amount <NUMBER> (default: 1)
* 3: Show Hint <BOOL> (default: false)
* *
* Return Value: * Return Value:
* None * None
@ -18,7 +19,7 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_position", "_item", "_i"]; private ["_position", "_item", "_i"];
params ["_itemClass", "_vehicle", ["_amount", 1]]; params ["_itemClass", "_vehicle", ["_amount", 1], ["_showHint", false, [false]] ];
TRACE_3("params",_itemClass,_vehicle,_amount); TRACE_3("params",_itemClass,_vehicle,_amount);
_position = getPos _vehicle; _position = getPos _vehicle;
@ -29,7 +30,7 @@ for "_i" from 1 to _amount do {
_item = createVehicle [_itemClass, _position, [], 0, "CAN_COLLIDE"]; _item = createVehicle [_itemClass, _position, [], 0, "CAN_COLLIDE"];
// Load item or delete it if no space left // 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); TRACE_1("no room to load item - deleting",_item);
deleteVehicle _item; deleteVehicle _item;
}; };

View File

@ -45,7 +45,7 @@ if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) ex
private ["_text", "_condition", "_statement", "_icon", "_action"]; private ["_text", "_condition", "_statement", "_icon", "_action"];
_condition = { _condition = {
params ["_target", "_player"]; params ["_target", "_player"];
GVAR(enable) && {locked _target < 2} && {[_player, _target, []] call EFUNC(common,canInteractWith)} GVAR(enable) && {locked _target < 2} && {alive _target} && {[_player, _target, []] call EFUNC(common,canInteractWith)}
}; };
_text = localize LSTRING(openMenu); _text = localize LSTRING(openMenu);
_statement = {GVAR(interactionVehicle) = _target; createDialog QGVAR(menu);}; _statement = {GVAR(interactionVehicle) = _target; createDialog QGVAR(menu);};

View File

@ -5,6 +5,7 @@
* Arguments: * Arguments:
* 0: Object <OBJECT> * 0: Object <OBJECT>
* 1: Vehicle <OBJECT> * 1: Vehicle <OBJECT>
* 2: Show Hint <BOOL> (default: true)
* *
* Return value: * Return value:
* Object loaded <BOOL> * Object loaded <BOOL>
@ -18,7 +19,7 @@
private ["_loaded", "_space", "_itemSize"]; private ["_loaded", "_space", "_itemSize"];
params ["_item", "_vehicle"]; params ["_item", "_vehicle", ["_showHint", true, [true]] ];
TRACE_2("params",_item,_vehicle); TRACE_2("params",_item,_vehicle);
if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith { if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {
@ -46,7 +47,9 @@ private ["_itemName", "_vehicleName"];
_itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName"); _itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName");
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName"); _vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
if (_showHint) then {
["displayTextStructured", [[localize LSTRING(LoadedItem), _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent); ["displayTextStructured", [[localize LSTRING(LoadedItem), _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
};
// Invoke listenable event // Invoke listenable event
["cargoLoaded", [_item, _vehicle]] call EFUNC(common,globalEvent); ["cargoLoaded", [_item, _vehicle]] call EFUNC(common,globalEvent);

View File

@ -83,6 +83,9 @@
["setDir", {(_this select 0) setDir (_this select 1)}] call FUNC(addEventhandler); ["setDir", {(_this select 0) setDir (_this select 1)}] call FUNC(addEventhandler);
["setFuel", {(_this select 0) setFuel (_this select 1)}] call FUNC(addEventhandler); ["setFuel", {(_this select 0) setFuel (_this select 1)}] call FUNC(addEventhandler);
["setSpeaker", {(_this select 0) setSpeaker (_this select 1)}] call FUNC(addEventhandler); ["setSpeaker", {(_this select 0) setSpeaker (_this select 1)}] call FUNC(addEventhandler);
["selectLeader", {(_this select 0) selectLeader (_this select 1)}] call FUNC(addEventHandler);
["assignTeam", {(_this select 0) assignTeam (_this select 1)}] call FUNC(addEventHandler);
["setVelocity", {(_this select 0) setVelocity (_this select 1)}] call FUNC(addEventHandler);
if (isServer) then { if (isServer) then {
["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler); ["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler);
@ -397,8 +400,8 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then {
// @todo still needed? // @todo still needed?
[QGVAR(StateArrested), false, true, QUOTE(ADDON)] call FUNC(defineVariable); [QGVAR(StateArrested), false, true, QUOTE(ADDON)] call FUNC(defineVariable);
["displayTextStructured", FUNC(displayTextStructured)] call FUNC(addEventhandler); ["displayTextStructured", {_this call FUNC(displayTextStructured)}] call FUNC(addEventhandler);
["displayTextPicture", FUNC(displayTextPicture)] call FUNC(addEventhandler); ["displayTextPicture", {_this call FUNC(displayTextPicture)}] call FUNC(addEventhandler);
["medical_onUnconscious", { ["medical_onUnconscious", {
params ["_unit", "_isUnconscious"]; params ["_unit", "_isUnconscious"];

View File

@ -19,14 +19,17 @@ _object = _this;
if (!local _object) exitWith {}; if (!local _object) exitWith {};
// save and restore hitpoints, see below why // save and restore hitpoints, see below why
private ["_hitPoints", "_hitPointDamages"]; private "_hitPointDamages";
_hitPointDamages = getAllHitPointsDamage _object;
_hitPoints = [_object] call FUNC(getHitpoints); // get correct format for objects without hitpoints
_hitPointDamages = [_hitPoints, {_object getHitPointDamage _this}] call FUNC(map); if (_hitPointDamages isEqualTo []) then {
_hitPointDamages = [[],[],[]];
};
// this prevents physx objects from floating when near other physx objects with allowDamage false // this prevents physx objects from floating when near other physx objects with allowDamage false
_object setDamage damage _object; _object setDamage damage _object;
{ {
_object setHitPointDamage [_x, _hitPointDamages select _forEachIndex]; _object setHitIndex [_forEachIndex, _x];
} forEach _hitPoints; } forEach (_hitPointDamages select 2);

View File

@ -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)) // 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); [_unit, _target] call FUNC(dropObject_carry);
[_idPFH] call CBA_fnc_removePerFrameHandler; [_idPFH] call CBA_fnc_removePerFrameHandler;
}; };

View File

@ -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)) // 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); [_unit, _target] call FUNC(dropObject);
[_idPFH] call CBA_fnc_removePerFrameHandler; [_idPFH] call CBA_fnc_removePerFrameHandler;
}; };

View File

@ -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)) // 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); [_unit, _target] call FUNC(dropObject);
[_idPFH] call CBA_fnc_removePerFrameHandler; [_idPFH] call CBA_fnc_removePerFrameHandler;
}; };

View File

@ -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)) // 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); [_unit, _target] call FUNC(dropObject);
[_idPFH] call CBA_fnc_removePerFrameHandler; [_idPFH] call CBA_fnc_removePerFrameHandler;
}; };

View File

@ -1,3 +1,4 @@
class CfgAmmo { class CfgAmmo {
class FlareCore; class FlareCore;
class FlareBase: FlareCore { class FlareBase: FlareCore {

View File

@ -1,3 +1,4 @@
class Extended_PreInit_EventHandlers { class Extended_PreInit_EventHandlers {
class ADDON { class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit)); init = QUOTE(call COMPILE_FILE(XEH_preInit));
@ -13,7 +14,7 @@ class Extended_PostInit_EventHandlers {
class Extended_FiredBIS_EventHandlers { class Extended_FiredBIS_EventHandlers {
class CAManBase { class CAManBase {
class ADDON { class ADDON {
clientFiredBIS = QUOTE( _this call FUNC(throwGrenade) ); firedBIS = QUOTE(_this call FUNC(throwGrenade));
}; };
}; };
}; };

View File

@ -1,9 +1,6 @@
class CfgVehicles { class CfgVehicles {
class NATO_Box_Base; 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 Box_NATO_Grenades_F: NATO_Box_Base {
class TransportItems { class TransportItems {
MACRO_ADDITEM(ACE_HandFlare_White,12); 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 Box_East_Grenades_F: EAST_Box_Base {
class TransportItems { class TransportItems {
MACRO_ADDITEM(ACE_HandFlare_Yellow,12); 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 Box_IND_Grenades_F: IND_Box_Base {
class TransportItems { class TransportItems {
MACRO_ADDITEM(ACE_HandFlare_Yellow,12); 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 ACE_Box_Misc: Box_NATO_Support_F {
class TransportItems { class TransportItems {
MACRO_ADDITEM(ACE_HandFlare_White,12); MACRO_ADDITEM(ACE_HandFlare_White,12);

View File

@ -1,21 +1,26 @@
class CfgWeapons { class CfgWeapons {
class GrenadeLauncher; class GrenadeLauncher;
class Throw: 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 ThrowMuzzle;
class ACE_HandFlare_WhiteMuzzle: ThrowMuzzle { class ACE_HandFlare_WhiteMuzzle: ThrowMuzzle {
magazines[] = {"ACE_HandFlare_White"}; magazines[] = {"ACE_HandFlare_White"};
}; };
class ACE_HandFlare_RedMuzzle: ThrowMuzzle { class ACE_HandFlare_RedMuzzle: ThrowMuzzle {
magazines[] = {"ACE_HandFlare_Red"}; magazines[] = {"ACE_HandFlare_Red"};
}; };
class ACE_HandFlare_GreenMuzzle: ThrowMuzzle { class ACE_HandFlare_GreenMuzzle: ThrowMuzzle {
magazines[] = {"ACE_HandFlare_Green"}; magazines[] = {"ACE_HandFlare_Green"};
}; };
class ACE_HandFlare_YellowMuzzle: ThrowMuzzle { class ACE_HandFlare_YellowMuzzle: ThrowMuzzle {
magazines[] = {"ACE_HandFlare_Yellow"}; magazines[] = {"ACE_HandFlare_Yellow"};
}; };
class ACE_M84Muzzle: ThrowMuzzle { class ACE_M84Muzzle: ThrowMuzzle {
magazines[] = {"ACE_M84"}; magazines[] = {"ACE_M84"};
}; };

View File

@ -2,7 +2,7 @@
#include "script_component.hpp" #include "script_component.hpp"
["flashbangExplosion", DFUNC(flashbangExplosionEH)] call EFUNC(common,addEventHandler); ["flashbangExplosion", {_this call FUNC(flashbangExplosionEH)}] call EFUNC(common,addEventHandler);
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
@ -21,4 +21,4 @@ GVAR(flashbangPPEffectCC) ppEffectForceInNVG true;
[] call FUNC(nextMode); [] call FUNC(nextMode);
}, },
{false}, {false},
[9, [false, false, false]], false] call cba_fnc_addKeybind; //8 Key [9, [false, false, false]], false] call CBA_fnc_addKeybind; //8 Key

View File

@ -15,13 +15,14 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_affected", "_strength", "_posGrenade", "_angleDiff", "_light", "_losCount", "_dirToUnitVector", "_eyeDir", "_eyePos"];
params ["_grenade"]; params ["_grenade"];
private ["_affected", "_strength", "_posGrenade", "_eyePos", "_losCount", "_eyeDir", "_dirToUnitVector", "_angleDiff", "_light"];
_affected = _grenade nearEntities ["CAManBase", 20]; _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; _strength = 1 - ((_x distance _grenade) min 15) / 15;
@ -30,16 +31,19 @@ _affected = _grenade nearEntities ["CAManBase", 20];
if (_x != ACE_player) then { if (_x != ACE_player) then {
//must be AI //must be AI
[_x, true] call EFUNC(common,disableAI); [_x, true] call EFUNC(common,disableAI);
_x setSkill ((skill _x) / 50);
_x setSkill (skill _x / 50);
[{ [{
params ["_unit"]; params ["_unit"];
//Make sure we don't enable AI for unconscious units //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, false] call EFUNC(common,disableAI);
}; };
_unit setSkill (skill _unit * 50); _unit setSkill (skill _unit * 50);
}, [_x], (7 * _strength)] call EFUNC(common,waitAndExecute); }, [_x], 7 * _strength] call EFUNC(common,waitAndExecute);
} else { } else {
//Do effects for player //Do effects for player
// is there line of sight to the grenade? // 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) //Check for line of sight (check 4 points in case grenade is stuck in an object or underground)
_losCount = { _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]]; } 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); TRACE_1("Line of sight count (out of 4)",_losCount);
@ -57,9 +61,9 @@ _affected = _grenade nearEntities ["CAManBase", 20];
_strength = _strength / 10; _strength = _strength / 10;
}; };
//Add ace_hearing ear ringing sound effect // add ace_hearing ear ringing sound effect
if ((isClass (configFile >> "CfgPatches" >> "ACE_Hearing")) && {_strength > 0}) then { if (isClass (configFile >> "CfgPatches" >> "ACE_Hearing") && {_strength > 0}) then {
[_x, (20 * _strength)] call EFUNC(hearing,earRinging); [_x, 20 * _strength] call EFUNC(hearing,earRinging);
}; };
// account for people looking away by slightly // account for people looking away by slightly
@ -68,16 +72,16 @@ _affected = _grenade nearEntities ["CAManBase", 20];
_dirToUnitVector = _eyePos vectorFromTo _posGrenade; _dirToUnitVector = _eyePos vectorFromTo _posGrenade;
_angleDiff = acos (_eyeDir vectorDotProduct _dirToUnitVector); _angleDiff = acos (_eyeDir vectorDotProduct _dirToUnitVector);
//From 0-45deg, full effect // from 0-45deg, full effect
if (_angleDiff > 45) then { if (_angleDiff > 45) then {
_strength = _strength - _strength * ((_angleDiff - 45) / 120); _strength = _strength - _strength * ((_angleDiff - 45) / 120);
}; };
TRACE_1("Final strength for player",_strength); TRACE_1("Final strength for player",_strength);
//Add ace_medical pain effect: // add ace_medical pain effect:
if ((isClass (configFile >> "CfgPatches" >> "ACE_Medical")) && {_strength > 0.1}) then { if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {_strength > 0.1}) then {
[ACE_player, (_strength / 2)] call EFUNC(medical,adjustPainLevel); [ACE_player, _strength / 2] call EFUNC(medical,adjustPainLevel);
}; };
// create flash to illuminate environment // create flash to illuminate environment
@ -87,14 +91,14 @@ _affected = _grenade nearEntities ["CAManBase", 20];
_light setLightColor [1,1,1]; _light setLightColor [1,1,1];
_light setLightDayLight true; _light setLightDayLight true;
//Delete the light after 0.1 seconds // delete the light after 0.1 seconds
[{ [{
params ["_light"]; params ["_light"];
deleteVehicle _light; deleteVehicle _light;
}, [_light], 0.1] call EFUNC(common,waitAndExecute); }, [_light], 0.1] call EFUNC(common,waitAndExecute);
// blind player // blind player
if (_strength > 0.1 && hasInterface) then { if (hasInterface && {_strength > 0.1}) then {
GVAR(flashbangPPEffectCC) ppEffectEnable true; 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) 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; GVAR(flashbangPPEffectCC) ppEffectCommit 0.01;
@ -102,14 +106,15 @@ _affected = _grenade nearEntities ["CAManBase", 20];
//PARTIALRECOVERY - start decreasing effect over ACE_time //PARTIALRECOVERY - start decreasing effect over ACE_time
[{ [{
params ["_strength"]; params ["_strength"];
GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]]; GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]];
GVAR(flashbangPPEffectCC) ppEffectCommit (10 * _strength); GVAR(flashbangPPEffectCC) ppEffectCommit (10 * _strength);
}, [_strength], (7 * _strength), 0] call EFUNC(common,waitAndExecute); }, [_strength], 7 * _strength] call EFUNC(common,waitAndExecute);
//FULLRECOVERY - end effect //FULLRECOVERY - end effect
[{ [{
GVAR(flashbangPPEffectCC) ppEffectEnable false; GVAR(flashbangPPEffectCC) ppEffectEnable false;
}, [], (17 * _strength)] call EFUNC(common,waitAndExecute); }, [], 17 * _strength] call EFUNC(common,waitAndExecute);
}; };
}; };
}; };

View File

@ -14,6 +14,7 @@
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_projectile"]; params ["_projectile"];
if (alive _projectile) then { if (alive _projectile) then {
@ -21,5 +22,6 @@ if (alive _projectile) then {
private "_affected"; private "_affected";
_affected = _projectile nearEntities ["CAManBase", 50]; _affected = _projectile nearEntities ["CAManBase", 50];
["flashbangExplosion", _affected, [_projectile]] call EFUNC(common,targetEvent); ["flashbangExplosion", _affected, [_projectile]] call EFUNC(common,targetEvent);
}; };

View File

@ -1,3 +1,4 @@
class ACE_Settings { class ACE_Settings {
class GVAR(minDamageToTrigger) { class GVAR(minDamageToTrigger) {
//Minimum mamage needed to trigger falling down while moving. Set to -1 to disable completely. //Minimum mamage needed to trigger falling down while moving. Set to -1 to disable completely.

View File

@ -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" #include "script_component.hpp"
params ["_unit", "_firer", "_damage"]; 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 // don't fall on collision damage
if (_unit == _firer) exitWith {}; if (_unit == _firer) exitWith {};
//Exit if system disabled:
if (GVAR(minDamageToTrigger) == -1) exitWith {};
// camshake for player // camshake for player
if (_unit == ACE_player) then { if (_unit == ACE_player) then {
addCamShake [3, 5, _damage + random 10]; addCamShake [3, 5, _damage + random 10];
}; };
// play scream sound
if (!isNil QUOTE(EFUNC(medical,playInjuredSound))) then {
[_unit] call EFUNC(medical,playInjuredSound);
};
private "_vehicle"; private "_vehicle";
_vehicle = vehicle _unit; _vehicle = vehicle _unit;
// handle static weapons // handle static weapons
if (_vehicle isKindOf "StaticWeapon") exitwith { if (_vehicle isKindOf "StaticWeapon") exitWith {
if (!alive _unit) then { if (!alive _unit) then {
_unit action ["Eject", _vehicle]; _unit action ["Eject", _vehicle];
unassignVehicle _unit; unassignVehicle _unit;
}; };
}; };
// don't fall after minor damage // don't do animations if in a vehicle (looks weird and animations never reset):
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):
if (_vehicle != _unit) exitWith {}; if (_vehicle != _unit) exitWith {};
// this checks most things, so it doesn't mess with being inside vehicles or while dragging etc. // 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 {}; if (_velocity < 2) exitWith {};
// get correct animation by weapon // get correct animation by weapon
private ["_isPlayer", "_isRunning", "_anim"]; private "_anim";
_isPlayer = [_unit] call EFUNC(common,isPlayer); call {
private "_weapon";
_weapon = currentWeapon _unit;
if (_weapon == "") exitWith {
_anim = "AmovPercMsprSnonWnonDf_AmovPpneMstpSnonWnonDnon"
};
if (_weapon == primaryWeapon _unit) exitWith {
if ([_unit] call EFUNC(common,isPlayer)) then {
private "_isRunning";
_isRunning = _velocity > 4; _isRunning = _velocity > 4;
_anim = switch (currentWeapon _unit) do { _anim = [
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,
["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning, ["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning,
"AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDleft", "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDleft",
"AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDright" "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDright"
] select floor random 4; ] select floor random 4;
} else {
_anim = "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon";
};
}; };
case (handgunWeapon _unit): {
if !(_isPlayer) exitWith {"AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon"};
[ if (_weapon == handgunWeapon _unit) exitWith {
if ([_unit] call EFUNC(common,isPlayer)) then {
_anim = [
"AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon", "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon",
"AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon", "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon",
"AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDleft", "AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDleft",
"AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDright" "AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDright"
] select floor random 4; ] select floor random 4;
} else {
_anim = "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon";
}; };
default {""};
}; };
// exit if no animation for this weapon exists, i.E. binocular or rocket launcher _anim = "";
};
// exit if no animation for this weapon exists, i.e. binocular or rocket launcher
if (_anim == "") exitWith {}; if (_anim == "") exitWith {};
// don't mess with transitions. don't fall then. // don't mess with transitions. don't fall then.
if ([_unit] call EFUNC(common,inTransitionAnim)) exitWith {}; if !([_unit] call EFUNC(common,inTransitionAnim)) then {
[_unit, _anim, 2] call EFUNC(common,doAnimation); [_unit, _anim, 2] call EFUNC(common,doAnimation);
};

View File

@ -1,3 +1,4 @@
class ACE_Settings { class ACE_Settings {
class GVAR(EnableTeamManagement) { class GVAR(EnableTeamManagement) {
value = 1; value = 1;

View File

@ -1,6 +1,5 @@
class ACE_ZeusActions { class ACE_ZeusActions {
// _target = curatorLogic
// curatorSelected = [objects,groups,waypoints,markers]
class ZeusUnits { class ZeusUnits {
displayName = "$STR_A3_RscDisplayCurator_ModeUnits_tooltip"; displayName = "$STR_A3_RscDisplayCurator_ModeUnits_tooltip";
icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeUnits_ca.paa"; icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeUnits_ca.paa";
@ -29,12 +28,14 @@ class ACE_ZeusActions {
statement = "{_x setUnitPos 'AUTO';} forEach (curatorSelected select 0);"; statement = "{_x setUnitPos 'AUTO';} forEach (curatorSelected select 0);";
}; };
}; };
class remoteControl { class remoteControl {
displayName = "$STR_A3_CfgVehicles_ModuleRemoteControl_F"; displayName = "$STR_A3_CfgVehicles_ModuleRemoteControl_F";
icon = "\A3\Modules_F_Curator\Data\portraitRemoteControl_ca.paa"; icon = "\A3\Modules_F_Curator\Data\portraitRemoteControl_ca.paa";
statement = "_unit = objNull; { if ((side _x in [east,west,resistance,civilian]) && !(isPlayer _x)) exitWith { _unit = _x; }; } forEach (curatorSelected select 0); bis_fnc_curatorObjectPlaced_mouseOver = ['OBJECT',_unit]; (group _target) createUnit ['ModuleRemoteControl_F',[0,0,0],[],0,''];"; statement = "_unit = objNull; { if ((side _x in [east,west,resistance,civilian]) && !(isPlayer _x)) exitWith { _unit = _x; }; } forEach (curatorSelected select 0); bis_fnc_curatorObjectPlaced_mouseOver = ['OBJECT',_unit]; (group _target) createUnit ['ModuleRemoteControl_F',[0,0,0],[],0,''];";
}; };
}; };
class ZeusGroups { class ZeusGroups {
displayName = "$STR_A3_RscDisplayCurator_ModeGroups_tooltip"; displayName = "$STR_A3_RscDisplayCurator_ModeGroups_tooltip";
icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeGroups_ca.paa"; icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeGroups_ca.paa";
@ -67,6 +68,7 @@ class ACE_ZeusActions {
statement = "{ _x setBehaviour 'STEALTH'; } forEach (curatorSelected select 1);"; statement = "{ _x setBehaviour 'STEALTH'; } forEach (curatorSelected select 1);";
}; };
}; };
class speed { class speed {
displayName = "$STR_HC_Menu_Speed"; displayName = "$STR_HC_Menu_Speed";
@ -86,6 +88,7 @@ class ACE_ZeusActions {
statement = "{_x setSpeedMode 'FULL';} forEach (curatorSelected select 1);"; statement = "{_x setSpeedMode 'FULL';} forEach (curatorSelected select 1);";
}; };
}; };
class formation { class formation {
displayName = "$STR_Formation"; displayName = "$STR_Formation";
@ -136,6 +139,7 @@ class ACE_ZeusActions {
}; };
}; };
}; };
class ZeusWaypoints { class ZeusWaypoints {
displayName = "Waypoints"; displayName = "Waypoints";
icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeRecent_ca.paa"; icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeRecent_ca.paa";
@ -168,6 +172,7 @@ class ACE_ZeusActions {
statement = "{ _x setWaypointBehaviour 'STEALTH'; } forEach (curatorSelected select 2);"; statement = "{ _x setWaypointBehaviour 'STEALTH'; } forEach (curatorSelected select 2);";
}; };
}; };
class speed { class speed {
displayName = "$STR_HC_Menu_Speed"; displayName = "$STR_HC_Menu_Speed";
@ -187,6 +192,7 @@ class ACE_ZeusActions {
statement = "{ _x setWaypointSpeed 'FULL'; } forEach (curatorSelected select 2);"; statement = "{ _x setWaypointSpeed 'FULL'; } forEach (curatorSelected select 2);";
}; };
}; };
class formation { class formation {
displayName = "$STR_Formation"; displayName = "$STR_Formation";
@ -237,6 +243,7 @@ class ACE_ZeusActions {
}; };
}; };
}; };
class ZeusMarkers { class ZeusMarkers {
displayName = "$STR_A3_RscDisplayCurator_ModeMarkers_tooltip"; displayName = "$STR_A3_RscDisplayCurator_ModeMarkers_tooltip";
icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeMarkers_ca.paa"; icon = "\A3\UI_F_Curator\Data\Displays\RscDisplayCurator\modeMarkers_ca.paa";

View File

@ -1,3 +1,4 @@
class Extended_PreInit_EventHandlers { class Extended_PreInit_EventHandlers {
class ADDON { class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit)); init = QUOTE(call COMPILE_FILE(XEH_preInit));
@ -9,3 +10,11 @@ class Extended_PostInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_postInit)); init = QUOTE(call COMPILE_FILE(XEH_postInit));
}; };
}; };
class Extended_Respawn_EventHandlers {
class CAManBase {
class ADDON {
respawn = QUOTE((_this select 0) setVariable [ARR_3(QUOTE(QGVAR(assignedFireTeam)),(_this select 0) getVariable [ARR_2(QUOTE(QGVAR(assignedFireTeam)),'MAIN')],true)]);
};
};
};

View File

@ -1,3 +1,4 @@
class CfgVehicles { class CfgVehicles {
class ACE_Module; class ACE_Module;
class ACE_ModuleInteraction: ACE_Module { class ACE_ModuleInteraction: ACE_Module {
@ -8,6 +9,7 @@ class CfgVehicles {
scope = 2; scope = 2;
isGlobal = 1; isGlobal = 1;
icon = PATHTOF(UI\Icon_Module_Interaction_ca.paa); icon = PATHTOF(UI\Icon_Module_Interaction_ca.paa);
class Arguments { class Arguments {
class EnableTeamManagement { class EnableTeamManagement {
displayName = CSTRING(EnableTeamManagement_DisplayName); displayName = CSTRING(EnableTeamManagement_DisplayName);
@ -16,6 +18,7 @@ class CfgVehicles {
defaultValue = 1; defaultValue = 1;
}; };
}; };
class ModuleDescription { class ModuleDescription {
description = CSTRING(Module_Description); description = CSTRING(Module_Description);
}; };
@ -77,7 +80,6 @@ class CfgVehicles {
priority = 2.1; priority = 2.1;
hotkey = "Y"; hotkey = "Y";
}; };
class ACE_UnassignTeam { class ACE_UnassignTeam {
displayName = CSTRING(LeaveTeam); displayName = CSTRING(LeaveTeam);
condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {assignedTeam _target != 'MAIN'}); condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {assignedTeam _target != 'MAIN'});
@ -98,29 +100,29 @@ class CfgVehicles {
icon = PATHTOF(UI\team\team_management_ca.paa); icon = PATHTOF(UI\team\team_management_ca.paa);
hotkey = "J"; hotkey = "J";
}; };
class ACE_GetDown { class ACE_GetDown {
displayName = CSTRING(GetDown); displayName = CSTRING(GetDown);
condition = QUOTE([_target] call DFUNC(canInteractWithCivilian)); condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canInteractWithCivilian));
statement = QUOTE([_target] call DFUNC(getDown)); statement = QUOTE([ARR_2(_player,_target)] call DFUNC(getDown));
showDisabled = 0; showDisabled = 0;
priority = 2.2; priority = 2.2;
}; };
class ACE_SendAway { class ACE_SendAway {
displayName = CSTRING(SendAway); displayName = CSTRING(SendAway);
condition = QUOTE([_target] call DFUNC(canInteractWithCivilian)); condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canInteractWithCivilian));
statement = QUOTE([_target] call DFUNC(sendAway)); statement = QUOTE([ARR_2(_player,_target)] call DFUNC(sendAway));
showDisabled = 0; showDisabled = 0;
priority = 2.0; priority = 2.0;
}; };
class ACE_Pardon { class ACE_Pardon {
displayName = CSTRING(Pardon); displayName = CSTRING(Pardon);
condition = QUOTE(rating _target < -2000 && {alive _target} && {side group _player == side group _target}); condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canPardon));
statement = QUOTE([ARR_3(_target,'{_this addRating -rating _this}',_target)] call DEFUNC(common,execRemoteFnc)); statement = QUOTE([ARR_2(_player,_target)] call DFUNC(pardon));
showDisabled = 0; showDisabled = 0;
priority = 2.5; priority = 2.5;
}; };
}; };
class ACE_Torso { class ACE_Torso {
displayName = CSTRING(Torso); displayName = CSTRING(Torso);
selection = "spine3"; selection = "spine3";
@ -165,12 +167,11 @@ class CfgVehicles {
}; };
class ACE_Weapon { class ACE_Weapon {
displayName = CSTRING(Weapon); displayName = CSTRING(Weapon);
position = QUOTE(call FUNC(getWeaponPos)); position = QUOTE(call DFUNC(getWeaponPos));
distance = 1.50; distance = 1.50;
condition = ""; condition = "";
statement = ""; statement = "";
}; };
class ACE_TapShoulderRight { class ACE_TapShoulderRight {
displayName = CSTRING(TapShoulder); displayName = CSTRING(TapShoulder);
selection = "rightshoulder"; selection = "rightshoulder";
@ -238,7 +239,6 @@ class CfgVehicles {
icon = PATHTOF(UI\team\team_yellow_ca.paa); icon = PATHTOF(UI\team\team_yellow_ca.paa);
hotkey = "Y"; hotkey = "Y";
}; };
class ACE_LeaveTeam { class ACE_LeaveTeam {
displayName = CSTRING(LeaveTeam); displayName = CSTRING(LeaveTeam);
condition = QUOTE(assignedTeam _player != 'MAIN'); condition = QUOTE(assignedTeam _player != 'MAIN');
@ -405,6 +405,7 @@ class CfgVehicles {
}; };
}; };
}; };
class ACE_SelfActions { class ACE_SelfActions {
class ACE_Passengers { class ACE_Passengers {
displayName = CSTRING(Passengers); displayName = CSTRING(Passengers);
@ -414,6 +415,7 @@ class CfgVehicles {
}; };
}; };
}; };
class Tank: LandVehicle { class Tank: LandVehicle {
class ACE_Actions { class ACE_Actions {
class ACE_MainActions { class ACE_MainActions {
@ -429,6 +431,7 @@ class CfgVehicles {
}; };
}; };
}; };
class ACE_SelfActions { class ACE_SelfActions {
class ACE_Passengers { class ACE_Passengers {
displayName = CSTRING(Passengers); displayName = CSTRING(Passengers);
@ -455,6 +458,7 @@ class CfgVehicles {
}; };
}; };
}; };
class ACE_SelfActions { class ACE_SelfActions {
class ACE_Passengers { class ACE_Passengers {
displayName = CSTRING(Passengers); displayName = CSTRING(Passengers);
@ -464,6 +468,7 @@ class CfgVehicles {
}; };
}; };
}; };
class Plane: Air { class Plane: Air {
class ACE_Actions { class ACE_Actions {
class ACE_MainActions { class ACE_MainActions {
@ -479,6 +484,7 @@ class CfgVehicles {
}; };
}; };
}; };
class ACE_SelfActions { class ACE_SelfActions {
class ACE_Passengers { class ACE_Passengers {
displayName = CSTRING(Passengers); displayName = CSTRING(Passengers);
@ -501,7 +507,7 @@ class CfgVehicles {
class ACE_Push { class ACE_Push {
displayName = CSTRING(Push); displayName = CSTRING(Push);
distance = 6; distance = 6;
condition = QUOTE(((getMass _target) <= 2600) && {alive _target} && {(vectorMagnitude (velocity _target)) < 3}); condition = QUOTE(getMass _target <= 2600 && {alive _target} && {vectorMagnitude velocity _target < 3});
statement = QUOTE(_this call FUNC(push)); statement = QUOTE(_this call FUNC(push));
showDisabled = 0; showDisabled = 0;
priority = -1; priority = -1;
@ -514,6 +520,7 @@ class CfgVehicles {
}; };
}; };
}; };
class ACE_SelfActions { class ACE_SelfActions {
class ACE_Passengers { class ACE_Passengers {
displayName = CSTRING(Passengers); displayName = CSTRING(Passengers);
@ -539,6 +546,7 @@ class CfgVehicles {
}; };
}; };
}; };
class ACE_SelfActions { class ACE_SelfActions {
class ACE_Passengers { class ACE_Passengers {
displayName = CSTRING(Passengers); displayName = CSTRING(Passengers);
@ -551,6 +559,7 @@ class CfgVehicles {
class StaticMGWeapon: StaticWeapon {}; class StaticMGWeapon: StaticWeapon {};
class HMG_01_base_F: StaticMGWeapon {}; class HMG_01_base_F: StaticMGWeapon {};
class HMG_01_high_base_F: HMG_01_base_F { class HMG_01_high_base_F: HMG_01_base_F {
class ACE_Actions: ACE_Actions { class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions { class ACE_MainActions: ACE_MainActions {
@ -558,6 +567,7 @@ class CfgVehicles {
}; };
}; };
}; };
class AA_01_base_F: StaticMGWeapon { class AA_01_base_F: StaticMGWeapon {
class ACE_Actions: ACE_Actions { class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions { class ACE_MainActions: ACE_MainActions {
@ -565,6 +575,7 @@ class CfgVehicles {
}; };
}; };
}; };
class AT_01_base_F: StaticMGWeapon { class AT_01_base_F: StaticMGWeapon {
class ACE_Actions: ACE_Actions { class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions { class ACE_MainActions: ACE_MainActions {
@ -581,6 +592,7 @@ class CfgVehicles {
selection = ""; selection = "";
distance = 2; distance = 2;
condition = "true"; condition = "true";
class ACE_OpenBox { class ACE_OpenBox {
displayName = CSTRING(OpenBox); displayName = CSTRING(OpenBox);
condition = QUOTE(alive _target); condition = QUOTE(alive _target);
@ -590,6 +602,7 @@ class CfgVehicles {
}; };
}; };
}; };
class ACE_SelfActions {}; class ACE_SelfActions {};
}; };
@ -602,6 +615,7 @@ class CfgVehicles {
condition = "true"; condition = "true";
}; };
}; };
class ACE_SelfActions {}; class ACE_SelfActions {};
}; };
}; };

View File

@ -1,3 +1,4 @@
#define HSPACE 0.5-2.0/16/2 #define HSPACE 0.5-2.0/16/2
#define VSPACE 0.5-0.3/9/2 #define VSPACE 0.5-0.3/9/2
@ -44,11 +45,13 @@ class ACE_Interaction_Button_Base {
class RscListbox; class RscListbox;
class IGUIBack; class IGUIBack;
class RscText; class RscText;
#define X_OFFSET 0.2 #define X_OFFSET 0.2
class RscACE_SelectAnItem { class RscACE_SelectAnItem {
idd = 8854; idd = 8854;
movingEnable = 0; movingEnable = 0;
class controls { class controls {
class back: IGUIBack { class back: IGUIBack {
x = X_OFFSET; x = X_OFFSET;
@ -139,18 +142,21 @@ class RscInteractionIcon: RscPicture {
w = 2*GUI_GRID_H; w = 2*GUI_GRID_H;
h = 2*GUI_GRID_H; h = 2*GUI_GRID_H;
}; };
class RscInteractionHelperIcon: RscInteractionIcon { class RscInteractionHelperIcon: RscInteractionIcon {
x = 20 * GUI_GRID_W; x = 20 * GUI_GRID_W;
y = 16 * GUI_GRID_H; y = 16 * GUI_GRID_H;
w = GUI_GRID_H; w = GUI_GRID_H;
h = GUI_GRID_H; h = GUI_GRID_H;
}; };
class RscInteractionText: RscText{ class RscInteractionText: RscText{
x = 21 * GUI_GRID_W; x = 21 * GUI_GRID_W;
y = 16 * GUI_GRID_H; y = 16 * GUI_GRID_H;
w = 24 * GUI_GRID_W; w = 24 * GUI_GRID_W;
h = 1.5 * GUI_GRID_H; h = 1.5 * GUI_GRID_H;
}; };
class RscTitles { class RscTitles {
class GVAR(InteractionHelper) { class GVAR(InteractionHelper) {
idd = 9930; idd = 9930;

View File

@ -1,37 +1,52 @@
// by commy2 and esteldunedain // by commy2 and esteldunedain
#include "script_component.hpp" #include "script_component.hpp"
ACE_Modifier = 0; ACE_Modifier = 0;
//SelectLeader Event Handler for BecomeLeader action: ["pardon", {(_this select 0) addRating -rating (_this select 0)}] call EFUNC(common,addEventHandler);
[QGVAR(selectLeader), {
PARAMS_2(_group,_leader); ["getDown", {
_group selectLeader _leader; params ["_target"];
_target setUnitPos "DOWN";
}] call EFUNC(common,addEventHandler); }] call EFUNC(common,addEventHandler);
//Pushing boats from FUNC(push) ["sendAway", {
[QGVAR(pushBoat), { params ["_unit", "_position"];
params ["_boat", "_newVelocity"];
_boat setVelocity _newVelocity;
}] call EFUNC(common,addEventHandler);
_unit setUnitPos "AUTO";
_unit doMove _position;
}] call EFUNC(common,addEventHandler);
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
GVAR(isOpeningDoor) = false; GVAR(isOpeningDoor) = false;
[{_this call FUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler);
["tapShoulder", {
params ["_unit", "_shoulderNum"];
if (_unit == ACE_player) then {
addCamShake [4, 0.5, 5];
};
private "_message";
_message = parseText format ([["%1 &gt;", localize LSTRING(YouWereTappedRight)], ["&lt; %1", localize LSTRING(YouWereTappedLeft)]] select (_shoulderNum == 0));
["displayTextStructured", _message] call EFUNC(common,targetEvent);
}] call EFUNC(common,addEventHandler);
// restore global fire teams for JIP // restore global fire teams for JIP
private ["_team"]; private "_team";
{ {
_team = _x getVariable [QGVAR(assignedFireTeam), ""]; _team = _x getVariable [QGVAR(assignedFireTeam), ""];
if (_team != "") then {_x assignTeam _team}; if (_team != "") then {_x assignTeam _team};
} forEach allUnits; false
} count allUnits;
// add keybinds
// Add keybinds ["ACE3 Common", QGVAR(openDoor), localize LSTRING(OpenDoor), {
["ACE3 Common", QGVAR(openDoor), localize LSTRING(OpenDoor),
{
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
@ -40,18 +55,16 @@ private ["_team"];
// Statement // Statement
call EFUNC(interaction,openDoor); call EFUNC(interaction,openDoor);
true true
}, }, {
{
//Probably don't want any condidtions here, so variable never gets locked down //Probably don't want any condidtions here, so variable never gets locked down
// Statement // Statement
GVAR(isOpeningDoor) = false; GVAR(isOpeningDoor) = false;
true true
}, },
[57, [false, true, false]], false] call cba_fnc_addKeybind; //Key CTRL+Space [57, [false, true, false]], false] call CBA_fnc_addKeybind; //Key CTRL+Space
["ACE3 Common", QGVAR(tapShoulder), localize LSTRING(TapShoulder), ["ACE3 Common", QGVAR(tapShoulder), localize LSTRING(TapShoulder), {
{
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
@ -62,7 +75,7 @@ private ["_team"];
true true
}, },
{false}, {false},
[20, [true, false, false]], false] call cba_fnc_addKeybind; [20, [true, false, false]], false] call CBA_fnc_addKeybind;
["isNotSwimming", {!underwater (_this select 0)}] call EFUNC(common,addCanInteractWithCondition); ["isNotSwimming", {!underwater (_this select 0)}] call EFUNC(common,addCanInteractWithCondition);
["isNotOnLadder", {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState (_this select 0) >> "ACE_isLadder") != 1}] call EFUNC(common,addCanInteractWithCondition); ["isNotOnLadder", {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState (_this select 0) >> "ACE_isLadder") != 1}] call EFUNC(common,addCanInteractWithCondition);

View File

@ -2,37 +2,38 @@
ADDON = false; ADDON = false;
// interaction menu
PREP(addPassengerActions); PREP(addPassengerActions);
PREP(addPassengersActions); PREP(addPassengersActions);
PREP(addSelectableItem); PREP(getWeaponPos);
PREP(applyButtons); PREP(moduleInteraction);
PREP(canBecomeLeader); PREP(removeTag);
// scroll wheel hint
PREP(showMouseHint);
PREP(hideMouseHint);
// interaction with units
PREP(canInteractWithCivilian); PREP(canInteractWithCivilian);
PREP(getDown);
PREP(sendAway);
PREP(canJoinGroup); PREP(canJoinGroup);
PREP(canJoinTeam); PREP(canJoinTeam);
PREP(canTapShoulder); PREP(joinTeam);
PREP(canBecomeLeader);
PREP(doBecomeLeader); PREP(doBecomeLeader);
PREP(canTapShoulder);
PREP(tapShoulder);
PREP(canPardon);
PREP(pardon);
// interaction with doors
PREP(getDoor); PREP(getDoor);
PREP(getDoorAnimations); PREP(getDoorAnimations);
PREP(getDown); PREP(handleScrollWheel);
PREP(getSelectedButton);
PREP(getWeaponPos);
PREP(hideMenu);
PREP(hideMouseHint);
PREP(isInRange);
PREP(joinTeam);
PREP(moduleInteraction);
PREP(moveDown);
PREP(onSelectMenuDblClick);
PREP(openDoor); PREP(openDoor);
PREP(openMenuSelectUI);
PREP(openSelectMenu); // interaction with boats
PREP(prepareSelectMenu);
PREP(push); PREP(push);
PREP(removeTag);
PREP(sendAway);
PREP(showMouseHint);
PREP(sortOptionsByPriority);
PREP(tapShoulder);
ADDON = true; ADDON = true;

View File

@ -14,6 +14,6 @@ class CfgPatches {
#include "CfgEventHandlers.hpp" #include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp" #include "CfgVehicles.hpp"
#include "Menu_Config.hpp" #include "RscTitles.hpp"
#include "ACE_Settings.hpp" #include "ACE_Settings.hpp"
#include "ACE_ZeusActions.hpp" #include "ACE_ZeusActions.hpp"

View File

@ -1,13 +1,13 @@
/* /*
* Author: esteldunedain * Author: esteldunedain
* Mount unit actions inside passenger submenu * Mount unit actions inside passenger submenu.
* *
* Arguments: * Arguments:
* 0: Vehicle <OBJECT> * 0: Vehicle <OBJECT>
* 1: Player <OBJECT> * 1: Player <OBJECT>
* 3: Parameters <ARRAY> * 3: Parameters <ARRAY>
* *
* Return value: * Return Value:
* Children actions <ARRAY> * Children actions <ARRAY>
* *
* Example: * Example:
@ -17,8 +17,8 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
EXPLODE_3_PVT(_this,_vehicle,_player,_parameters); params ["", "", "_parameters"];
EXPLODE_1_PVT(_parameters,_unit); _parameters params ["_unit"];
private ["_varName", "_actionTrees", "_actions"]; private ["_varName", "_actionTrees", "_actions"];
@ -26,11 +26,13 @@ _varName = format [QEGVAR(interact_menu,Act_%1), typeOf _unit];
_actionTrees = missionNamespace getVariable [_varName, []]; _actionTrees = missionNamespace getVariable [_varName, []];
_actions = []; _actions = [];
// Mount unit MainActions menu
// Mount unit MainActions menu
{ {
EXPLODE_2_PVT(_x,_actionData,_children); _x params ["_actionData", "_children"];
_actions pushBack [_actionData, _children, _unit]; _actions pushBack [_actionData, _children, _unit];
} forEach ((_actionTrees select 0) select 1); false
} count (_actionTrees select 0 select 1);
_actions _actions

View File

@ -1,13 +1,13 @@
/* /*
* Author: esteldunedain * Author: esteldunedain
* Create one action per passenger * Create one action per passenger.
* *
* Arguments: * Arguments:
* 0: Vehicle <OBJECT> * 0: Vehicle <OBJECT>
* 1: Player <OBJECT> * 1: Player <OBJECT>
* 3: Parameters <ARRAY> * 3: Parameters <ARRAY>
* *
* Return value: * Return Value:
* Children actions <ARRAY> * Children actions <ARRAY>
* *
* Example: * Example:
@ -17,39 +17,43 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
EXPLODE_3_PVT(_this,_vehicle,_player,_parameters); params ["_vehicle", "_player"];
private ["_actions"]; private "_actions";
_actions = []; _actions = [];
{ {
private ["_unit", "_icon"]; private ["_unit", "_icon"];
_unit = _x; _unit = _x;
if ((_unit != _player) && {(getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "simulation")) != "UAVPilot"}) then {
_icon = switch _unit do { if (_unit != _player && {getText (configFile >> "CfgVehicles" >> typeOf _unit >> "simulation") != "UAVPilot"}) then {
case (driver _vehicle): { QUOTE(A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_driver_ca.paa) }; _icon = [
case (gunner _vehicle): { QUOTE(A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_gunner_ca.paa) }; "",
case (commander _vehicle): { QUOTE(A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_commander_ca.paa) }; "A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_driver_ca.paa",
default { "" }; "A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_gunner_ca.paa",
}; "A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_commander_ca.paa"
] select (([driver _vehicle, gunner _vehicle, commander _vehicle] find _unit) + 1);
if (_unit getVariable [QEGVAR(captives,isHandcuffed), false]) then { if (_unit getVariable [QEGVAR(captives,isHandcuffed), false]) then {
_icon = QUOTE(PATHTOEF(captives,UI\handcuff_ca.paa)); _icon = QUOTE(PATHTOEF(captives,UI\handcuff_ca.paa));
}; };
_actions pushBack
_actions pushBack [
[ [
[ format ["%1", _unit],
str(_unit),
[_unit, true] call EFUNC(common,getName), [_unit, true] call EFUNC(common,getName),
_icon, _icon,
{}, {},
{true}, {true},
{_this call FUNC(addPassengerActions);}, {_this call FUNC(addPassengerActions)},
[_unit] [_unit]
] call EFUNC(interact_menu,createAction), ] call EFUNC(interact_menu,createAction),
[], [],
_unit _unit
]; ];
}; };
} forEach crew _vehicle; false
} count crew _vehicle;
_actions _actions

View File

@ -1,32 +0,0 @@
/*
* Author: Garth de Wet (LH)
* Adds an item to the select menu
*
* Arguments:
* 0: List container <ARRAY/NUMBER>
* 1: Display name <STRING>
* 2: Picture <STRING>
* 3: Data <STRING/CODE>
*
* Return value:
* Container <ARRAY/NUMBER>
*
* Example:
* [actions, "Banana", "UI\dot_ca.paa", "bananaContents"] call ace_interaction_fnc_addSelectableItem
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_4(_container,_displayName,_picture,_data);
if (_picture == "" || _picture == "PictureThing") then {
_picture = QUOTE(PATHTOF(UI\dot_ca.paa));
};
private ["_index"];
_index = lbAdd [_container, _displayName];
lbSetData [_container, _index, str _data];
lbSetPicture [_container, _index, _picture];
_container

View File

@ -1,66 +0,0 @@
/*
* Author: commy2
* Applies buttons
*
* Arguments:
* None
*
* Return value:
* None
*
* Example:
* call ace_interaction_fnc_applyButtons
*
* Public: No
*/
#include "script_component.hpp"
private ["_object", "_actions", "_dlgInteractionDialog", "_ctrlInteractionDialog", "_index", "_ctrlInteractionDialogIcon", "_a", "_action", "_count"];
_object = GVAR(Target);
_actions = GVAR(Buttons);
disableSerialization;
_dlgInteractionDialog = uiNamespace getVariable QGVAR(Dialog);
/*
for "_a" from 0 to (_count - 1) do {
_action = GVAR(Buttons) select _a;
_ctrlInteractionDialog = _dlgInteractionDialog displayCtrl (10 + _a);
_ctrlInteractionDialog ctrlShow true;
_ctrlInteractionDialog ctrlSetText (_action select 0);
_ctrlInteractionDialog ctrlEnable (call (_action select 2));
};
*/
_ctrlInteractionDialog = _dlgInteractionDialog displayCtrl 3;
GVAR(MainButton) = "(findDisplay 1713999) closeDisplay 1;";
if (_object isKindOf "Man") then {
_ctrlInteractionDialog ctrlSetText (if (alive _object) then {name _object} else {_object getVariable ["ACE_Name", "Unknown"]});
} else {
_ctrlInteractionDialog ctrlSetText (getText (configFile >> "CfgVehicles" >> typeOf _object >> "displayName"));
};
for "_index" from 0 to 9 do {
_ctrlInteractionDialog = _dlgInteractionDialog displayCtrl (10 + _index);
_ctrlInteractionDialog ctrlShow true;
_ctrlInteractionDialogIcon = _dlgInteractionDialog displayCtrl (20 + _index);
if (_index < _count) then {
_action = GVAR(Buttons) select _index;
_ctrlInteractionDialog ctrlSetText (_action select 0);
_ctrlInteractionDialog ctrlEnable (call (_action select 2));
_ctrlInteractionDialogIcon ctrlSetText (_action select 5);
} else {
_ctrlInteractionDialog ctrlSetText "";
_ctrlInteractionDialog ctrlEnable false;
_ctrlInteractionDialogIcon ctrlSetText "";
};
};

View File

@ -1,21 +1,20 @@
/* /*
* Author: PabstMirror * Author: PabstMirror
* Test if can Become Leader of group * Test if can Become Leader of group.
* *
* Arguments: * Arguments:
* 0: Target <OBJECT> * 1: Unit <OBJECT>
* 1: Player <OBJECT>
* *
* Return Value: * Return Value:
* Able to become leader of group <BOOL> * Able to become leader of group <BOOL>
* *
* Example: * Example:
* [player, player] call ace_interaction_fnc_canBecomeLeader * [player] call ace_interaction_fnc_canBecomeLeader
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_2(_target,_player); params ["_unit"];
(count (units group _player) > 1) && {leader group _player != _player} count units group _unit > 1 && {leader group _unit != _unit}

View File

@ -1,11 +1,13 @@
/* /*
* Author: commy2 * Author: commy2
* Checks if the player can interact with civilian * Checks if the unit can interact with civilian
* *
* Arguments: * Arguments:
* 0: Target <OBJECT> * 0: Unit <OBJECT>
* 1: Target <OBJECT>
* 2: Target has to be on the civilian side (default: true) <BOOL>
* *
* Return value: * Return Value:
* Able to interact with civilian <BOOL> * Able to interact with civilian <BOOL>
* *
* Example: * Example:
@ -15,10 +17,6 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
EXPLODE_2_PVT(_this,_unit,_isCivilian); params ["_unit", "_target", ["_isCivilian", true]];
if (isNil "_isCivilian") then {_isCivilian = true}; alive _target && [side _target != side _unit, side group _target == civilian] select _isCivilian // return
alive _unit
&& [side _unit != side ACE_player, side group _unit == civilian] select _isCivilian
//&& {count (weapons _unit) == 0}

View File

@ -1,12 +1,12 @@
/* /*
* Author: commy2 * Author: commy2
* Checks if the player can join a group * Checks if the unit can join a group
* *
* Arguments: * Arguments:
* 0: Player <OBJECT> * 0: Unit <OBJECT>
* 1: Target <OBJECT> * 1: Target <OBJECT>
* *
* Return value: * Return Value:
* Able to join a group <BOOL> * Able to join a group <BOOL>
* *
* Example: * Example:
@ -16,9 +16,9 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_2(_unit,_target); params ["_unit", "_target"];
alive _target alive _target
&& {!(_target getVariable ["ACE_isUnconscious", false])} && {!(_target getVariable ["ACE_isUnconscious", false])}
&& {side group _unit == side group _target} && {side group _unit == side group _target}
&& {group _unit != group _target} && {group _unit != group _target} // return

View File

@ -0,0 +1,20 @@
/*
* Author: commy2
* Checks if the unit can pardon the target.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* Unit can pardon target <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_target"];
alive _target
&& {rating _target < -2000}
&& {side group _unit == side group _target}

View File

@ -1,12 +1,12 @@
/* /*
* Author: commy2 * Author: commy2
* Checks if the player can tap a shoulder * Checks if the player can tap a shoulder.
* *
* Arguments: * Arguments:
* 0: Player <OBJECT> * 0: Player <OBJECT>
* 1: Target <OBJECT> * 1: Target <OBJECT>
* *
* Return value: * Return Value:
* Able to tap a shoulder <BOOL> * Able to tap a shoulder <BOOL>
* *
* Example: * Example:
@ -16,9 +16,9 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_2(_unit,_target); params ["_unit", "_target"];
_target isKindOf "CAManBase" && _target isKindOf "CAManBase" &&
{alive _target} && {alive _target} &&
{_unit distance _target < 4} && {_unit distance _target < 4} &&
{!(_target getVariable ["ACE_isUnconscious", false])} {!(_target getVariable ["ACE_isUnconscious", false])} // return

View File

@ -1,21 +1,20 @@
/* /*
* Author: PabstMirror * Author: PabstMirror
* Become Leader of group * Become Leader of group.
* *
* Arguments: * Arguments:
* 0: Target <OBJECT> * 0: Unit <OBJECT>
* 1: Player <OBJECT>
* *
* Return Value: * Return Value:
* None * None
* *
* Example: * Example:
* [player, player] call ace_interaction_fnc_doBecomeLeader * [player] call ace_interaction_fnc_doBecomeLeader
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_2(_target,_player); params ["_unit"];
[QGVAR(selectLeader), (units group _player), [(group _player), _player]] call EFUNC(common,targetEvent); ["selectLeader", units group _unit, [group _unit, _unit]] call EFUNC(common,targetEvent);

View File

@ -1,11 +1,11 @@
/* /*
* Author: commy2 * Author: commy2
* Get door * Find door.
* *
* Arguments: * Arguments:
* 0: Distance <NUMBER> * 0: Distance <NUMBER>
* *
* Return value: * Return Value:
* House objects and door <ARRAY> * House objects and door <ARRAY>
* 0: House <OBJECT> * 0: House <OBJECT>
* 1: Door Name <STRING> * 1: Door Name <STRING>
@ -17,19 +17,18 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_1(_distance); params ["_distance"];
private ["_position0", "_position1", "_intersections", "_count", "_house", "_door"]; private ["_position0", "_position1", "_intersections", "_house", "_door"];
_position0 = positionCameraToWorld [0, 0, 0]; _position0 = positionCameraToWorld [0, 0, 0];
_position1 = positionCameraToWorld [0, 0, _distance]; _position1 = positionCameraToWorld [0, 0, _distance];
_intersections = lineIntersectsWith [ATLToASL _position0, ATLToASL _position1, objNull, objNull, true]; _intersections = lineIntersectsSurfaces [AGLToASL _position0, AGLToASL _position1, cameraOn, objNull, true, 1, "GEOM"];
_count = count _intersections; if (_intersections isEqualTo []) exitWith {[objNull, ""]};
if (_count == 0) exitWith {[objNull, ""]};
_house = _intersections select (_count - 1); _house = _intersections select 0 select 2;
// shithouse is bugged // shithouse is bugged
if (typeOf _house == "") exitWith {[objNull, ""]}; if (typeOf _house == "") exitWith {[objNull, ""]};
@ -37,6 +36,7 @@ if (typeOf _house == "") exitWith {[objNull, ""]};
_intersections = [_house, "GEOM"] intersect [_position0, _position1]; _intersections = [_house, "GEOM"] intersect [_position0, _position1];
_door = _intersections select 0 select 0; _door = _intersections select 0 select 0;
if (isNil "_door") exitWith {[_house, ""]}; if (isNil "_door") exitWith {[_house, ""]};
[_house, _door] [_house, _door]

View File

@ -1,12 +1,12 @@
/* /*
* Author: commy2 * Author: commy2
* Get door animations * Get door animations. @todo rewrite for better custom building support
* *
* Arguments: * Arguments:
* 0: House <OBJECT> * 0: House <OBJECT>
* 1: Door <STRING> * 1: Door <STRING>
* *
* Return value: * Return Value:
* Animation and Locked variable <ARRAY> * Animation and Locked variable <ARRAY>
* 0: Animation <STRING> * 0: Animation <STRING>
* 1: Locked variable <STRING> * 1: Locked variable <STRING>
@ -18,7 +18,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_2(_house,_door); params ["_house", "_door"];
private ["_index", "_animations", "_lockedVariable"]; private ["_index", "_animations", "_lockedVariable"];

View File

@ -1,38 +1,33 @@
/* /*
* Author: KoffeinFlummi * Author: KoffeinFlummi, commy2
* Forces a civilian to the ground (with a chance of failure) * Forces a civilian to the ground with a chance of failure.
* *
* Arguments: * Arguments:
* 0: Unit <OBJECT> * 0: Unit <OBJECT>
* 1: Target <OBJECT>
* *
* Return value: * Return Value:
* None * None
* *
* Example: * Example:
* [target] call ace_interaction_fnc_getDown * [civillian] call ace_interaction_fnc_getDown
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
#define RADIUS 10 #define SEND_RADIUS 10
PARAMS_1(_unit); params ["_unit", "_target"];
private ["_chance", "_x"]; _unit playActionNow "GestureGo";
ACE_player playActionNow "GestureGo"; // put something else here. private "_chance";
_chance = [0.5, 0.8] select (count weapons _unit > 0);
if (count (weapons ACE_player) > 0) then {
_chance = 0.8;
} else {
_chance = 0.5;
};
{ {
if (count (weapons _unit) == 0 and random 1 < _chance) then { if (count weapons _x == 0 && {random 1 < _chance}) then {
[-2, { ["getDown", [_x], [_x]] call EFUNC(common,targetEvent);
_this setUnitPos "DOWN";
}, _x] call CBA_fnc_globalExecute;
}; };
} forEach (_unit nearEntities ["Civilian", RADIUS]); false
} count (_target nearEntities ["Civilian", SEND_RADIUS]);

View File

@ -1,38 +0,0 @@
/*
* Author: commy2
* Get selected button
*
* Arguments:
* None
*
* Return value:
* Angle <NUMBER>
*
* Example:
* call ace_interaction_fnc_getSelectedButton
*
* Public: No
*/
#include "script_component.hpp"
#define MIN_DISTANCE 0.0065
private ["_position", "_distance", "_angle"];
_position = uiNamespace getVariable [QGVAR(CursorPosition), [0.5, 0.5, 0]];
_position = [((_position select 1) - 0.5) / safezoneH, ((_position select 2) - 0.5) / safezoneW, 0];
_distance = [0, 0, 0] vectorDistanceSqr _position;
// is in center
if (_distance < MIN_DISTANCE) exitWith {-1};
_angle = (_position select 0) atan2 (_position select 1);
// rotate circle
_angle = 180 - _angle + 360 / 10 / 2;
if (_angle < 0) then {_angle = _angle + 360};
_angle = floor (_angle / 360 * 10);
if (_angle == 10) then {0} else {_angle}

View File

@ -0,0 +1,23 @@
/*
* Author: commy2
* Handles incremental door opening
*
* Arguments:
* 0: scroll amount <NUMBER>
*
* Return Value:
* handled <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
params ["_scroll"];
if !(GVAR(isOpeningDoor)) exitWith {false};
GVAR(doorTargetPhase) = ((GVAR(doorTargetPhase) + (_scroll / (1.2 * 12))) max 0) min 1;
GVAR(usedScrollWheel) = true;
true

View File

@ -1,22 +0,0 @@
/*
* Author: Garth de Wet (LH)
* Closes the Interaction menu
*
* Arguments:
* None
*
* Return value:
* None
*
* Example:
* call ace_interaction_fnc_hideMenu
*
* Public: No
*/
#include "script_component.hpp"
closeDialog 0;
(findDisplay 1713999) closeDisplay 1;
(uiNameSpace getVariable QGVAR(Flow_Display)) closeDisplay 0;
GVAR(MainButton) = nil;
call FUNC(hideMouseHint);

View File

@ -1,53 +0,0 @@
/*
* Author: commy2
* Check if the vehicle is in range of the player.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Distance in meters <NUMBER>
*
* Return value:
* Vehicle in range of player <BOOL>
*
* Example:
* [target, 5] call ace_interaction_fnc_isInRange
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_vehicle,_distance);
private ["_player", "_position0", "_position1"];
_player = ACE_player;
if (_vehicle isKindOf "Man") exitWith {_player distance _vehicle < _distance};
private ["_position0", "_position1"];//, "_direction"];
_position0 = getPosASL _player;
_position1 = getPosASL _vehicle;
/*
_direction = _position1 vectorDiff _position0;
_direction = _direction vectorMultiply (_distance / (vectorMagnitude _direction));
_position0 = eyePos _player;
_position1 = _position0 vectorAdd _direction;
_vehicle in lineIntersectsWith [_position0, _position1] || {_player distance _vehicle < _distance}
*/
_position0 = ATLToASL positionCameraToWorld [0, 0, 0];
_position0 set [2, (_position0 select 2) - (getTerrainHeightASL _position0 min 0)];
_position1 = ATLToASL positionCameraToWorld [0, 0, _distance];
_position1 set [2, (_position1 select 2) - (getTerrainHeightASL _position1 min 0)];
if (_vehicle in lineIntersectsWith [_position0, _position1] || {_player distance _vehicle < _distance}) then {
true
} else {
["Not in Range"] call FUNC(addToTooltip);
false
}

View File

@ -1,35 +1,39 @@
/* /*
* Author: commy2 * Author: commy2
* Assigns a unit to the team * Unit joins a fire team.
* *
* Arguments: * Arguments:
* 0: Unit <OBJECT> * 0: Unit <OBJECT>
* 1: Team <STRING> * 1: Team <STRING>
* *
* Return value: * Return Value:
* None * None
* *
* Example: * Example:
* [target, "YELLOW"] call ace_interaction_fnc_joinTeam * [player, "YELLOW"] call ace_interaction_fnc_joinTeam
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_2(_unit,_team); params ["_unit", "_team"];
private ["_message"];
// make sure correct team is set on JIP
_unit setVariable [QGVAR(assignedFireTeam), _team, true]; _unit setVariable [QGVAR(assignedFireTeam), _team, true];
[_unit, format ["{_this assignTeam '%1'}", _team]] call EFUNC(common,execRemoteFnc);
// join fire team on every machine in that group
["assignTeam", units group _unit, [_unit, _team]] call EFUNC(common,targetEvent);
// display message
if (_unit == ACE_player) then { if (_unit == ACE_player) then {
_message = if (_team == "MAIN") then { private "_message";
localize LSTRING(LeftTeam);
if (_team == "MAIN") then {
_message = localize LSTRING(LeftTeam);
} else { } else {
_team = localize format [LSTRING(Team%1), _team]; _team = localize format [LSTRING(Team%1), _team];
format [localize LSTRING(JoinedTeam), _team]; _message = format [localize LSTRING(JoinedTeam), _team];
}; };
[_message] call EFUNC(common,displayTextStructured); ["displayTextStructured", _message] call EFUNC(common,localEvent);
}; };

View File

@ -1,13 +1,13 @@
/* /*
* Author: bux578 * Author: bux578
* Initializes the Interaction module * Initializes the Interaction module.
* *
* Arguments: * Arguments:
* 0: Logic <NUMBER> * 0: Logic <NUMBER>
* 1: ??? * 1: Units <ARRAY>
* 2: Activation State <BOOL> * 2: Activation State <BOOL>
* *
* Return value: * Return Value:
* None * None
* *
* Example: * Example:
@ -17,10 +17,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_logic", "_activated"]; params ["_logic", "", "_activated"];
_logic = _this select 0;
_activated = _this select 2;
if !(_activated) exitWith {}; if !(_activated) exitWith {};

View File

@ -1,67 +0,0 @@
/*
* Author: Garth de Wet (LH)
* Scrolls through the list down or up
*
* Arguments:
* 0: Amount <NUMBER>
*
* Return value:
* None
*
* Example:
* [2] call ace_interaction_fnc_moveDown
*
* Public: No
*/
#include "script_component.hpp"
private ["_count", "_player", "_vehicle", "_dlgInteractionDialog", "_top", "_i", "", "_ctrl", "_index", "_action", "_color", "_current", "_infoText", "_target"];
#define CLAMP(x,low,high) (if(x > high)then{high}else{if(x < low)then{low}else{x}})
if (isNil QGVAR(MainButton)) exitWith{};
if (isNil QGVAR(Buttons)) exitWith{};
_count = (count GVAR(Buttons))- 1;
GVAR(SelectedButton) = CLAMP(GVAR(SelectedButton) + _this, 0, _count);
_target = GVAR(Target);
_player = ACE_player;
_vehicle = vehicle _player;
disableSerialization;
_dlgInteractionDialog = uiNamespace getVariable QGVAR(Flow_Display);
_top = GVAR(SelectedButton) - 2;
_i = 0;
while {_i <= 4} do {
_index =_i + _top;
_ctrl = _dlgInteractionDialog displayCtrl (1200 + _i);
if (_index >= 0 && {_index <= _count}) then {
_action = GVAR(Buttons) select _index;
_ctrl ctrlShow true;
_ctrl ctrlSetText (_action select 5);
_color = [1,1,1,1];
if !([_target, _player] call (_action select 2)) then {
_color = [0.3,0.3,0.3,0.8];
};
if (_i == 0 || _i == 4) then {
_color set [3, 0.5];
};
if (_i == 1 || _i == 3) then {
_color set [3, 0.75];
};
_ctrl ctrlSetTextColor _color;
}else{
_ctrl ctrlShow false;
};
_i = _i + 1;
};
_ctrl = _dlgInteractionDialog displayCtrl 1000;
_ctrl ctrlSetText ((GVAR(Buttons) select GVAR(SelectedButton)) select 0);
_ctrl = _dlgInteractionDialog displayCtrl 1100;
_current = (GVAR(Buttons) select GVAR(SelectedButton));
_infoText = "";
if !([_target, _player] call (_current select 2)) then {
_infoText = "Unavailable";
};
_ctrl ctrlSetText _infoText;
_ctrl ctrlShow (_infoText != "");

View File

@ -1,44 +0,0 @@
/*
* Author: commy2
* On button up
*
* Arguments:
* None
*
* Return value:
* None
*
* Example:
* call ace_interaction_fnc_onButtonUp
*
* Public: No
*/
#include "script_component.hpp"
private ["_player", "_vehicle", "_target", "_count", "_index", "_action", "_statement", "_condition", "_conditionShow", "_distance"];
_player = ACE_player;
_vehicle = vehicle _player;
_target = [GVAR(Target), _player] select (GVAR(MenuType) % 2 == 1);
_count = count GVAR(Buttons);
_index = call FUNC(getSelectedButton);
_action = if (_index != -1 && {_index < _count}) then {
GVAR(Buttons) select _index
} else {
["", {}, {false}, 0, [], "", "", {false}, [], 0]
};
(findDisplay 1713999) closeDisplay 1;
closeDialog 0;
_statement = _action select 1;
_condition = _action select 2;
_conditionShow = _action select 7;
_distance = _action select 9;
if ((_distance == 0 || {[GVAR(Target), _distance] call FUNC(isInRange)}) && {[_target, _player] call _condition} && {[_target, _player] call _conditionShow}) then {
[_target, _player] call _statement;
};

View File

@ -1,57 +0,0 @@
/*
* Author: commy2
* On click
*
* Arguments:
* Index <NUMBER>
*
* Return value:
* None
*
* Example:
* 5 call ace_interaction_fnc_onClick
*
* Public: No
*/
#include "script_component.hpp"
private ["_player", "_vehicle", "_target", "_count", "_index", "_action", "_subMenu", "_statement", "_condition", "_conditionShow", "_distance"];
_player = ACE_player;
_vehicle = vehicle _player;
_target = [GVAR(Target), _player] select (GVAR(MenuType) % 2 == 1);
_count = count GVAR(Buttons);
_index = _this;
_action = if (_index != -1 && {_index < _count}) then {
GVAR(Buttons) select _index
} else {
["", {}, {false}, 0, [], "", "", {false}, [], 0]
};
_subMenu = _action select 4;
// back
if (_index == -1) exitWith {
call GVAR(MainButton);
};
if (count _subMenu < 2) then {
(findDisplay 1713999) closeDisplay 1;
closeDialog 0;
_statement = _action select 1;
_condition = _action select 2;
_conditionShow = _action select 7;
_distance = _action select 9;
if ((_distance == 0 || {[GVAR(Target), _distance] call FUNC(isInRange)}) && {[_target, _player] call _condition} && {[_target, _player] call _conditionShow}) then {
[_target, _player] call _statement;
};
} else {
if (_subMenu select 1 < 1) then {
[_subMenu select 0] call FUNC(openSubMenu);
} else {
[_subMenu select 0] call FUNC(openSubMenuSelf);
};
};

View File

@ -1,18 +0,0 @@
/*
* Author: CorruptedHeart, commy2
* On select menu double click
*
* Arguments:
* None
*
* Return value:
* None
*
* Example:
* call ace_interaction_fnc_onSelectMenuDblClick
*
* Public: No
*/
#include "script_component.hpp"
call compile (lbData [8866, lbCurSel 8866]) call GVAR(SelectAccept);

View File

@ -1,12 +1,12 @@
/* /*
* Author: commy2 * Author: commy2
* Opens door * Open door.
* *
* Arguments: * Arguments:
* 0: House <OBJECT> * 0: House <OBJECT>
* 1: Door <STRING> * 1: Door <STRING>
* *
* Return value: * Return Value:
* None * None
* *
* Example: * Example:
@ -16,56 +16,56 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_info", "_phase", "_position", "_time", "_usedMouseWheel", "_getDoorAnimations"]; private "_info";
_info = [MACRO_DOOR_REACH_DISTANCE] call FUNC(getDoor); _info = [MACRO_DOOR_REACH_DISTANCE] call FUNC(getDoor);
EXPLODE_2_PVT(_info,_house,_door); _info params ["_house", "_door"];
if (isNull _house) exitWith {}; if (isNull _house) exitWith {};
private "_getDoorAnimations";
_getDoorAnimations = [_house, _door] call FUNC(getDoorAnimations); _getDoorAnimations = [_house, _door] call FUNC(getDoorAnimations);
EXPLODE_2_PVT(_getDoorAnimations,_animations,_lockedVariable); _getDoorAnimations params ["_animations", "_lockedVariable"];
if (count _animations == 0) exitWith {}; if (_animations isEqualTo []) exitWith {};
if (_house animationPhase (_animations select 0) <= 0 && {_house getVariable [_lockedVariable select 0, 0] == 1}) exitWith { if (_house animationPhase (_animations select 0) <= 0 && {_house getVariable [_lockedVariable select 0, 0] == 1}) exitWith {
_lockedVariable set [0, _house]; _lockedVariable set [0, _house];
_lockedVariable spawn compile preprocessFileLineNumbers "\A3\Structures_F\scripts\LockedDoor_open.sqf"; _lockedVariable call BIS_fnc_LockedDoorOpen;
}; };
GVAR(isOpeningDoor) = true;
playSound "ACE_Sound_Click"; // @todo replace with smth. more fitting playSound "ACE_Sound_Click"; // @todo replace with smth. more fitting
[_house, _animations] spawn { GVAR(doorTargetPhase) = _house animationPhase (_animations select 0);
private ["_house", "_animations", "_phase", "_position", "_time", "_usedMouseWheel"]; GVAR(isOpeningDoor) = true;
_house = _this select 0; GVAR(usedScrollWheel) = false;
_animations = _this select 1;
_phase = _house animationPhase (_animations select 0); [{
_position = getPosASL ACE_player; (_this select 0) params ["_house", "_animations", "_position", "_time", "_frame"];
_time = ACE_time + 0.2; if !(GVAR(isOpeningDoor)) exitWith {
_usedMouseWheel = false; [_this select 1] call CBA_fnc_removePerFrameHandler;
waitUntil {
if (inputAction "PrevAction" > 0 || {inputAction "NextAction" > 0}) then {
_usedMouseWheel = true;
};
_phase = _phase + (inputAction "PrevAction" / 12) min 1; // didn't use incremental opening. Just do animation normally.
_phase = _phase - (inputAction "NextAction" / 12) max 0; if !(GVAR(usedScrollWheel)) then {
private "_phase";
{_house animate [_x, _phase]} forEach _animations;
!GVAR(isOpeningDoor) || {getPosASL ACE_player distance _position > 1}
};
if (!_usedMouseWheel && {ACE_time < _time} && {[ACE_player, objNull, []] call EFUNC(common,canInteractWith)}) then {
_phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5); _phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5);
{_house animate [_x, _phase]} forEach _animations; {_house animate [_x, _phase]; false} count _animations;
};
}; };
// check if player moved too far away
if (getPosASL ACE_player distance _position > 1) exitWith {
GVAR(isOpeningDoor) = false; GVAR(isOpeningDoor) = false;
}; };
// this allows for holding the door in it's current state.
if (ACE_time > _time && {diag_frameno > _frame}) then {
GVAR(usedScrollWheel) = true;
};
// do incremental door opening
{_house animate [_x, GVAR(doorTargetPhase)]; false} count _animations;
}, 0.1, [_house, _animations, getPosASL ACE_player, ACE_time + 0.2, diag_frameno + 2]] call CBA_fnc_addPerFrameHandler;

View File

@ -1,57 +0,0 @@
/*
* Author: commy2
* Opens menu select UI
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Vehicle <OBJECT>
*
* Return value:
* None
*
* Example:
* [unit, vehicle] call ace_interaction_fnc_openMenuSelectUI
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_vehicle);
private ["_cargo", "_actions"];
// Allow interaction with all cargo slots and all FFV slots
_cargo = [_vehicle, ["cargo", "ffv"], true] call EFUNC(common,getVehicleCrew);
// You can only interact if you are in cargo or FFV yourself. exit otherwise
if !(_unit in _cargo) exitWith {};
GVAR(InteractionMenu_Crew) = _cargo;
// Prepare: add header and "OK" button to select menu
_actions = [localize LSTRING(InteractionMenu), localize LSTRING(Interact)] call FUNC(prepareSelectMenu);
// Prepare: add all cargo units as options to select menu
{
if (_x != _unit) then {
_actions = [
_actions,
[_x] call EFUNC(common,getName),
QUOTE(PATHTOF(UI\dot_ca.paa)),
_forEachIndex
] call FUNC(addSelectableItem);
};
} forEach _cargo;
// Open select menu
[
_actions,
{
call FUNC(hideMenu);
[0, GVAR(InteractionMenu_Crew) select _this, ""] spawn FUNC(showMenu);
GVAR(InteractionMenu_Crew) = nil;
},
{
call FUNC(hideMenu);
}
] call FUNC(openSelectMenu);

View File

@ -1,49 +0,0 @@
/*
* Author: Garth de Wet (LH)
* Opens the select menu UI and sets up the UI
*
* Arguments:
* 0: Items <ARRAY>
* 0: Text <STRING>
* 1: Statement to execute <CODE>
* 2: Condition before execute <CODE>
* 3: showDisabled <BOOL>
* 4: Priority <NUMBER>
* 5: Icon <STRING>
* 6: Extra variables passed to the code <ARRAY>
* 1: Select Action <CODE>
* 2: Cancel Action <CODE>
*
* Return value:
* None
*
* Example:
* [["text", {statement}, {condition}, showDisabled, priority, "icon", [variables]], {selectAction}, {cancelAction}] call ace_interaction_fnc_openSelectMenu
*
* Public: No
*/
#include "script_component.hpp"
private["_action", "_count", "_customActions", "_i"];
if (!(profileNamespace getVariable [QGVAR(FlowMenu), false])) then {
GVAR(SelectAccept) = _this select 1;
GVAR(SelectCancel) = _this select 2;
buttonSetAction [8855, QUOTE( call GVAR(SelectCancel); )]; // Cancel
buttonSetAction [8860, QUOTE( (call compile (lbData [ARR_2(8866, lbCurSel 8866)])) call GVAR(SelectAccept); )]; // Accept
lbSetCurSel [8866, 0];
}else{
PARAMS_1(_customActions);
private ["_count", "_action"];
_count = count _customActions;
if (_count == 0) exitWith {};
_customActions call FUNC(sortOptionsByPriority);
for "_i" from 0 to _count -1 do {
_action = _customActions select _i;
_action set [1, (_this select 1)];
};
GVAR(Buttons) = _customActions;
[(_this select 2), true, true, false, ACE_player] call FUNC(initialiseInteraction);
};

View File

@ -0,0 +1,18 @@
/*
* Author: commy2
* Unit pardons target unit.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
params ["", "_target"];
["pardon", [_target], [_target]] call EFUNC(common,targetEvent);

View File

@ -1,33 +0,0 @@
/*
* Author: Garth de Wet (LH)
* Prepares the select menu for use
*
* Arguments:
* 0: Header Text <STRING>
* 1: Approve Button Text <STRING>
*
* Return value:
* Container object <NUMBER>
*
* Example:
* array = ["Select Explosive", "Place"] call ace_interaction_fnc_prepareSelectMenu
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_header,_buttonText);
closeDialog 0;
if (isNil "_buttonText" or {_buttonText == ""}) then {
_buttonText = localize LSTRING(MakeSelection);
};
createDialog "RscACE_SelectAnItem";
ctrlSetText [8860, _buttonText];
ctrlSetText [8870, _header];
lbClear 8866;
8866

View File

@ -4,7 +4,7 @@
* *
* Arguments: * Arguments:
* 0: Boat <OBJECT> * 0: Boat <OBJECT>
* 1: Player <OBJECT> * 1: Unit <OBJECT>
* *
* Return Value: * Return Value:
* None * None
@ -14,13 +14,13 @@
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_boat", "_player"]; params ["_boat", "_unit"];
private ["_newVelocity"]; private "_newVelocity";
_newVelocity = vectorDir _unit;
_newVelocity set [2, 0.25];
_newVelocity = _newVelocity vectorMultiply 2;
_newVelocity = [2 * (vectorDir _player select 0), 2 * (vectorDir _player select 1), 0.5]; ["setVelocity", [_boat], [_boat, _newVelocity]] call EFUNC(common,targetEvent);
[QGVAR(pushBoat), [_boat], [_boat, _newVelocity]] call EFUNC(common,targetEvent);

View File

@ -1,40 +1,37 @@
/* /*
* Author: KoffeinFlummi * Author: KoffeinFlummi, commy2
* Sends a civilian crowd away with a chance of failure * Sends a near civilian crowd away with a chance of failure.
* *
* Arguments: * Arguments:
* 0: Unit <OBJECT> * 0: Unit <OBJECT>
* *
* Return value: * Return Value:
* None * None
* *
* Example: * Example:
* [target] call ace_interaction_fnc_sendAway * [civillian] call ace_interaction_fnc_sendAway
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
#define DISTANCE 50 #define SEND_DISTANCE 50
#define RADIUS 10 #define SEND_RADIUS 10
PARAMS_1(_unit); params ["_unit"];
private ["_chance", "_x"]; _unit playActionNow "GestureGo";
ACE_player playActionNow "GestureGo"; private "_chance";
_chance = [0.5, 0.8] select (count weapons _unit > 0);
if (count weapons ACE_player > 0) then {
_chance = 0.8;
} else {
_chance = 0.5;
};
{ {
if (count (weapons _unit) == 0 and random 1 < _chance) then { if (count weapons _x == 0 && {random 1 < _chance}) then {
[-2, { private "_position";
(_this select 0) setUnitPos "AUTO"; _position = getPosASL _unit vectorAdd (eyeDirection _unit vectorMultiply SEND_DISTANCE);
(_this select 0) doMove [(getPos (_this select 0) select 0) + DISTANCE * (eyeDirection (_this select 1) select 0), (getPos (_this select 0) select 1) + DISTANCE * (eyeDirection (_this select 1) select 1), 0]; _position set [2, 0];
}, [_x, ACE_player]] call CBA_fnc_globalExecute;
["sendAway", [_x], [_x, _position]] call EFUNC(common,targetEvent);
}; };
} forEach (_unit nearEntities ["Civilian", RADIUS]); false
} count (_unit nearEntities ["Civilian", SEND_RADIUS]);

View File

@ -1,35 +0,0 @@
/*
* Author: commy2
* Sort options by priority
*
* Arguments:
* Actions <ARRAY>
*
* Return value:
* None
*
* Example:
* customActions call ace_interaction_fnc_sortOptionsByPriority
*
* Public: No
*/
#include "script_component.hpp"
private ["_actions", "_count", "_index", "_actionN", "_actionM"];
_actions = _this;
_count = count _actions;
_index = 0;
while {_index < _count - 1} do {
_actionN = + _actions select _index;
_actionM = + _actions select (_index + 1);
if (_actionN select 3 < _actionM select 3) then {
_actions set [_index, _actionM];
_actions set [_index + 1, _actionN];
_index = 0;
} else {
_index = _index + 1;
};
};

View File

@ -3,38 +3,26 @@
* Taps a shoulder * Taps a shoulder
* *
* Arguments: * Arguments:
* 0: Player <OBJECT> * 0: Unit <OBJECT>
* 1: Target <OBJECT> * 1: Target <OBJECT>
* 2: Shoulder which was tapped <NUMBER> * 2: Shoulder which was tapped [0: left, 1: right] <NUMBER>
* *
* Return value: * Return Value:
* None * None
* *
* Example: * Example:
* [player, target] call ace_interaction_fnc_tapShoulder * [player, target, 0] call ace_interaction_fnc_tapShoulder
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_3(_tapper,_target,_shoulderNum); params ["_unit", "_target", "_shoulderNum"];
if (_target != ACE_player) exitWith { if (_unit == ACE_player) then {
addCamShake [4, 0.5, 5]; addCamShake [4, 0.5, 5];
ACE_player playActionNow "PutDown";
if !(local _target) then {
[[_tapper, _target, _shoulderNum], QUOTE(DFUNC(tapShoulder)), _target] call EFUNC(common,execRemoteFnc);
};
}; };
addCamShake [4, 0.5, 5]; _unit playActionNow "PutDown";
private ["_message"]; ["tapShoulder", [_target], [_target, _shoulderNum]] call EFUNC(common,targetEvent);
//localize is converting the escaped <> symbols, so just add them here instead of in the stringtable
if (_shoulderNum == 0) then {
_message = format ["%1 &gt;", (localize LSTRING(YouWereTappedRight))];
} else {
_message = format ["&lt; %1", (localize LSTRING(YouWereTappedLeft))];
};
[parseText _message] call EFUNC(common,displayTextStructured);

View File

@ -1,33 +0,0 @@
/*
* Author: commy2
* Updates tooltip's position
*
* Arguments:
* 0: Tooltip Display <NUMBER>
* 1: X Coordinate <NUMBER>
* 2: Y Coordinate <NUMBER>
*
* Return value:
* None
*
* Example:
* [player, 0.5, 0.5] call ace_interaction_fnc_updateTooltipPosition
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_3(_tooltip,_coordinateX,_coordinateY);
private["_ctrl"];
disableSerialization;
_ctrl = ctrlParent _tooltip displayCtrl 40;
_ctrl ctrlSetPosition [
_coordinateX + 0.01 * safezoneW,
_coordinateY + 0.01 * safezoneH,
2.0 / 16 * safezoneW,
0.3 / 9 * safezoneH
];
_ctrl ctrlCommit 0;

View File

@ -99,6 +99,11 @@
#define ACE_isHC (!hasInterface && !isDedicated) #define ACE_isHC (!hasInterface && !isDedicated)
//By default CBA's TRACE/LOG/WARNING spawn a buffer, which can cause messages to be logged out of order:
#ifdef CBA_DEBUG_SYNCHRONOUS
#define CBA_fnc_log { params ["_file","_lineNum","_message"]; diag_log [diag_frameNo, diag_tickTime, time, _file + ":"+str(_lineNum + 1), _message]; }
#endif
#define ACE_LOG(module,level,message) diag_log text ACE_LOGFORMAT(module,level,message) #define ACE_LOG(module,level,message) diag_log text ACE_LOGFORMAT(module,level,message)
#define ACE_LOGFORMAT(module,level,message) FORMAT_2(QUOTE([ACE] (module) %1: %2),level,message) #define ACE_LOGFORMAT(module,level,message) FORMAT_2(QUOTE([ACE] (module) %1: %2),level,message)

View File

@ -12,11 +12,9 @@
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_setting", "_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"]; private ["_setting", "_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList", "_xVehicle"];
params [["_logic", objNull, [objNull]]]; params [["_logic", objNull, [objNull]]];
if (!isNull _logic) then { if (!isNull _logic) then {
@ -44,7 +42,9 @@ if (!isNull _logic) then {
if (!isnil "_x") then { if (!isnil "_x") then {
if (typeName _x == typeName objNull) then { if (typeName _x == typeName objNull) then {
if (local _x) then { if (local _x) then {
_x setvariable [QGVAR(medicClass), _setting, true]; _xVehicle = vehicle _x;
TRACE_3("setting medical vehicle", _x, _xVehicle, (typeOf _xVehicle));
_xVehicle setvariable [QGVAR(medicClass), _setting, true];
}; };
}; };
}; };
@ -54,6 +54,7 @@ if (!isNull _logic) then {
if (!isnil "_x") then { if (!isnil "_x") then {
if (typeName _x == typeName objNull) then { if (typeName _x == typeName objNull) then {
if (local _x) then { if (local _x) then {
TRACE_2("setting medical vehicle", _x, (typeOf _x));
_x setvariable [QGVAR(medicClass), _setting, true]; _x setvariable [QGVAR(medicClass), _setting, true];
}; };
}; };

View File

@ -21,6 +21,11 @@
#define DEFAULT_DELAY (round(random(10)+5)) #define DEFAULT_DELAY (round(random(10)+5))
// only run this after the settings are initialized
if !(EGVAR(common,settingsInitFinished)) exitWith {
EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(setUnconscious), _this];
};
private ["_animState", "_originalPos", "_startingTime", "_isDead"]; private ["_animState", "_originalPos", "_startingTime", "_isDead"];
params ["_unit", ["_set", true], ["_minWaitingTime", DEFAULT_DELAY], ["_force", false]]; params ["_unit", ["_set", true], ["_minWaitingTime", DEFAULT_DELAY], ["_force", false]];

View File

@ -1,6 +1,6 @@
class Extended_PostInit_EventHandlers { class Extended_PostInit_EventHandlers {
class ADDON { class ADDON {
clientInit = QUOTE(call COMPILE_FILE(XEH_post_initClient)); init = QUOTE(call COMPILE_FILE(XEH_postInit));
serverInit = QUOTE(call COMPILE_FILE(XEH_post_initServer));
}; };
}; };

View 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);

View File

@ -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);

View File

@ -1,6 +0,0 @@
// by commy2
#include "script_component.hpp"
addMissionEventHandler ["HandleDisconnect", {
[_this select 0, "isPlayer"] call EFUNC(common,unmuteUnit);
}];

View File

@ -1,3 +1,4 @@
class ACE_Settings { class ACE_Settings {
class GVAR(SavePreDeathGear) { class GVAR(SavePreDeathGear) {
value = 0; value = 0;

View File

@ -1,3 +1,4 @@
class CfgAddons { class CfgAddons {
class GVAR(Rallypoints) { class GVAR(Rallypoints) {
list[] = {"ACE_Rallypoint_West", "ACE_Rallypoint_East", "ACE_Rallypoint_Independent", "ACE_Rallypoint_West_Base", "ACE_Rallypoint_East_Base", "ACE_Rallypoint_Independent_Base"}; list[] = {"ACE_Rallypoint_West", "ACE_Rallypoint_East", "ACE_Rallypoint_Independent", "ACE_Rallypoint_West_Base", "ACE_Rallypoint_East_Base", "ACE_Rallypoint_Independent_Base"};

View File

@ -1,3 +1,4 @@
class CfgVehicleClasses { class CfgVehicleClasses {
class GVAR(Rallypoints) { class GVAR(Rallypoints) {
displayName = CSTRING(EditorCategory); displayName = CSTRING(EditorCategory);

View File

@ -1,3 +1,4 @@
class CfgVehicles { class CfgVehicles {
class ACE_Module; class ACE_Module;
class ACE_ModuleRespawn: ACE_Module { class ACE_ModuleRespawn: ACE_Module {
@ -6,7 +7,7 @@ class CfgVehicles {
displayName = CSTRING(Module_DisplayName); displayName = CSTRING(Module_DisplayName);
function = QFUNC(module); function = QFUNC(module);
scope = 2; scope = 2;
isGlobal = 1; isGlobal = 0;
icon = QUOTE(PATHTOF(UI\Icon_Module_Respawn_ca.paa)); icon = QUOTE(PATHTOF(UI\Icon_Module_Respawn_ca.paa));
class Arguments { class Arguments {
@ -24,6 +25,7 @@ class CfgVehicles {
defaultValue = 1; defaultValue = 1;
}; };
}; };
class ModuleDescription { class ModuleDescription {
description = CSTRING(Module_Description); description = CSTRING(Module_Description);
}; };

View File

@ -13,7 +13,6 @@ PREP(moduleFriendlyFire);
PREP(moduleRallypoint); PREP(moduleRallypoint);
PREP(moveRallypoint); PREP(moveRallypoint);
PREP(removeBody); PREP(removeBody);
PREP(removeDisconnectedPlayer);
PREP(restoreGear); PREP(restoreGear);
PREP(showFriendlyFireMessage); PREP(showFriendlyFireMessage);
PREP(teleportToRallypoint); PREP(teleportToRallypoint);

View File

@ -1,33 +1,30 @@
/* /*
Name: ACE_Respawn_fnc_canMoveRallypoint * Author: commy2
* Checks if a unit can move a rally point.
Author(s): *
commy2 * Arguments:
* 0: Unit <OBJECT>
Description: * 1: Side <SIDE>
checks if a unit can move a rally point *
* Return Value:
Parameters: * Can move <BOOL>
0: OBJECT - unit *
1: OBJECT - side * Example:
* [ACE_Player, side ACE_Player] call ace_respawn_fnc_canMoveRallypoint
Returns: *
BOOLEAN * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_unit", "_side"]; params ["_unit", "_side"];
_unit = _this select 0; // player has to be a rallypoint mover. group leader by default
_side = _this select 1; if !(_unit getVariable ["ACE_canMoveRallypoint", false]) exitWith {false};
// rallypoint names are defined in CfgVehicles.hpp // rallypoint of that side has to exist
!isNull ([
_unit getVariable ["ACE_canMoveRallypoint", false]
&& {!isNull ([
objNull, objNull,
missionNamespace getVariable ["ACE_Rallypoint_West", objNull], missionNamespace getVariable ["ACE_Rallypoint_West", objNull],
missionNamespace getVariable ["ACE_Rallypoint_East", objNull], missionNamespace getVariable ["ACE_Rallypoint_East", objNull],
missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull] missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]
] select ([west, east, independent] find _side) + 1)} ] select ([west, east, independent] find _side) + 1) // return

View File

@ -1,26 +1,39 @@
// by commy2 /*
// execute on server only! * Author: commy2
* Handle XEH Init Post on Server.
* Execution on server only.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [ACE_Player] call ace_respawn_fnc_handleInitPostServer
*
* Public: No
*/
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_1(_unit); params ["_unit"];
private ["_group0", "_rallypoint"]; private ["_groupUnit", "_rallypoint", "_leaderVarName"];
_group0 = group _unit; // _group-is a reserved veriable and shouldn't be used _groupUnit = group _unit; // _group is a reserved veriable and shouldn't be used
_rallypoint = [ _rallypoint = [
objNull, objNull,
missionNamespace getVariable ["ACE_Rallypoint_West", objNull], missionNamespace getVariable ["ACE_Rallypoint_West", objNull],
missionNamespace getVariable ["ACE_Rallypoint_East", objNull], missionNamespace getVariable ["ACE_Rallypoint_East", objNull],
missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull] missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]
] select ([west, east, independent] find side _group0) + 1; ] select ([west, east, independent] find side _groupUnit) + 1;
// exit if no moveable rallypoint is placed for that side // exit if no moveable rallypoint is placed for that side
if (isNull _rallypoint) exitWith {}; if (isNull _rallypoint) exitWith {};
// find leader // find leader
private "_leaderVarName"; _leaderVarName = _groupUnit getVariable [QGVAR(leaderVarName), ""];
_leaderVarName = _group0 getVariable [QGVAR(leaderVarName), ""];
// exit if group already has a playable slot assigned as rallypoint leader // exit if group already has a playable slot assigned as rallypoint leader
if (_leaderVarName != "") exitWith { if (_leaderVarName != "") exitWith {
@ -31,7 +44,7 @@ if (_leaderVarName != "") exitWith {
}; };
// treat group leader // treat group leader
_unit = leader _group0; _unit = leader _groupUnit;
_leaderVarName = vehicleVarName _unit; _leaderVarName = vehicleVarName _unit;
@ -47,6 +60,6 @@ if (_leaderVarName == "") then {
}; };
// prevent group from getting multiple leaders; use this to assign rallypoint moving ability on JIP // prevent group from getting multiple leaders; use this to assign rallypoint moving ability on JIP
_group0 setVariable [QGVAR(leaderVarName), _leaderVarName]; _groupUnit setVariable [QGVAR(leaderVarName), _leaderVarName];
_unit setVariable ["ACE_canMoveRallypoint", true, true]; _unit setVariable ["ACE_canMoveRallypoint", true, true];

View File

@ -1,31 +1,30 @@
/* /*
Name: ACE_Respawn_fnc_handleKilled * Author: bux578
* Handles the XEH killed event.
Author(s): *
bux578 * Arguments:
* 0: Unit <OBJECT>
Description: * 1: Killer <OBJECT>
Handles the XEH Killed event *
* Return Value:
Parameters: * None
0: OBJECT - Killed unit *
1: OBJECT - Attacker * Example:
* [ACE_player, bad_dude] call ace_respawn_fnc_handleKilled
Returns: *
VOID * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_1(_killedUnit); params ["_unit"];
// Saves the gear when the player! (and only him) is killed // Saves the gear when the player! (and only him) is killed
if (ACE_player == _killedUnit) then { if (ACE_player == _unit) then {
GVAR(unitGear) = []; GVAR(unitGear) = [];
if (GVAR(SavePreDeathGear)) then { if (GVAR(SavePreDeathGear)) then {
GVAR(unitGear) = [_killedUnit] call EFUNC(common,getAllGear); GVAR(unitGear) = [_unit] call EFUNC(common,getAllGear);
GVAR(unitGear) pushBack [currentWeapon _killedUnit, currentMuzzle _killedUnit, currentWeaponMode _killedUnit]; GVAR(unitGear) pushBack [currentWeapon _unit, currentMuzzle _unit, currentWeaponMode _unit];
}; };
}; };

View File

@ -1,44 +1,28 @@
// by commy2 /*
* Author: commy2
* Handle player changed event. Updates visibility of Rallypoint markers.
*
* Arguments:
* 0: New Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [ACE_player] call ace_respawn_fnc_handlePlayerChanged
*
* Public: No
*/
#include "script_component.hpp" #include "script_component.hpp"
private "_newUnit"; params ["_newUnit"];
_newUnit = _this select 0; private "_side";
_side = side group _newUnit;
switch (side group _newUnit) do { ((GETMVAR(ACE_Rallypoint_West, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == west));
case (west): { ((GETMVAR(ACE_Rallypoint_West_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == west));
((missionNamespace getVariable ["ACE_Rallypoint_West", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1; ((GETMVAR(ACE_Rallypoint_East, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == east));
((missionNamespace getVariable ["ACE_Rallypoint_East", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; ((GETMVAR(ACE_Rallypoint_East_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == east));
((missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0; ((GETMVAR(ACE_Rallypoint_Independent, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == independent));
((missionNamespace getVariable ["ACE_Rallypoint_West_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1; ((GETMVAR(ACE_Rallypoint_Independent_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == independent));
((missionNamespace getVariable ["ACE_Rallypoint_East_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_Independent_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
};
case (east): {
((missionNamespace getVariable ["ACE_Rallypoint_West", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_East", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1;
((missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_West_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_East_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1;
((missionNamespace getVariable ["ACE_Rallypoint_Independent_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
};
case (independent): {
((missionNamespace getVariable ["ACE_Rallypoint_West", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_East", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1;
((missionNamespace getVariable ["ACE_Rallypoint_West_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_East_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_Independent_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1;
};
default {
((missionNamespace getVariable ["ACE_Rallypoint_West", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_East", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_West_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_East_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_Independent_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
};
};

View File

@ -1,32 +1,29 @@
/* /*
Name: ACE_Respawn_fnc_handleRespawn * Author: bux578
* Handles the XEH Respawn event.
Author(s): *
bux578 * Arguments:
* 0: Unit <OBJECT>
Description: * 1: Corpse <OBJECT>
Handles the XEH Respawn event *
* Return Value:
Parameters: * None
0: OBJECT - Respawned Unit *
1: ? * Example:
* [ACE_Player, old_body_lying_on_floor] call ace_respawn_fnc_handleRespawn
Returns: *
VOID * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_respawnedUnit"]; params ["_unit"];
_respawnedUnit = _this select 0;
// Restores the gear when the player respawns // Restores the gear when the player respawns
if (GVAR(SavePreDeathGear)) then { if (GVAR(SavePreDeathGear)) then {
[_respawnedUnit, GVAR(unitGear)] call FUNC(restoreGear); [_unit, GVAR(unitGear)] call FUNC(restoreGear);
}; };
// fix for setVariable public being lost on respawn for machines that JIP after the command was broadcasted // fix for setVariable public being lost on respawn for machines that JIP after the command was broadcasted
if (_respawnedUnit getVariable ["ACE_canMoveRallypoint", false]) then { if (_unit getVariable ["ACE_canMoveRallypoint", false]) then {
_respawnedUnit setVariable ["ACE_canMoveRallypoint", true, true]; _unit setVariable ["ACE_canMoveRallypoint", true, true];
}; };

View File

@ -1,37 +1,37 @@
/* /*
Name: ACE_Respawn_fnc_initRallypoint * Author: commy2
* Init code for rallypoints.
Author(s): *
commy2 * Arguments:
* 0: Rallypoint Object <OBJECT>
Description: * 1: Respawn Marker <STRING>
init code for rally points * 2: Side <SIDE>
*
Parameters: * Return Value:
0: OBJECT - rally * None
*
Returns: * Example:
VOID * [respawn_object, "", west] call ace_respawn_fnc_initRallypoint
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_3(_rallypoint,_respawnMarker,_side); params ["_rallypoint", "_respawnMarker", "_side"];
private "_name"; private "_name";
_name = typeOf _rallypoint; _name = typeOf _rallypoint;
// init visible marker // init visible marker
if (hasInterface) then { if (hasInterface) then {
// fix init having wrong position, vars etc. [{
[_rallypoint, _respawnMarker, _side, _name] spawn { params ["_rallypoint", "_respawnMarker", "_side", "_name"];
PARAMS_4(_rallypoint,_respawnMarker,_side,_name);
private ["_marker", "_type"]; private ["_marker", "_type", "_date"];
_marker = format ["ACE_Marker_%1", _name]; _marker = format ["ACE_Marker_%1", _name];
// exit if it already exist // exit if marker already exist
if (_marker in allMapMarkers) exitWith {}; if (_marker in allMapMarkers) exitWith {};
_marker = createMarkerLocal [_marker, getPosASL _rallypoint]; _marker = createMarkerLocal [_marker, getPosASL _rallypoint];
@ -40,13 +40,12 @@ if (hasInterface) then {
_marker setMarkerTypeLocal _type; _marker setMarkerTypeLocal _type;
_marker setMarkerAlphaLocal ([0,1] select (_side == playerSide)); // playerSide to guarantee init _marker setMarkerAlphaLocal ([0,1] select (_side == playerSide)); // playerSide to guarantee init
private "_markerDate"; _date = _rallypoint getVariable [QGVAR(markerDate), ""];
_markerDate = _rallypoint getVariable [QGVAR(markerDate), ""];
_marker setMarkerTextLocal _markerDate; _marker setMarkerTextLocal _date;
_rallypoint setVariable [QGVAR(marker), _marker]; _rallypoint setVariable [QGVAR(marker), _marker];
}; }, [_rallypoint, _respawnMarker, _side, _name], 0.1] call EFUNC(common,waitAndExecute);
}; };
if (!isServer) exitWith {}; if (!isServer) exitWith {};
@ -62,7 +61,6 @@ if (isNil _name) then {
}; };
["rallypointMoved", [_rallypoint, _side]] call EFUNC(common,globalEvent); ["rallypointMoved", [_rallypoint, _side]] call EFUNC(common,globalEvent);
} else { } else {
deleteVehicle _rallypoint; deleteVehicle _rallypoint;
ACE_LOGERROR("Multiple Rallypoints of same type."); ACE_LOGERROR("Multiple Rallypoints of same type.");

View File

@ -1,26 +1,23 @@
/* /*
Name: ACE_Respawn_fnc_module * Author: KoffeinFlummi, bux578, esteldunedain, commy2
* Initializes the respawn module.
Author(s): *
KoffeinFlummi, bux578, esteldunedain, commy2 * Arguments:
* 0: Logic <OBJECT>
Description: * 1: Synced units <ARRAY>
initializes the respawn module * 2: Activated <BOOL>
*
Parameters: * Return Value:
0: OBJECT - logic * None
1: ARRAY<OBJECT> - synced units *
2: BOOLEAN - activated * Example:
* [logic, [ACE_Player], true] call ace_respawn_fnc_module
Returns: *
VOID * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_3(_logic,_units,_activated); params ["_logic", "_units", "_activated"];
if !(isServer) exitWith {};
if !(_activated) exitWith {}; if !(_activated) exitWith {};
@ -29,20 +26,18 @@ GVAR(Module) = true;
[_logic, QGVAR(SavePreDeathGear), "SavePreDeathGear"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(SavePreDeathGear), "SavePreDeathGear"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(RemoveDeadBodiesDisconnected), "RemoveDeadBodiesDisconnected"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(RemoveDeadBodiesDisconnected), "RemoveDeadBodiesDisconnected"] call EFUNC(common,readSettingFromModule);
if (isServer) then { if (isServer && {GVAR(RemoveDeadBodiesDisconnected)}) then {
if (GVAR(RemoveDeadBodiesDisconnected)) then {
addMissionEventHandler ["HandleDisconnect", { addMissionEventHandler ["HandleDisconnect", {
[{ [{
PARAMS_1(_unit); params ["_unit"];
if (!alive _unit) then { if (!alive _unit) then {
deleteVehicle _unit; deleteVehicle _unit;
}; };
}, },
_this, 4, 1] call EFUNC(common,waitAndExecute); _this, 4] call EFUNC(common,waitAndExecute);
false false
}]; }];
}; };
};
ACE_LOGINFO("Respawn Module Initialized."); ACE_LOGINFO("Respawn Module Initialized.");

View File

@ -1,32 +1,33 @@
/* /*
Name: ACE_Respawn_fnc_moduleFriendlyFire * Author: commy2
* Initializes the friendly fire module.
Author(s): *
commy2 * Arguments:
* 0: Logic <OBJECT>
Description: * 1: Synced units <ARRAY>
initializes the Friendly Fire Messages module * 2: Activated <BOOL>
*
Parameters: * Return Value:
0: OBJECT - logic * None
1: ARRAY<OBJECT> - synced units *
2: BOOLEAN - activated * Example:
* [logic, [ACE_Player], true] call ace_respawn_fnc_moduleFriendlyFire
Returns: *
VOID * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
_this spawn { params ["_logic", "_units", "_activated"];
PARAMS_3(_logic,_units,_activated);
if !(_activated) exitWith {}; if !(_activated) exitWith {};
// this is done for JIP compatibility
if (isServer) then { if (isServer) then {
[{
missionNamespace setVariable [QGVAR(showFriendlyFireMessage), true]; missionNamespace setVariable [QGVAR(showFriendlyFireMessage), true];
publicVariable QGVAR(showFriendlyFireMessage); publicVariable QGVAR(showFriendlyFireMessage);
},
[], 0.1] call EFUNC(common,waitAndExecute);
}; };
ACE_LOGINFO("Friendly Fire Messages Module Initialized."); ACE_LOGINFO("Friendly Fire Messages Module Initialized.");
};

View File

@ -1,29 +1,29 @@
/* /*
Name: ACE_Respawn_fnc_moduleRallypoint * Author: commy2
* Initializes the Rallypoint module.
Author(s): *
commy2 * Arguments:
* 0: Logic <OBJECT>
Description: * 1: Synced units <ARRAY>
initializes the Rallypoint module * 2: Activated <BOOL>
*
Parameters: * Return Value:
0: OBJECT - logic * None
1: ARRAY<OBJECT> - synced units *
2: BOOLEAN - activated * Example:
* [logic, [ACE_Player], true] call ace_respawn_fnc_moduleRallypoint
Returns: *
VOID * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_3(_logic,_units,_activated); params ["_logic", "_units", "_activated"];
if !(_activated) exitWith {}; if !(_activated) exitWith {};
{ {
_x setVariable ["ACE_canMoveRallypoint", true]; _x setVariable ["ACE_canMoveRallypoint", true];
} forEach _units; false
} count _units;
ACE_LOGINFO("Rallypoint Module Initialized."); ACE_LOGINFO("Rallypoint Module Initialized.");

View File

@ -1,28 +1,25 @@
/* /*
Name: ACE_Respawn_fnc_moveRallypoint * Author: commy2
* Moves a rallypoint to the players location.
Author(s): *
commy2 * Arguments:
* 0: Unit <OBJECT>
Description: * 1: Side <SIDE>
Moves a rallypoint to the player's location *
* Return Value:
Parameters: * None
0: OBJECT - unit *
1: OBJECT - side * Example:
* [ACE_Player, side ACE_Player] call ace_respawn_fnc_moveRallypoint
Returns: *
VOID * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_2(_unit,_side); params ["_unit", "_side"];
private ["_rallypoint", "_position"]; private ["_rallypoint", "_position"];
// rallypoint names are defined in CfgVehicles.hpp
_rallypoint = [ _rallypoint = [
objNull, objNull,
missionNamespace getVariable ["ACE_Rallypoint_West", objNull], missionNamespace getVariable ["ACE_Rallypoint_West", objNull],
@ -30,23 +27,21 @@ _rallypoint = [
missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull] missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]
] select ([west, east, independent] find _side) + 1; ] select ([west, east, independent] find _side) + 1;
TRACE_3("moving rally",_unit, _rallypoint, (typeOf _rallypoint)); TRACE_3("moving rally",_unit,_rallypoint,typeOf _rallypoint);
if (isNull _rallypoint) exitWith {}; if (isNull _rallypoint) exitWith {};
_position = getPosATL _unit; _position = getPosATL _unit;
_position = _position findEmptyPosition [0, 2, typeOf _rallypoint]; _position = _position findEmptyPosition [0, 2, typeOf _rallypoint];
if (count _position == 0) then {_position = getPosATL _unit};
if (_position isEqualTo []) then {_position = getPosATL _unit};
_position set [2, 0]; _position set [2, 0];
[localize LSTRING(Deploy)] call EFUNC(common,displayTextStructured); [localize LSTRING(Deploy)] call EFUNC(common,displayTextStructured);
[{ [{
_rallypoint = _this select 0; params ["_rallypoint", "_unit", "_position"];
_unit = _this select 1;
_position = _this select 2;
_rallypoint = _this select 3;
_rallypoint setPosATL _position; _rallypoint setPosATL _position;
_unit reveal _rallypoint; _unit reveal _rallypoint;
@ -56,5 +51,4 @@ _position set [2, 0];
["rallypointMoved", [_rallypoint, _side, _position]] call EFUNC(common,globalEvent); ["rallypointMoved", [_rallypoint, _side, _position]] call EFUNC(common,globalEvent);
[localize LSTRING(Deployed)] call EFUNC(common,displayTextStructured); [localize LSTRING(Deployed)] call EFUNC(common,displayTextStructured);
}, }, [_rallypoint, _unit, _position], 5] call EFUNC(common,waitAndExecute);
[_rallypoint, _unit, _position, _rallypoint], 5, 1] call EFUNC(common,waitAndExecute);

View File

@ -1,36 +1,27 @@
/* /*
Name: ACE_Respawn_fnc_removeBody * Author: bux578, commy2
* Removes a given body.
Author(s): *
bux578 * Arguments:
* 0: Body <OBJECT>
Description: *
removes a given body * Return Value:
* None
Parameters: *
0: OBJECT - body * Example:
1: BOOLEAN - forceRemove // not used atm * [corpse] call ace_respawn_fnc_removeBody
*
Returns: * Public: No
VOID
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_body", "_forceRemove", "_bodyRemoveTimer"]; params ["_body", "_forceRemove"];
_body = _this select 0; private "_bodyRemoveTimer";
_forceRemove = _this select 1; _bodyRemoveTimer = [GVAR(BodyRemoveTimer) max 0, 2] select _forceRemove; // could be used for SpecOps missions.
_bodyRemoveTimer = GVAR(BodyRemoveTimer) max 0;
// could be used for SpecOps missions.
if (_forceRemove) then {
_bodyRemoveTimer = 2;
};
[{ [{
// hideBody takes ~20s till body is fully underground // hideBody takes ~20s till body is fully underground
// a better hideBody would make this more aesthetic // a better hideBody would make this more aesthetic
deleteVehicle _this; deleteVehicle _this;
}, _body, _bodyRemoveTimer, 1] call EFUNC(common,waitAndExecute); }, _body, _bodyRemoveTimer] call EFUNC(common,waitAndExecute);

View File

@ -1,31 +0,0 @@
/*
Name: ACE_Respawn_fnc_removeDisconnectedPlayer
Author(s):
commy2
Description:
handles the disconnected event
Parameters:
0: BOOLEAN - forceRemove // not used atm
Returns:
VOID
*/
#include "script_component.hpp"
private ["_forceRemove", "_body", "_uid"];
_forceRemove = _this select 0;
{
if (getPlayerUID _x == _uid) exitWith {
_body = _x;
};
} forEach playableUnits;
if (!isNil "_body" && {!alive _body}) then {
[_body, _forceRemove] call FUNC(removeBody);
};

View File

@ -1,34 +1,22 @@
/* /*
Name: ACE_Respawn_fnc_restoreGear * Author: bux578
* Restores previously saved gear.
Author(s): *
bux578 * Arguments:
* 0: Unit <OBJECT>
Description: * 1: All Gear based on return value of ACE_common_fnc_getAllGear <ARRAY>
Restores previously saved gear *
* Return Value:
Parameters: * None
0: OBJECT - unit *
1: ARRAY<String, Array, ...> - Array containing all gear (result of ACE_common_fnc_getAllGear) * Example:
* [ACE_Player, stored_allGear] call ace_respawn_fnc_restoreGear
Returns: *
VOID * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_2(_unit,_allGear); params ["_unit", "_allGear"];
private ["_unit", "_allGear", "_headgear", "_goggles",
"_uniform", "_uniformitems",
"_vest", "_vestitems",
"_backpack", "_backpackitems", "_backpa",
"_primaryweapon", "_primaryweaponitems", "_primaryweaponmagazine",
"_secondaryweapon", "_secondaryweaponitems", "_secondaryweaponmagazine",
"_handgunweapon", "_handgunweaponitems", "_handgunweaponmagazine",
"_assigneditems", "_binocular",
"_activeWeaponAndMuzzle", "_activeWeapon", "_activeMuzzle", "_activeWeaponMode"];
// remove all starting gear of a player // remove all starting gear of a player
removeAllWeapons _unit; removeAllWeapons _unit;
@ -40,77 +28,66 @@ removeAllAssignedItems _unit;
clearAllItemsFromBackpack _unit; clearAllItemsFromBackpack _unit;
removeBackpack _unit; removeBackpack _unit;
_headgear = _allGear select 0; _allGear params [
_goggles = _allGear select 1; "_headgear", "_goggles",
_uniform = _allGear select 2; "_uniform", "_uniformitems",
_uniformitems = _allGear select 3; "_vest", "_vestitems",
_vest = _allGear select 4; "_backpack", "_backpackitems",
_vestitems = _allGear select 5; "_primaryweapon", "_primaryweaponitems", "_primaryweaponmagazine",
_backpack = _allGear select 6; "_secondaryweapon", "_secondaryweaponitems", "_secondaryweaponmagazine",
_backpackitems = _allGear select 7; "_handgunweapon", "_handgunweaponitems", "_handgunweaponmagazine",
_primaryweapon = _allGear select 8; "_assigneditems", "_binocular",
_primaryweaponitems = _allGear select 9; "_activeWeaponAndMuzzle"
_primaryweaponmagazine = _allGear select 10; ];
_secondaryweapon = _allGear select 11;
_secondaryweaponitems = _allGear select 12;
_secondaryweaponmagazine = _allGear select 13;
_handgunweapon = _allGear select 14;
_handgunweaponitems = _allGear select 15;
_handgunweaponmagazine = _allGear select 16;
_assigneditems = _allGear select 17;
_binocular = _allGear select 18;
_activeWeaponAndMuzzle = _allGear select 19;
// start restoring the items // start restoring the items
if (_headgear != "") then { if (_headgear != "") then {_unit addHeadgear _headgear};
_unit addHeadgear _headgear; if (_goggles != "") then {_unit addGoggles _goggles};
}; if (_uniform != "") then {_unit forceAddUniform _uniform};
if (_uniform != "") then { if (_vest != "") then {_unit addVest _vest};
_unit forceAddUniform _uniform;
};
if (_vest != "") then {
_unit addVest _vest;
};
if (_goggles != "") then {
_unit addGoggles _goggles;
};
{ {
_unit addItemToUniform _x; _unit addItemToUniform _x;
} forEach _uniformitems; false
} count _uniformitems;
{ {
_unit addItemToVest _x; _unit addItemToVest _x;
} forEach _vestitems; false
} count _vestitems;
private "_flagRemoveDummyBag"; private "_flagRemoveDummyBag";
_flagRemoveDummyBag = false;
if (format ["%1", _backpack] != "") then { if (format ["%1", _backpack] != "") then {
_unit addBackpack _backpack; _unit addBackpack _backpack;
_backpa = unitBackpack _unit; // make sure the backpack is empty. Some bags are prefilled by config
clearMagazineCargoGlobal _backpa; private "_backpackObject";
clearWeaponCargoGlobal _backpa; _backpackObject = unitBackpack _unit;
clearItemCargoGlobal _backpa;
clearMagazineCargoGlobal _backpackObject;
clearWeaponCargoGlobal _backpackObject;
clearItemCargoGlobal _backpackObject;
{ {
_unit addItemToBackpack _x; _unit addItemToBackpack _x;
} forEach _backpackitems; false
} count _backpackitems;
_flagRemoveDummyBag = false;
} else { } else {
// dummy backpack to ensure mags being loaded // dummy backpack to ensure mags being loaded
_unit addBackpack "B_Kitbag_Base"; _unit addBackpack "Bag_Base";
_flagRemoveDummyBag = true; _flagRemoveDummyBag = true;
}; };
// primaryWeapon // primaryWeapon
if ((_primaryweapon != "") && {_primaryweapon != "ACE_FakePrimaryWeapon"}) then { if ((_primaryweapon != "") && {_primaryweapon != "ACE_FakePrimaryWeapon"}) then {
{ {
_unit addMagazine _x; _unit addMagazine _x;
} forEach _primaryweaponmagazine; false
} count _primaryweaponmagazine;
_unit addWeapon _primaryweapon; _unit addWeapon _primaryweapon;
@ -118,15 +95,16 @@ if ((_primaryweapon != "") && {_primaryweapon != "ACE_FakePrimaryWeapon"}) then
if (_x != "") then { if (_x != "") then {
_unit addPrimaryWeaponItem _x; _unit addPrimaryWeaponItem _x;
}; };
} forEach _primaryweaponitems; false
} count _primaryweaponitems;
}; };
// secondaryWeapon // secondaryWeapon
if (_secondaryweapon != "") then { if (_secondaryweapon != "") then {
{ {
_unit addMagazine _x; _unit addMagazine _x;
} forEach _secondaryweaponmagazine; false
} count _secondaryweaponmagazine;
_unit addWeapon _secondaryweapon; _unit addWeapon _secondaryweapon;
@ -134,15 +112,16 @@ if (_secondaryweapon != "") then {
if (_x != "") then { if (_x != "") then {
_unit addSecondaryWeaponItem _x; _unit addSecondaryWeaponItem _x;
}; };
} forEach _secondaryweaponitems; false
} count _secondaryweaponitems;
}; };
// handgun // handgun
if (_handgunweapon != "") then { if (_handgunweapon != "") then {
{ {
_unit addMagazine _x; _unit addMagazine _x;
} forEach _handgunweaponmagazine; false
} count _handgunweaponmagazine;
_unit addWeapon _handgunweapon; _unit addWeapon _handgunweapon;
@ -150,20 +129,19 @@ if (_handgunweapon != "") then {
if (_x != "") then { if (_x != "") then {
_unit addHandgunItem _x; _unit addHandgunItem _x;
}; };
} forEach _handgunweaponitems; false
} count _handgunweaponitems;
}; };
// remove dummy bagpack // remove dummy bagpack
if (_flagRemoveDummyBag) then { if (_flagRemoveDummyBag) then {
removeBackpack _unit; removeBackpack _unit;
}; };
_assignedItems deleteAt (_assignedItems find _binocular);
_assignedItems = _assignedItems - [_binocular];
// items // items
{_unit linkItem _x} forEach _assignedItems; {_unit linkItem _x; false} count _assignedItems;
_unit addWeapon _binocular; _unit addWeapon _binocular;
@ -178,24 +156,24 @@ if ("Laserdesignator" in assignedItems _unit) then {
}; };
// restore the last active weapon, muzzle and weaponMode // restore the last active weapon, muzzle and weaponMode
_activeWeapon = _activeWeaponAndMuzzle select 0; _activeWeaponAndMuzzle params ["_activeWeapon", "_activeMuzzle", "_activeWeaponMode"];
_activeMuzzle = _activeWeaponAndMuzzle select 1;
_activeWeaponMode = _activeWeaponAndMuzzle select 2;
if (!(_activeMuzzle isEqualTo "") and
!(_activeMuzzle isEqualTo _activeWeapon) and
(_activeMuzzle in getArray (configfile >> "CfgWeapons" >> _activeWeapon >> "muzzles"))) then {
if (
(_activeMuzzle != "") &&
{_activeMuzzle != _activeWeapon} &&
{_activeMuzzle in getArray (configfile >> "CfgWeapons" >> _activeWeapon >> "muzzles")}
) then {
_unit selectWeapon _activeMuzzle; _unit selectWeapon _activeMuzzle;
} else { } else {
if (!(_activeWeapon isEqualTo "")) then { if (_activeWeapon != "") then {
_unit selectWeapon _activeWeapon; _unit selectWeapon _activeWeapon;
}; };
}; };
if (!(currentWeapon _unit isEqualTo "")) then { if (currentWeapon _unit != "") then {
private ["_index"]; private "_index";
_index = 0; _index = 0;
while { while {
_index < 100 && {currentWeaponMode _unit != _activeWeaponMode} _index < 100 && {currentWeaponMode _unit != _activeWeaponMode}
} do { } do {

View File

@ -1,28 +1,24 @@
/* /*
Name: ACE_Respawn_fnc_showFriendlyFireMessages * Author: commy2
* Shows a message in system chat of who killed whom.
Author(s): *
commy2 * Arguments:
* 0: Unitn <OBJECT>
Description: * 1: Killer <OBJECT>
shows a message in system chat of who killed who *
* Return Value:
Parameters: * None
0: OBJECT - unit *
1: OBJECT - killer * Example:
* [ACE_Player, killer] call ace_module_fnc_functionName
Returns: *
VOID * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_unit", "_killer"]; params ["_unit", "_killer"];
_unit = _this select 0; if (_unit != _killer && {side group _unit in [side group ACE_player, civilian]} && {side group _killer == side group ACE_player}) then {
_killer = _this select 1;
if (_unit != _killer && side group _unit in [side group ACE_player, civilian] && {side group _killer == side group ACE_player}) then {
systemChat format ["%1 was killed by %2", [_unit] call EFUNC(common,getName), [_killer] call EFUNC(common,getName)]; systemChat format ["%1 was killed by %2", [_unit] call EFUNC(common,getName), [_killer] call EFUNC(common,getName)];
// Raise ACE globalEvent // Raise ACE globalEvent

View File

@ -1,29 +1,25 @@
/* /*
* Author: commy2 * Author: commy2
* teleports a unit to a rallypoint * Teleports a unit to a rallypoint
* *
* Arguments: * Arguments:
* 0: unit <OBJECT> * 0: Unit <OBJECT>
* 1: side? <OBJECT> * 1: Side <SIDE>
* 2: teleport to base <BOOLEAN> * 2: Rallypoint name <STRING>
* *
* Return Value: * Return Value:
* Nothing * None
* *
* Example: * Example:
* [,,] call ACE_Respawn_fnc_teleportToRallypoint; * [ACE_player, side ACE_Player, rallypoint_name] call ace_respawn_fnc_teleportToRallypoint;
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_3(_unit,_side,_rallypoint); params ["_unit", "_side", "_rallypoint"];
private ["_toBase"]; private "_toBase";
// rallypoint names are defined in CfgVehicles.hpp
//IGNORE_PRIVATE_WARNING("_Base")
_toBase = _rallypoint find "_Base" != -1; _toBase = _rallypoint find "_Base" != -1;
_rallypoint = missionNamespace getVariable [_rallypoint, objNull], _rallypoint = missionNamespace getVariable [_rallypoint, objNull],
@ -31,4 +27,5 @@ _rallypoint = missionNamespace getVariable [_rallypoint, objNull],
if (isNull _rallypoint) exitWith {}; if (isNull _rallypoint) exitWith {};
_unit setPosASL getPosASL _rallypoint; _unit setPosASL getPosASL _rallypoint;
[[localize LSTRING(TeleportedToRallypoint), localize LSTRING(TeleportedToBase)] select _toBase] call EFUNC(common,displayTextStructured); [[localize LSTRING(TeleportedToRallypoint), localize LSTRING(TeleportedToBase)] select _toBase] call EFUNC(common,displayTextStructured);

View File

@ -1,11 +1,23 @@
// by commy2 /*
* Author: commy2
* Updates marker position and texts.
*
* Arguments:
* 0: Marker <STRING>
* 1: Side <SIDE>
* 2: Position <ARRAY>
*
* Return Value:
* None
*
* Example:
* [marker_name, side ACE_Player, getPos ACE_Player] call ace_respawn_fnc_updateRallypoint
*
* Public: No
*/
#include "script_component.hpp" #include "script_component.hpp"
private ["_rallypoint", "_side", "_position"]; params ["_rallypoint", "_side", "_position"];
_rallypoint = _this select 0;
_side = _this select 1;
_position = _this select 2;
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};

View File

@ -7,6 +7,6 @@ class Extended_PreInit_EventHandlers {
class Extended_PostInit_EventHandlers { class Extended_PostInit_EventHandlers {
class ADDON { class ADDON {
clientInit = QUOTE( call COMPILE_FILE(XEH_postInit) ); init = QUOTE(call COMPILE_FILE(XEH_postInit));
}; };
}; };

View File

@ -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); //["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" //@todo addEventHandler infoDisplayChanged with select 1 == "Soldier"
// add keybinds
// Add keybinds
["ACE3 Weapons", QGVAR(safeMode), localize LSTRING(SafeMode), ["ACE3 Weapons", QGVAR(safeMode), localize LSTRING(SafeMode),
{ {
// Conditions: canInteract // Conditions: canInteract
@ -21,4 +20,4 @@ if (!hasInterface) exitWith {};
true true
}, },
{false}, {false},
[41, [false, true, false]], false] call cba_fnc_addKeybind; [41, [false, true, false]], false] call CBA_fnc_addKeybind;

View File

@ -20,10 +20,10 @@
// don't immediately switch back // don't immediately switch back
if (inputAction "nextWeapon" > 0) exitWith {}; if (inputAction "nextWeapon" > 0) exitWith {};
private ["_safedWeapons", "_condition", "_statement", "_id", "_picture"];
params ["_unit", "_weapon", "_muzzle"]; params ["_unit", "_weapon", "_muzzle"];
private ["_safedWeapons", "_picture"];
_safedWeapons = _unit getVariable [QGVAR(safedWeapons), []]; _safedWeapons = _unit getVariable [QGVAR(safedWeapons), []];
if (_weapon in _safedWeapons) exitWith { if (_weapon in _safedWeapons) exitWith {
@ -35,14 +35,14 @@ _safedWeapons pushBack _weapon;
_unit setVariable [QGVAR(safedWeapons), _safedWeapons]; _unit setVariable [QGVAR(safedWeapons), _safedWeapons];
if (_unit getVariable [QGVAR(actionID), -1] == -1) then { if (_unit getVariable [QGVAR(actionID), -1] == -1) then {
_condition = { _unit setVariable [QGVAR(actionID), [
params ["", "_caller"]; _unit, "DefaultAction", {
if ( if (
[_caller] call EFUNC(common,canUseWeapon) [_this select 1] call EFUNC(common,canUseWeapon)
&& { && {
if (currentMuzzle _caller in (_caller getVariable [QGVAR(safedWeapons), []])) then { if (currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(safedWeapons), []])) then {
if (inputAction "nextWeapon" > 0) exitWith { if (inputAction "nextWeapon" > 0) exitWith {
[_this select 1, currentWeapon _caller, currentMuzzle _caller] call FUNC(unlockSafety); [_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call FUNC(unlockSafety);
false false
}; };
true true
@ -56,26 +56,18 @@ if (_unit getVariable [QGVAR(actionID), -1] == -1) then {
// player hud // player hud
[true] call FUNC(setSafeModeVisual); [true] call FUNC(setSafeModeVisual);
false false
} };
}, {}
] call EFUNC(common,addActionEventHandler)];
}; };
_statement = { if (typeName _muzzle == "STRING") then {
params ["", "_caller"]; _unit selectWeapon _muzzle;
[_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];
};
if ((typeName _muzzle) == (typeName "")) then {
_unit selectWeapon _muzzle; //_weapon
}; };
// play fire mode selector sound // play fire mode selector sound
[_unit, _weapon, _muzzle] call FUNC(playChangeFiremodeSound); [_unit, _weapon, _muzzle] call FUNC(playChangeFiremodeSound);
// show info box
_picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");
[localize LSTRING(PutOnSafety), _picture] call EFUNC(common,displayTextPicture); [localize LSTRING(PutOnSafety), _picture] call EFUNC(common,displayTextPicture);

View File

@ -16,23 +16,28 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_sound", "_position"];
params ["_unit", "_weapon"]; params ["_unit", "_weapon"];
private ["_sound", "_position"];
_sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound"); _sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound");
if (count _sound == 0) exitWith { if (_sound isEqualTo []) exitWith {
playSound "ACE_Sound_Click"; playSound "ACE_Sound_Click";
}; };
// add file extension // get position where to play the sound (position of the weapon)
if ({(toLower (_sound select 0) find _x == (count toArray (_sound select 0) - count toArray _x) - 1)} count [".wav", ".ogg", ".wss"] == 0) then { _position = AGLToASL (_unit modelToWorldVisual (_unit selectionPosition "RightHand"));
_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)];
_sound params ["_filename", ["_volume", 1], ["_soundPitch", 1], ["_distance", 0]]; _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]; playSound3D [_filename, objNull, false, _position, _volume, _soundPitch, _distance];

View File

@ -15,17 +15,17 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_control", "_config"];
params ["_show"]; params ["_show"];
disableSerialization; disableSerialization;
private "_control";
_control = (uiNamespace getVariable ["ACE_dlgSoldier", displayNull]) displayCtrl 187; _control = (uiNamespace getVariable ["ACE_dlgSoldier", displayNull]) displayCtrl 187;
if (isNull _control) exitWith {}; if (isNull _control) exitWith {};
if (_show) then { if (_show) then {
private "_config";
_config = configFile >> "RscInGameUI" >> "RscUnitInfoSoldier" >> "WeaponInfoControlsGroupLeft" >> "controls" >> "CA_ModeTexture"; _config = configFile >> "RscInGameUI" >> "RscUnitInfoSoldier" >> "WeaponInfoControlsGroupLeft" >> "controls" >> "CA_ModeTexture";
_control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")]; _control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")];

View File

@ -17,25 +17,20 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_safedWeapons", "_id", "_picture"];
params ["_unit", "_weapon", "_muzzle"]; params ["_unit", "_weapon", "_muzzle"];
_safedWeapons = _unit getVariable [QGVAR(safedWeapons), []]; private ["_safedWeapons", "_picture"];
if (_weapon in _safedWeapons) then { _safedWeapons = _unit getVariable [QGVAR(safedWeapons), []];
_safedWeapons = _safedWeapons - [_weapon]; _safedWeapons deleteAt (_safedWeapons find _weapon);
_unit setVariable [QGVAR(safedWeapons), _safedWeapons]; _unit setVariable [QGVAR(safedWeapons), _safedWeapons];
if (count _safedWeapons == 0) then { // remove action if all weapons have put their safety on
_id = _unit getVariable [QGVAR(actionID), -1]; if (_safedWeapons isEqualTo []) then {
[_unit, "DefaultAction", _unit getVariable [QGVAR(actionID), -1]] call EFUNC(common,removeActionEventHandler);
//[_unit, "DefaultAction", _id] call EFUNC(common,removeActionMenuEventHandler);
[_unit, "DefaultAction", _id] call EFUNC(common,removeActionEventHandler);
_unit setVariable [QGVAR(actionID), -1]; _unit setVariable [QGVAR(actionID), -1];
}; };
};
_unit selectWeapon _muzzle; _unit selectWeapon _muzzle;
@ -74,5 +69,6 @@ if (inputAction "nextWeapon" > 0) then {
// player hud // player hud
[true] call FUNC(setSafeModeVisual); [true] call FUNC(setSafeModeVisual);
// show info box
_picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture");
[localize LSTRING(TookOffSafety), _picture] call EFUNC(common,displayTextPicture); [localize LSTRING(TookOffSafety), _picture] call EFUNC(common,displayTextPicture);

View File

@ -10,7 +10,7 @@
* 4: Slide Duration <NUMBER> (0 disables automatic transitions) * 4: Slide Duration <NUMBER> (0 disables automatic transitions)
* *
* Return Value: * Return Value:
* Parsed List <ARRAY> * None
* *
* Example: * Example:
* [[object1, object2, object3], [controller1], ["images\image1.paa", "images\image2.paa"], ["Action1", "Action2"], 5] call ace_slideshow_fnc_createSlideshow * [[object1, object2, object3], [controller1], ["images\image1.paa", "images\image2.paa"], ["Action1", "Action2"], 5] call ace_slideshow_fnc_createSlideshow
@ -20,21 +20,24 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_currentSlideshow", "_slidesAction", "_varString"]; private ["_currentSlideshow", "_slidesAction", "_varString"];
params ["_objects", "_controllers", "_images", "_names", "_duration"]; params [
["_objects", [], [[]] ],
["_controllers", [], [[]] ],
["_images", [], [[]] ],
["_names", [], [[]] ],
["_duration", 0, [0]]
];
// Verify data // Verify data
if (count _images != count _names || {count _images == 0} || {count _names == 0}) exitWith { if (_objects isEqualTo []) exitWith {
ACE_LOGERROR("Slideshow Images or Names fields can NOT be empty and must have equal number of items!"); ACE_LOGERROR("Slideshow Objects field must NOT be empty!");
};
if (count _images != count _names || {_images isEqualTo []} || {_names isEqualTo []}) exitWith {
ACE_LOGERROR("Slideshow Images or Names fields must NOT be empty and must have equal number of items!");
}; };
// Objects synced to the module
{
_objects pushBack _x;
nil
} count (synchronizedObjects _logic);
// If no controllers use objects as controllers // If no controllers use objects as controllers
if (count _controllers == 0) then { if (_controllers isEqualTo []) then {
_controllers = _objects; _controllers = _objects;
}; };
@ -54,7 +57,7 @@ _currentSlideshow = GVAR(slideshows); // Local variable in case GVAR gets change
// If interaction menu module is not present, set default duration value // If interaction menu module is not present, set default duration value
if !(["ace_interact_menu"] call EFUNC(common,isModLoaded)) then { if !(["ace_interact_menu"] call EFUNC(common,isModLoaded)) then {
_duration = 5; _duration = NOINTERACTMENU_DURATION;
ACE_LOGINFO_1("Interaction Menu module not present, defaulting duration value to %1",_duration); ACE_LOGINFO_1("Interaction Menu module not present, defaulting duration value to %1",_duration);
}; };

View File

@ -30,7 +30,13 @@ _images = [_logic getVariable ["Images", ""], true, false] call FUNC(makeList);
_names = [_logic getVariable ["Names", ""], true, false] call FUNC(makeList); _names = [_logic getVariable ["Names", ""], true, false] call FUNC(makeList);
_duration = _logic getVariable ["Duration", 0]; _duration = _logic getVariable ["Duration", 0];
// Objects synced to the module
{
_objects pushBack _x;
nil
} count (synchronizedObjects _logic);
// Prepare with actions // Prepare with actions
[_objects, _controllers, _images, _names, _duration] call FUNC(createSlideshow); [_objects, _controllers, _images, _names, _duration] call FUNC(createSlideshow);
ACE_LOGINFO_2("Slideshow Module Initialized for: %1 with Duration: %2", _objects, _duration); ACE_LOGINFO_1("Slideshow Module Initialized on %1 Objects", count _objects);

View File

@ -10,3 +10,6 @@
#endif #endif
#include "\z\ace\addons\main\script_macros.hpp" #include "\z\ace\addons\main\script_macros.hpp"
#define NOINTERACTMENU_DURATION 5

Some files were not shown because too many files have changed in this diff Show More