diff --git a/addons/apl/data/vehicle_destr1024_1024_mc.paa b/addons/apl/data/vehicle_destr1024_1024_mc.paa new file mode 100644 index 0000000000..68dfc1b977 Binary files /dev/null and b/addons/apl/data/vehicle_destr1024_1024_mc.paa differ diff --git a/addons/apl/data/vehicle_destr1024_1024_smdi.paa b/addons/apl/data/vehicle_destr1024_1024_smdi.paa new file mode 100644 index 0000000000..2a2cfc0357 Binary files /dev/null and b/addons/apl/data/vehicle_destr1024_1024_smdi.paa differ diff --git a/addons/sandbag/$PBOPREFIX$ b/addons/sandbag/$PBOPREFIX$ new file mode 100644 index 0000000000..1061a20968 --- /dev/null +++ b/addons/sandbag/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\sandbag \ No newline at end of file diff --git a/addons/sandbag/CfgEventHandlers.hpp b/addons/sandbag/CfgEventHandlers.hpp new file mode 100644 index 0000000000..17911f6b1f --- /dev/null +++ b/addons/sandbag/CfgEventHandlers.hpp @@ -0,0 +1,19 @@ +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_Init_EventHandlers { + class ACE_SandbagObject { + class ADDON { + init = QUOTE(_this call DEFUNC(dragging,initObject)); + }; + }; +}; \ No newline at end of file diff --git a/addons/sandbag/CfgVehicles.hpp b/addons/sandbag/CfgVehicles.hpp new file mode 100644 index 0000000000..f26b746629 --- /dev/null +++ b/addons/sandbag/CfgVehicles.hpp @@ -0,0 +1,113 @@ +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_Sandbags { + displayName = $STR_ACE_AC_BUILD; + condition = QUOTE(call FUNC(canDeploy)); + statement = QUOTE(call FUNC(deploy)); + exceptions[] = {"isNotSwimming", "isNotInside"}; + showDisabled = 1; + priority = 4; + icon = PATHTOF(UI\icon_sandbag_ca.paa); + }; + }; + }; + + class Item_Base_F; + class ACE_Item_Sandbag_empty: Item_Base_F { + author = "$STR_ACE_Common_ACETeam"; + scope = 2; + scopeCurator = 2; + displayName = "$STR_ACE_M_SBEMPTY"; + vehicleClass = "Items"; + class TransportItems { + class ACE_Sandbag_empty { + name = "ACE_Sandbag_empty"; + count = 1; + }; + }; + }; + /* + class ACE_Item_Sandbag: Item_Base_F { + author = "$STR_ACE_Common_ACETeam"; + scope = 2; + scopeCurator = 2; + displayName = "$STR_ACE_Sandbag"; + vehicleClass = "Items"; + class TransportItems { + class ACE_Sandbag { + name = "ACE_Sandbag"; + count = 1; + }; + }; + }; + */ + class thingX; + class ACE_SandbagObject: thingX { + author = "$STR_ACE_Common_ACETeam"; + XEH_ENABLED; + scope = 1; + side = -1; + model = PATHTOF(data\ace_sandbag_build.p3d); + displayName = $STR_ACE_Sandbag; + typicalCargo[] = {}; + armor = 12000; // Withstand 200 5.56 bullets before sandbag hull is cheese + mapSize = 0.4; + nameSound = "Bunker"; + icon = PATHTOF(UI\icon_sandbag_ca.paa); + accuracy = 1000; + + destrType = "DestructDefault"; + + class DestructionEffects {}; + class Damage { + tex[] = {}; + mat[] = { + "z\ace\addons\sandbag\data\bag_destruct.rvmat", + "z\ace\addons\sandbag\data\bag_destruct.rvmat", + "z\ace\addons\sandbag\data\bag_destruct.rvmat" + }; + }; + class ACE_Actions { + class ACE_MainActions { + selection = ""; + distance = 5; + condition = "true"; + class ACE_PickUp { + selection = ""; + displayName = "$STR_ACE_AC_PICKUPSB"; + distance = 4; + condition = QUOTE(!(_player getVariable [ARR_2('ace_sandbag_usingSandbag',false)])); + statement = QUOTE([ARR_2(_target,_player)] call FUNC(pickup)); + showDisabled = 0; + exceptions[] = {}; + priority = 5; + icon = PATHTOF(UI\icon_sandbag_ca.paa); + }; + class ACE_Carry { + selection = ""; + displayName = "$STR_ACE_AC_CARRYSB"; + distance = 4; + condition = QUOTE(!(_player getVariable [ARR_2('ace_sandbag_usingSandbag',false)])); + statement = QUOTE([ARR_2(_target,_player)] call FUNC(carry)); + showDisabled = 0; + exceptions[] = {}; + priority = 5; + icon = PATHTOF(UI\icon_sandbag_ca.paa); + }; + }; + }; + }; + class ACE_SandbagObject_NoGeo: ACE_SandbagObject { + scope = 1; + model = PATHTOF(data\ace_sandbag_nogeo.p3d); + }; + + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_Sandbag_empty,50); + }; + }; +}; diff --git a/addons/sandbag/CfgWeapons.hpp b/addons/sandbag/CfgWeapons.hpp new file mode 100644 index 0000000000..cb80d1e9d9 --- /dev/null +++ b/addons/sandbag/CfgWeapons.hpp @@ -0,0 +1,30 @@ + +class CfgWeapons { + class ACE_ItemCore; + class InventoryItem_Base_F; + + class ACE_Sandbag_empty: ACE_ItemCore { + author = "$STR_ACE_Common_ACETeam"; + scope = 2; + displayName = "$STR_ACE_M_SBEMPTY"; + model = PATHTOF(data\ace_sandbag_m.p3d); + picture = PATHTOF(data\m_sandbag_ca.paa); + + class ItemInfo: InventoryItem_Base_F { + mass = 8; + }; + }; + /* + class ACE_Sandbag: ACE_ItemCore { + author = "$STR_ACE_Common_ACETeam"; + scope = 2; + displayName = "$STR_ACE_Sandbag"; + model = PATHTOF(data\ace_sandbag_build.p3d); + picture = PATHTOF(data\m_sandbag_ca.paa); + + class ItemInfo: InventoryItem_Base_F { + mass = 160; + }; + }; + */ +}; diff --git a/addons/sandbag/README.md b/addons/sandbag/README.md new file mode 100644 index 0000000000..8c67ed9a6d --- /dev/null +++ b/addons/sandbag/README.md @@ -0,0 +1,10 @@ +ace_sandbag +=============== + +Stackable sandbags. + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [Ruthberg] (http://github.com/Ulteq) \ No newline at end of file diff --git a/addons/sandbag/UI/icon_sandbag_ca.paa b/addons/sandbag/UI/icon_sandbag_ca.paa new file mode 100644 index 0000000000..5d6ea6d4d9 Binary files /dev/null and b/addons/sandbag/UI/icon_sandbag_ca.paa differ diff --git a/addons/sandbag/XEH_postInit.sqf b/addons/sandbag/XEH_postInit.sqf new file mode 100644 index 0000000000..d1c0ad0766 --- /dev/null +++ b/addons/sandbag/XEH_postInit.sqf @@ -0,0 +1,15 @@ +#include "script_component.hpp" + +GVAR(placer) = objNull; +GVAR(sandBag) = objNull; +GVAR(deployPFH) = -1; +GVAR(deployDirection) = 0; + +// Cancel deploy sandbag if interact menu opened +["interactMenuOpened", { + if (GVAR(deployPFH) != -1 && {!isNull (GVAR(sandBag))}) then { + call FUNC(deployCancel); + }; +}] call EFUNC(common,addEventHandler); + +[{_this call DFUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler); diff --git a/addons/sandbag/XEH_preInit.sqf b/addons/sandbag/XEH_preInit.sqf new file mode 100644 index 0000000000..1978913723 --- /dev/null +++ b/addons/sandbag/XEH_preInit.sqf @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(canDeploy); +PREP(carry); +PREP(deploy); +PREP(deployCancel); +PREP(deployConfirm); +PREP(drop); +PREP(handleScrollWheel); +PREP(pickup); + +ADDON = true; diff --git a/addons/sandbag/config.cpp b/addons/sandbag/config.cpp new file mode 100644 index 0000000000..6b7ce1a456 --- /dev/null +++ b/addons/sandbag/config.cpp @@ -0,0 +1,16 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {"ACE_Item_Sandbag", "ACE_Item_Sandbag_empty"}; + weapons[] = {"ACE_Sandbag", "ACE_Sandbag_empty"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_interaction"}; + author[] = {"Rocko", "Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" \ No newline at end of file diff --git a/addons/sandbag/data/ace_sandbag_build.p3d b/addons/sandbag/data/ace_sandbag_build.p3d new file mode 100644 index 0000000000..eb24832c31 Binary files /dev/null and b/addons/sandbag/data/ace_sandbag_build.p3d differ diff --git a/addons/sandbag/data/ace_sandbag_m.p3d b/addons/sandbag/data/ace_sandbag_m.p3d new file mode 100644 index 0000000000..3f651a7530 Binary files /dev/null and b/addons/sandbag/data/ace_sandbag_m.p3d differ diff --git a/addons/sandbag/data/ace_sandbag_nogeo.p3d b/addons/sandbag/data/ace_sandbag_nogeo.p3d new file mode 100644 index 0000000000..5a7680ffd8 Binary files /dev/null and b/addons/sandbag/data/ace_sandbag_nogeo.p3d differ diff --git a/addons/sandbag/data/bag.rvmat b/addons/sandbag/data/bag.rvmat new file mode 100644 index 0000000000..d764320caa --- /dev/null +++ b/addons/sandbag/data/bag.rvmat @@ -0,0 +1,132 @@ +/* +ambient[]={0.992157,0.992157,0.992157,1.000000}; +diffuse[]={0.992157,0.992157,0.992157,1.000000}; +forcedDiffuse[]={0.000000,0.000000,0.000000,0.000000}; +emmisive[]={0.000000,0.000000,0.000000,1.000000}; +specular[]={0.000000,0.000000,0.000000,1.000000}; +specularPower=40.000000; +*/ + +ambient[]={1.000000,1.000000,1.000000,1.000000}; +diffuse[]={1.000000,1.000000,1.000000,1.000000}; +forcedDiffuse[]={0.000000,0.000000,0.000000,0.000000}; +emmisive[]={0.000000,0.000000,0.000000,1.000000}; +specular[]={0.250000,0.250000,0.250000,0.250000}; +specularPower=30.000000; +PixelShaderID="NormalMapSpecularDIMap"; +VertexShaderID="NormalMap"; +class Stage1 { + texture="z\ace\addons\sandbag\data\bag_nohq.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; +class Stage2 { + texture="z\ace\addons\sandbag\data\bag_smdi.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; + +/* +ambient[]={1.0, 1.0, 1.0, 1.0}; +diffuse[]={1.0, 1.0, 1.0, 1.0}; +forcedDiffuse[]={0.0, 0.0, 0.0, 0.0}; +emmisive[]={0.0, 0.0, 0.0, 0.0}; +specular[]={0.93, 0.93, 0.93, 0.0}; +specularPower=400.0; +PixelShaderID="Super"; +VertexShaderID="Super"; + +class Stage1 { + texture="z\ace\addons\sandbag\data\bag_nohq.paa"; + uvSource="tex"; + + class uvTransform { + aside[]={1.0, 0.0, 0.0}; + up[]={0.0, 1.0, 0.0}; + dir[]={0.0, 0.0, 0.0}; + pos[]={0.0, 0.0, 0.0}; + }; +}; + +class Stage2 { + texture="a3\weapons_f\data\detailmaps\metal_detail_dt.paa"; + uvSource="tex"; + + class uvTransform { + aside[]={6.0, 0.0, 0.0}; + up[]={0.0, 3.0, 0.0}; + dir[]={0.0, 0.0, 0.0}; + pos[]={0.0, 0.0, 0.0}; + }; +}; + +class Stage3 { + texture="#(argb,8,8,3)color(0,0,0,0,MC)"; + uvSource="tex"; + + class uvTransform { + aside[]={1.0, 0.0, 0.0}; + up[]={0.0, 1.0, 0.0}; + dir[]={0.0, 0.0, 0.0}; + pos[]={0.0, 0.0, 0.0}; + }; +}; + +class Stage4 { + texture="#(argb,8,8,3)color(0.8,0,0,1,AS)"; + uvSource="tex"; + + class uvTransform { + aside[]={1.0, 0.0, 0.0}; + up[]={0.0, 1.0, 0.0}; + dir[]={0.0, 0.0, 0.0}; + pos[]={0.0, 0.0, 0.0}; + }; +}; + +class Stage5 { + texture="z\ace\addons\sandbag\data\bag_smdi.paa"; + uvSource="tex"; + + class uvTransform { + aside[]={1.0, 0.0, 0.0}; + up[]={0.0, 1.0, 0.0}; + dir[]={0.0, 0.0, 0.0}; + pos[]={0.0, 0.0, 0.0}; + }; +}; + +class Stage6 { + texture="#(ai,64,64,1)fresnel(1.29,0.5)"; + uvSource="tex"; + + class uvTransform { + aside[]={1.0, 0.0, 0.0}; + up[]={0.0, 1.0, 0.0}; + dir[]={0.0, 0.0, 0.0}; + pos[]={0.0, 0.0, 0.0}; + }; +}; + +class Stage7 { + texture="a3\data_f\env_land_co.paa"; + uvSource="tex"; + + class uvTransform { + aside[]={1.0, 0.0, 0.0}; + up[]={0.0, 1.0, 0.0}; + dir[]={0.0, 0.0, 0.0}; + pos[]={0.0, 0.0, 0.0}; + }; +}; +*/ diff --git a/addons/sandbag/data/bag_co.paa b/addons/sandbag/data/bag_co.paa new file mode 100644 index 0000000000..436b8af955 Binary files /dev/null and b/addons/sandbag/data/bag_co.paa differ diff --git a/addons/sandbag/data/bag_destruct.rvmat b/addons/sandbag/data/bag_destruct.rvmat new file mode 100644 index 0000000000..1a592c973e --- /dev/null +++ b/addons/sandbag/data/bag_destruct.rvmat @@ -0,0 +1,48 @@ +ambient[]={1.000000,1.000000,1.000000,1.000000}; +diffuse[]={1.000000,1.000000,1.000000,1.000000}; +forcedDiffuse[]={0.000000,0.000000,0.000000,0.000000}; +emmisive[]={0.000000,0.000000,0.000000,1.000000}; +specular[]={0.250000,0.250000,0.250000,0.250000}; +specularPower=30.000000; +PixelShaderID="NormalMapSpecularDIMap"; +VertexShaderID="NormalMap"; +class Stage1 { + texture="z\ace\addons\sandbag\data\bag_nohq.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; +class Stage2 { + texture="z\ace\addons\apl\data\vehicle_destr1024_1024_mc.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.200000,0.000000,0.000000}; + pos[]={0.200000,0.000000,0.000000}; + }; +}; +class Stage3 { + texture="#(argb,8,8,3)color(1,1,1,0.3)"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; +class Stage4 { + texture="z\ace\addons\apl\data\vehicle_destr1024_1024_smdi.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1.000000,0.000000,0.000000}; + up[]={0.000000,1.000000,0.000000}; + dir[]={0.000000,0.000000,0.000000}; + pos[]={0.000000,0.000000,0.000000}; + }; +}; diff --git a/addons/sandbag/data/bag_nohq.paa b/addons/sandbag/data/bag_nohq.paa new file mode 100644 index 0000000000..009b9c5525 Binary files /dev/null and b/addons/sandbag/data/bag_nohq.paa differ diff --git a/addons/sandbag/data/bag_smdi.paa b/addons/sandbag/data/bag_smdi.paa new file mode 100644 index 0000000000..8c277264db Binary files /dev/null and b/addons/sandbag/data/bag_smdi.paa differ diff --git a/addons/sandbag/data/m_sandbag_ca.paa b/addons/sandbag/data/m_sandbag_ca.paa new file mode 100644 index 0000000000..b0c2d9e3be Binary files /dev/null and b/addons/sandbag/data/m_sandbag_ca.paa differ diff --git a/addons/sandbag/data/model.cfg b/addons/sandbag/data/model.cfg new file mode 100644 index 0000000000..064073b314 --- /dev/null +++ b/addons/sandbag/data/model.cfg @@ -0,0 +1,21 @@ +class CfgSkeletons { + class Default { + isDiscrete = 1; + skeletonInherit = ""; + skeletonBones[] = {}; + }; + class ACE_SB_Skeleton: Default {}; +}; + +class CfgModels { + class Default { + sectionsInherit=""; + sections[] = {""}; + skeletonName = ""; + }; + class ace_sandbag_build { + sectionsInherit = "Default"; + sections[] = {"zbytek"}; + skeletonName = "ACE_SB_Skeleton"; + }; +}; diff --git a/addons/sandbag/functions/fnc_canDeploy.sqf b/addons/sandbag/functions/fnc_canDeploy.sqf new file mode 100644 index 0000000000..a55b9f9875 --- /dev/null +++ b/addons/sandbag/functions/fnc_canDeploy.sqf @@ -0,0 +1,28 @@ +/* + * Author: Ruthberg + * Checks if the player can deploy a sandbag + * + * Arguments: + * None + * + * Return Value: + * can deploy? + * + * Example: + * call ace_sandbag_fnc_canDeploy; + * + * Public: No + */ +#include "script_component.hpp" + +#define SURFACE_BLACKLIST ["water", "concrete", "tarmac", "wood", "metal", "roof_tin", "roof_tiles", "wood_int", "concrete_int", "tiles_int", "metal_int", "stony", "rock", "int_concrete", "int_tiles", "int_wood", "tiling", "wavymetal", "int_metal"] + +if !([ACE_player, "ACE_Sandbag_empty"] call EFUNC(common,hasItem)) exitWith { false }; +if (ACE_player getVariable [QGVAR(usingSandbag), false]) exitWith { false }; +if ((getPosATL ACE_player select 2) - (getPos ACE_player select 2) > 1E-5) exitWith { false }; + +private ["_surfaceClass", "_surfaceType"]; +_surfaceClass = ([surfaceType (position ACE_player), "#"] call CBA_fnc_split) select 1; +_surfaceType = getText (configfile >> "CfgSurfaces" >> _surfaceClass >> "soundEnviron"); + +!(_surfaceType in SURFACE_BLACKLIST) diff --git a/addons/sandbag/functions/fnc_carry.sqf b/addons/sandbag/functions/fnc_carry.sqf new file mode 100644 index 0000000000..cefcd827c3 --- /dev/null +++ b/addons/sandbag/functions/fnc_carry.sqf @@ -0,0 +1,56 @@ +/* + * Author: Ruthberg + * Carry sandbag + * + * Arguments: + * 0: sandbag + * 1: unit + * + * Return Value: + * None + * + * Example: + * [_sandbag, _unit] call ace_sandbag_fnc_carry; + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_sandbag,_unit); + +_unit playActionNow "PutDown"; + +_unit setVariable [QGVAR(usingSandbag), true]; +[{ + PARAMS_2(_sandbag,_unit); + + GVAR(carrier) = ACE_player; + + [GVAR(carrier), "ACE_Sandbag", true] call EFUNC(common,setForceWalkStatus); + + deleteVehicle _sandbag; + + GVAR(sandBag) = createVehicle ["ACE_SandbagObject_NoGeo", [0,0,0], [], 0, "NONE"]; + GVAR(sandBag) enableSimulationGlobal false; + + // Force physx update + { + _x setPosASL (getPosASL _x); + } forEach (GVAR(carrier) nearObjects ["ACE_SandbagObject", 5]); + + GVAR(carryPFH) = [{ + if (GVAR(carrier) != ACE_player) exitWith { + call FUNC(drop); + }; + GVAR(sandBag) setPosASL ((eyePos ACE_player) vectorAdd (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0])); + GVAR(sandBag) setDir (GVAR(deployDirection) + getDir ACE_player); + }, 0, []] call CBA_fnc_addPerFrameHandler; + + [localize "STR_ACE_AC_DROP", "", ""] call EFUNC(interaction,showMouseHint); + + GVAR(carrier) setVariable [QGVAR(drop), + [GVAR(carrier), "DefaultAction", + {GVAR(carryPFH) != -1 && !isNull (GVAR(sandBag))}, + {call FUNC(drop);} + ] call EFUNC(common,AddActionEventHandler)]; +}, [_sandbag, _unit], 1, 0.5] call EFUNC(common,waitAndExecute); diff --git a/addons/sandbag/functions/fnc_deploy.sqf b/addons/sandbag/functions/fnc_deploy.sqf new file mode 100644 index 0000000000..9501d5d09e --- /dev/null +++ b/addons/sandbag/functions/fnc_deploy.sqf @@ -0,0 +1,47 @@ +/* + * Author: Garth 'L-H' de Wet, Ruthberg + * Starts the deploy process for sandbags. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_sandbag_fnc_deploy; + * + * Public: No + */ +#include "script_component.hpp" + +closeDialog 0; + +GVAR(placer) = ACE_player; + +[GVAR(placer), "ACE_Sandbag", true] call EFUNC(common,setForceWalkStatus); + +GVAR(sandBag) = createVehicle ["ACE_SandbagObject_NoGeo", [0,0,0], [], 0, "NONE"]; +GVAR(sandBag) enableSimulationGlobal false; + +GVAR(deployPFH) = [{ + if (GVAR(placer) != ACE_player) exitWith { + call FUNC(deployCancel); + }; + GVAR(sandBag) setPosASL ((eyePos ACE_player) vectorAdd (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0])); + GVAR(sandBag) setDir (GVAR(deployDirection) + getDir ACE_player); +}, 0, []] call CBA_fnc_addPerFrameHandler; + +[localize "STR_ACE_AC_CONF", localize "STR_ACE_AC_CANCEL", localize "STR_ACE_Sandbag_ScrollAction"] call EFUNC(interaction,showMouseHint); + +GVAR(placer) setVariable [QGVAR(Deploy), + [GVAR(placer), "DefaultAction", + {GVAR(deployPFH) != -1 && !isNull (GVAR(sandBag))}, + {call FUNC(deployConfirm);} +] call EFUNC(common,AddActionEventHandler)]; + +GVAR(placer) setVariable [QGVAR(Cancel), + [GVAR(placer), "zoomtemp", + {GVAR(deployPFH) != -1 && !isNull (GVAR(sandBag))}, + {call FUNC(deployCancel);} +] call EFUNC(common,AddActionEventHandler)]; diff --git a/addons/sandbag/functions/fnc_deployCancel.sqf b/addons/sandbag/functions/fnc_deployCancel.sqf new file mode 100644 index 0000000000..65677ea887 --- /dev/null +++ b/addons/sandbag/functions/fnc_deployCancel.sqf @@ -0,0 +1,35 @@ +/* + * Author: Garth 'L-H' de Wet, Ruthberg + * Cancels sandbag deployment + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_sandbag_fnc_deployCancel; + * + * Public: No + */ +#include "script_component.hpp" + +if (isNull GVAR(placer)) exitWith {}; + +[GVAR(deployPFH)] call cba_fnc_removePerFrameHandler; + +if (!isNull (GVAR(sandBag))) then { + deleteVehicle GVAR(sandBag); +}; + +[GVAR(placer), "ACE_Sandbag", false] call EFUNC(Common,setForceWalkStatus); + +call EFUNC(interaction,hideMouseHint); +[GVAR(placer), "DefaultAction", GVAR(placer) getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); +[GVAR(placer), "zoomtemp", GVAR(placer) getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); + +GVAR(placer) addItem "ACE_Sandbag_empty"; + +GVAR(sandBag) = objNull; +GVAR(placer) = objNull; diff --git a/addons/sandbag/functions/fnc_deployConfirm.sqf b/addons/sandbag/functions/fnc_deployConfirm.sqf new file mode 100644 index 0000000000..2cb297c51e --- /dev/null +++ b/addons/sandbag/functions/fnc_deployConfirm.sqf @@ -0,0 +1,51 @@ +/* + * Author: Garth 'L-H' de Wet, Ruthberg + * Confirms sandbag deployment + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_sandbag_fnc_deployConfirm; + * + * Public: No + */ +#include "script_component.hpp" + +if (isNull GVAR(sandBag) || isNull GVAR(placer)) exitWith {}; + +[GVAR(deployPFH)] call cba_fnc_removePerFrameHandler; + +[GVAR(placer), "ACE_Sandbag", false] call EFUNC(Common,setForceWalkStatus); +[GVAR(placer), "DefaultAction", GVAR(placer) getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); +[GVAR(placer), "zoomtemp", GVAR(placer) getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); + +call EFUNC(interaction,hideMouseHint); + +GVAR(placer) playActionNow "PutDown"; + +GVAR(placer) setVariable [QGVAR(usingSandbag), true]; +[{ + _this setVariable [QGVAR(usingSandbag), false]; +}, GVAR(placer), 1.5, 0.5] call EFUNC(common,waitAndExecute); + +[{ + private ["_sandBag", "_position", "_direction"]; + _position = getPosASL GVAR(sandBag); + _direction = getDir GVAR(sandBag); + + deleteVehicle GVAR(sandBag); + + _sandBag = createVehicle ["ACE_SandbagObject", [0,0,0], [], 0, "NONE"]; + _sandBag enableSimulationGlobal true; + _sandBag setPosASL _position; + _sandBag setDir _direction; + + GVAR(placer) removeItem "ACE_Sandbag_empty"; + + GVAR(sandBag) = objNull; + GVAR(placer) = objNull; +}, [], 1.0, 0.5] call EFUNC(common,waitAndExecute); diff --git a/addons/sandbag/functions/fnc_drop.sqf b/addons/sandbag/functions/fnc_drop.sqf new file mode 100644 index 0000000000..1ef61289bf --- /dev/null +++ b/addons/sandbag/functions/fnc_drop.sqf @@ -0,0 +1,47 @@ +/* + * Author: Garth 'L-H' de Wet, Ruthberg + * Drop sandbag + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_sandbag_fnc_deployCancel; + * + * Public: No + */ +#include "script_component.hpp" + +if (isNull GVAR(sandBag) || isNull GVAR(carrier)) exitWith {}; + +[GVAR(carryPFH)] call cba_fnc_removePerFrameHandler; + +[GVAR(carrier), "ACE_Sandbag", false] call EFUNC(Common,setForceWalkStatus); +[GVAR(carrier), "DefaultAction", GVAR(carrier) getVariable [QGVAR(drop), -1]] call EFUNC(Common,removeActionEventHandler); + +call EFUNC(interaction,hideMouseHint); + +GVAR(carrier) playActionNow "PutDown"; + +[{ + _this setVariable [QGVAR(usingSandbag), false]; +}, GVAR(carrier), 1.5, 0.5] call EFUNC(common,waitAndExecute); + +[{ + private ["_sandBag", "_position", "_direction"]; + _position = getPosASL GVAR(sandBag); + _direction = getDir GVAR(sandBag); + + deleteVehicle GVAR(sandBag); + + _sandBag = createVehicle ["ACE_SandbagObject", [0,0,0], [], 0, "NONE"]; + _sandBag enableSimulationGlobal true; + _sandBag setPosASL _position; + _sandBag setDir _direction; + + GVAR(sandBag) = objNull; + GVAR(carrier) = objNull; +}, [], 1.0, 0.5] call EFUNC(common,waitAndExecute); diff --git a/addons/sandbag/functions/fnc_handleScrollWheel.sqf b/addons/sandbag/functions/fnc_handleScrollWheel.sqf new file mode 100644 index 0000000000..2b831f5cdc --- /dev/null +++ b/addons/sandbag/functions/fnc_handleScrollWheel.sqf @@ -0,0 +1,24 @@ +/* + * Author: Garth 'L-H' de Wet, Ruthberg + * Handles sandbag rotation + * + * Arguments: + * 0: scroll amount + * + * Return Value: + * handled + * + * Example: + * 1.2 call ace_sandbag_fnc_handleScrollWheel; + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_scroll); + +if (GETMVAR(ACE_Modifier,0) == 0 || GVAR(deployPFH) == -1) exitWith { false }; + +GVAR(deployDirection) = GVAR(deployDirection) + (_scroll * 5); + +true diff --git a/addons/sandbag/functions/fnc_pickup.sqf b/addons/sandbag/functions/fnc_pickup.sqf new file mode 100644 index 0000000000..360a18983a --- /dev/null +++ b/addons/sandbag/functions/fnc_pickup.sqf @@ -0,0 +1,35 @@ +/* + * Author: Ruthberg + * Pick up sandbag + * + * Arguments: + * 0: sandbag + * 1: unit + * + * Return Value: + * None + * + * Example: + * [_sandbag, _unit] call ace_sandbag_fnc_pickup; + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_sandbag,_unit); + +_unit playActionNow "PutDown"; + +_unit setVariable [QGVAR(usingSandbag), true]; +[{ + PARAMS_2(_sandbag,_unit); + _unit setVariable [QGVAR(usingSandbag), false]; + deletevehicle _sandbag; + + // Force physx update + { + _x setPosASL (getPosASL _x); + } forEach (_unit nearObjects ["ACE_SandbagObject", 5]); + + [_unit, "ACE_Sandbag_empty"] call EFUNC(common,addToInventory); +}, [_sandbag, _unit], 1.5, 0.5] call EFUNC(common,waitAndExecute); diff --git a/addons/sandbag/functions/script_component.hpp b/addons/sandbag/functions/script_component.hpp new file mode 100644 index 0000000000..1d6f10c806 --- /dev/null +++ b/addons/sandbag/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\sandbag\script_component.hpp" \ No newline at end of file diff --git a/addons/sandbag/script_component.hpp b/addons/sandbag/script_component.hpp new file mode 100644 index 0000000000..8737beef07 --- /dev/null +++ b/addons/sandbag/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT sandbag +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_SANDBAG + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_SANDBAG + #define DEBUG_SETTINGS DEBUG_SETTINGS_SANDBAG +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/sandbag/stringtable.xml b/addons/sandbag/stringtable.xml new file mode 100644 index 0000000000..49f8840bcc --- /dev/null +++ b/addons/sandbag/stringtable.xml @@ -0,0 +1,149 @@ + + + + + Sandbag + Sandsack + Мешок с песком + Worek z piaskiem + Sandbag + Sac de sable + Pytel s pískem + Sacco di Sabbia + Homokzsák + + + Sandbag (empty) + Sandsack (leer) + Мешок с песком (пустой) + Worek na piasek + Sandbag (empty) + Sac de sable (vide) + Pytel na písek (prázdný) + Sacco di Sabbia (Vuoto) + Homokzsák (üres) + + + Cannot build here + Nicht möglich + Установка на этом месте невозможна + Nie można tu budować + Cannot build here + Impossible de construire ici + Zde nelze postavit + Impossibile costruire qui + Nem teheted ide + + + Pick up Sandbag + Sandsack abbauen + Взять мешок с песком + Zabierz worek + Pick up sandbag + Prendre sac de sable + Zvednout pytel + Prendi Sacco di Sabbia + Homokzsák felvétele + + + Carry Sandbag + Sandsack tragen + Нести мешок с песком + Przenieś worek + Carry sandbag + Porter sac de sable + Nést pytel + Trasporta Sacco di Sabbia + Homokzsák cipelése + + + End Carrying + Tragen beenden + Завершить переноску + Zostaw worek + End carrying + Arreter de porter + Položit + Fine Trasporto + Cipelés abbahagyása + + + Drop Sandbag + Sandsack ablegen + Положить мешок + Upuść worek + Drop sandbag + Lacher sac de sable + Odložit pytel + Lascia Sacco di Sabbia + Homokzsák eldobása + + + Confirm Deployment + Aufbauen + Подтвердить установку + Potwierdź rozłożenie + Confirm Deployment + Confirmer Déploiement + Potvrdit Položení + Conferma Posizionamento + Lerak + + + Cancel Deployment + Abbrechen + Отменить установку + Anuluj rozłożenie + Cancel Deployment + Annuler Déploiement + Zrušit Položení + Cancella Posizionamento + Visszavonás + + + Deploy Sandbag + Sandsack aufbauen + Установить мешок с песком + Rozłóż worek z piaskiem + Deploy sandbag + Deployer sac de sable + Umístit pytel + Posiziona Sacco di Sabbia + Homokzsák lerakása + + + Sandbag Box + Sandsack Kiste + Ящик мешков с песком + Skrzynia worków na piasek + Sandbag box + Caisse de sacs de sable + Bedna na pytle s pískem + Contenitore Sacchi di Sabbia + Homokzsákos láda + + + Here is no sand + Hier gibt es keinen Sand + Здесь нет песка + Tu nie ma piasku + Here is no sand + Pas de sable ici + Tady není písek + Qui non cè Sabbia + Itt nincs homok + + + + Modifier, rotates + + Modifikator, drehen + + Modificador, girar + + Modificateur, tourner + + Modificatore, rotazione + + Modifikátor, otočit + + Változtatás, forgatás + + Modyfikator, obrót + + Modificador, rotaciona + + Bращать + + + \ No newline at end of file