Skip to content

Commit

Permalink
workaround for mortars disappearing
Browse files Browse the repository at this point in the history
see acemod/ACE3#10010 for details
  • Loading branch information
b-mayr-1984 committed Jul 7, 2024
1 parent 1f254cd commit 8b06f13
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 2 deletions.
5 changes: 3 additions & 2 deletions description.ext
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

class CfgFunctions {
createShortcuts = 1;
#include "scripts\diary\funcs.hpp" // ingame documentation (as diary entries in the map screen)
#include "scripts\arsr\funcs.hpp" // enable sound directionfinder
#include "scripts\stomper\funcs.hpp" // enable sitting on Stomper UGV
#include "scripts\craters\funcs.hpp" // terrain deformation on artillery impacts
#include "scripts\lgshells\funcs.hpp" // fix for unreliable vanilla laser guided shells
#include "scripts\spot-randomizer\funcs.hpp" // handle randomization of supply containers
#include "scripts\tfar-persistence\funcs.hpp" // restore previous TFAR settings after respawn
#include "scripts\grad-loadout\CfgFunctions.hpp" // Gruppe Adler loadout handling
#include "scripts\shelltracker\funcs.hpp" // display of artillery shells for Zeus and streamers
#include "scripts\grad-loadout\CfgFunctions.hpp" // Gruppe Adler loadout handling
#include "scripts\spot-randomizer\funcs.hpp" // handle randomization of supply containers
};


Expand Down
9 changes: 9 additions & 0 deletions initPlayerLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ fnc_TFAR_Boost_RadioTower_Loop = {
[fnc_TFAR_Boost_RadioTower_Loop, 2] call CBA_fnc_addPerFrameHandler;


// store last unloaded Mk6 mortar
// (as workaround for https://github.com/acemod/ACE3/issues/10010)
["ace_cargoUnloaded", {
params ["_item", "_vehicle", "_unloadType"];
if (_item isKindOf "Mortar_01_base_F") then {
localNamespace setVariable ["shootnscoot_lastUnloadedMortar", _item];
};
}] call CBA_fnc_addEventHandler;


// prevent map markers because this would be too easy
// --> we want to foster teamplay through radio comms instead
Expand Down
8 changes: 8 additions & 0 deletions scripts/diary/funcs.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class diary {
tag = "diary";
class functions {
file = "scripts\diary\functions";
class postInit{postInit = 1;};
class placeMortarOnTerrain{};
};
};
27 changes: 27 additions & 0 deletions scripts/diary/functions/fn_placeMortarOnTerrain.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*/////////////////////////////////////////////////
Author: Bernhard
File: fn_placeMortarOnTerrain.sqf
Parameters:
Return: none
This function is a workaround for a suspected ACE glitch.
During unloading of mortars quite a lot of them disappear.
They are then located below the surface.
Using this function they are being brought back to the surface.
See https://github.com/acemod/ACE3/issues/10010 for more information.
*///////////////////////////////////////////////

private _mortar = localNamespace getVariable "shootnscoot_lastUnloadedMortar";

if (!isNil "_mortar") then {
private _pos = getPosATL _mortar;
diag_log format ["fn_placeMortarOnTerrain.sqf: getPosATL=%1", _pos]; // logging output might help to narrow down the problem
_mortar setPosATL [_pos#0, _pos#1, 0]; // place at same x and y coordinate, but with z coordinate on the surface
} else {
hint parseText "This restore function works on the last mortar that you've unloaded.<br/><t color='#ff0000'>You haven`t unloaded a mortar yet.</t>";
};
13 changes: 13 additions & 0 deletions scripts/diary/functions/fn_postInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if !(hasInterface) exitWith {};

// create root of ingame documentation
player createDiarySubject ["shootnscoot_diarySubject","Shoot and Scoot"];

// create documentation topics for different game aspects

// mortar docu
player createDiaryRecord ["shootnscoot_diarySubject", ["Mortar","During past games quite a few <font color='#00ffff'>Mk6 mortars got lost after unloading them</font> from the vehicle.<br/>
Using the link below you should be able to restore them.<br/>
<executeClose expression='call diary_fnc_placeMortarOnTerrain'>Fix lost mortar</executeClose><br/>
<br/>
In case it doesn't work for you --> ping Zeus"]];

0 comments on commit 8b06f13

Please sign in to comment.