first pass

This commit is contained in:
PabstMirror 2015-01-13 13:12:37 -06:00
parent 629c0f92db
commit 1648def53f
15 changed files with 290 additions and 265 deletions

View File

@ -0,0 +1 @@
z\ace\addons\disposable

View File

@ -0,0 +1,45 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE( call COMPILE_FILE(XEH_preInit) );
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
clientInit = QUOTE( call COMPILE_FILE(XEH_postInitClient) );
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class ADDON {
// firedBIS = "if (local (_this select 0)) then {_this call AGM_Disposable_fnc_replaceATWeapon};";
firedBIS = QUOTE( _this call FUNC(replaceATWeapon); );
};
};
};
// handle preloaded missile
class Extended_Init_EventHandlers {
class CAManBase {
class ADDON {
init = "if (local (_this select 0)) then {_this spawn {[_this select 0, secondaryWeapon (_this select 0)] call AGM_Disposable_fnc_takeLoadedATWeapon}};";
};
};
};
class Extended_Take_EventHandlers {
class CAManBase {
class ADDON {
take = "if (local (_this select 0)) then {[_this select 0, _this select 2] call AGM_Disposable_fnc_takeLoadedATWeapon; [_this select 0, findDisplay 602] call AGM_Disposable_fnc_updateInventoryDisplay};";
};
};
};
class Extended_Put_EventHandlers {
class CAManBase {
class ADDON {
put = "if (local (_this select 0)) then {[_this select 0, findDisplay 602] call AGM_Disposable_fnc_updateInventoryDisplay};";
};
};
};

View File

@ -0,0 +1,24 @@
class CfgMagazines {
class NLAW_F;
class ACE_PreloadedMissileDummy: NLAW_F { // The dummy magazine
author = "$STR_ACE_Common_ACETeam";
scope = 1;
displayName = "$STR_ACE_Disposable_PreloadedMissileDummy";
picture = "\AGM_Core\UI\blank_CO.paa";
weaponPoolAvailable = 0;
mass = 0;
};
class ACE_FiredMissileDummy: ACE_PreloadedMissileDummy {
count = 0;
};
class ACE_UsedTube_F: NLAW_F {
author = "$STR_ACE_Common_ACETeam";
displayName = "$STR_ACE_Disposable_UsedTube";
descriptionShort = "$STR_ACE_Disposable_UsedTubeDescription";
displayNameShort = "-";
count = 0;
weaponPoolAvailable = 0;
modelSpecial = "";
mass = 0;
};
};

View File

