Refuel - Add enable setting
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_Fconfig; -
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
setFuelCargois persistent for terrain pumps -
[x] search for workaround for damaged pumps explosion strength
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.
_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
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.
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
setFuelCargowill 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]
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}}}
};
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];
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 :)
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.
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 :-(
I don't have more ideas
I tried to setFuelCargo 1 in BuildingChanged Mission Event Handler but it doesn't work even in SP.
I tried to
setFuelCargo 1inBuildingChangedMission 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.