ACE3 icon indicating copy to clipboard operation
ACE3 copied to clipboard

Refuel - Add enable setting

Open Dystopian opened this issue 4 years ago • 11 comments

When merged this pull request will:

  • Close #7040.

  • add refuel functionality from #7040 (which looks hard to merge): add enable setting and remove the need for compat addons;

  • add support for vehicles without ACE refuel config;

  • add Land_FuelStation_03_pump_F config;

  • fix terrain fuel pumps support (not implemented in #7040);

  • ~restore big explosion and long burn of refuel vehicles~;

  • optimize some code.

  • [x] add terrain pumps locations

  • [x] check if setFuelCargo is persistent for terrain pumps

  • [x] search for workaround for damaged pumps explosion strength

Dystopian avatar Mar 25 '20 20:03 Dystopian

Looks like terrain pumps have local fuel value and they reset it in JIP. I fixed it.

I'm implementing pump locations caching now because _worldCenter nearObjects [_x, _worldSize] is quite long operation on big maps.

Dystopian avatar Apr 08 '20 21:04 Dystopian

_worldSize * sqrt(2) / 2 but I don't think it will help much 😄

I'm still worried about if setFuelCargo will be persistent, from what I understand map objects can be "streamed" in and out of memory and changes to them may be lost

e.g. setVariable may work initially but might be lost if player moves away from the area

PabstMirror avatar Apr 08 '20 21:04 PabstMirror

Added pumps locations. I don't own Contact DLC so who wants please try call compile preprocessFileLineNumbers "z\ace\addons\refuel\dev\exportTerrainRefuelPositions.sqf" in Eden Editor console when Livonia is loaded. Will check if setFuelCargo is persistent. Also will search for workaround for damaged pumps explosion strength.

Dystopian avatar Apr 11 '20 17:04 Dystopian

Now destroyed refuel vehicles burn much longer - like did in vanilla. I didn't find good enough way to catch deadly hit so I implemented it with HandleDamage and alive on next frame. It doesn't handle 100% but it's good enough.

I'm still worried about if setFuelCargo will be persistent, from what I understand map objects can be "streamed" in and out of memory and changes to them may be lost

Just checked if setFuelCargo is persistent in 2 hours MP session on Chernarus 2020. No pumps lost their fuel cargo. I won't be able to check it in longer session. Script returns all pumps count on map (should be the same) and array of desynced pumps (should be empty):

private _a = [];
private _c = 0;
{
    _x params ["_class", "_positions"];
    {
        {
            if (0 != getFuelCargo _x) then {
                _a pushBack ASLToAGL getPosASL _x;
            };
            _c = _c + 1;
        } forEach (_x nearObjects [_class, 30]);
    } forEach _positions;
} forEach getArray (configFile >> "ace_refuel_positions" >> worldName);
[_c, _a]

Dystopian avatar Apr 12 '20 23:04 Dystopian

I don't own Contact DLC so who wants please try call compile preprocessFileLineNumbers "z\ace\addons\refuel\dev\exportTerrainRefuelPositions.sqf" in Eden Editor console when Livonia is loaded.

    Enoch[] = { /*  Livonia  */
        {"Land_FuelStation_Feed_F", {{10208,2173,0}}},
        {"Land_FuelStation_03_pump_F", {{2008,7365,0},{6259,3949,0}}}
    };

bux avatar Apr 21 '20 07:04 bux

I was curious about another way to get map objects using [2708,5788,0] nearestObject 65997 which is some kind of terrain builder ID but doesn't seem to be any better than [2708,5788,0] nearObjects ["Land_FuelStation_Feed_F", 30];

PabstMirror avatar Apr 22 '20 03:04 PabstMirror

I've updated Chernarus 2020 config and added some more maps. And because export algo is not ideal I got WRONG COUNT message for Chernarus 2020 and Rosche and INCREASE DISTANCE for Farabad. In all cases I found close placed positions and replaced them with manual position. Thanks @johnb432 for added sorting :)

Dystopian avatar Mar 27 '24 15:03 Dystopian

restore big explosion and long burn of refuel vehicles;

I was testing this. Self-hosted, with a second PC joining as a client.

When the host shot a gas pump on Altis, it would burn long for both host and client. However, when the client shot a pump, it was a long burn for the host but a short one for the client.

johnb432 avatar Apr 01 '24 09:04 johnb432

shot a gas pump on Altis

I always tested on Stratis and it worked. But it really doesn't work on Altis. I don't have more ideas how to handle this so I decided to remove that PR part. Also I removed it for vehicles because loop logic becomes too messy without terrain pumps. Maybe it would be implemented somehow in another PR but I don't think from me :-(

Dystopian avatar Apr 03 '24 19:04 Dystopian

I don't have more ideas

I tried to setFuelCargo 1 in BuildingChanged Mission Event Handler but it doesn't work even in SP.

Dystopian avatar Apr 05 '24 21:04 Dystopian

I tried to setFuelCargo 1 in BuildingChanged Mission Event Handler but it doesn't work even in SP.

Don't bother with trying to find a solution. If you do, it's best to make another PR at this point imo.

johnb432 avatar Apr 06 '24 19:04 johnb432