Merge branch 'master' into parseList

This commit is contained in:
jonpas 2015-09-05 20:16:59 +02:00
commit 8fc061bfd6
20 changed files with 358 additions and 33 deletions

View File

@ -6,23 +6,11 @@ class CfgAmmo {
timeToLive=6;
};
class B_20mm : BulletBase {
timeToLive=30;
};
class B_25mm : BulletBase {
timeToLive=30;
};
class B_35mm_AA : BulletBase {
timeToLive=30;
};
class B_30mm_AP : BulletBase {
timeToLive=30;
};
class B_556x45_Ball : BulletBase {
airFriction=-0.00126466;
hit=8;
typicalSpeed=750;
tracerScale = 1;
tracerStartTime=0.073; // M856 tracer burns out to 800m
tracerEndTime=1.57123; // Time in seconds calculated with ballistics calculator
ACE_caliber=5.69;
@ -128,9 +116,13 @@ class CfgAmmo {
ACE_muzzleVelocities[]={785, 883, 925};
ACE_barrelLengths[]={254.0, 414.02, 508.0};
};
class B_56x15_dual: BulletBase {
tracerScale = 0.5;
};
class B_65x39_Caseless : BulletBase {
airFriction=-0.00075308;
typicalSpeed=800;
tracerScale = 1.1; //1.0;
ACE_caliber=6.706;
ACE_bulletLength=32.893;
ACE_bulletMass=7.9704;
@ -180,10 +172,15 @@ class CfgAmmo {
ACE_muzzleVelocities[]={750, 820, 840, 852, 860};
ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4};
};
class SubmunitionBullet;
class B_65x39_Minigun_Caseless: SubmunitionBullet {
tracerScale = 1.1; //1.0;
};
class B_762x51_Ball : BulletBase {
airFriction=-0.00100957;
typicalSpeed=833;
hit=9;
tracerScale = 1.2; //0.6;
tracerStartTime=0.073; // Based on the British L5A1 which burns out to 1000m
tracerEndTime=2.15957; // Time in seconds calculated with ballistics calculator
ACE_caliber=7.823;
@ -479,6 +476,7 @@ class CfgAmmo {
class B_9x21_Ball : BulletBase {
airFriction=-0.00226847;
typicalSpeed=390;
tracerScale = 0.5;
hit=6;
ACE_caliber=9.042;
ACE_bulletLength=15.494;
@ -491,6 +489,9 @@ class CfgAmmo {
ACE_muzzleVelocities[]={440, 460, 480};
ACE_barrelLengths[]={101.6, 127.0, 228.6};
};
class B_9x21_Ball_Tracer_Green: B_9x21_Ball {
tracerScale = 0.5;
};
class ACE_9x18_Ball_57N181S : B_9x21_Ball {
hit=5;
airFriction=-0.00190333;
@ -584,6 +585,7 @@ class CfgAmmo {
timeToLive=10;
airFriction=-0.00038944;
typicalSpeed=910;
tracerScale = 1.3; //1.2;
ACE_caliber=10.363;
ACE_bulletLength=54.0;
ACE_bulletMass=26.568;
@ -670,9 +672,13 @@ class CfgAmmo {
ACE_muzzleVelocities[]={880, 915, 925};
ACE_barrelLengths[]={508.0, 660.4, 711.2};
};
class B_127x33_Ball: BulletBase {
tracerScale = 1.3; //1.2;
};
class B_127x54_Ball : BulletBase {
airFriction=-0.00019268;
typicalSpeed=300;
tracerScale = 1.3;//
ACE_caliber=12.954;
ACE_bulletLength=64.516;
ACE_bulletMass=48.6;
@ -688,6 +694,7 @@ class CfgAmmo {
timeToLive=10;
airFriction=-0.00057503;
typicalSpeed=900;
tracerScale = 1.3; //1.2;
ACE_caliber=12.954;
ACE_bulletLength=58.674;
ACE_bulletMass=41.9256;
@ -703,6 +710,7 @@ class CfgAmmo {
timeToLive=10;
airFriction=-0.00057503;
typicalSpeed=900;
tracerScale = 1.3;//
hit=25;
caliber=4.0;
ACE_caliber=12.954;
@ -736,6 +744,7 @@ class CfgAmmo {
timeToLive=10;
airFriction=-0.00063800;
typicalSpeed=820;
tracerScale = 1.3; //1.5;
ACE_caliber=12.979;
ACE_bulletLength=64.008;
ACE_bulletMass=48.276;
@ -750,6 +759,7 @@ class CfgAmmo {
class B_45ACP_Ball : BulletBase {
airFriction=-0.00081221;
typicalSpeed=250;
tracerScale = 0.6;
ACE_caliber=11.481;
ACE_bulletLength=17.272;
ACE_bulletMass=14.904;
@ -761,4 +771,36 @@ class CfgAmmo {
ACE_muzzleVelocities[]={230, 250, 285};
ACE_barrelLengths[]={101.6, 127.0, 228.6};
};
class B_19mm_HE: BulletBase {
tracerScale = 1;
};
class B_30mm_HE: B_19mm_HE {
tracerScale = 2.5;
};
class B_20mm: BulletBase {
timeToLive=30;
tracerScale = 1.5; //1;
};
class B_25mm: BulletBase {
timeToLive=30;
tracerScale = 2.0; //1;
};
class B_30mm_AP: BulletBase {
timeToLive=30;
tracerScale = 2.5;
};
class B_35mm_AA: BulletBase {
timeToLive=30;
tracerScale = 2.75; //1.85;
};
class ShellBase;
class Sh_120mm_HE: ShellBase {
tracerScale = 3;
};
class Sh_120mm_APFSDS: ShellBase {
tracerScale = 3;
};
class Gatling_30mm_HE_Plane_CAS_01_F: BulletBase {
tracerScale = 2.5;
};
};

View File

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

View File

@ -150,6 +150,15 @@ call FUNC(checkFiles);
//Event that settings are safe to use:
["SettingsInitialized", []] call FUNC(localEvent);
//Set init finished and run all delayed functions:
GVAR(settingsInitFinished) = true;
diag_log text format ["[ACE] %1 delayed functions running", (count GVAR(runAtSettingsInitialized))];
{
_x params ["_func", "_params"];
_params call _func;
} forEach GVAR(runAtSettingsInitialized);
GVAR(runAtSettingsInitialized) = nil; //cleanup
}, 0, [false]] call CBA_fnc_addPerFrameHandler;
@ -326,7 +335,7 @@ GVAR(OldIsCamera) = false;
if (didJip) then {
// We are jipping! Get ready and wait, and throw the event
[{
if(!(isNull player)) then {
if((!(isNull player)) && GVAR(settingsInitFinished)) then {
["PlayerJip", [player] ] call FUNC(localEvent);
[(_this select 1)] call cba_fnc_removePerFrameHandler;
};

View File

@ -158,6 +158,7 @@ PREP(requestCallback);
PREP(resetAllDefaults);
PREP(restoreVariablesJIP);
PREP(revertKeyCodeLocalized);
PREP(runAfterSettingsInit);
PREP(sanitizeString);
PREP(sendRequest);
PREP(serverLog);
@ -304,6 +305,9 @@ GVAR(nextFrameNo) = diag_frameno;
GVAR(nextFrameBufferA) = [];
GVAR(nextFrameBufferB) = [];
GVAR(settingsInitFinished) = false;
GVAR(runAtSettingsInitialized) = [];
// @TODO: Generic local-managed global-synced objects (createVehicleLocal)
//Debug

View File

@ -0,0 +1,27 @@
/*
* Author: PabstMirror
* Executes code after setting are initilized.
*
* Argument:
* 0: Code to execute <CODE>
* 1: Parameters to run the code with <ANY>
*
* Return value:
* None
*
* Example:
* [{if (GVAR(setting) then {x} else {y};}, []] call ace_common_fnc_runAfterSettingsInit
*
* Public: No
*/
#include "script_component.hpp"
params ["_func", "_params"];
if (GVAR(settingsInitFinished)) then {
//Setting Already Finished, Direct Run the code
_params call _func;
} else {
//Waiting on settings, throw it on the delayed run array
GVAR(runAtSettingsInitialized) pushBack [_func, _params];
};

View File

@ -85,6 +85,7 @@ class CfgAmmo {
suppressionRadiusHit = 20;
typicalSpeed = 22;
cost = 40;
explosive = 1E-7;
deflecting = 15;
explosionTime = 2.3;
timeToLive = 6;

View File

@ -68,6 +68,7 @@ PREP(selectionNameToNumber);
PREP(setCardiacArrest);
PREP(setDead);
PREP(setHitPointDamage);
PREP(setStructuralDamage);
PREP(setUnconscious);
PREP(treatment);
PREP(treatment_failure);

View File

@ -79,5 +79,5 @@ _newUnit setvariable ["ACE_isUnconscious", true, true];
_newUnit setvariable [QGVAR(disableInteraction), true, true];
_oldBody setvariable [QGVAR(disableInteraction), true, true];
_newUnit setDamage 0.89;
[_newUnit, 0.89] call FUNC(setStructuralDamage);
_newUnit;

View File

@ -82,5 +82,5 @@ if (isPLayer _unit) then {
["medical_onSetDead", [_unit]] call EFUNC(common,localEvent);
_unit setdamage 1;
[_unit, 1] call FUNC(setStructuralDamage);
true;

View File

@ -0,0 +1,25 @@
/*
* Author: commy2
* Set the structural damage of a soldier without changing the individual hitpoints. Unit has to be local. Not safe to use with vehicles!
*
* Arguments:
* 0: The unit <OBJECT>
*
* ReturnValue:
* <NIL>
*
* Public: no?
*/
params ["_unit", "_damage"];
if (!local _unit) exitWith {};
private "_allHitPoints";
_allHitPoints = getAllHitPointsDamage _unit select 2;
_unit setDamage _damage;
{
_unit setHitIndex [_forEachIndex, _x];
} forEach _allHitPoints;

View File

@ -61,4 +61,11 @@ class ACE_Settings {
values[] = {CSTRING(engineerSetting_anyone), CSTRING(engineerSetting_EngineerOnly), CSTRING(engineerSetting_RepairSpecialistOnly)};
category = ECSTRING(OptionsMenu,CategoryLogistics);
};
class GVAR(addSpareParts) {
displayName = CSTRING(addSpareParts_name);
description = CSTRING(addSpareParts_description);
typeName = "BOOL";
value = 1;
category = ECSTRING(OptionsMenu,CategoryLogistics);
};
};

View File

@ -13,31 +13,31 @@ class Extended_PostInit_EventHandlers {
class Extended_Init_EventHandlers {
class Car {
class ADDON {
init = QUOTE(_this call DFUNC(addRepairActions));
init = QUOTE(_this call DFUNC(addRepairActions); _this call DFUNC(addSpareParts));
};
};
class Tank {
class ADDON {
init = QUOTE(_this call DFUNC(addRepairActions));
init = QUOTE(_this call DFUNC(addRepairActions); _this call DFUNC(addSpareParts));
};
};
class Helicopter {
class ADDON {
init = QUOTE(_this call DFUNC(addRepairActions));
init = QUOTE(_this call DFUNC(addRepairActions); _this call DFUNC(addSpareParts));
};
};
class Plane {
class ADDON {
init = QUOTE(_this call DFUNC(addRepairActions));
init = QUOTE(_this call DFUNC(addRepairActions); _this call DFUNC(addSpareParts));
};
};
class Ship_F {
class ADDON {
init = QUOTE(_this call DFUNC(addRepairActions));
init = QUOTE(_this call DFUNC(addRepairActions); _this call DFUNC(addSpareParts));
};
};
};

View File

@ -91,6 +91,12 @@ class CfgVehicles {
class Special { name = CSTRING(engineerSetting_RepairSpecialistOnly); value = 2; default = 1;};
};
};
class addSpareParts {
displayName = CSTRING(addSpareParts_name);
description = CSTRING(addSpareParts_description);
typeName = "BOOL";
defaultValue = 1;
};
};
class ModuleDescription {
description = CSTRING(moduleDescription);
@ -215,19 +221,57 @@ class CfgVehicles {
sync[] = {};
};
};
class ACE_moduleAddSpareParts: Module_F {
scope = 2;
displayName = CSTRING(AddSpareParts_Module_DisplayName);
icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa));
category = "ACE_Logistics";
function = QFUNC(moduleAddSpareParts);
functionPriority = 10;
isGlobal = 0;
isTriggerActivated = 0;
isDisposable = 0;
author = ECSTRING(common,ACETeam);
class Arguments {
class List {
displayName = CSTRING(AddSpareParts_List_DisplayName);
description = CSTRING(AddSpareParts_List_Description);
defaultValue = "";
typeName = "STRING";
};
class Part {
displayName = CSTRING(AddSpareParts_Part_DisplayName);
description = CSTRING(AddSpareParts_Part_Description);
typeName = "STRING";
class values {
class Wheel {
name = CSTRING(SpareWheel);
value = "ACE_Wheel";
default = 1;
};
class Track {
name = CSTRING(SpareTrack);
value = "ACE_Track";
};
};
};
class Amount {
displayName = CSTRING(AddSpareParts_Amount_DisplayName);
description = CSTRING(AddSpareParts_Amount_Description);
typeName = "NUMBER";
defaultValue = 1;
};
};
class ModuleDescription {
description = CSTRING(AddSpareParts_Module_Description);
sync[] = {};
};
};
class LandVehicle;
class Car: LandVehicle {
MACRO_REPAIRVEHICLE
class ACE_Cargo {
class Cargo {
class ACE_Wheel {
type = "ACE_Wheel";
amount = 1;
};
};
};
};
class Tank: LandVehicle {

View File

@ -5,3 +5,20 @@
// wheels
["setWheelHitPointDamage", {(_this select 0) setHitPointDamage [_this select 1, _this select 2]}] call EFUNC(common,addEventHandler);
if (isServer) then {
["SettingsInitialized", {
GVAR(settingInitted) = true; // Stop collecting in FUNC(addSpareParts)
// Exit if adding spare parts disabled and clean collection
if (!GVAR(addSpareParts)) exitWith {GVAR(addSparePartsCollection) = nil};
// Add spare parts to vehicles in collection
{
[_x] call FUNC(addSpareParts);
} forEach GVAR(addSparePartsCollection);
// Clean collection
GVAR(addSparePartsCollection) = nil;
}] call EFUNC(common,addEventHandler);
};

View File

@ -3,6 +3,7 @@
ADDON = false;
PREP(addRepairActions);
PREP(addSpareParts);
PREP(canMiscRepair);
PREP(canRemove);
PREP(canRepair);
@ -24,6 +25,7 @@ PREP(isEngineer);
PREP(isInRepairFacility);
PREP(isNearRepairVehicle);
PREP(isRepairVehicle);
PREP(moduleAddSpareParts);
PREP(moduleAssignEngineer);
PREP(moduleAssignRepairVehicle);
PREP(moduleAssignRepairFacility);
@ -38,4 +40,6 @@ PREP(spawnObject);
PREP(useItem);
PREP(useItems);
GVAR(addSparePartsCollection) = [];
ADDON = true;

View File

@ -0,0 +1,47 @@
/*
* Author: Jonpas
* Adds spare parts to the vehicle. Before SettingsInitialized only collect for later execution.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Amount <NUMBER> (default: 1)
* 2: Spare Part Classname <STRING> (default: "")
* 3: Force (add even if setting is disabled) <BOOL> (default: false)
*
* Return Value:
* None
*
* Example:
* [vehicle] call ace_repair_fnc_addSpareParts
*
* Public: No
*/
#include "script_component.hpp"
private ["_part"];
params ["_vehicle", ["_amount", 1], ["_part", ""], ["_force", false]];
TRACE_2("params",_vehicle,_amount);
// Exit if ace_cargo is not loaded
if !(["ace_cargo"] call EFUNC(common,isModLoaded)) exitWith {};
// Collect until SettingsInitialized
if (isNil QGVAR(settingInitted)) exitWith {
if !(_vehicle in GVAR(addSparePartsCollection)) then {
GVAR(addSparePartsCollection) pushBack _vehicle;
};
};
// Exit if not forced and add spare parts is disabled (after settings initted to make sure it really is)
if (!_force && !GVAR(addSpareParts)) exitWith {};
// Select appropriate part
if (_part == "") then {
if (_vehicle isKindOf "Car") then { _part = "ACE_Wheel" };
if (_vehicle isKindOf "Tank") then { _part = "ACE_Track" };
};
// Exit if no appropriate part
if (_part == "") exitWith {};
// Load
["AddCargoByClass", [_part, _vehicle, _amount]] call EFUNC(common,localEvent);

View File

@ -0,0 +1,61 @@
/*
* Author: Jonpas
* Adds spare parts to a vehicle.
*
* Arguments:
* 0: The module logic <OBJECT>
* 1: Synchronized units <ARRAY>
* 2: Activated <BOOL>
*
* Return Value:
* None
*
* Example:
* function = "ace_repair_fnc_moduleAssignRepairVehicle"
*
* Public: No
*/
#define DEBUG_MODE_FULL
#include "script_component.hpp"
params ["_logic"];
if (!isNull _logic) then {
private ["_list", "_part", "_amount", "_nilCheckPassedList"];
// Module settings
_list = _logic getVariable ["List", ""];
_part = _logic getVariable ["Part", 0];
_amount = _logic getVariable ["Amount", 1];
// Parse list
_nilCheckPassedList = "";
{
_x = [_x] call EFUNC(common,stringRemoveWhiteSpace);
if !(isnil _x) then {
if (_nilCheckPassedList == "") then {
_nilCheckPassedList = _x;
} else {
_nilCheckPassedList = _nilCheckPassedList + "," + _x;
};
};
} forEach ([_list, ","] call BIS_fnc_splitString);
_list = "[" + _nilCheckPassedList + "]";
_list = [] call compile _list;
// Add synchronized objects to list
{
_list pushBack _x;
} forEach (synchronizedObjects _logic);
if (_list isEqualTo []) exitWith {};
TRACE_3("module info parsed",_list,_part,_amount);
// Add spare parts
{
if (!isNil "_x" && {typeName _x == typeName objNull}) then {
[_x, _amount, _part, true] call FUNC(addSpareParts);
};
} forEach _list;
};
true

View File

@ -31,4 +31,6 @@ if (!isServer) exitWith {};
[_logic, QGVAR(fullRepairLocation), "fullRepairLocation"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(engineerSetting_fullRepair), "engineerSetting_fullRepair"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(addSpareParts), "addSpareParts"] call EFUNC(common,readSettingFromModule);
diag_log text "[ACE]: Repair Module Initialized.";

View File

@ -118,6 +118,12 @@
<English>Who can perform a full repair on a vehicle?</English>
<Polish>Kto może przeprowadzić pełną naprawę pojazdu?</Polish>
</Key>
<Key ID="STR_ACE_Repair_addSpareParts_name">
<English>Add Spare Parts</English>
</Key>
<Key ID="STR_ACE_Repair_addSpareParts_description">
<English>Add spare parts to vehicles (requires Cargo component)?</English>
</Key>
<Key ID="STR_ACE_Repair_Repair">
<English>Repair &gt;&gt;</English>
<German>Reparieren &gt;&gt;</German>
@ -656,5 +662,30 @@
<English>Assign one or multiple objects as a repair Facility</English>
<Polish>Przydziel klasę budynku naprawczego do jednego lub kilku budynków.</Polish>
</Key>
<Key ID="STR_ACE_Repair_AddSpareParts_Module_DisplayName">
<English>Add Spare Parts</English>
</Key>
<Key ID="STR_ACE_Repair_AddSpareParts_Module_Description">
<English>Add spare parts to one or multiple objects</English>
</Key>
<Key ID="STR_ACE_Repair_AddSpareParts_List_DisplayName">
<English>List</English>
</Key>
<Key ID="STR_ACE_Repair_AddSpareParts_List_Description">
<English>List of objects that will get spare parts added, separated by commas.</English>
</Key>
<Key ID="STR_ACE_Repair_AddSpareParts_Part_DisplayName">
<English>Part</English>
</Key>
<Key ID="STR_ACE_Repair_AddSpareParts_Part_Description">
<English>Spare part.</English>
</Key>
<Key ID="STR_ACE_Repair_AddSpareParts_Amount_DisplayName">
<English>Amount</English>
</Key>
<Key ID="STR_ACE_Repair_AddSpareParts_Amount_Description">
<English>Number of selected spare parts.</English>
</Key>
</Package>
</Project>

View File

@ -182,15 +182,18 @@ _activeWeapon = _activeWeaponAndMuzzle select 0;
_activeMuzzle = _activeWeaponAndMuzzle select 1;
_activeWeaponMode = _activeWeaponAndMuzzle select 2;
if (_activeMuzzle != "" and _activeMuzzle != _activeWeapon) then {
if (!(_activeMuzzle isEqualTo "") and
!(_activeMuzzle isEqualTo _activeWeapon) and
(_activeMuzzle in getArray (configfile >> "CfgWeapons" >> _activeWeapon >> "muzzles"))) then {
_unit selectWeapon _activeMuzzle;
} else {
if (_activeWeapon != "") then {
if (!(_activeWeapon isEqualTo "")) then {
_unit selectWeapon _activeWeapon;
};
};
if (currentWeapon _unit != "") then {
if (!(currentWeapon _unit isEqualTo "")) then {
private ["_index"];
_index = 0;
while {