added gunbag

This commit is contained in:
ir0n1e 2016-05-03 10:21:21 +02:00
parent 3a4a02e524
commit 9567b587c6
32 changed files with 683 additions and 0 deletions

View File

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

View File

@ -0,0 +1,12 @@
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) );
};
};

View File

@ -0,0 +1,108 @@
class CBA_Extended_EventHandlers;
class CfgVehicles {
class Man;
class CAManBase: Man {
class ACE_SelfActions {
class ACE_Equipment {
class GVAR(actions) {
displayName = CSTRING(displayname);
condition = QUOTE([_player] call FUNC(isGunbag));
showDisabled = 0;
priority = 0.1;
icon = PATHTOF(ui\gunbag_icon_ca.paa);
class GVAR(WeapontoGunbag) {
displayName = CSTRING(toGunbag);
condition = QUOTE([ARR_2(_player,_player)] call FUNC(canInteract) == 0);
statement = QUOTE([ARR_2(_player,_player)] call FUNC(toGunbag));
showDisabled = 0;
priority = 1;
icon = PATHTOF(ui\gunbag_icon_ca.paa);
};
class GVAR(WeaponoffGunbag) {
displayName = CSTRING(offGunbag);
condition = QUOTE([ARR_2(_player,_player)] call FUNC(canInteract) == 1);
statement = QUOTE([ARR_2(_player,_player)] call FUNC(offGunbag));
showDisabled = 0;
priority = 1;
icon = PATHTOF(ui\gunbag_icon_ca.paa);
};
class GVAR(StatusGunbag) {
displayName = CSTRING(Status);
condition = QUOTE([_player] call FUNC(isGunbag));
statement = QUOTE([_player] call FUNC(status));
showDisabled = 0;
priority = 2;
icon = PATHTOF(ui\gunbag_icon_ca.paa);
};
};
};
};
class ACE_Actions {
class ACE_MainActions {
class GVAR(WeapontoGunbag) {
displayName = CSTRING(toGunbag);
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canInteract) == 0);
statement = QUOTE([ARR_2(_player,_target)] call FUNC(toGunbag));
showDisabled = 0;
priority = 1;
icon = PATHTOF(ui\gunbag_icon_ca.paa);
};
class GVAR(WeaponoffGunbag) {
displayName = CSTRING(offGunbag);
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canInteract) == 1);
statement = QUOTE([ARR_2(_player,_target)] call FUNC(offGunbag));
showDisabled = 0;
priority = 1;
icon = PATHTOF(ui\gunbag_icon_ca.paa);
};
class GVAR(StatusGunbag) {
displayName = CSTRING(Status);
condition = QUOTE([_target] call FUNC(isGunbag));
statement = QUOTE([_target] call FUNC(status));
showDisabled = 0;
priority = 2;
icon = PATHTOF(ui\gunbag_icon_ca.paa);
};
};
};
};
class Bag_Base;
class CLASSNAME: Bag_Base {
_generalMacro = QUOTE(CLASSNAME);
author = "Ir0n1E";
scope = 2;
displayName = CSTRING(Displayname);
model = PATHTOF(data\gunbag.p3d);
picture = PATHTOF(ui\gunbag_ca.paa);
icon = PATHTOF(ui\gunbag_icon_ca.paa);
hiddenSelections[] = {QUOTE(Camo),QUOTE(insignia)};
hiddenSelectionsTextures[] = {PATHTOF(data\gunbag_co.paa)};
maximumLoad = 80;
transportMaxMagazines = 2;
transportMaxWeapons = 1;
transportMaxBackpacks = 0;
GVAR(gunbagswitch) = QUOTE(DOUBLES(CLASSNAME,Full));
mass = 11;
};
class DOUBLES(CLASSNAME,Tan): CLASSNAME {
displayName = CSTRING(Displayname_Tan);
picture = PATHTOF(ui\gunbag_tan_ca.paa);
hiddenSelectionsTextures[] = {PATHTOF(data\gunbag_tan_co.paa)};
GVAR(gunbagswitch) = QUOTE(TRIPLES(CLASSNAME,Tan,Full));
};
class DOUBLES(CLASSNAME,Full): CLASSNAME {
scope = 1;
mass = 311;
GVAR(gunbagswitch) = QUOTE(CLASSNAME);
};
class TRIPLES(CLASSNAME,Tan,Full): DOUBLES(CLASSNAME,Tan) {
scope = 1;
mass = 311;
GVAR(gunbagswitch) = QUOTE(DOUBLES(CLASSNAME,Tan));
};
};

