Mk6 Mortar ammo handling broken on dedicated
Arma 3 Version: 1.56 (stable - hotfixed)
CBA Version: 2.3.1 (stable)
ACE3 Version: 3.5.0 (stable)
Mods:
@CBA_A3@ace
Description:
- Prepare/Remove round option is not available until you enter mortar gunner (mortar init is called by
playerVehicleChanged) - On first use of mortar vanilla magazines are still loaded
- After first use you can unload vanilla rounds or shoot with them
- After shooting all vanilla rouds or unloading them you cannot load ACE mortar rounds properly (round is loaded but you can't fire)
Steps to reproduce:
- https://www.youtube.com/watch?v=jWMgG_dari0 (recorded on dedicated multiplayer)
Where did the issue occur?
- Dedicated
Placed Modules:
ace_mk6mortar_airResistanceEnabled - false
ace_mk6mortar_allowComputerRangefinder - false
ace_mk6mortar_allowCompass - true
ace_mk6mortar_useAmmoHandling - true
RPT log file:
- rpt log is clear, no errors
It's intentional that the mortar doesn't initialize the ammo handling system before a player enters it. That it didn't initialize is unexpected.
Was the mortar set to empty (no playable unit/AI) in the editor, or did you start manning it?
i started recording 5 sec after mission start. Mortar was set to empty (no AI) in editor. Mission made in Eden.
I've done some experimenting.
This is a problem for any mortar that is owned by the dedicated server. Spawning one via Zeus behaves as expected (enter it, it initializes properly). Spawning one via script on server through debug menu creates a mortar that will not initialize properly.
Before getting in the mortar, _mortar getVariable ["ace_mk6mortar_initialized",false] returns false. Even though it doesn't seem to run properly, getting in the mortar does cause the variable to be set to true which prevents the initialization from running again. The only place I see that setting being changed to true is here, which strongly implies that the ace_mk6mortar_fnc_mortarInit function ran properly, but the mortar still has its original magazines and weapon. Also, the interaction point to remove the round (which is the default 8Rnd Magazine) becomes available, allowing you to manually remove all the magazines in the mortar.
Now, this is where it gets a little bit weird for me. With the debug console, using cursortarget call ace_mk6mortar_fnc_mortarInit works every time when pointed at a mortar, irrelevant of locality.
Using setOwner to make the mortar local to my machine and not the dedicated server allows the "playerVehicleChanged" eventHandler to run properly.
This is all somehow locality based, combined with the usage of the "playerVehicleChanged" eventHandler. How is baffling me though.
Anyway, I hope this information is the slightest bit helpful.
Easy.The BI commands are shit. The real question is how to work around this.
The real question is how to work around this.
Maybe target event that will exec mortarInit on machine that own mortar?
Locality stuff gives me a headache, frankly.
Would it be better, at this point, to give in and just make an ACE_ version of the mortar? I'm not really in favour of if, since it defeats the point of letting it be selected at will via the module.
:+1: for own mortar. ACE2 had their own anyway.
I think own mortar is ok when port of ACE2 arty system by @NouberNou will be ready. If i remember right there will be added ace howitzer and ace mortar. In my opinion current approach to vanilla mortar is ok, we just have to solve this locality issue.
My hypothesis is that magazines _mortar may not be working properly on remote units, specially if the mortar was never fired. I did have similar problems with currentMagazinein the past.
If that's the case, one easy fix would be to always execute fnc_mortarInit on the machine in which the mortar is local via an objectEvent.
Maybe we can try that for 3.5.1 and see if the problem goes away. I agree that the end game should be to have our own proper mortars, but it would be great to fix our current implementation in the meantime.
@OriginalHoozin, could you take a look at #3583 and see if it fixes the issue?
I won't be able to test for another 12 hours or so, but just looking at the PR, I think the eventHandler will need to exist on a dedicated server and it won't from that PR. I think it needs to be moved above the if !hasInterface exitWith {}; check.
(It's early, so I could be missing something obvious.)
I think I found it. https://github.com/SzwedzikPL/ACE3/blob/master/addons/mk6mortar/functions/fnc_mortarInit.sqf#L41
if (_newWeapon != "") then {
_mortar removeWeaponGlobal _currentWeapon;
_mortar addWeaponGlobal _newWeapon;
};
While removeWeaponGlobal is a command that works regardless of locality, addWeaponGlobal isjust broken. See the note:
https://community.bistudio.com/wiki/addWeaponGlobal
The solution is to execute addWeapon on the machine where the mortar is local.
@commy2, this you see #3584?
That could work, but also note that I have another bug in BW with these turret commands. I suspect that either removeMagazineTurret is broken, or that turretLocal is always false on the dedicated server. No idea if this impacts this. Just note that these turret commands have to be executed where the turret is local, not the vehicle.
Just note that these turret commands have to be executed where the turret is local, not the vehicle.
Yeah, that's what @SzwedzikPL did. His PR was tested on dedicated server, and it works, so I think we are good for 3.5.1.
Fixed by #3584