Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize DM12 PARM sensor and fix carry and drag JIP #11

Merged
merged 15 commits into from
Jan 28, 2025
7 changes: 7 additions & 0 deletions .hemtt/project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name = "BW_Waffenkammer"
mainprefix = ""
prefix = "pbw"
author = "Herr_KaLeun, Lemonberries, Timi007"

Expand All @@ -22,3 +23,9 @@ preset = "Hemtt"

[hemtt.release]
folder = "BW_Waffenkammer"

[hemtt.launch.default]
workshop = [
"450814997", # CBA_A3's Workshop ID
"463939057" # ACE3's Workshop ID
]
5 changes: 0 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@
"**/release": true,
},
"files.associations": {
"**/*.hpp": "ext",
// "**/*.hpp": "cpp",
"**/*.cpp": "ext",
"**/XEH_PREP.hpp": "sqf",
"*.rpt": "log",
"init*.hpp": "sqf",
},
"sqf.enableACE3": true,
"sqf.enableCBA": true,
}
2 changes: 1 addition & 1 deletion addons/main/script_mod.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "script_version.hpp"

#define REQUIRED_VERSION 2.06
#define REQUIRED_VERSION 2.18
#define REQUIRED_CBA_VERSION {3,18,1}
#define REQUIRED_ACE_VERSION {3,19,0}
14 changes: 7 additions & 7 deletions addons/mines/CfgAmmo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class CfgAmmo {
submunitionParentSpeedCoef = 0;
triggerOnImpact = 1;
deleteParentWhenTriggered = 0;
model = "\A3\Weapons_F_Tank\Launchers\MRAWS\rocket_MRAWS_HEAT_F";

model = "\A3\Weapons_F_Tank\Launchers\MRAWS\rocket_MRAWS_HEAT_F.p3d";
hit = 2;
indirectHit = 15;
indirectHitRange = 4;
Expand All @@ -41,11 +41,11 @@ class CfgAmmo {
timeToLive = 6;
maneuvrability = 0;
allowAgainstInfantry = 0;
soundHit1[] = {"A3\Sounds_F\arsenal\weapons\Launchers\Titan\Explosion_titan_missile_01",2.5118864,1,1800};
soundHit2[] = {"A3\Sounds_F\arsenal\weapons\Launchers\Titan\Explosion_titan_missile_02",2.5118864,1,1800};
soundHit3[] = {"A3\Sounds_F\arsenal\weapons\Launchers\Titan\Explosion_titan_missile_03",2.5118864,1,1800};
soundHit1[] = {"A3\Sounds_F\arsenal\weapons\Launchers\Titan\Explosion_titan_missile_01.wss",2.5118864,1,1800};
soundHit2[] = {"A3\Sounds_F\arsenal\weapons\Launchers\Titan\Explosion_titan_missile_02.wss",2.5118864,1,1800};
soundHit3[] = {"A3\Sounds_F\arsenal\weapons\Launchers\Titan\Explosion_titan_missile_03.wss",2.5118864,1,1800};
multiSoundHit[] = {"soundHit1",0.34,"soundHit2",0.33,"soundHit3",0.33};
soundFly[] = {"A3\Sounds_F\arsenal\weapons\Launchers\RPG32\Fly_RPG32",0.31622776,1.5,900};
soundFly[] = {"A3\Sounds_F\arsenal\weapons\Launchers\RPG32\Fly_RPG32.wss",0.31622776,1.5,900};

class CamShakeExplode {
power = "(55*0.2)";
Expand Down Expand Up @@ -74,7 +74,7 @@ class CfgAmmo {

SoundSetExplosion[] = {"RocketsLight_Exp_SoundSet","RocketsLight_Tail_SoundSet","Explosion_Debris_SoundSet"};
};

class SLAMDirectionalMine_Wire_Ammo;
class PBW_DM12_Ammo: SLAMDirectionalMine_Wire_Ammo {
explosionEffects = "ATMineExplosion";
Expand Down
6 changes: 3 additions & 3 deletions addons/mines/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
class Extended_PostInit_EventHandlers {
class pbw_mines {
init = "call compile preprocessFileLineNumbers '\pbw_mines\XEH_postInit.sqf'";
init = "call compileScript ['\pbw_mines\XEH_postInit.sqf']";
};
};

class Extended_DisplayLoad_EventHandlers {
class RscDisplayMission {
pbw_mines = "call compile preprocessFileLineNumbers '\pbw_mines\XEH_missionDisplayLoad.sqf'";
pbw_mines = "call compileScript ['\pbw_mines\XEH_missionDisplayLoad.sqf']";
};
};

Expand All @@ -16,4 +16,4 @@ class Extended_InitPost_EventHandlers {
init = "call pbw_mines_fnc_fixDM12Rotation;";
};
};
};
};
6 changes: 3 additions & 3 deletions addons/mines/CfgMagazines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ class CfgMagazines {
displayNameShort = "$STR_pbw_mines_DM12_NameShort";
descriptionShort = "$STR_pbw_mines_DM12_Desc";
descriptionUse = "$STR_pbw_mines_DM12_Desc";
model = "\pbw_mines\data\pbw_dm12";
model = "\pbw_mines\data\pbw_dm12.p3d";
picture = "\pbw_mines\ui\pbw_dm12_picture_ca.paa";
ammo = "PBW_DM12_Ammo";
initSpeed = 0;
type = "2 * 256";
count = 1;
mass = 80; // real mine is 9.6kg but this is too big for normal backbacks
mass = 80; // real mine is 9.6kg but this is too big for normal backpacks

useAction = 0;
ACE_explosives_Placeable = 1;
ACE_explosives_SetupObject = "PBW_DM12_Static";

class ACE_Triggers {
SupportedTriggers[] = {"FibreOpticCable"};
class FibreOpticCable {
Expand Down
22 changes: 13 additions & 9 deletions addons/mines/CfgVehicles.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
class CBA_Extended_EventHandlers_base;

class CfgVehicles {
class LandVehicle;
class StaticWeapon: LandVehicle {
Expand All @@ -24,7 +22,7 @@ class CfgVehicles {
displayName = "$STR_pbw_mines_DM12_Name";
displayNameShort = "$STR_pbw_mines_DM12_NameShort";
description = "$STR_pbw_mines_DM12_Desc";
model = "\pbw_mines\data\pbw_dm12";
model = "\pbw_mines\data\pbw_dm12.p3d";
picture = "\pbw_mines\ui\pbw_dm12_picture_ca.paa";
editorPreview = "\pbw_mines\editorpreview\pbw_dm12.jpg";
icon = "iconExplosiveAT";
Expand All @@ -39,11 +37,21 @@ class CfgVehicles {
accuracy = 0.12;
cost = 10000;

armor = 400;

// ACE
ace_dragging_canCarry = 1;

ace_dragging_canDrag = 1;
ace_dragging_dragPosition[] = {0, 1, 0};
ace_dragging_dragDirection = 0;

armor = 400;
ace_cargo_canLoad = 0;
ace_cargo_noRename = 1;

class ace_csw {
enabled = 0;
};

class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions {
Expand Down Expand Up @@ -106,10 +114,6 @@ class CfgVehicles {
};
};

class EventHandlers {
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers_base {};
};

class Turrets: Turrets {
class MainTurret: MainTurret {
minTurn = -45;
Expand All @@ -133,7 +137,7 @@ class CfgVehicles {

weapons[] = {};
magazines[] = {};
gunnerOpticsModel = "\A3\weapons_f\reticle\optics_empty";
gunnerOpticsModel = "\A3\weapons_f\reticle\optics_empty.p3d";
gunnerOpticsEffect[] = {"OpticsCHAbera1","OpticsBlur2"};
gunnerOutOpticsShowCursor = 0;
gunnerOpticsShowCursor = 0;
Expand Down
19 changes: 9 additions & 10 deletions addons/mines/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@ if (hasInterface) then {
["ace_unconscious", {
params ["_unit"];

if (player isEqualTo _unit) exitWith {
if (ACE_player isEqualTo _unit) exitWith {
pbw_mines_isPlacingCable = PLACE_CANCEL;
};
}] call CBA_fnc_addEventHandler;
};

["pbw_mines_lockDM12", {
params ["_dm12", "_lock"];

_dm12 lock ([0, 2] select _lock);
if (isServer) then {
["pbw_mines_startSensorCheck", pbw_mines_fnc_startSensorCheck] call CBA_fnc_addEventHandler;
["pbw_mines_detonateDM12", pbw_mines_fnc_detonateDM12] call CBA_fnc_addEventHandler;
["pbw_mines_sensorDetectedVehicles", pbw_mines_fnc_detonateDM12] call CBA_fnc_addEventHandler;
};

[_dm12, !_lock] call ace_dragging_fnc_setCarryable;
[_dm12, !_lock] call ace_dragging_fnc_setDraggable;
["pbw_mines_lock", {
params ["_vehicle", ["_lock", false, [false]]];
_vehicle lock ([0, 2] select _lock);
}] call CBA_fnc_addEventHandler;

["pbw_mines_armDM12Sensor", {_this call pbw_mines_fnc_startSensorCheck}] call CBA_fnc_addEventHandler;
["pbw_mines_sensorDetectedVehicles", {_this call pbw_mines_fnc_detonateDM12}] call CBA_fnc_addEventHandler;
14 changes: 9 additions & 5 deletions addons/mines/functions/fn_armDM12.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@

params ["_dm12"];

if (!(_dm12 getVariable ["pbw_mines_isTriggerSet", false]) || _dm12 getVariable ["pbw_mines_isArmed", false]) exitWith {};
private _endPosATL = _dm12 getVariable ["pbw_mines_fiberOpticCableEndPos", []];
if ((_endPosATL isEqualTo []) || {_dm12 getVariable ["pbw_mines_isArmed", false]}) exitWith {};

_dm12 setVariable ["pbw_mines_isArmed", true, true];

["pbw_mines_lockDM12", [_dm12, true], "pbw_mines_lockDM12"] call CBA_fnc_globalEventJIP;
["pbw_mines_lock", [_dm12, true], _dm12] call CBA_fnc_targetEvent;
[_dm12, false, nil, nil, nil, true] call ace_dragging_fnc_setCarryable;
[_dm12, false, nil, nil, nil, true] call ace_dragging_fnc_setDraggable;

_dm12 animateSource ["hideCap", 1, true];

private _endPosATL = _dm12 getVariable ["pbw_mines_fiberOpticCableEndPos", []];
private _class = _dm12 getVariable ["pbw_mines_magClass", "PBW_DM12"];
private _magClass = _dm12 getVariable ["pbw_mines_magClass", "PBW_DM12"];
["pbw_mines_startSensorCheck", [_dm12, _magClass, _endPosATL]] call CBA_fnc_serverEvent;

["pbw_mines_armDM12Sensor", [_dm12, _class, _endPosATL]] call CBA_fnc_serverEvent;
// Provide hook
["pbw_mines_DM12Armed", [_dm12]] call CBA_fnc_localEvent;
8 changes: 4 additions & 4 deletions addons/mines/functions/fn_canArmDM12.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

params ["_dm12"];

(alive _dm12) &&
{count (crew _dm12) isEqualTo 0} &&
{_dm12 getVariable ["pbw_mines_isTriggerSet", false]} &&
{!(_dm12 getVariable ["pbw_mines_isArmed", false])}
(alive _dm12) &&
{(crew _dm12) isEqualTo []} &&
{(_dm12 getVariable ["pbw_mines_fiberOpticCableEndPos", []]) isNotEqualTo []} &&
{!(_dm12 getVariable ["pbw_mines_isArmed", false])}
4 changes: 2 additions & 2 deletions addons/mines/functions/fn_canDefuseDM12.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@

params ["_dm12"];

(alive _dm12) &&
{_dm12 getVariable ["pbw_mines_isArmed", false]}
(alive _dm12) &&
{_dm12 getVariable ["pbw_mines_isArmed", false]}
6 changes: 3 additions & 3 deletions addons/mines/functions/fn_canPickupDM12.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* [cursorObject] call pbw_mines_fnc_canPickupDM12
*
*/

params ["_dm12"];

(alive _dm12) &&
{count (crew _dm12) isEqualTo 0} &&
{(crew _dm12) isEqualTo []} &&
{!(_dm12 getVariable ["pbw_mines_isArmed", false])} &&
{!(_dm12 getVariable ["pbw_mines_blockSetTrigger", false])}
{!(_dm12 getVariable ["pbw_mines_blockSetTrigger", false])}
2 changes: 1 addition & 1 deletion addons/mines/functions/fn_canPickupFiberOpticCable.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ params ["_dm12"];

(alive _dm12) &&
{!(_dm12 getVariable ["pbw_mines_isArmed", false])} &&
{_dm12 getVariable ["pbw_mines_isTriggerSet", false]}
{(_dm12 getVariable ["pbw_mines_fiberOpticCableEndPos", []]) isNotEqualTo []}
8 changes: 4 additions & 4 deletions addons/mines/functions/fn_canSetTrigger.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* [cursorObject] call pbw_mines_fnc_canSetTrigger
*
*/

params ["_dm12"];

(alive _dm12) &&
(alive _dm12) &&
{!(_dm12 getVariable ["pbw_mines_blockSetTrigger", false])} &&
{!(_dm12 getVariable ["pbw_mines_isTriggerSet", false])} &&
{!(_dm12 getVariable ["pbw_mines_isArmed", false])}
{(_dm12 getVariable ["pbw_mines_fiberOpticCableEndPos", []]) isEqualTo []} &&
{!(_dm12 getVariable ["pbw_mines_isArmed", false])}
11 changes: 8 additions & 3 deletions addons/mines/functions/fn_defuseDM12.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
* [cursorObject] call pbw_mines_fnc_defuseDM12
*
*/

params ["_dm12"];

if !(_dm12 getVariable ["pbw_mines_isArmed", false]) exitWith {};

["pbw_mines_lockDM12", [_dm12, false], "pbw_mines_lockDM12"] call CBA_fnc_globalEventJIP;
["pbw_mines_lock", [_dm12, false], _dm12] call CBA_fnc_targetEvent;
[_dm12, true, nil, nil, nil, true] call ace_dragging_fnc_setCarryable;
[_dm12, true, nil, nil, nil, true] call ace_dragging_fnc_setDraggable;

_dm12 animateSource ["hideCap", 0, true];

_dm12 setVariable ["pbw_mines_isArmed", false, true];
_dm12 setVariable ["pbw_mines_isArmed", false, true];

// Provide hook
["pbw_mines_DM12Defused", [_dm12]] call CBA_fnc_localEvent;
16 changes: 11 additions & 5 deletions addons/mines/functions/fn_detonateDM12.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,30 @@
*
*/

params ["_dm12", "_magClass"];
if (!isServer) exitWith {
["pbw_mines_detonateDM12", _this] call CBA_fnc_serverEvent;
};

params [["_dm12", objNull, [objNull]], ["_magClass", "", [""]]];

if (isNull _dm12 || {_magClass isEqualTo ""}) exitWith {};

private _warheadBeginRelPos = _dm12 selectionPosition ["warhead_begin", "Memory"];
private _warheadBeginPosASL = _dm12 modelToWorldVisualWorld _warheadBeginRelPos;
private _warheadBeginPosWorld = _dm12 modelToWorldWorld _warheadBeginRelPos;

private _dm12Config = configFile >> "CfgMagazines" >> _magClass;
private _rocketStarterClass = getText (_dm12Config >> "ammo");
private _rocketStarter = _rocketStarterClass createVehicle [0, 0, 0];
["ace_common_hideObjectGlobal", [_rocketStarter, true]] call CBA_fnc_serverEvent;
_rocketStarter hideObjectGlobal true;

private _dir0 = getDirVisual _dm12;
private _dir0 = getDir _dm12;
private _dir = _dir0 - deg (_dm12 animationSourcePhase "mainTurret");
private _pitch0 = (_dm12 call BIS_fnc_getPitchBank) select 0;
private _pitch = _pitch0 + deg (_dm12 animationSourcePhase "mainGun");

deleteVehicle _dm12;

_rocketStarter setPosASL _warheadBeginPosASL;
_rocketStarter setPosWorld _warheadBeginPosWorld;
_rocketStarter setDir _dir;
[_rocketStarter, _pitch, 0] call BIS_fnc_setPitchBank;

Expand Down
4 changes: 2 additions & 2 deletions addons/mines/functions/fn_fixDM12Rotation.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ if (!local _dm12) exitWith {};
// Stupid but better than copying the whole placing system
[{(_this select 0) getVariable ["ace_explosives_Direction", -1] isNotEqualTo -1}, {
params ["_dm12"];

private _dir = _dm12 getVariable ["ace_explosives_Direction", 0];
_dm12 setDir _dir;
_dm12 setVariable ["ace_explosives_Direction", _dir, true];
}, _this, 1] call CBA_fnc_waitUntilAndExecute;
}, _this, 1] call CBA_fnc_waitUntilAndExecute;
8 changes: 5 additions & 3 deletions addons/mines/functions/fn_pickupDM12.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ _player playAction "putdown";

[{((animationState (_this select 1)) select [25,7]) isEqualTo "putdown"}, {
params ["_dm12", "_player"];


if (isNull _dm12) exitWith {};

private _magClass = _dm12 getVariable ["pbw_mines_magClass", "PBW_DM12"];
deleteVehicle _dm12;
[_player, "PBW_DM12"] call ace_common_fnc_addToInventory;
[_player, _magClass] call ace_common_fnc_addToInventory;
}, _this] call CBA_fnc_waitUntilAndExecute;

5 changes: 2 additions & 3 deletions addons/mines/functions/fn_pickupFiberOpticCable.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

params ["_dm12"];

if !(_dm12 getVariable ["pbw_mines_isTriggerSet", false]) exitWith {};
if ((_dm12 getVariable ["pbw_mines_fiberOpticCableEndPos", []]) isEqualTo []) exitWith {};

_dm12 setVariable ["pbw_mines_isTriggerSet", false, true];
_dm12 setVariable ["pbw_mines_fiberOpticCableEndPos", nil, true];
_dm12 setVariable ["pbw_mines_magClass", nil, true];
_dm12 setVariable ["pbw_mines_magClass", nil, true];
Loading