Vdauphin / HeartsAndMinds

:heart::brain: 1.24.4 is out! 🎉
http://vdauphin.github.io/HeartsAndMinds/
111 stars 66 forks source link

Possibly Autosave after all players disconnect not working on dedicated server, sorta #1651

Closed deBearN closed 2 months ago

deBearN commented 2 months ago

Arma 3 Version: 2.16.152172 (stable) CBA Version: 3.171 (stable) ACE3 Version: 3.17.1 (stable) Hearts and minds Version: 1.24.2 (stable)

Mods:

- CBA_A3
- ace

Description:

Steps to reproduce:

Add mission file: Mission.zip RPT log file: Logs.zip

Vdauphin commented 2 months ago

Hello,

Thanks for the report Base on your rpt, it looks like you didn't enable the feature or this is return false: https://github.com/Vdauphin/HeartsAndMinds/blob/master/%3DBTC%3Dco%4030_Hearts_and_Minds.Altis/core/fnc/eh/server.sqf#L82

To exclude those hypotheses please change those line https://github.com/Vdauphin/HeartsAndMinds/blob/master/%3DBTC%3Dco%4030_Hearts_and_Minds.Altis/core/fnc/eh/server.sqf#L80-L86 to:

[format ["Auto save enabled? %1", btc_p_auto_db], __FILE__, [false, btc_debug_log, false]] call btc_debug_fnc_message;
if (btc_p_auto_db) then {
    addMissionEventHandler ["HandleDisconnect", {
        [format ["HandleDisconnect triggered, remaining connected players: %1", allPlayers - entities "HeadlessClient_F"], __FILE__, [false, btc_debug_log, false]] call btc_debug_fnc_message;
        if ((allPlayers - entities "HeadlessClient_F") isEqualTo []) then {
            [format ["Saving in progress, who triggered the save %1", _this], __FILE__, [false, btc_debug_log, false]] call btc_debug_fnc_message;
            [] call btc_db_fnc_save;
        };
    }];
};

The dev server (https://github.com/Vdauphin/HeartsAndMinds/discussions/1098) is using this feature without issue, you can give it a try yourself

Also why not using parameters:

Cheers

deBearN commented 2 months ago

11:27:19 (0:02:10) fnc\slot\serializeState - Bear 11:27:19 (0:02:10) fnc\slot\serializeState - [[8307.4,10088.5,75.7807],138.8,[[["arifle_MSBS65_GL_sand_F","","acc_flashlight","op 11:27:19 tic_Holosight_blk_F",["30Rnd_65x39_caseless_msbs_mag",30],[],""],[],["hgun_P07_khk_F","","","",["16Rnd_9x21_Mag",17],[], 11:27:19 ""],["U_C_IDAP_Man_TeeShorts_F",[["ACE_fieldDressing",1],["ACE_packingBandage",1],["ACE_morphine",1],["ACE_tourniquet",1 11:27:19 ]]],["V_PlateCarrier1_wdl",[["16Rnd_9x21_Mag",2,17],["HandGrenade",2,1],["SmokeShell",1,1],["SmokeShellGreen",1,1],["Che 11:27:19 mlight_green",2,1]]],["B_CombinationUnitRespirator_01_F",[]],"H_Booniehat_tan","G_AirPurifyingRespirator_01_nofilter_F", 11:27:19 [],["ItemMap","","ItemRadio","ItemCompass","ItemWatch","NVGoggles_INDEP"]],[["ace_arsenal_insignia","ACE_insignia_logo"] 11:27:19 ]],"",false,"{""ace_medical_openwounds"": {}, ""ace_medical_bloodpressure"": [80, 119], ""ace_medical_ivbags"": null, "" 11:27:19 ace_medical_inpain"": false, ""ace_medical_medications"": [], ""ace_medical_tourniquets"": [0, 0, 0, 0, 0, 0], ""ace_med 11:27:19 ical_heartrate"": 79.6623, ""ace_medical_pain"": 0, ""ace_medical_bloodvolume"": 6, ""ace_medical_stitchedwounds"": {}, 11:27:19 ""ace_medical_fractures"": [0, 0, 0, 0, 0, 0], ""ace_medical_triagelevel"": 0, ""ace_medical_bodypartdamage"": [0, 0, 0, 11:27:19 0, 0, 0], ""ace_medical_hemorrhage"": 0, ""ace_medical_occludedmedications"": null, ""ace_medical_triagecard"": [], ""a 11:27:19 ce_medical_bandagedwounds"": {}, ""ace_medical_peripheralresistance"": 100, ""ace_medical_painsuppress"": 0, ""ace_medic 11:27:19 al_statemachinestate"": ""Default""}",B Alpha 3-5:1,[0,0]] 11:27:19 (0:02:10) fnc\eh\server - HandleDisconnect triggered, remaining connected players: [B Alpha 3-5:1]

How is this even possible? i'm gonna put the other 2 logs i did here and soon a video of me doing all that

deBearN commented 2 months ago

NewLogs.zip

https://www.youtube.com/watch?v=YcN-Qzvl8Bg

deBearN commented 2 months ago

I managed to trigger the save by closing the game via task manager, which sent "me" (the player in the server) into losing connection, when re-opening the game and trying to join it gave me connection failed which kicked the "player" of me in there losing connection and it saved, perhaps it's a delay between the player leaving and the script?

Vdauphin commented 2 months ago

Thank you for the detailed report, I think A3 do not clean the allPlayers variable fast enough for the mission so the H&M still think the player is connected

Would you like to test the above linked fix?

deBearN commented 2 months ago

testing right now

deBearN commented 2 months ago

It seems to have worked in the default Altis mission, great, gonna test this in my modded mission

deBearN commented 2 months ago

It did indeed work thank you

Vdauphin commented 2 months ago

Thanks for the test Let's keep it open until the PR is merged!