mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
switch NLAW to CBA disposable system
This commit is contained in:
parent
28ac653635
commit
74229224d6
@ -1,33 +0,0 @@
|
||||
|
||||
class Extended_PreStart_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preStart));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_DisplayLoad_EventHandlers {
|
||||
class RscDisplayInventory {
|
||||
ADDON = QUOTE([ARR_2(ACE_player, _this select 0)] call FUNC(updateInventoryDisplay));
|
||||
};
|
||||
};
|
||||
|
||||
// handle preloaded missile
|
||||
class Extended_InitPost_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
init = QUOTE([_this select 0] call FUNC(takeLoadedATWeapon));
|
||||
};
|
||||
};
|
||||
};
|
@ -1,15 +1,7 @@
|
||||
class CfgMagazines {
|
||||
class NLAW_F;
|
||||
class ACE_PreloadedMissileDummy: NLAW_F { // The dummy magazine
|
||||
author = ECSTRING(common,ACETeam);
|
||||
class CA_LauncherMagazine;
|
||||
class NLAW_F: CA_LauncherMagazine {
|
||||
scope = 1;
|
||||
scopeArsenal = 1;
|
||||
displayName = CSTRING(PreloadedMissileDummy);
|
||||
picture = "\a3\ui_f\data\IGUI\Cfg\Targeting\Empty_ca.paa";
|
||||
weaponPoolAvailable = 0;
|
||||
mass = 0;
|
||||
};
|
||||
class ACE_FiredMissileDummy: ACE_PreloadedMissileDummy {
|
||||
count = 0;
|
||||
allowedSlots[] = {};
|
||||
};
|
||||
};
|
||||
|
@ -1,19 +1,52 @@
|
||||
class CfgWeapons {
|
||||
class Launcher_Base_F;
|
||||
class launch_NLAW_F: Launcher_Base_F {
|
||||
ACE_UsedTube = "ACE_launch_NLAW_Used_F"; // The class name of the used tube.
|
||||
magazines[] = {"ACE_PreloadedMissileDummy"}; // The dummy magazine
|
||||
class Launcher;
|
||||
class Launcher_Base_F: Launcher {
|
||||
class WeaponSlotsInfo;
|
||||
};
|
||||
class ACE_launch_NLAW_Used_F: launch_NLAW_F { // the used tube should be a sub class of the disposable launcher
|
||||
EGVAR(nlaw,enabled) = 0; // disable guidance for the disposabled tube
|
||||
|
||||
class launch_NLAW_F: Launcher_Base_F {
|
||||
author = "$STR_BWA3_Author";
|
||||
scope = 1;
|
||||
ACE_isUsedLauncher = 1;
|
||||
scopeArsenal = 1;
|
||||
baseWeapon = "BWA3_PzF3";
|
||||
|
||||
magazineReloadTime = 0.1;
|
||||
|
||||
class EventHandlers {
|
||||
fired = "_this call CBA_fnc_firedDisposable"; // this weapon eventhandler is required!
|
||||
};
|
||||
|
||||
class WeaponSlotsInfo: WeaponSlotsInfo {
|
||||
mass = LAUNCHER_MASS;
|
||||
};
|
||||
};
|
||||
|
||||
class ACE_launch_NLAW_loaded_F: launch_NLAW_F {
|
||||
author = ECSTRING(common,ACETeam);
|
||||
scope = 2;
|
||||
scopeArsenal = 2;
|
||||
baseWeapon = "ACE_launch_NLAW_loaded_F";
|
||||
|
||||
magazines[] = {"CBA_FakeLauncherMagazine"};
|
||||
|
||||
class WeaponSlotsInfo: WeaponSlotsInfo {
|
||||
mass = 180; // launcher 100, magazine 80
|
||||
};
|
||||
};
|
||||
|
||||
class ACE_launch_NLAW_used_F: launch_NLAW_F {
|
||||
author = ECSTRING(common,ACETeam);
|
||||
scope = 1;
|
||||
scopeArsenal = 1;
|
||||
baseWeapon = "ACE_launch_NLAW_used_F";
|
||||
|
||||
displayName = CSTRING(UsedTube);
|
||||
descriptionShort = CSTRING(UsedTubeDescription);
|
||||
magazines[] = {"ACE_FiredMissileDummy"}; // This will disable the used launcher class from being fired again.
|
||||
//picture = ""; @todo
|
||||
//model = ""; @todo
|
||||
magazines[] = {"CBA_FakeLauncherMagazine"};
|
||||
weaponPoolAvailable = 0;
|
||||
|
||||
class WeaponSlotsInfo: WeaponSlotsInfo {
|
||||
mass = LAUNCHER_MASS;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -1,4 +0,0 @@
|
||||
|
||||
PREP(replaceATWeapon);
|
||||
PREP(takeLoadedATWeapon);
|
||||
PREP(updateInventoryDisplay);
|
@ -1,15 +0,0 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
["loadout", {
|
||||
params ["_unit"];
|
||||
[_unit] call FUNC(takeLoadedATWeapon);
|
||||
[_unit] call FUNC(updateInventoryDisplay);
|
||||
}] call CBA_fnc_addPlayerEventHandler;
|
||||
|
||||
// Register fire event handler
|
||||
// Only for the local player and for AI. Non-local players will handle it themselves
|
||||
["ace_firedPlayer", DFUNC(replaceATWeapon)] call CBA_fnc_addEventHandler;
|
||||
["ace_firedNonPlayer", DFUNC(replaceATWeapon)] call CBA_fnc_addEventHandler;
|
@ -1,9 +0,0 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP_RECOMPILE_START;
|
||||
#include "XEH_PREP.hpp"
|
||||
PREP_RECOMPILE_END;
|
||||
|
||||
ADDON = true;
|
@ -1,3 +0,0 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#include "XEH_PREP.hpp"
|
@ -4,7 +4,7 @@ class CfgPatches {
|
||||
class ADDON {
|
||||
name = COMPONENT_NAME;
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
weapons[] = {"ACE_launch_NLAW_loaded_F","ACE_launch_NLAW_used_F"};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_common"};
|
||||
author = ECSTRING(common,ACETeam);
|
||||
@ -14,7 +14,10 @@ class CfgPatches {
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
class CBA_DisposableLaunchers {
|
||||
launch_NLAW_F[] = {"ACE_launch_NLAW_loaded_F","ACE_launch_NLAW_used_F"};
|
||||
};
|
||||
|
||||
#include "CfgWeapons.hpp"
|
||||
#include "CfgMagazines.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
|
@ -1,69 +0,0 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: bux, commy2
|
||||
* Replace the disposable launcher with the used dummy. Called from the unified fired EH.
|
||||
*
|
||||
* Arguments:
|
||||
* None. Parameters inherited from EFUNC(common,firedEH)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [fromBisFiredEH] call ace_disposable_fnc_replaceATWeapon;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
|
||||
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
|
||||
|
||||
if (!local _unit || {_weapon != secondaryWeapon _unit} || {_weapon != _muzzle}) exitWith {};
|
||||
|
||||
private _replacementTube = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_UsedTube");
|
||||
if (_replacementTube == "") exitWith {}; //If no replacement defined just exit
|
||||
|
||||
// Save magazine of spotting muzzle (should be re-added to replacement weapon)
|
||||
(((getUnitLoadout _unit) select 1) select 5) params [["_spottingMag", ""], ["_spottingRnds", 0]];
|
||||
if (_spottingMag != "") then { _unit addMagazine [_spottingMag, _spottingRnds]; };
|
||||
//Save array of items attached to launcher
|
||||
private _items = secondaryWeaponItems _unit;
|
||||
//Replace the orginal weapon with the 'usedTube' weapon
|
||||
_unit addWeapon _replacementTube;
|
||||
//Makes sure the used tube is still equiped
|
||||
_unit selectWeapon _replacementTube;
|
||||
//Re-add all attachments to the used tube
|
||||
{
|
||||
if (_x != "") then {_unit addSecondaryWeaponItem _x};
|
||||
} count _items;
|
||||
|
||||
|
||||
// AI - Remove the ai's missle launcher tube after the missle has exploded
|
||||
if !([_unit] call EFUNC(common,isPlayer)) then {
|
||||
[{
|
||||
params ["_args","_idPFH"];
|
||||
_args params ["_unit", "_tube", "_projectile"];
|
||||
|
||||
//don't do anything until projectile is null (exploded/max range)
|
||||
if (isNull _projectile) then {
|
||||
//Remove PFEH:
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
//If (tube is dropped) OR (is dead) OR (is player) just exit
|
||||
if (secondaryWeapon _unit != _tube || {!alive _unit} || {[_unit] call EFUNC(common,isPlayer)}) exitWith {};
|
||||
|
||||
//private _items = secondaryWeaponItems _unit;
|
||||
private _container = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"];
|
||||
_container setPosAsl (getPosAsl _unit);
|
||||
_container addWeaponCargoGlobal [_tube, 1];
|
||||
|
||||
//This will duplicate attachements, because we will be adding a weapon that may already have attachments on it
|
||||
//We either need a way to add a clean weapon, or a way to add a fully configured weapon to a container:
|
||||
// {
|
||||
// if (_x != "") then {_container addItemCargoGlobal [_x, 1];};
|
||||
// } forEach _items;
|
||||
|
||||
_unit removeWeaponGlobal _tube;
|
||||
};
|
||||
}, 1, [_unit, _replacementTube, _projectile]] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
@ -1,59 +0,0 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Handle the take event. Add a dummy magazine if a disposable rocket launcher is taken.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: unit - Object the event handler is assigned to <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [fromTakeEH] call ace_disposable_fnc_takeLoadedATWeapon;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_unit"];
|
||||
TRACE_1("params",_unit);
|
||||
|
||||
if (!local _unit) exitWith {};
|
||||
|
||||
private _launcher = secondaryWeapon _unit;
|
||||
private _config = configFile >> "CfgWeapons" >> _launcher;
|
||||
|
||||
if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber (_config >> "ACE_isUsedLauncher") != 1} && {count secondaryWeaponMagazine _unit == 0}) then {
|
||||
private _magazine = getArray (_config >> "magazines") select 0;
|
||||
private _isLauncherSelected = currentWeapon _unit == _launcher;
|
||||
|
||||
_unit removeMagazines _magazine;
|
||||
|
||||
if (backpack _unit == "") then {
|
||||
_unit addBackpack "ACE_FakeBackpack";
|
||||
_unit removeWeapon _launcher;
|
||||
_unit addMagazine _magazine;
|
||||
private _didAdd = _magazine in magazines _unit;
|
||||
_unit addWeapon _launcher;
|
||||
|
||||
if (!_didAdd) then {
|
||||
TRACE_1("Failed To Add Disposable Magazine Normally, doing backup method (no backpack)",_unit);
|
||||
_unit addSecondaryWeaponItem _magazine;
|
||||
};
|
||||
removeBackpack _unit;
|
||||
} else {
|
||||
_unit removeWeapon _launcher;
|
||||
_unit addMagazine _magazine;
|
||||
private _didAdd = _magazine in magazines _unit;
|
||||
_unit addWeapon _launcher;
|
||||
|
||||
if (!_didAdd) then {
|
||||
TRACE_2("Failed To Add Disposable Magazine Normally, doing backup method",_unit,(backpack _unit));
|
||||
_unit addSecondaryWeaponItem _magazine;
|
||||
};
|
||||
};
|
||||
|
||||
if (_isLauncherSelected) then {
|
||||
_unit selectWeapon _launcher;
|
||||
};
|
||||
};
|
@ -1,47 +0,0 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: bux, commy2
|
||||
* Hide or show the secondary weapon magazine inventory slot to prevent unloading of dummy magazines.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: unit - Object the event handler is assigned to <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [player] call ace_disposable_fnc_updateInventoryDisplay;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
disableSerialization;
|
||||
params ["_player", ["_display",(findDisplay 602),[displayNull]]];
|
||||
TRACE_2("params",_player,_display);
|
||||
|
||||
_player removeMagazines "ACE_PreloadedMissileDummy";
|
||||
_player removeMagazines "ACE_FiredMissileDummy";
|
||||
|
||||
if (isNull _display) exitWith {};
|
||||
|
||||
private _launcher = secondaryWeapon _player;
|
||||
|
||||
if (_launcher == "" || {getText (configFile >> "CfgWeapons" >> _launcher >> "ACE_UsedTube") == ""}) then {
|
||||
private _control = _display displayCtrl 627;
|
||||
private _config = configFile >> "RscDisplayInventory" >> "controls" >> "SlotSecondaryMagazine";
|
||||
_control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")];
|
||||
_control ctrlCommit 0;
|
||||
|
||||
_control = _display displayCtrl 1251;
|
||||
_config = configFile >> "RscDisplayInventory" >> "controls" >> "BackgroundSlotSecondaryMagazine";
|
||||
_control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")];
|
||||
_control ctrlCommit 0;
|
||||
} else {
|
||||
private _control = _display displayCtrl 627;
|
||||
_control ctrlSetPosition [0, 0, 0, 0];
|
||||
_control ctrlCommit 0;
|
||||
|
||||
_control = _display displayCtrl 1251;
|
||||
_control ctrlSetPosition [0, 0, 0, 0];
|
||||
_control ctrlCommit 0;
|
||||
};
|
@ -1 +0,0 @@
|
||||
#include "\z\ace\addons\disposable\script_component.hpp"
|
Loading…
Reference in New Issue
Block a user