mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge remote-tracking branch 'refs/remotes/acemod/master'
This commit is contained in:
commit
bd5dc83a27
@ -18,7 +18,8 @@ private ["_muzzleVelocityShiftTableUpperLimit", "_temperatureIndexFunction",
|
||||
"_temperatureIndexA", "_temperatureIndexB", "_interpolationRatio"];
|
||||
params["_muzzleVelocityShiftTable", "_temperature"];
|
||||
|
||||
// Check if muzzleVelocityShiftTable is Larger Than 11 Entrys
|
||||
// Check if muzzleVelocityShiftTable is Less Than 11 Entrys
|
||||
if ((count _muzzleVelocityShiftTable) < 11) exitWith {0};
|
||||
_muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10;
|
||||
if (isNil "_muzzleVelocityShiftTableUpperLimit") exitWith { 0 };
|
||||
|
||||
|
@ -24,12 +24,12 @@ if (!hasInterface) exitWith {};
|
||||
if (!GVAR(enabled)) exitWith {};
|
||||
|
||||
// Parameterization
|
||||
private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"];
|
||||
private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletLength", "_barrelTwist", "_stabilityFactor", "_aceTimeSecond", "_barrelVelocityShift", "_ammoTemperatureVelocityShift"];
|
||||
|
||||
params ["_unit", "_weapon", "", "_mode", "_ammo", "_magazine", "_bullet"];
|
||||
|
||||
_abort = false;
|
||||
|
||||
|
||||
if (!(_ammo isKindOf "BulletBase")) exitWith {};
|
||||
if (!alive _bullet) exitWith {};
|
||||
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {};
|
||||
@ -75,22 +75,22 @@ _WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"];
|
||||
_bulletVelocity = velocity _bullet;
|
||||
_muzzleVelocity = vectorMagnitude _bulletVelocity;
|
||||
|
||||
_barrelVelocityShift = 0;
|
||||
if (GVAR(barrelLengthInfluenceEnabled)) then {
|
||||
_barrelVelocityShift = uiNamespace getVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],nil];
|
||||
if (isNil "_barrelVelocityShift") then {
|
||||
_barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift);
|
||||
uiNamespace setVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],_muzzleVelocityShift];
|
||||
};
|
||||
_barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift);
|
||||
};
|
||||
|
||||
_ammoTemperatureVelocityShift = 0;
|
||||
if (GVAR(ammoTemperatureEnabled)) then {
|
||||
_temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight);
|
||||
_temperatureVelocityShift = ([_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift));
|
||||
_ammoTemperatureVelocityShift = ([_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift));
|
||||
};
|
||||
|
||||
if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then {
|
||||
_muzzleVelocityShift = _barrelVelocityShift + _ammoTemperatureVelocityShift;
|
||||
TRACE_4("shift",_muzzleVelocity,_muzzleVelocityShift, _barrelVelocityShift, _ammoTemperatureVelocityShift);
|
||||
if (_muzzleVelocityShift != 0) then {
|
||||
_muzzleVelocity = _muzzleVelocity + (_barrelVelocityShift + _ammoTemperatureVelocityShift);
|
||||
_muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
|
||||
_bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift));
|
||||
_bullet setVelocity _bulletVelocity;
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project name="ACE">
|
||||
<Package name="Captives">
|
||||
<Key ID="STR_ACE_Captives_SetCaptive">
|
||||
@ -181,9 +181,11 @@
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Captives_ModuleHandcuffed_DisplayName">
|
||||
<English>Make Unit Handcuffed</English>
|
||||
<Portuguese>Fazer unidade algemada</Portuguese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Captives_ModuleHandcuffed_Description">
|
||||
<English>Sync a unit to make them handcuffed.<br />Source: ace_captives</English>
|
||||
<Portuguese>Sincronizar uma unidade para deixá-la algemada.<br/>Source: ace_captives</Portuguese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Captives_ModuleSettings_DisplayName">
|
||||
<English>Captives Settings</English>
|
||||
|
@ -1,5 +1,45 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
["LoadCargo", {_this call FUNC(loadItem)}] call EFUNC(common,addEventHandler);
|
||||
["UnloadCargo", {_this call FUNC(unloadItem)}] call EFUNC(common,addEventHandler);
|
||||
["AddCargoByClass", {_this call FUNC(addCargoItem)}] call EFUNC(common,addEventHandler);
|
||||
|
||||
["LoadCargo", {
|
||||
(_this select 0) params ["_item","_vehicle"];
|
||||
private ["_loaded", "_hint", "_itemName", "_vehicleName"];
|
||||
|
||||
_loaded = [_item, _vehicle] call FUNC(loadItem);
|
||||
|
||||
// Show hint as feedback
|
||||
_hint = [LSTRING(LoadingFailed), LSTRING(LoadedItem)] select _loaded;
|
||||
_itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName");
|
||||
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
|
||||
|
||||
["displayTextStructured", [[_hint, _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
|
||||
|
||||
if (_loaded) then {
|
||||
// Invoke listenable event
|
||||
["cargoLoaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
|
||||
};
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
||||
["UnloadCargo", {
|
||||
(_this select 0) params ["_item","_vehicle"];
|
||||
private ["_unloaded", "_itemClass", "_hint", "_itemName", "_vehicleName"];
|
||||
|
||||
_unloaded = [_item, _vehicle] call FUNC(unloadItem);
|
||||
|
||||
_itemClass = if (typeName _item == "STRING") then {_item} else {typeOf _item};
|
||||
|
||||
// Show hint as feedback
|
||||
_hint = [LSTRING(UnloadingFailed), LSTRING(UnloadedItem)] select _unloaded;
|
||||
_itemName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName");
|
||||
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
|
||||
|
||||
["displayTextStructured", [[_hint, _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
|
||||
|
||||
if (_unloaded) then {
|
||||
// Invoke listenable event
|
||||
["cargoUnloaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
|
||||
};
|
||||
|
||||
// TOOO maybe drag/carry the unloaded item?
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
@ -22,20 +22,9 @@ private ["_position", "_item", "_i"];
|
||||
params ["_itemClass", "_vehicle", ["_amount", 1], ["_showHint", false, [false]] ];
|
||||
TRACE_3("params",_itemClass,_vehicle,_amount);
|
||||
|
||||
_position = getPos _vehicle;
|
||||
_position set [1, (_position select 1) + 1];
|
||||
_position set [2, (_position select 2) + 7.5];
|
||||
|
||||
for "_i" from 1 to _amount do {
|
||||
_item = createVehicle [_itemClass, _position, [], 0, "CAN_COLLIDE"];
|
||||
|
||||
// Load item or delete it if no space left
|
||||
if !([_item, _vehicle, _showHint] call FUNC(loadItem)) exitWith {
|
||||
TRACE_1("no room to load item - deleting",_item);
|
||||
deleteVehicle _item;
|
||||
};
|
||||
TRACE_1("Item Loaded",_item);
|
||||
|
||||
// Invoke listenable event
|
||||
["cargoAddedByClass", [_itemClass, _vehicle, _amount]] call EFUNC(common,globalEvent);
|
||||
[_item, _vehicle] call FUNC(loadItem);
|
||||
};
|
||||
|
||||
// Invoke listenable event
|
||||
["cargoAddedByClass", [_itemClass, _vehicle, _amount]] call EFUNC(common,globalEvent);
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Check if item can be loaded into other Object.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Item Object <OBJECT>
|
||||
* 0: Item <OBJECT or STRING>
|
||||
* 1: Holder Object (Vehicle) <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
@ -16,14 +16,24 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_item", "_vehicle"];
|
||||
params [["_item", "", [objNull,""]], "_vehicle"];
|
||||
|
||||
if (speed _vehicle > 1 || (((getPos _vehicle) select 2) > 3)) exitWith {false};
|
||||
|
||||
private "_itemSize";
|
||||
_itemSize = ([_item] call FUNC(getSizeItem));
|
||||
private ["_itemSize", "_validItem"];
|
||||
_itemSize = [_item] call FUNC(getSizeItem);
|
||||
|
||||
(_itemSize > 0) &&
|
||||
{alive _item && alive _vehicle} &&
|
||||
{(_item distance _vehicle <= MAX_LOAD_DISTANCE)} &&
|
||||
if (typeName _item == "STRING") then {
|
||||
_validItem =
|
||||
isClass (configFile >> "CfgVehicles" >> _item) &&
|
||||
{getNumber (configFile >> "CfgVehicles" >> _item >> QGVAR(canLoad)) == 1};
|
||||
} else {
|
||||
_validItem =
|
||||
(alive _item) &&
|
||||
{(_item distance _vehicle) <= MAX_LOAD_DISTANCE};
|
||||
};
|
||||
|
||||
_validItem &&
|
||||
{_itemSize > 0} &&
|
||||
{alive _vehicle} &&
|
||||
{_itemSize <= ([_vehicle] call FUNC(getCargoSpaceLeft))}
|
||||
|
@ -16,18 +16,19 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_loaded", "_validVehiclestate", "_emptyPos"];
|
||||
|
||||
params ["_item", "_vehicle"];
|
||||
private ["_loaded", "_itemClass", "_validVehiclestate", "_emptyPos"];
|
||||
|
||||
_loaded = _vehicle getVariable [QGVAR(loaded), []];
|
||||
if !(_item in _loaded) exitWith {false};
|
||||
|
||||
_itemClass = if (typeName _item == "STRING") then {_item} else {typeOf _item};
|
||||
|
||||
_validVehiclestate = true;
|
||||
_emptyPos = [];
|
||||
if (_vehicle isKindOf "Ship" ) then {
|
||||
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]); // TODO: if spot is underwater pick another spot.
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, _itemClass]); // TODO: if spot is underwater pick another spot.
|
||||
} else {
|
||||
if (_vehicle isKindOf "Air" ) then {
|
||||
if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false};
|
||||
@ -35,7 +36,7 @@ if (_vehicle isKindOf "Ship" ) then {
|
||||
_emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ];
|
||||
} else {
|
||||
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]);
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, _itemClass]);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Get the cargo size of an object.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
* 0: Item <OBJECT or STRING>
|
||||
*
|
||||
* Return value:
|
||||
* Cargo size <NUMBER> (default: -1)
|
||||
@ -15,14 +15,24 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_config";
|
||||
|
||||
params ["_item"];
|
||||
private ["_isVirtual","_itemClass","_config"];
|
||||
scopeName "return";
|
||||
|
||||
_config = (configFile >> "CfgVehicles" >> typeOf _item >> QGVAR(size));
|
||||
_isVirtual = (typeName _item == "STRING");
|
||||
_itemClass = if (_isVirtual) then {_item} else {typeOf _item};
|
||||
_config = (configFile >> "CfgVehicles" >> _itemClass >> QGVAR(size));
|
||||
|
||||
if (isNumber (_config)) exitWith {
|
||||
_item getVariable [QGVAR(size), getNumber (_config)]
|
||||
if (_isVirtual) then {
|
||||
if (isNumber _config) then {
|
||||
(getNumber _config) breakOut "return";
|
||||
};
|
||||
} else {
|
||||
_config = (configFile >> "CfgVehicles" >> typeOf _item >> QGVAR(size));
|
||||
|
||||
if (isNumber _config) then {
|
||||
(_item getVariable [QGVAR(size), getNumber _config]) breakOut "return";
|
||||
};
|
||||
};
|
||||
|
||||
-1
|
||||
|
@ -20,12 +20,13 @@ params ["_vehicle"];
|
||||
private["_loaded"];
|
||||
|
||||
_loaded = _vehicle getVariable [QGVAR(loaded), []];
|
||||
if (count _loaded == 0) exitWith {};
|
||||
if (_loaded isEqualTo []) exitWith {};
|
||||
|
||||
{
|
||||
// TODO deleteVehicle or just delete vehicle? Do we want to be able to recover destroyed equipment?
|
||||
deleteVehicle _x;
|
||||
//_x setDamage 1;
|
||||
// TODO Do we want to be able to recover destroyed equipment?
|
||||
if (typeName _x == "OBJECT") then {
|
||||
deleteVehicle _x;
|
||||
};
|
||||
} count _loaded;
|
||||
|
||||
[_vehicle] call FUNC(validateCargoSpace);
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Load object into vehicle.
|
||||
* Objects loaded via classname remain virtual until unloaded.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
* 0: Item <OBJECT or STRING>
|
||||
* 1: Vehicle <OBJECT>
|
||||
* 2: Show Hint <BOOL> (default: true)
|
||||
*
|
||||
@ -17,15 +18,10 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_item","",[objNull,""]], ["_vehicle",objNull,[objNull]]];
|
||||
private ["_loaded", "_space", "_itemSize"];
|
||||
|
||||
params ["_item", "_vehicle", ["_showHint", true, [true]] ];
|
||||
TRACE_2("params",_item,_vehicle);
|
||||
|
||||
if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {
|
||||
TRACE_2("canLoadItemIn failed",_item,_vehicle);
|
||||
false
|
||||
};
|
||||
if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {false};
|
||||
|
||||
_loaded = _vehicle getVariable [QGVAR(loaded), []];
|
||||
_loaded pushback _item;
|
||||
@ -37,21 +33,10 @@ _space = [_vehicle] call FUNC(getCargoSpaceLeft);
|
||||
_itemSize = [_item] call FUNC(getSizeItem);
|
||||
_vehicle setVariable [QGVAR(space), _space - _itemSize, true];
|
||||
|
||||
detach _item;
|
||||
_item attachTo [_vehicle,[0,0,100]];
|
||||
["hideObjectGlobal", [_item, true]] call EFUNC(common,serverEvent);
|
||||
|
||||
// show hint
|
||||
private ["_itemName", "_vehicleName"];
|
||||
|
||||
_itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName");
|
||||
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
|
||||
|
||||
if (_showHint) then {
|
||||
["displayTextStructured", [[localize LSTRING(LoadedItem), _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
|
||||
if (typeName _item == "OBJECT") then {
|
||||
detach _item;
|
||||
_item attachTo [_vehicle,[0,0,-100]];
|
||||
["hideObjectGlobal", [_item, true]] call EFUNC(common,serverEvent);
|
||||
};
|
||||
|
||||
// Invoke listenable event
|
||||
["cargoLoaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
|
||||
|
||||
true
|
||||
|
@ -22,7 +22,7 @@ params ["_display"];
|
||||
uiNamespace setVariable [QGVAR(menuDisplay), _display];
|
||||
|
||||
[{
|
||||
private ["_display","_loaded", "_ctrl", "_label"];
|
||||
private ["_display","_loaded", "_ctrl", "_class", "_label"];
|
||||
disableSerialization;
|
||||
_display = uiNamespace getVariable QGVAR(menuDisplay);
|
||||
if (isnil "_display") exitWith {
|
||||
@ -40,7 +40,8 @@ uiNamespace setVariable [QGVAR(menuDisplay), _display];
|
||||
|
||||
lbClear _ctrl;
|
||||
{
|
||||
_ctrl lbAdd (getText(configfile >> "CfgVehicles" >> typeOf _x >> "displayName"));
|
||||
_class = if (typeName _x == "STRING") then {_x} else {typeOf _x};
|
||||
_ctrl lbAdd (getText(configfile >> "CfgVehicles" >> _class >> "displayName"));
|
||||
true
|
||||
} count _loaded;
|
||||
|
||||
|
@ -16,16 +16,25 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_player", "_object"];
|
||||
private ["_vehicle", "_size", "_displayName"];
|
||||
|
||||
private ["_nearestVehicle"];
|
||||
_nearestVehicle = [_player] call FUNC(findNearestVehicle);
|
||||
_vehicle = [_player] call FUNC(findNearestVehicle);
|
||||
|
||||
if (isNull _nearestVehicle || _nearestVehicle isKindOf "Cargo_Base_F") then {
|
||||
if (isNull _vehicle || _vehicle isKindOf "Cargo_Base_F") then {
|
||||
{
|
||||
if ([_object, _x] call FUNC(canLoadItemIn)) exitWith {_nearestVehicle = _x};
|
||||
if ([_object, _x] call FUNC(canLoadItemIn)) exitWith {_vehicle = _x};
|
||||
} foreach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]);
|
||||
};
|
||||
|
||||
if (isNull _nearestVehicle) exitWith {false};
|
||||
if (isNull _vehicle) exitWith {false};
|
||||
|
||||
[_object, _nearestVehicle] call FUNC(loadItem)
|
||||
// Start progress bar
|
||||
if ([_object, _vehicle] call FUNC(canLoadItemIn)) then {
|
||||
_size = [_object] call FUNC(getSizeItem);
|
||||
|
||||
[5 * _size, [_object,_vehicle], "LoadCargo", {}, localize LSTRING(LoadingItem)] call EFUNC(common,progressBar);
|
||||
} else {
|
||||
_displayName = getText (configFile >> "CfgVehicles" >> typeOf _object >> "displayName");
|
||||
|
||||
["displayTextStructured", [[LSTRING(LoadingFailed), _displayName], 3.0]] call EFUNC(common,localEvent);
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ private ["_display", "_loaded", "_ctrl", "_selected", "_item"];
|
||||
disableSerialization;
|
||||
|
||||
_display = uiNamespace getVariable QGVAR(menuDisplay);
|
||||
if (isnil "_display") exitWith {};
|
||||
if (isNil "_display") exitWith {};
|
||||
|
||||
_loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []];
|
||||
if (count _loaded == 0) exitWith {};
|
||||
@ -32,4 +32,17 @@ _selected = (lbCurSel _ctrl) max 0;
|
||||
if (count _loaded <= _selected) exitWith {};
|
||||
_item = _loaded select _selected;
|
||||
|
||||
[_item, GVAR(interactionVehicle)] call FUNC(unloadItem);
|
||||
|
||||
// Start progress bar
|
||||
private ["_size", "_itemClass", "_displayName"];
|
||||
|
||||
if ([_item, GVAR(interactionVehicle)] call FUNC(canUnloadItem)) then {
|
||||
_size = [_item] call FUNC(getSizeItem);
|
||||
|
||||
[5 * _size, [_item, GVAR(interactionVehicle)], "UnloadCargo", {}, localize LSTRING(UnloadingItem)] call EFUNC(common,progressBar);
|
||||
} else {
|
||||
_itemClass = if (typeName _item == "STRING") then {_item} else {typeOf _item};
|
||||
_displayName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName");
|
||||
|
||||
["displayTextStructured", [[LSTRING(UnloadingFailed), _displayName], 3.0]] call EFUNC(common,localEvent);
|
||||
};
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Unload object from vehicle.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
* 0: Item <OBJECT or STRING>
|
||||
* 1: Vehicle <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
@ -16,20 +16,21 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_loaded", "_space", "_itemSize", "_emptyPos", "_validVehiclestate"];
|
||||
|
||||
params ["_item", "_vehicle"];
|
||||
private ["_loaded", "_space", "_itemSize", "_emptyPos", "_validVehiclestate"];
|
||||
|
||||
if !([_item, _vehicle] call FUNC(canUnloadItem)) exitWith {
|
||||
false
|
||||
};
|
||||
|
||||
_itemClass = if (typeName _item == "STRING") then {_item} else {typeOf _item};
|
||||
|
||||
_validVehiclestate = true;
|
||||
_emptyPos = [];
|
||||
if (_vehicle isKindOf "Ship" ) then {
|
||||
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
|
||||
TRACE_1("SHIP Ground Check", getPosATL _vehicle );
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]); // TODO: if spot is underwater pick another spot.
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, _itemClass]); // TODO: if spot is underwater pick another spot.
|
||||
} else {
|
||||
if (_vehicle isKindOf "Air" ) then {
|
||||
if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false};
|
||||
@ -39,38 +40,29 @@ if (_vehicle isKindOf "Ship" ) then {
|
||||
} else {
|
||||
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
|
||||
TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle);
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, typeOf _item]);
|
||||
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, _itemClass]);
|
||||
};
|
||||
};
|
||||
|
||||
TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle);
|
||||
if (!_validVehiclestate) exitWith {false};
|
||||
|
||||
if (count _emptyPos == 0) exitWith {false}; //consider displaying text saying there are no safe places to exit the vehicle
|
||||
if (count _emptyPos == 0) exitWith {false};
|
||||
|
||||
_loaded = _vehicle getVariable [QGVAR(loaded), []];
|
||||
_loaded = _loaded - [_item];
|
||||
_loaded deleteAt (_loaded find _item);
|
||||
_vehicle setVariable [QGVAR(loaded), _loaded, true];
|
||||
|
||||
_space = [_vehicle] call FUNC(getCargoSpaceLeft);
|
||||
_itemSize = [_item] call FUNC(getSizeItem);
|
||||
_vehicle setVariable [QGVAR(space), (_space + _itemSize), true];
|
||||
|
||||
detach _item;
|
||||
_item setPosASL (_emptyPos call EFUNC(common,PositiontoASL));
|
||||
["hideObjectGlobal", [_item, false]] call EFUNC(common,serverEvent);
|
||||
|
||||
// show hint
|
||||
private ["_itemName", "_vehicleName"];
|
||||
|
||||
_itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName");
|
||||
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
|
||||
|
||||
["displayTextStructured", [[localize LSTRING(UnloadedItem), _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
|
||||
|
||||
// TOOO maybe drag/carry the unloaded item?
|
||||
|
||||
// Invoke listenable event
|
||||
["cargoUnloaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
|
||||
if (typeName _item == "OBJECT") then {
|
||||
detach _item;
|
||||
_item setPosASL (_emptyPos call EFUNC(common,PositiontoASL));
|
||||
["hideObjectGlobal", [_item, false]] call EFUNC(common,serverEvent);
|
||||
} else {
|
||||
createVehicle [_item, _emptyPos, [], 0, ""];
|
||||
};
|
||||
|
||||
true
|
||||
|
@ -24,7 +24,7 @@ _loaded = _vehicle getVariable [QGVAR(loaded), []];
|
||||
_newLoaded = [];
|
||||
_totalSpaceOccupied = 0;
|
||||
{
|
||||
if !(isNull _x) then {
|
||||
if ((typeName _x == "STRING") || {!isNull _x}) then {
|
||||
_newLoaded pushback _x;
|
||||
_totalSpaceOccupied = _totalSpaceOccupied + ([_x] call FUNC(getSizeItem));
|
||||
};
|
||||
@ -35,4 +35,4 @@ if (count _loaded != count _newLoaded) then {
|
||||
_vehicle setVariable [QGVAR(loaded), _newLoaded, true];
|
||||
};
|
||||
|
||||
_vehicle setVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeof _vehicle >> QGVAR(space)) - _totalSpaceOccupied, true];
|
||||
_vehicle setVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(space)) - _totalSpaceOccupied, true];
|
||||
|
@ -95,5 +95,17 @@
|
||||
<Hungarian>1%<br/>kirakodva ebből:<br/>%2</Hungarian>
|
||||
<Russian>%1<br/>разгружен из<br/>%2</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Cargo_LoadingItem">
|
||||
<English>Loading Cargo</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Cargo_UnloadingItem">
|
||||
<English>Unloading Cargo</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Cargo_LoadingFailed">
|
||||
<English>%1<br/>could not be loaded</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Cargo_UnloadingFailed">
|
||||
<English>%1<br/>could not be unloaded</English>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
|
@ -30,4 +30,4 @@ GVAR(vectorConnected) = false;
|
||||
GVAR(noVectorData) = true;
|
||||
GVAR(vectorGrid) = "00000000";
|
||||
|
||||
["RangerfinderData", {_this call FUNC(handleRangeFinderData)}] call EFUNC(common,addEventHandler);
|
||||
["RangerfinderData", FUNC(handleRangeFinderData)] call EFUNC(common,addEventHandler);
|
||||
|
@ -41,7 +41,8 @@ GVAR(outputPFH) = [{
|
||||
|
||||
// GRID
|
||||
_gridArray = [(getPos ACE_player), false] call EFUNC(common,getMapGridFromPos);
|
||||
_dagrGrid = format ["%1 %2", ((_gridArray select 0) select [0,4]), ((_gridArray select 1) select [0,4])];
|
||||
_gridArray params ["_gridArrayX","_gridArrayY"];
|
||||
_dagrGrid = format ["%1 %2", ((_gridArrayX) select [0,4]), ((_gridArrayY) select [0,4])];
|
||||
|
||||
// SPEED
|
||||
_speed = speed (vehicle ACE_player);
|
||||
@ -68,7 +69,7 @@ GVAR(outputPFH) = [{
|
||||
__gridControl ctrlSetText format ["%1", _dagrGrid];
|
||||
__speedControl ctrlSetText format ["%1", _dagrSpeed];
|
||||
__elevationControl ctrlSetText format ["%1", _dagrElevation];
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1 °", _dagrHeading] });
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1 <EFBFBD>", _dagrHeading] });
|
||||
__timeControl ctrlSetText format ["%1", _dagrTime];
|
||||
|
||||
}, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Author: Rosuto
|
||||
* DAGR vector output loop
|
||||
*
|
||||
@ -14,7 +14,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_pos", "_xGrid", "_yGrid", "_dagrGrid", "_bearing", "_dagrDist", "_dagrElevation", "_dagrTime", "_elevation", "_xCoord", "_yCoord"];
|
||||
private ["_xGrid", "_yGrid", "_dagrGrid", "_bearing", "_dagrDist", "_dagrElevation", "_dagrTime", "_elevation", "_xCoord", "_yCoord"];
|
||||
|
||||
135471 cutRsc ["DAGR_DISPLAY", "plain down"];
|
||||
|
||||
@ -30,15 +30,14 @@ private ["_pos", "_xGrid", "_yGrid", "_dagrGrid", "_bearing", "_dagrDist", "_dag
|
||||
__background ctrlSetText QUOTE(PATHTOF(UI\dagr_vector.paa));
|
||||
|
||||
if (GVAR(noVectorData)) exitwith {};
|
||||
|
||||
_pos = [GVAR(LAZPOS) select 0, GVAR(LAZPOS) select 1];
|
||||
GVAR(LAZPOS) params ["_lazPosX", "_lazPosY", "_lazPosZ"];
|
||||
|
||||
// Incase grids go neg due to 99-00 boundry
|
||||
if (_pos select 0 < 0) then {_pos set [0, (_pos select 0) + 99999];};
|
||||
if (_pos select 1 < 0) then {_pos set [1, (_pos select 1) + 99999];};
|
||||
if (_lazPosX < 0) then { _lazPosX = _lazPosX + 99999;};
|
||||
if (_lazPosY < 0) then {_lazPosY = _lazPosY + 99999;};
|
||||
|
||||
// Find laser position
|
||||
_xGrid = toArray Str(round(_pos select 0));
|
||||
_xGrid = toArray Str(round _lazPosX);
|
||||
|
||||
while {count _xGrid < 5} do {
|
||||
_xGrid = [48] + _xGrid;
|
||||
@ -47,7 +46,7 @@ _xGrid resize 4;
|
||||
_xGrid = toString _xGrid;
|
||||
_xGrid = parseNumber _xGrid;
|
||||
|
||||
_yGrid = toArray Str(round(_pos select 1));
|
||||
_yGrid = toArray Str(round _lazPosY);
|
||||
while {count _yGrid < 5} do {
|
||||
_yGrid = [48] + _yGrid;
|
||||
};
|
||||
@ -72,7 +71,7 @@ _yCoord = switch true do {
|
||||
_dagrGrid = _xCoord + " " + _yCoord;
|
||||
|
||||
// Find target elevation
|
||||
_elevation = floor ((GVAR(LAZPOS) select 2) + EGVAR(common,mapAltitude));
|
||||
_elevation = floor ((_lazPosZ) + EGVAR(common,mapAltitude));
|
||||
_dagrElevation = str _elevation + "m";
|
||||
|
||||
// Time
|
||||
@ -94,5 +93,5 @@ GVAR(vectorGrid) = _dagrGrid;
|
||||
__gridControl ctrlSetText format ["%1", _dagrGrid];
|
||||
__speedControl ctrlSetText format ["%1", _dagrDist];
|
||||
__elevationControl ctrlSetText format ["%1", _dagrElevation];
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _bearing] } else { format ["%1°", _bearing] });
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _bearing] } else { format ["%1°", _bearing] });
|
||||
__timeControl ctrlSetText format ["%1", _dagrTime];
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Author: Rosuto
|
||||
* DAGR waypoint output loop
|
||||
*
|
||||
@ -41,7 +41,8 @@ GVAR(outputPFH) = [{
|
||||
|
||||
// GRID
|
||||
_gridArray = [(getPos ACE_player), false] call EFUNC(common,getMapGridFromPos);
|
||||
_dagrGrid = format ["%1 %2", ((_gridArray select 0) select [0,4]), ((_gridArray select 1) select [0,4])];
|
||||
_gridArray params ["_gridArrayX","_gridArrayY"];
|
||||
_dagrGrid = format ["%1 %2", (_gridArrayX select [0,4]), (_gridArrayY select [0,4])];
|
||||
|
||||
// WP Grid
|
||||
_xGrid2 = floor (DAGR_WP_INFO / 10000);
|
||||
@ -84,7 +85,7 @@ GVAR(outputPFH) = [{
|
||||
__gridControl ctrlSetText format ["%1", _dagrGrid];
|
||||
__speedControl ctrlSetText format ["%1", _bearing];
|
||||
__elevationControl ctrlSetText format ["%1", _dagrGrid2];
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1°", _dagrHeading] });
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1°", _dagrHeading] });
|
||||
__timeControl ctrlSetText format ["%1", _dagrDistance];
|
||||
|
||||
}, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -23,11 +23,12 @@ if (GVAR(run)) then {
|
||||
};
|
||||
GVAR(hidden) = true;
|
||||
[{
|
||||
EXPLODE_1_PVT(_this select 0,_vehicle);
|
||||
params ["_args", "_idPFH"];
|
||||
_args params ["_vehicle"];
|
||||
if (!GVAR(run) || (!alive ACE_player) || (vehicle ACE_player != _vehicle)) exitWith {
|
||||
GVAR(run) = false;
|
||||
135471 cutText ["", "PLAIN"];
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
if (cameraView == "GUNNER") then {
|
||||
if (!GVAR(hidden)) then {
|
||||
|
@ -6,7 +6,7 @@ class CfgAmmo {
|
||||
class F_20mm_White: FlareBase {};
|
||||
|
||||
class ACE_FlashlightProxy_White: F_20mm_White {
|
||||
model = "";
|
||||
model = "\A3\Weapons_f\empty";
|
||||
effectFlare = "FlareShell";
|
||||
|
||||
triggerTime = 0;
|
||||
|
@ -1,5 +1,22 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
//Delete map glow lights from disconnecting players #2810
|
||||
if (isServer) then {
|
||||
addMissionEventHandler ["HandleDisconnect",{
|
||||
params ["_disconnectedPlayer"];
|
||||
|
||||
if ((!GVAR(mapGlow)) || {isNull _disconnectedPlayer}) exitWith {};
|
||||
{
|
||||
if (_x isKindOf "ACE_FlashlightProxy_White") then {
|
||||
// ACE_LOGINFO_2("Deleting leftover light [%1:%2] from DC player [%3]", _x, typeOf _x, _disconnectedPlayer);
|
||||
deleteVehicle _x;
|
||||
};
|
||||
} forEach attachedObjects _disconnectedPlayer;
|
||||
|
||||
nil
|
||||
}];
|
||||
};
|
||||
|
||||
// Exit on Headless as well
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
|
@ -54,7 +54,7 @@ if (_show) then {
|
||||
_allInjuryTexts = [];
|
||||
_genericMessages = [];
|
||||
|
||||
if (GVAR(level) >= 2) then {
|
||||
if (GVAR(level) >= 2 && {([_unit] call FUNC(hasMedicalEnabled))}) then {
|
||||
_partText = [LSTRING(Head), LSTRING(Torso), LSTRING(LeftArm) ,LSTRING(RightArm) ,LSTRING(LeftLeg), LSTRING(RightLeg)] select _selectionN;
|
||||
_genericMessages pushback [localize _partText, [1, 1, 1, 1]];
|
||||
};
|
||||
@ -87,7 +87,7 @@ if (_show) then {
|
||||
|
||||
_damaged = [false, false, false, false, false, false];
|
||||
_selectionBloodLoss = [0,0,0,0,0,0];
|
||||
if (GVAR(level) >= 2) then {
|
||||
if (GVAR(level) >= 2 && {([_target] call FUNC(hasMedicalEnabled))}) then {
|
||||
_openWounds = _target getvariable [QGVAR(openWounds), []];
|
||||
private "_amountOf";
|
||||
{
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
params ["_target", "_player", "_selectionN", "_actionData"];
|
||||
|
||||
if (GVAR(level) < 2) exitwith {
|
||||
if (GVAR(level) < 2 || {!([_target] call FUNC(hasMedicalEnabled))}) exitwith {
|
||||
private ["_pointDamage"];
|
||||
_pointDamage = (_target getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]) select _selectionN;
|
||||
|
||||
|
@ -62,7 +62,7 @@ _damaged = [false, false, false, false, false, false];
|
||||
_selectionBloodLoss = [0, 0, 0, 0, 0, 0];
|
||||
|
||||
_allInjuryTexts = [];
|
||||
if (EGVAR(medical,level) >= 2) then {
|
||||
if ((EGVAR(medical,level) >= 2) && {([_target] call EFUNC(medical,hasMedicalEnabled))}) then {
|
||||
_openWounds = _target getVariable [QEGVAR(medical,openWounds), []];
|
||||
private "_amountOf";
|
||||
{
|
||||
|
@ -308,6 +308,9 @@ class CfgVehicles {
|
||||
class O_Heli_Light_02_F: Heli_Light_02_base_F {
|
||||
displayName = CSTRING(Heli_Light_02_Name);
|
||||
};
|
||||
class O_Heli_Light_02_v2_F: Heli_Light_02_base_F {
|
||||
displayName = CSTRING(Heli_Light_02_v2_Name);
|
||||
};
|
||||
class Heli_Light_02_unarmed_base_F;
|
||||
class O_Heli_Light_02_unarmed_F: Heli_Light_02_unarmed_base_F {
|
||||
displayName = CSTRING(Heli_Light_02_unarmed_Name);
|
||||
|
@ -817,6 +817,17 @@
|
||||
<Hungarian>Ka-60 Kasatka</Hungarian>
|
||||
<Italian>Ka-60 Kasatka</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_RealisticNames_Heli_Light_02_v2_Name">
|
||||
<English>Ka-60 Kasatka (Black & White)</English>
|
||||
<Czech>Ka-60 Kasatka (černobílá)</Czech>
|
||||
<French>Ka-60 Kasatka (noir et blanc)</French>
|
||||
<German>Ka-60 Kasatka (Schwarz-weiß)</German>
|
||||
<Italian>Ka-60 Kasatka (bianco e nero)</Italian>
|
||||
<Polish>Ka-60 Kasatka (czarno-biały)</Polish>
|
||||
<Portuguese>Ka-60 Kasatka (preto e branco)</Portuguese>
|
||||
<Russian>Ka-60 Касатка (белый и черный)</Russian>
|
||||
<Spanish>Ka-60 Kasatka (blanco y negro)</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_RealisticNames_Heli_Light_02_unarmed_Name">
|
||||
<English>Ka-60 Kasatka (unarmed)</English>
|
||||
<German>Ka-60 Kasatka (unbewaffnet)</German>
|
||||
|
@ -16,7 +16,7 @@ def get_private_declare(content):
|
||||
|
||||
priv_dec_str = ''.join(priv_srch_declared)
|
||||
|
||||
srch = re.compile('(?<![_a-zA-Z0-9])(_[a-zA-Z]*?)[ ,\}\]\)";]')
|
||||
srch = re.compile('(?<![_a-zA-Z0-9])(_[a-zA-Z0-9]*?)[ ,\}\]\)";]')
|
||||
priv_split = srch.findall(priv_dec_str)
|
||||
priv_split = sorted(set(priv_split))
|
||||
priv_declared += priv_split;
|
||||
@ -27,12 +27,18 @@ def get_private_declare(content):
|
||||
|
||||
priv_dec_str = ''.join(priv_srch_declared)
|
||||
|
||||
srch = re.compile('(?<![_a-zA-Z0-9])(_[a-zA-Z]*?)[ ,\}\]\)";]')
|
||||
srch = re.compile('(?<![_a-zA-Z0-9])(_[a-zA-Z0-9]*?)[ ,\}\]\)";]')
|
||||
priv_split = srch.findall(priv_dec_str)
|
||||
priv_split = sorted(set(priv_split))
|
||||
|
||||
priv_declared += priv_split;
|
||||
|
||||
srch = re.compile('(?i)[\s]*local[\s]+(_[\w\d]*)[\s]*=.*')
|
||||
priv_local = srch.findall(content)
|
||||
priv_local_declared = sorted(set(priv_local))
|
||||
|
||||
priv_declared += priv_local_declared;
|
||||
|
||||
|
||||
return priv_declared
|
||||
|
||||
@ -53,7 +59,7 @@ def check_privates(filepath):
|
||||
|
||||
|
||||
# Regex search privates
|
||||
srch = re.compile('(?<![_a-zA-Z0-9])(_[a-zA-Z]*?)[ ,\^\-\+\/\*\%\}\]\)";]')
|
||||
srch = re.compile('(?<![_a-zA-Z0-9])(_[a-zA-Z0-9]*?)[ =,\^\-\+\/\*\%\}\]\)";]')
|
||||
priv_use = srch.findall(content)
|
||||
priv_use = sorted(set(priv_use))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user