@ -0,0 +1,146 @@
class CfgVehicles {
#define MACRO_NONLAW \
class TransportMagazines { \
class _xx_NLAW_F { \
count = 0; \
}; \
};
class ReammoBox_F;
class NATO_Box_Base: ReammoBox_F {};
class Box_NATO_Ammo_F: NATO_Box_Base {
MACRO_NONLAW
};
class Box_NATO_WpsLaunch_F: NATO_Box_Base {
MACRO_NONLAW
};
class IND_Box_Base: ReammoBox_F {};
class Box_IND_WpsLaunch_F: IND_Box_Base {
MACRO_NONLAW
};
class Box_IND_Ammo_F: IND_Box_Base {
MACRO_NONLAW
};
class B_supplyCrate_F: ReammoBox_F {
MACRO_NONLAW
};
class I_supplyCrate_F: B_supplyCrate_F {
MACRO_NONLAW
};
class C_supplyCrate_F: ReammoBox_F {
MACRO_NONLAW
};
class B_AssaultPack_rgr;
class B_AssaultPack_rgr_LAT: B_AssaultPack_rgr {
MACRO_NONLAW
};
class B_AssaultPack_rgr_ReconLAT: B_AssaultPack_rgr {
MACRO_NONLAW
};
class B_Carryall_mcamo;
class B_AssaultPack_mcamo_Ammo: B_Carryall_mcamo {
MACRO_NONLAW
};
class B_Carryall_oli;
class I_Fieldpack_oli_Ammo: B_Carryall_oli {
MACRO_NONLAW
};
class B_AssaultPack_dgtl;
class I_Fieldpack_oli_LAT: B_AssaultPack_dgtl {
MACRO_NONLAW
};
class CargoNet_01_ammo_base_F;
class B_CargoNet_01_ammo_F: CargoNet_01_ammo_base_F {
MACRO_NONLAW
};
class I_CargoNet_01_ammo_F: CargoNet_01_ammo_base_F {
MACRO_NONLAW
};
class Slingload_01_Base_F;
class B_Slingload_01_Cargo_F: Slingload_01_Base_F {
MACRO_NONLAW
};
class Tank_F;
class APC_Tracked_01_base_F: Tank_F {
MACRO_NONLAW
};
/*class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F {
MACRO_NONLAW
};
class B_APC_Tracked_01_rcws_F: B_APC_Tracked_01_base_F {
MACRO_NONLAW
};
class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F {
MACRO_NONLAW
};
class B_APC_Tracked_01_AA_F: B_APC_Tracked_01_base_F {
MACRO_NONLAW
};*/
class Car_F;
class MRAP_01_base_F: Car_F {
MACRO_NONLAW
};
/*class MRAP_01_gmg_base_F: MRAP_01_base_F {
MACRO_NONLAW
};
class MRAP_01_hmg_base_F: MRAP_01_gmg_base_F {
MACRO_NONLAW
};
class B_MRAP_01_F: MRAP_01_base_F {
MACRO_NONLAW
};
class B_MRAP_01_gmg_F: MRAP_01_gmg_base_F {
MACRO_NONLAW
};
class B_MRAP_01_hmg_F: MRAP_01_hmg_base_F {
MACRO_NONLAW
};*/
class MRAP_03_base_F: Car_F {
MACRO_NONLAW
};
/*class MRAP_03_hmg_base_F: MRAP_03_base_F {
MACRO_NONLAW
};
class MRAP_03_gmg_base_F: MRAP_03_hmg_base_F {
MACRO_NONLAW
};
class I_MRAP_03_F: MRAP_03_base_F {
MACRO_NONLAW
};
class I_MRAP_03_hmg_F: MRAP_03_hmg_base_F {
MACRO_NONLAW
};
class I_MRAP_03_gmg_F: MRAP_03_gmg_base_F {
MACRO_NONLAW
};*/
class Wheeled_APC_F: Car_F {};
class APC_Wheeled_03_base_F: Wheeled_APC_F {
MACRO_NONLAW
};
class APC_Wheeled_01_base_F: Wheeled_APC_F {
MACRO_NONLAW
};
/*class B_APC_Wheeled_01_base_F: APC_Wheeled_01_base_F {
MACRO_NONLAW
};
class B_APC_Wheeled_01_cannon_F: B_APC_Wheeled_01_base_F {
MACRO_NONLAW
};
class I_APC_Wheeled_03_base_F: APC_Wheeled_03_base_F {
MACRO_NONLAW
};
class I_APC_Wheeled_03_cannon_F: I_APC_Wheeled_03_base_F {
MACRO_NONLAW
};*/
};

View File

@ -0,0 +1,18 @@
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 ACE_launch_NLAW_Used_F: launch_NLAW_F { // the used tube should be a sub class of the disposable launcher
scope = 1;
ACE_isUsedLauncher = 1;
author = "$STR_ACE_Common_ACETeam";
displayName = "$STR_ACE_Disposable_UsedTube";
descriptionShort = "$STR_ACE_Disposable_UsedTubeDescription";
magazines[] = {"ACE_FiredMissileDummy"}; // This will disable the used launcher class from being fired again.
//picture = ""; @todo
//model = ""; @todo
weaponPoolAvailable = 0;
};
};

View File