View File

@ -0,0 +1,41 @@
class CfgWeapons {
class Rifle_Long_Base_F;
/* Long Rifles */
class GM6_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
class LRR_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
class DMR_06_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
class DMR_05_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
class DMR_04_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
class DMR_03_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
class DMR_02_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
class DMR_01_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
class EBR_base_F: Rifle_Long_Base_F {
GVAR(allowGunbag) = 1;
};
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 MiB

View File

@ -0,0 +1,6 @@
PREP(toGunbag);
PREP(offGunbag);
PREP(status);
PREP(canInteract);
PREP(switchBackpack);
PREP(isGunbag);

View File

@ -0,0 +1,7 @@
#include "script_component.hpp"
ADDON = false;
#include "XEH_PREP.hpp"
ADDON = true;

View File

@ -0,0 +1,3 @@
#include "script_component.hpp"
#include "XEH_PREP.hpp"

16
addons/gunbag/config.cpp Normal file
View File

@ -0,0 +1,16 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {"ACE_Gunbag", "ACE_Gunbag_tan", "ACE_Gunbag_full", "ACE_Gunbag_tan_full"};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_interaction"};
author[] = {"Ir0n1E"};
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"

Binary file not shown.

View File

@ -0,0 +1,89 @@
class StageTI
{
texture="a3\characters_f_beta\indep\data\officer_ti_ca.paa";
};
ambient[]={0.69999999,0.69999999,0.69999999,1};
diffuse[]={0.69999999,0.69999999,0.69999999,1};
forcedDiffuse[]={0.30000001,0.30000001,0.30000001,0};
emmisive[]={0,0,0,1};
specular[]={0.2,0.2,0.2,1};
specularPower=100;
PixelShaderID="Super";
VertexShaderID="Super";
class Stage1
{
texture="z\ace\addons\gunbag\data\gunbag_nohq.paa";
uvSource="tex";
class uvTransform
{
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage2
{
texture="#(argb,8,8,3)color(0.5,0.5,0.5,0.5,DT)";
uvSource="tex";
class uvTransform
{
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage3
{
texture="#(argb,8,8,3)color(0,0,0,0,MC)";
uvSource="tex";
class uvTransform
{
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage4
{
texture="#(argb,8,8,3)color(1,1,1,1,AS)";
uvSource="tex";
class uvTransform
{
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage5
{
texture="z\ACE\addons\gunbag\data\gunbag_smdi.paa";
uvSource="tex";
class uvTransform
{
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage6
{
texture="#(ai,64,64,1)fresnel(1,0.3)";
uvSource="none";
};
class Stage7
{
texture="a3\data_f\env_co.paa";
uvSource="tex";
class uvTransform
{
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,148 @@
class CfgSkeletons {
class Default {
isDiscrete = 1;
skeletonInherit = "";
skeletonBones[] = {};
};
class OFP2_ManSkeleton {
isDiscrete = 0;
skeletonInherit = "";
skeletonBones[] = {
"Pelvis","",
"Spine","Pelvis",
"Spine1","Spine",
"Spine2","Spine1",
"Spine3","Spine2",
"Camera","Pelvis",
"weapon","Spine1",
"launcher","Spine1",
//Head skeleton in hierarchy
"neck","Spine3",
"neck1","neck",
"head","neck1",
//New facial features
"Face_Hub","head",
"Face_Jawbone","Face_Hub",
"Face_Jowl","Face_Jawbone",
"Face_chopRight","Face_Jawbone",
"Face_chopLeft","Face_Jawbone",
"Face_LipLowerMiddle","Face_Jawbone",
"Face_LipLowerLeft","Face_Jawbone",
"Face_LipLowerRight","Face_Jawbone",
"Face_Chin","Face_Jawbone",
"Face_Tongue","Face_Jawbone",
"Face_CornerRight","Face_Hub",
"Face_CheekSideRight","Face_CornerRight",
"Face_CornerLeft","Face_Hub",
"Face_CheekSideLeft","Face_CornerLeft",
"Face_CheekFrontRight","Face_Hub",
"Face_CheekFrontLeft","Face_Hub",
"Face_CheekUpperRight","Face_Hub",
"Face_CheekUpperLeft","Face_Hub",
"Face_LipUpperMiddle","Face_Hub",
"Face_LipUpperRight","Face_Hub",
"Face_LipUpperLeft","Face_Hub",
"Face_NostrilRight","Face_Hub",
"Face_NostrilLeft","Face_Hub",
"Face_Forehead","Face_Hub",
"Face_BrowFrontRight","Face_Forehead",
"Face_BrowFrontLeft","Face_Forehead",
"Face_BrowMiddle","Face_Forehead",
"Face_BrowSideRight","Face_Forehead",
"Face_BrowSideLeft","Face_Forehead",
"Face_Eyelids","Face_Hub",
"Face_EyelidUpperRight","Face_Hub",
"Face_EyelidUpperLeft","Face_Hub",
"Face_EyelidLowerRight","Face_Hub",
"Face_EyelidLowerLeft","Face_Hub",
"EyeLeft","Face_Hub",
"EyeRight","Face_Hub",
//Left upper side
"LeftShoulder","Spine3",
"LeftArm","LeftShoulder",
"LeftArmRoll","LeftArm",
"LeftForeArm","LeftArmRoll",
"LeftForeArmRoll","LeftForeArm",
"LeftHand","LeftForeArmRoll",
"LeftHandRing","LeftHand",
"LeftHandRing1","LeftHandRing",
"LeftHandRing2","LeftHandRing1",
"LeftHandRing3","LeftHandRing2",
"LeftHandPinky1","LeftHandRing",
"LeftHandPinky2","LeftHandPinky1",
"LeftHandPinky3","LeftHandPinky2",
"LeftHandMiddle1","LeftHand",
"LeftHandMiddle2","LeftHandMiddle1",
"LeftHandMiddle3","LeftHandMiddle2",
"LeftHandIndex1","LeftHand",
"LeftHandIndex2","LeftHandIndex1",
"LeftHandIndex3","LeftHandIndex2",
"LeftHandThumb1","LeftHand",
"LeftHandThumb2","LeftHandThumb1",
"LeftHandThumb3","LeftHandThumb2",
//Right upper side
"RightShoulder","Spine3",
"RightArm","RightShoulder",
"RightArmRoll","RightArm",
"RightForeArm","RightArmRoll",
"RightForeArmRoll","RightForeArm",
"RightHand","RightForeArmRoll",
"RightHandRing","RightHand",
"RightHandRing1","RightHandRing",
"RightHandRing2","RightHandRing1",
"RightHandRing3","RightHandRing2",
"RightHandPinky1","RightHandRing",
"RightHandPinky2","RightHandPinky1",
"RightHandPinky3","RightHandPinky2",
"RightHandMiddle1","RightHand",
"RightHandMiddle2","RightHandMiddle1",
"RightHandMiddle3","RightHandMiddle2",
"RightHandIndex1","RightHand",
"RightHandIndex2","RightHandIndex1",
"RightHandIndex3","RightHandIndex2",
"RightHandThumb1","RightHand",
"RightHandThumb2","RightHandThumb1",
"RightHandThumb3","RightHandThumb2",
//Left lower side
"LeftUpLeg","Pelvis",
"LeftUpLegRoll","LeftUpLeg",
"LeftLeg","LeftUpLegRoll",
"LeftLegRoll","LeftLeg",
"LeftFoot","LeftLegRoll",
"LeftToeBase","LeftFoot",
//Right lower side
"RightUpLeg","Pelvis",
"RightUpLegRoll","RightUpLeg",
"RightLeg","RightUpLegRoll",
"RightLegRoll","RightLeg",
"RightFoot","RightLegRoll",
"RightToeBase","RightFoot"
};
// location of pivot points (local axes) for hierarchical animation
pivotsModel="A3\anims_f\data\skeleton\SkeletonPivots.p3d";
};
};
class CfgModels {
class Default {
sectionsInherit="";
sections[] = {};
skeletonName = "";
};
class ArmaMan: Default {
htMin = 60; // Minimum half-cooling time (in seconds)
htMax = 1800; // Maximum half-cooling time (in seconds)
afMax = 30; // Maximum temperature in case the model is alive (in celsius)
mfMax = 0; // Maximum temperature when the model is moving (in celsius)
mFact = 1; // Metabolism factor - number from interval <0, 1> (0 - metabolism has no influence, 1 - metabolism has full influence (no other temperature source will be considered)).
tBody = 37; // Metabolism temperature of the model (in celsius)
sections[] = {
"osobnost","Head_Injury","Body_Injury","l_leg_injury","l_arm_injury","r_arm_injury","r_leg_injury","injury_body", "injury_legs", "injury_hands",
"clan","clan_sign","Camo","CamoB","Camo1","Camo2","personality","hl", "injury_head", "insignia"
};
skeletonName = "OFP2_ManSkeleton";
};
class gunbag: ArmaMan {};
};

View File

@ -0,0 +1,32 @@
/*
* Author: Ir0n1E
* Check if client able to interact with gunbag
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* <NUMBER> -1: can't interact 0: empty gunbag 1: full gunbag
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit","_target"];
private ["_result","_gunbag"];
_result = -1;
_gunbag = backpackContainer _target;
if(count (_gunbag getVariable [QGVAR(GunbagWeapon),[]]) <= 0 && {primaryWeapon _unit != ""} && {getNumber (configFile >> "CfgWeapons" >> primaryWeapon _unit >> QGVAR(allowGunbag)) == 1}) then {
_result = 0;
};
if(count (_gunbag getVariable [QGVAR(GunbagWeapon),[]]) >= 1 && {primaryWeapon _unit == ""}) then {
_result = 1;
};
_result

View File

@ -0,0 +1,18 @@
/*
* Author: Ir0n1E
* switches gunbag full/empty for mass calculation
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* (BOOL)
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
backpackContainer _unit isKindOf QUOTE(CLASSNAME)

View File

@ -0,0 +1,42 @@
/*
* Author: Ir0n1E
* get weapon out of gunbag
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* Nothing
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit","_target"];
private ["_weapon", "_items", "_gunbag", "_state"];
_gunbag = backpackContainer _target;
_state = _gunbag getVariable [QGVAR(GunbagWeapon),[]];
/*
* example returnvalue _state
* ["","","optic_Aco","",["arifle_MX_GL_ACO_F","GL_3GL_F"],["30Rnd_65x39_caseless_mag","1Rnd_HE_Grenade_shell"],[30,1]]
*/
if (count _state <= 0) exitWith {
[localize LSTRING(empty)] call EFUNC(common,displayTextStructured);
};
_weapon = (_state select 0) select 0;
_items = (_state select 1);
_unit addWeapon _weapon;
{
_unit addWeaponItem [_weapon, _x];
} forEach _items;
([_target] call FUNC(switchBackpack)) setVariable [QGVAR(GunbagWeapon), [], true];

View File

@ -0,0 +1,26 @@
/*
* Author: Ir0n1E
* check gunbag status full/empty
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* Nothing
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
private _state = (backpackContainer _unit) getVariable [QGVAR(GunbagWeapon),[]];
if (count _state <= 0) then {
[localize LSTRING(empty)] call EFUNC(common,displayTextStructured);
} else {
private _weapon = (_state select 0) select 0;
[getText (configFile >> "CfgWeapons" >> _weapon >> "displayname"),
getText (configFile >> "CfgWeapons" >> _weapon >> "picture")] call EFUNC(common,displayTextPicture);
};

View File

@ -0,0 +1,36 @@
/*
* Author: Ir0n1E
* switches gunbag full/empty for mass calculation
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* backpack <OBJECT>
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
private ["_altgunbag", "_items", "_gunbag"];
_gunbag = backpackContainer _unit;
_items = backpackItems _unit;
_altgunbag = getText (configFile >> "CfgVehicles" >> typeof _gunbag >> QGVAR(gunbagswitch));
removeBackpack _unit;
_unit addBackpack _altgunbag;
{
_unit addItemToBackpack _x;
} forEach _items;
if ([QUOTE(ACE_Backpacks)] call EFUNC(common,isModLoaded)) then {
[_unit, backpackContainer _unit] call EFUNC(backpacks,backpackOpened);
};
(backpackContainer _unit)

View File

@ -0,0 +1,50 @@
/*
* Author: Ir0n1E
* put weapon into gunbag
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* Nothing
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_target"];
private ["_weapon", "_magazine", "_items", "_gunbag", "_state"];
_gunbag = backpackContainer _target;
_state = [_unit, primaryWeapon _unit] call EFUNC(common,getWeaponState);
/*
* example returnvalue _state
* [["","","optic_Aco",""],["arifle_MX_GL_ACO_F","GL_3GL_F"],["30Rnd_65x39_caseless_mag","1Rnd_HE_Grenade_shell"],[30,1]]
*/
_weapon = ((_state select 1) select 0);
_magazine = [(_state select 2) select 0, (_state select 3) select 0];
_items = _state select 0;
if ((_magazine select 0) != "") then {
_unit addMagazine _magazine;
};
_unit removeWeapon _weapon;
for "_loop" from 0 to (count _state) -1 do {
if (typeName (_state select _loop) == QUOTE(STRING)) then {
_items pushBack (_state select _loop);
};
};
([_target] call FUNC(switchBackpack)) setVariable [QGVAR(GunbagWeapon), [[_weapon], _items], true];

View File

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

View File

@ -0,0 +1,18 @@
#define COMPONENT gunbag
#include "\z\ace\addons\main\script_mod.hpp"
#define CLASSNAME ACE_Gunbag
#define DEBUG_MODE_FULL
#define DISABLE_COMPILE_CACHE
#define CBA_DEBUG_SYNCHRONOUS
#define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_GUNBAG
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_GUNBAG
#define DEBUG_SETTINGS DEBUG_SETTINGS_GUNBAG
#endif
#include "\z\ace\addons\main\script_macros.hpp"

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="gunbag">
<Key ID="STR_ACE_Gunbag_DisplayName">
<English>Gunbag</English>
<German>Waffentasche</German>
</Key>
<Key ID="STR_ACE_Gunbag_DisplayName_Tan">
<English>Gunbag (Tan)</English>
<German>Waffentasche (Tan)</German>
</Key>
<Key ID="STR_ACE_Gunbag_toGunbag">
<English>Put weapon into gunbag</English>
<German>Lege Waffe in Waffentasche</German>
</Key>
<Key ID="STR_ACE_Gunbag_offGunbag">
<English>Get weapon out of gunbag</English>
<German>Hole Waffe aus Waffentasche</German>
</Key>
<Key ID="STR_ACE_Gunbag_Status">
<English>Status Gunbag</English>
<German>Status Waffentasche</German>
</Key>
<Key ID="STR_ACE_Gunbag_empty">
<English>Gunbag Empty</English>
<German>Waffentasche leer</German>
</Key>
</Package>
</Project>

Binary file not shown.

Binary file not shown.

Binary file not shown.