More sandbag features:

* You can now carry sandbags
* Different sandbag model during deployment (no geometry)
* Deploying sandbags now requires an appropriate surface
* Proper PhysX activation chain when you deploy/pickup sandbags
* Sandbags are now destructible
* Some stringtable fixes
This commit is contained in:
ulteq 2015-06-04 11:13:12 +02:00
parent 5b2ad32c3f
commit da28aa3c64
13 changed files with 179 additions and 18 deletions

Binary file not shown.

Binary file not shown.

View File

@ -50,11 +50,25 @@ class CfgVehicles {
scope = 1;
side = -1;
model = PATHTOF(data\ace_sandbag_build.p3d);
icon = "";
displayName = $STR_ACE_Sandbag;
EGVAR(dragging,canDrag) = 1;
EGVAR(dragging,dragPosition[]) = {0,0.8,0};
EGVAR(dragging,dragDirection) = 0;
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 = "";
@ -71,9 +85,24 @@ class CfgVehicles {
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 {

View File

@ -3,9 +3,11 @@
ADDON = false;
PREP(canDeploy);
PREP(carry);
PREP(deploy);
PREP(deployCancel);
PREP(deployConfirm);
PREP(drop);
PREP(handleScrollWheel);
PREP(pickup);

View File

@ -17,7 +17,7 @@ class Stage1 {
};
};
class Stage2 {
texture="ca\data\destruct\vehicle_destr1024_1024_mc.paa";
texture="z\ace\addons\apl\data\vehicle_destr1024_1024_mc.paa";
uvSource="tex";
class uvTransform {
aside[]={1.000000,0.000000,0.000000};
@ -37,7 +37,7 @@ class Stage3 {
};
};
class Stage4 {
texture="ca\data\destruct\vehicle_destr1024_1024_smdi.paa";
texture="z\ace\addons\apl\data\vehicle_destr1024_1024_smdi.paa";
uvSource="tex";
class uvTransform {
aside[]={1.000000,0.000000,0.000000};

View File

@ -15,4 +15,14 @@
*/
#include "script_component.hpp"
(([ACE_player, "ACE_Sandbag_empty"] call EFUNC(common,hasItem)) && !(ACE_player getVariable [QGVAR(usingSandbag), false]))
#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)

View File

@ -0,0 +1,56 @@
/*
* Author: Ruthberg
* Carry sandbag
*
* Arguments:
* 0: sandbag <OBJECT>
* 1: unit <OBJECT>
*
* 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);

View File

@ -21,7 +21,7 @@ GVAR(placer) = ACE_player;
[GVAR(placer), "ACE_Sandbag", true] call EFUNC(common,setForceWalkStatus);
GVAR(sandBag) = createVehicle ["ACE_SandbagObject", [0,0,0], [], 0, "NONE"];
GVAR(sandBag) = createVehicle ["ACE_SandbagObject_NoGeo", [0,0,0], [], 0, "NONE"];
GVAR(sandBag) enableSimulationGlobal false;
GVAR(deployPFH) = [{

View File

@ -29,5 +29,7 @@ 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;

View File

@ -33,10 +33,19 @@ GVAR(placer) setVariable [QGVAR(usingSandbag), true];
}, GVAR(placer), 1.5, 0.5] call EFUNC(common,waitAndExecute);
[{
GVAR(sandBag) enableSimulationGlobal true;
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;
}, GVAR(placer), 1.0, 0.5] call EFUNC(common,waitAndExecute);
}, [], 1.0, 0.5] call EFUNC(common,waitAndExecute);

View File

@ -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);

View File

@ -25,5 +25,11 @@ _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);

View File

@ -35,7 +35,7 @@
<Hungarian>Nem teheted ide</Hungarian>
</Key>
<Key ID="STR_ACE_AC_PICKUPSB">
<English>Pick up sandbag</English>
<English>Pick up Sandbag</English>
<German>Sandsack abbauen</German>
<Russian>Взять мешок с песком</Russian>
<Polish>Zabierz worek</Polish>
@ -46,7 +46,7 @@
<Hungarian>Homokzsák felvétele</Hungarian>
</Key>
<Key ID="STR_ACE_AC_CARRYSB">
<English>Carry sandbag</English>
<English>Carry Sandbag</English>
<German>Sandsack tragen</German>
<Russian>Нести мешок с песком</Russian>
<Polish>Przenieś worek</Polish>
@ -57,7 +57,7 @@
<Hungarian>Homokzsák cipelése</Hungarian>
</Key>
<Key ID="STR_ACE_AC_ENDCARRYSB">
<English>End carrying</English>
<English>End Carrying</English>
<German>Tragen beenden</German>
<Russian>Завершить переноску</Russian>
<Polish>Zostaw worek</Polish>
@ -68,7 +68,7 @@
<Hungarian>Cipelés abbahagyása</Hungarian>
</Key>
<Key ID="STR_ACE_AC_DROP">
<English>Drop sandbag</English>
<English>Drop Sandbag</English>
<German>Sandsack ablegen</German>
<Russian>Положить мешок</Russian>
<Polish>Upuść worek</Polish>
@ -101,7 +101,7 @@
<Hungarian>Visszavonás</Hungarian>
</Key>
<Key ID="STR_ACE_AC_BUILD">
<English>Deploy sandbag</English>
<English>Deploy Sandbag</English>
<German>Sandsack aufbauen</German>
<Russian>Установить мешок с песком</Russian>
<Polish>Rozłóż worek z piaskiem</Polish>
@ -112,7 +112,7 @@
<Hungarian>Homokzsák lerakása</Hungarian>
</Key>
<Key ID="STR_ACE_V_SANDBOX">
<English>Sandbag box</English>
<English>Sandbag Box</English>
<German>Sandsack Kiste</German>
<Russian>Ящик мешков с песком</Russian>
<Polish>Skrzynia worków na piasek</Polish>