@ -0,0 +1,13 @@
// by commy2
// The Arma InventoryOpened EH fires actually before the inventory dialog is opened (findDisplay 602 => displayNull).
#include "script_component.hpp"
if (isNil QGVAR(UpdateInventoryDisplay_EHID)) then {
GVAR(UpdateInventoryDisplay_EHID) = [{
_player = ACE_player;
[_player, secondaryWeapon _player] call FUNC(takeLoadedATWeapon);
[_player, _this select 0] spawn FUNC(updateInventoryDisplay);
}] call EFUNC(common,addInventoryDisplayLoadedEventHandler);
};

View File

@ -0,0 +1,5 @@
#include "script_component.hpp"
PREP(replaceATWeapon);
PREP(takeLoadedATWeapon);
PREP(updateInventoryDisplay);

View File

@ -1,10 +0,0 @@
// by commy2
// The Arma InventoryOpened EH fires actually before the inventory dialog is opened (findDisplay 602 => displayNull).
if (isNil "AGM_Disposable_UpdateInventoryDisplay_EHID") then {
AGM_Disposable_UpdateInventoryDisplay_EHID = [{
_player = AGM_player;
[_player, secondaryWeapon _player] call AGM_Disposable_fnc_takeLoadedATWeapon;
[_player, _this select 0] spawn AGM_Disposable_fnc_updateInventoryDisplay;
}] call AGM_Core_fnc_addInventoryDisplayLoadedEventHandler;
};

View File

