mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
f83c605958
* Add jamming coef to change or disable jamming. * change max to 5 * add setting for overheating effects distance, unjaming on barrel swap, increase rate of fire with heat - add setting for overheating effects distance - add unjaming on barrel swap, with setting - add increase rate of fire with heat, with setting - fix some formatting * little tweaks * add overheating cookoff feature - add overheating cookoff feature - add documentation - bugfixes/improvements * Update ace3-config-entries.md * Update overheating-framework.md * Update addons/overheating/XEH_postInit.sqf Co-authored-by: jonpas <jonpas33@gmail.com> * Update addons/overheating/XEH_postInit.sqf Co-authored-by: jonpas <jonpas33@gmail.com> * Update addons/overheating/functions/fnc_firedEH.sqf Co-authored-by: jonpas <jonpas33@gmail.com> * Update addons/overheating/stringtable.xml Co-authored-by: jonpas <jonpas33@gmail.com> * Update docs/wiki/feature/overheating.md Co-authored-by: jonpas <jonpas33@gmail.com> * Update addons/overheating/stringtable.xml Co-authored-by: jonpas <jonpas33@gmail.com> * Update addons/overheating/functions/fnc_jamWeapon.sqf Co-authored-by: jonpas <jonpas33@gmail.com> * Update addons/overheating/functions/fnc_jamWeapon.sqf Co-authored-by: jonpas <jonpas33@gmail.com> * remove extra underwater cooling, make cookoffCoef enable cookoff - add coef setting for heat generation per shot - merge cookoff setting into cookoff coef setting - remove check for water that increased cooling - change max rof increase from heat to 10% - change ammo heating to a less linear formula - change cookoffCoef to effect inginition tempurature instead of heat amount - delay cookoff shot until any firing animation is done - update strings based on feedback * Update stringtable.xml * add cookoff notification * improvements from play testing - move ammo heat loop into seperate function with a tighter loop - factor rain into cooling calculation - handle cooling while swimming - merge cookoff take event handler into fnc_handleTakeEH - fix case where cookoff could potentially come from underbarrel weapon muzzle - only add TakeEH if required by enabled settings - improve cookoff muzzle/mode handling * fix missing semi that I swear I already fixed before pushing * Update overheating-framework.md * Update fnc_updateAmmoTemperature.sqf * include wind speed in cooling calculation * cool with X - add ace interactions to allow cooling with water sources when Ace X is loaded - add documentation for cooling - move getting barrel mass to a function * documentation formatting * Add config array for weapon jam types, as not all weapon can get all types IRL. * remove variable that's not required * add some compat entries for RHS * fix merge conflict * fix a happy little accident * move to CBA settings, minor styling. * Update error message in fnc_jamWeapon.sqf Co-authored-by: jonpas <jonpas33@gmail.com> * Apply suggestions from code review Co-authored-by: TyroneMF <TyroneMF@hotmail.com> Co-authored-by: jonpas <jonpas33@gmail.com> Co-authored-by: TyroneMF <TyroneMF@hotmail.com>
112 lines
4.7 KiB
Plaintext
112 lines
4.7 KiB
Plaintext
// by esteldunedain
|
|
#include "script_component.hpp"
|
|
|
|
// Spare barrel item to magazine
|
|
["ACE_SpareBarrel_Item", "ACE_SpareBarrel"] call EFUNC(common,registerItemReplacement);
|
|
|
|
if (hasInterface) then {
|
|
// Add keybinds
|
|
["ACE3 Weapons", QGVAR(unjamWeapon), localize LSTRING(UnjamWeapon), {
|
|
// Conditions: canInteract
|
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
|
// Conditions: specific
|
|
|
|
if !(GVAR(enabled) && {[ACE_player] call FUNC(canUnjam)}) exitWith {false};
|
|
|
|
// Statement
|
|
[ACE_player, currentMuzzle ACE_player, false] call FUNC(clearJam);
|
|
true
|
|
}, {false}, [19, [true, false, false]], false] call CBA_fnc_addKeybind; //SHIFT + R Key
|
|
};
|
|
|
|
["CBA_settingsInitialized", {
|
|
TRACE_1("SettingsInitialized eh", GVAR(enabled));
|
|
if (!GVAR(enabled)) exitWith {};
|
|
|
|
if (isServer) then {
|
|
GVAR(pseudoRandomList) = [];
|
|
// Construct a list of pseudo random 2D vectors
|
|
for "_i" from 0 to 30 do {
|
|
GVAR(pseudoRandomList) pushBack [-1 + random 2, -1 + random 2];
|
|
};
|
|
publicVariable QGVAR(pseudoRandomList);
|
|
|
|
// Keep track of the temperature of stored spare barrels
|
|
GVAR(storedSpareBarrels) = createHashMap;
|
|
|
|
// Install event handlers for spare barrels
|
|
[QGVAR(sendSpareBarrelTemperatureHint), FUNC(sendSpareBarrelsTemperaturesHint)] call CBA_fnc_addEventHandler;
|
|
[QGVAR(loadCoolestSpareBarrel), FUNC(loadCoolestSpareBarrel)] call CBA_fnc_addEventHandler;
|
|
|
|
// Schedule cool down calculation of stored spare barrels
|
|
[] call FUNC(updateSpareBarrelsTemperaturesThread);
|
|
};
|
|
|
|
if !(hasInterface) exitWith {};
|
|
|
|
GVAR(cacheWeaponData) = call CBA_fnc_createNamespace;
|
|
GVAR(cacheAmmoData) = call CBA_fnc_createNamespace;
|
|
GVAR(cacheSilencerData) = call CBA_fnc_createNamespace;
|
|
|
|
//Add Take EH if required
|
|
if (GVAR(unJamOnReload) || {GVAR(cookoffCoef) > 0}) then {
|
|
["CAManBase", "Take", {_this call FUNC(handleTakeEH);}] call CBA_fnc_addClassEventHandler;
|
|
};
|
|
|
|
// Register fire event handler
|
|
["ace_firedPlayer", DFUNC(firedEH)] call CBA_fnc_addEventHandler;
|
|
// Only add eh to non local players if dispersion is enabled
|
|
if (GVAR(overheatingDispersion) || {GVAR(showParticleEffectsForEveryone)}) then {
|
|
["ace_firedPlayerNonLocal", DFUNC(firedEH)] call CBA_fnc_addEventHandler;
|
|
};
|
|
|
|
// Schedule cool down calculation of player weapons at (infrequent) regular intervals
|
|
[] call FUNC(updateTemperatureThread);
|
|
|
|
//Add event handlers and start ammo heating loop for cookoff
|
|
if (GVAR(cookoffCoef) > 0) then {
|
|
[] call FUNC(updateAmmoTemperatureThread);
|
|
|
|
// Reset ammo temperature on reload, unless the reload is a second muzzle.
|
|
["CAManBase", "Reloaded", {
|
|
params ["_unit", "_weapon", "_muzzle"];
|
|
if (_muzzle == _weapon) then {
|
|
_unit setVariable [format [QGVAR(%1_ammoTemp), _weapon], 0];
|
|
};
|
|
}] call CBA_fnc_addClassEventHandler;
|
|
};
|
|
|
|
// Install event handler to display temp when a barrel was swapped
|
|
[QGVAR(showWeaponTemperature), DFUNC(displayTemperature)] call CBA_fnc_addEventHandler;
|
|
// Install event handler to initiate an assisted barrel swap
|
|
[QGVAR(initiateSwapBarrelAssisted), DFUNC(swapBarrel)] call CBA_fnc_addEventHandler;
|
|
|
|
// Add an action to allow hot weapons to be cooled off in AceX Field Rations water sources
|
|
if (isClass(configfile >> "CfgPatches" >> "acex_field_rations")) then {
|
|
[
|
|
{acex_field_rations_enabled || CBA_missionTime > 1},
|
|
{
|
|
if (!acex_field_rations_enabled) exitWith {};
|
|
|
|
_CoolWeaponWithWaterSourceAction = [
|
|
QGVAR(CoolWeaponWithWaterSource),
|
|
LLSTRING(CoolWeaponWithWaterSource),
|
|
"\z\acex\addons\field_rations\ui\icon_water_tap.paa",
|
|
{
|
|
private _waterSource = _target getVariable ["acex_field_rations_waterSource", objNull];
|
|
[_player, _waterSource] call FUNC(coolWeaponWithWaterSource);
|
|
},
|
|
{
|
|
private _waterSource = _target getVariable ["acex_field_rations_waterSource", objNull];
|
|
[_player, _waterSource] call acex_field_rations_fnc_canDrinkFromSource;
|
|
}
|
|
] call EFUNC(interact_menu,createAction);
|
|
|
|
["acex_field_rations_helper", 0, ["acex_field_rations_waterSource"], _CoolWeaponWithWaterSourceAction] call EFUNC(interact_menu,addActionToClass);
|
|
},
|
|
[]
|
|
] call CBA_fnc_waitUntilAndExecute;
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|