@ -1,255 +1,18 @@
#include "script_component.hpp"
class CfgPatches { class CfgPatches {
class AGM_Disposable { class ADDON {
units[] = {}; units[] = {};
weapons[] = {}; weapons[] = {};
requiredVersion = 0.60; requiredVersion = 0.60;
requiredAddons[] = {AGM_Core}; requiredAddons[] = {"ace_common"};
version = "0.95";
versionStr = "0.95";
versionAr[] = {0,95,0};
author[] = {"commy2"}; author[] = {"commy2"};
authorUrl = "https://github.com/commy2/"; authorUrl = "https://github.com/commy2/";
VERSION_CONFIG
}; };
}; };
class CfgFunctions { #include "CfgEventHandlers.hpp"
class AGM_Disposable { #include "CfgWeapons.hpp"
class AGM_Disposable { #include "CfgMagazines.hpp"
file = "\AGM_Disposable\functions"; #include "CfgVehicles.hpp"
class replaceATWeapon;
class takeLoadedATWeapon;
class updateInventoryDisplay;
};
};
};
class Extended_PostInit_EventHandlers {
class AGM_Disposable {
clientInit = "call compile preprocessFileLineNumbers '\AGM_Disposable\clientInit.sqf'";
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class AGM_Disposable_ReplaceFiredATWeapon {
firedBIS = "if (local (_this select 0)) then {_this call AGM_Disposable_fnc_replaceATWeapon};";
};
};
};
// handle preloaded missile
class Extended_Init_EventHandlers {
class CAManBase {
class AGM_Disposable_UpdateInventoryDisplay {
init = "if (local (_this select 0)) then {_this spawn {[_this select 0, secondaryWeapon (_this select 0)] call AGM_Disposable_fnc_takeLoadedATWeapon}};";
};
};
};
class Extended_Take_EventHandlers {
class CAManBase {
class AGM_Disposable_UpdateInventoryDisplay {
take = "if (local (_this select 0)) then {[_this select 0, _this select 2] call AGM_Disposable_fnc_takeLoadedATWeapon; [_this select 0, findDisplay 602] call AGM_Disposable_fnc_updateInventoryDisplay};";
};
};
};
class Extended_Put_EventHandlers {
class CAManBase {
class AGM_Disposable_UpdateInventoryDisplay {
put = "if (local (_this select 0)) then {[_this select 0, findDisplay 602] call AGM_Disposable_fnc_updateInventoryDisplay};";
};
};
};
class CfgWeapons {
class Launcher_Base_F;
class launch_NLAW_F: Launcher_Base_F {
AGM_UsedTube = "AGM_launch_NLAW_Used_F"; // The class name of the used tube.
magazines[] = {"AGM_PreloadedMissileDummy"}; // The dummy magazine
};
class AGM_launch_NLAW_Used_F: launch_NLAW_F { // the used tube should be a sub class of the disposable launcher
scope = 1;
AGM_isUsedLauncher = 1;
author = "$STR_AGM_Core_AGMTeam";
displayName = "$STR_AGM_Disposable_UsedTube";
descriptionShort = "$STR_AGM_Disposable_UsedTubeDescription";
magazines[] = {"AGM_FiredMissileDummy"}; // This will disable the used launcher class from being fired again.
//picture = ""; @todo
//model = ""; @todo
weaponPoolAvailable = 0;
};
};
class CfgMagazines {
class NLAW_F;
class AGM_PreloadedMissileDummy: NLAW_F { // The dummy magazine
author = "$STR_AGM_Core_AGMTeam";
scope = 1;
displayName = "$STR_AGM_Disposable_PreloadedMissileDummy";
picture = "\AGM_Core\UI\blank_CO.paa";
weaponPoolAvailable = 0;
mass = 0;
};
class AGM_FiredMissileDummy: AGM_PreloadedMissileDummy {
count = 0;
};
class AGM_UsedTube_F: NLAW_F {
author = "$STR_AGM_Core_AGMTeam";
displayName = "$STR_AGM_Disposable_UsedTube";
descriptionShort = "$STR_AGM_Disposable_UsedTubeDescription";
displayNameShort = "-";
count = 0;
weaponPoolAvailable = 0;
modelSpecial = "";
mass = 0;
};
};
class CfgVehicles {
#define MACRO_NONLAW \
class TransportMagazines { \
class _xx_NLAW_F { \
count = 0; \
}; \
};
class ReammoBox_F;
class NATO_Box_Base: ReammoBox_F {};
class Box_NATO_Ammo_F: NATO_Box_Base {
MACRO_NONLAW
};
class Box_NATO_WpsLaunch_F: NATO_Box_Base {
MACRO_NONLAW
};
class IND_Box_Base: ReammoBox_F {};
class Box_IND_WpsLaunch_F: IND_Box_Base {
MACRO_NONLAW
};
class Box_IND_Ammo_F: IND_Box_Base {
MACRO_NONLAW
};
class B_supplyCrate_F: ReammoBox_F {
MACRO_NONLAW
};
class I_supplyCrate_F: B_supplyCrate_F {
MACRO_NONLAW
};
class C_supplyCrate_F: ReammoBox_F {
MACRO_NONLAW
};
class B_AssaultPack_rgr;
class B_AssaultPack_rgr_LAT: B_AssaultPack_rgr {
MACRO_NONLAW
};
class B_AssaultPack_rgr_ReconLAT: B_AssaultPack_rgr {
MACRO_NONLAW
};
class B_Carryall_mcamo;
class B_AssaultPack_mcamo_Ammo: B_Carryall_mcamo {
MACRO_NONLAW
};
class B_Carryall_oli;
class I_Fieldpack_oli_Ammo: B_Carryall_oli {
MACRO_NONLAW
};
class B_AssaultPack_dgtl;
class I_Fieldpack_oli_LAT: B_AssaultPack_dgtl {
MACRO_NONLAW
};
class CargoNet_01_ammo_base_F;
class B_CargoNet_01_ammo_F: CargoNet_01_ammo_base_F {
MACRO_NONLAW
};
class I_CargoNet_01_ammo_F: CargoNet_01_ammo_base_F {
MACRO_NONLAW
};
class Slingload_01_Base_F;
class B_Slingload_01_Cargo_F: Slingload_01_Base_F {
MACRO_NONLAW
};
class Tank_F;
class APC_Tracked_01_base_F: Tank_F {
MACRO_NONLAW
};
/*class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F {
MACRO_NONLAW
};
class B_APC_Tracked_01_rcws_F: B_APC_Tracked_01_base_F {
MACRO_NONLAW
};
class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F {
MACRO_NONLAW
};
class B_APC_Tracked_01_AA_F: B_APC_Tracked_01_base_F {
MACRO_NONLAW
};*/
class Car_F;
class MRAP_01_base_F: Car_F {
MACRO_NONLAW
};
/*class MRAP_01_gmg_base_F: MRAP_01_base_F {
MACRO_NONLAW
};
class MRAP_01_hmg_base_F: MRAP_01_gmg_base_F {
MACRO_NONLAW
};
class B_MRAP_01_F: MRAP_01_base_F {
MACRO_NONLAW
};
class B_MRAP_01_gmg_F: MRAP_01_gmg_base_F {
MACRO_NONLAW
};
class B_MRAP_01_hmg_F: MRAP_01_hmg_base_F {
MACRO_NONLAW
};*/
class MRAP_03_base_F: Car_F {
MACRO_NONLAW
};
/*class MRAP_03_hmg_base_F: MRAP_03_base_F {
MACRO_NONLAW
};
class MRAP_03_gmg_base_F: MRAP_03_hmg_base_F {
MACRO_NONLAW
};
class I_MRAP_03_F: MRAP_03_base_F {
MACRO_NONLAW
};
class I_MRAP_03_hmg_F: MRAP_03_hmg_base_F {
MACRO_NONLAW
};
class I_MRAP_03_gmg_F: MRAP_03_gmg_base_F {
MACRO_NONLAW
};*/
class Wheeled_APC_F: Car_F {};
class APC_Wheeled_03_base_F: Wheeled_APC_F {
MACRO_NONLAW
};
class APC_Wheeled_01_base_F: Wheeled_APC_F {
MACRO_NONLAW
};
/*class B_APC_Wheeled_01_base_F: APC_Wheeled_01_base_F {
MACRO_NONLAW
};
class B_APC_Wheeled_01_cannon_F: B_APC_Wheeled_01_base_F {
MACRO_NONLAW
};
class I_APC_Wheeled_03_base_F: APC_Wheeled_03_base_F {
MACRO_NONLAW
};
class I_APC_Wheeled_03_cannon_F: I_APC_Wheeled_03_base_F {
MACRO_NONLAW
};*/
};

View File

@ -9,13 +9,16 @@
* Return value: * Return value:
* Nothing * Nothing
*/ */
#include "script_component.hpp"
private ["_unit", "_tube", "_projectile"]; private ["_unit", "_tube", "_projectile"];
_unit = _this select 0; _unit = _this select 0;
_tube = getText (configFile >> "CfgWeapons" >> _this select 1 >> "AGM_UsedTube"); _tube = getText (configFile >> "CfgWeapons" >> (_this select 1) >> "ACE_UsedTube");
_projectile = _this select 6; _projectile = _this select 6;
if (!local _unit) exitWith {};
if (_tube == "") exitWith {}; if (_tube == "") exitWith {};
private "_items"; private "_items";
@ -29,7 +32,7 @@ _unit selectWeapon _tube;
} forEach _items; } forEach _items;
// AI // AI
if !([_unit] call AGM_Core_fnc_isPlayer) then { if !([_unit] call EFUNC(common,isPlayer)) then {
[_unit, _tube, _projectile] spawn { [_unit, _tube, _projectile] spawn {
_unit = _this select 0; _unit = _this select 0;
_tube = _this select 1; _tube = _this select 1;

View File

@ -10,6 +10,8 @@
* Nothing * Nothing
*/ */
#include "script_component.hpp"
private ["_unit", "_launcher", "_config"]; private ["_unit", "_launcher", "_config"];
_unit = _this select 0; _unit = _this select 0;
@ -17,7 +19,7 @@ _launcher = _this select 1;
_config = configFile >> "CfgWeapons" >> _launcher; _config = configFile >> "CfgWeapons" >> _launcher;
if (isClass _config && {getText (_config >> "AGM_UsedTube") != ""} && {getNumber (_config >> "AGM_isUsedLauncher") != 1} && {count secondaryWeaponMagazine _unit == 0}) then { if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber (_config >> "ACE_isUsedLauncher") != 1} && {count secondaryWeaponMagazine _unit == 0}) then {
private ["_magazine", "_isLauncherSelected"]; private ["_magazine", "_isLauncherSelected"];
_magazine = getArray (_config >> "magazines") select 0; _magazine = getArray (_config >> "magazines") select 0;

View File

@ -10,12 +10,14 @@
* Nothing * Nothing
*/ */
#include "script_component.hpp"
private ["_player", "_display"]; private ["_player", "_display"];
_player = _this select 0; _player = _this select 0;
_player removeMagazines "AGM_PreloadedMissileDummy"; _player removeMagazines "ACE_PreloadedMissileDummy";
_player removeMagazines "AGM_FiredMissileDummy"; _player removeMagazines "ACE_FiredMissileDummy";
disableSerialization; disableSerialization;
_display = _this select 1; _display = _this select 1;
@ -26,7 +28,7 @@ private ["_launcher", "_control", "_config"];
_launcher = secondaryWeapon _player; _launcher = secondaryWeapon _player;
if (_launcher == "" || {getText (configFile >> "CfgWeapons" >> _launcher >> "AGM_UsedTube") == ""}) then { if (_launcher == "" || {getText (configFile >> "CfgWeapons" >> _launcher >> "ACE_UsedTube") == ""}) then {
_control = _display displayCtrl 627; _control = _display displayCtrl 627;
_config = configFile >> "RscDisplayInventory" >> "controls" >> "SlotSecondaryMagazine"; _config = configFile >> "RscDisplayInventory" >> "controls" >> "SlotSecondaryMagazine";
_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

@ -0,0 +1 @@
#include "\z\ace\addons\disposable\script_component.hpp"

View File

@ -0,0 +1,12 @@
#define COMPONENT disposable
#include "\z\ace\Addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_ATTACH
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_ATTACH
#define DEBUG_SETTINGS DEBUG_SETTINGS_ATTACH
#endif
#include "\z\ace\Addons\main\script_macros.hpp"

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-12-16 --> <!-- Edited with tabler - 2014-12-16 -->
<Project name="AGM"> <Project name="ACE">
<Package name="Disposable"> <Package name="Disposable">
<Key ID="STR_AGM_Disposable_UsedTube"> <Key ID="STR_ACE_Disposable_UsedTube">
<English>Used Tube</English> <English>Used Tube</English>
<German>Benutze Einwegwaffe</German> <German>Benutze Einwegwaffe</German>
<French>Tube utilisé</French> <French>Tube utilisé</French>
@ -12,7 +12,7 @@
<Hungarian>Használt cső</Hungarian> <Hungarian>Használt cső</Hungarian>
<Russian>Отстрелянная труба</Russian> <Russian>Отстрелянная труба</Russian>
</Key> </Key>
<Key ID="STR_AGM_Disposable_UsedTubeDescription"> <Key ID="STR_ACE_Disposable_UsedTubeDescription">
<English>Used disposable rocket launcher</English> <English>Used disposable rocket launcher</English>
<German>Benutzter Einweg-Raketenwerfer</German> <German>Benutzter Einweg-Raketenwerfer</German>
<French>Lance-roquette à usage unique utilisé</French> <French>Lance-roquette à usage unique utilisé</French>
@ -22,7 +22,7 @@
<Hungarian>Használt rakétavető</Hungarian> <Hungarian>Használt rakétavető</Hungarian>
<Russian>Отстрелянная одноразовая пусковая установка</Russian> <Russian>Отстрелянная одноразовая пусковая установка</Russian>
</Key> </Key>
<Key ID="STR_AGM_Disposable_PreloadedMissileDummy"> <Key ID="STR_ACE_Disposable_PreloadedMissileDummy">
<English>Preloaded Missile Dummy</English> <English>Preloaded Missile Dummy</English>
<German>Preloaded Missile Dummy</German> <German>Preloaded Missile Dummy</German>
<French>Preloaded Missile Dummy</French> <French>Preloaded Missile Dummy</French>