Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 0 additions & 130 deletions addons/refuel/ACE_Refuel_Positions.hpp

This file was deleted.

2 changes: 2 additions & 0 deletions addons/refuel/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ PREP(dropNozzle);
PREP(getCapacity);
PREP(getFuel);
PREP(getFuelCargo);
PREP(handleDamage);
PREP(handleDisconnect);
PREP(handleRespawn);
PREP(initObject);
PREP(initSource);
PREP(makeJerryCan);
PREP(makeSource);
Expand Down
62 changes: 14 additions & 48 deletions addons/refuel/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -62,66 +62,34 @@ if (hasInterface) then {

["All", "InitPost", {
params ["_vehicle"];
if (getFuelCargo _vehicle <= 0) exitWith {};
TRACE_1("initPost",_vehicle);

if (local _vehicle) then {
_vehicle setFuelCargo 0;
LOG("initPost setFuelCargo");
};
if !(typeOf _vehicle in (uiNamespace getVariable QGVAR(cacheRefuelCargo))) exitWith {};
TRACE_3("initPost",_vehicle,local _vehicle,getFuelCargo _vehicle);
_vehicle call FUNC(initObject);
}, true, ["Man"], true] call CBA_fnc_addClassEventHandler;

if (isServer) then {
addMissionEventHandler ["HandleDisconnect", {call FUNC(handleDisconnect)}];
};

private _cfgPositions = configFile >> QGVAR(positions) >> worldName;
if (isArray _cfgPositions) then {
{
_x params ["_class", "_positions"];
{
private _objects = _x nearObjects [_class, 30];
if (_objects isEqualTo []) then {
WARNING_3("no pumps %1 found near %2 %3",_class,worldName,_x);
} else {
{
// terrain fuel pumps don't trigger init and must setFuelCargo on each client
_x setFuelCargo 0;
} forEach _objects;
};
} forEach _positions;
} forEach getArray _cfgPositions;

// placed in editor static objects don't trigger init but synchronize fuel cargo
// placed in editor vehicles both trigger init and synchronize fuel cargo
{
if (getFuelCargo _x > 0 && {local _x}) then {
TRACE_1("allMissionObjects",_x);
_x setFuelCargo 0;
};
} forEach allMissionObjects "";
} else {
// here are both terrain and editor static objects
WARNING_2("World %1: %2 is not configured; can load slower",worldName,QGVAR(positions));
private _halfWorldSize = worldSize / 2;
private _worldCenter = [_halfWorldSize, _halfWorldSize];
_halfWorldSize = _halfWorldSize * sqrt 2;
private _baseStaticClasses = keys (uiNamespace getVariable QGVAR(cacheRefuelClassesBaseStatic));

private _staticClasses = keys (uiNamespace getVariable QGVAR(cacheRefuelClassesStatic));
private _staticFound = [];
{
// terrain and editor pumps
private _objects = _x allObjects 0;
if (_objects isEqualTo []) then {continue};
_staticFound pushBack [_x, count _objects];
{
{
_x setFuelCargo 0;
} forEach (_worldCenter nearObjects [_x, _halfWorldSize]);
} forEach _baseStaticClasses;
};
_x call FUNC(initObject);
} forEach _objects;
} forEach _staticClasses;
TRACE_1("init terrain",_staticFound);

if (!hasInterface) exitWith {};

["isNotRefueling", {!((_this select 0) getVariable [QGVAR(isRefueling), false])}] call EFUNC(common,addCanInteractWithCondition);

["MouseButtonDown", LINKFUNC(onMouseButtonDown)] call CBA_fnc_addDisplayHandler;

private _staticClasses = keys (uiNamespace getVariable QGVAR(cacheRefuelClassesStatic));
private _baseDynamicClasses = keys (uiNamespace getVariable QGVAR(cacheRefuelClassesBaseDynamic));

// init menu for config refuel vehicles
Expand All @@ -131,7 +99,6 @@ if (hasInterface) then {
{
[_className, 0, ["ACE_MainActions", QGVAR(Refuel)], _x] call EFUNC(interact_menu,addActionToClass);
} forEach GVAR(actions);
TRACE_1("add menu to static",_className);
} forEach _staticClasses;

{
Expand All @@ -140,7 +107,6 @@ if (hasInterface) then {
{
[_className, 0, ["ACE_MainActions", QGVAR(Refuel)], _x, true] call EFUNC(interact_menu,addActionToClass);
} forEach GVAR(actions);
TRACE_1("add menu to dynamic",_className);
} forEach _baseDynamicClasses;

#ifdef DRAW_HOOKS_POS
Expand Down
8 changes: 2 additions & 6 deletions addons/refuel/XEH_preStart.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

// cache refuel vehicles, see XEH_postInit.sqf
private _staticClasses = [];
private _baseStaticClasses = [];
private _baseDynamicClasses = [];
private _cacheRefuelCargo = createHashMap;

Expand All @@ -25,13 +24,12 @@ private _cacheRefuelCargo = createHashMap;
WARNING_3("Class %1: %2 [%3] needs XEH",_sourceClass,configName inheritsFrom _x,configSourceMod _x);
};
_staticClasses pushBack _sourceClass;
if (_baseStaticClasses findIf {_sourceClass isKindOf _x} == -1) then {
_baseStaticClasses pushBack _sourceClass;
};
TRACE_3("static",_sourceClass,_transportFuel,_fuelCargo);
};
} else {
if (_baseDynamicClasses findIf {_sourceClass isKindOf _x} == -1) then {
_baseDynamicClasses pushBack _sourceClass;
TRACE_3("dynamic",_sourceClass,_transportFuel,_fuelCargo);
};
};
if (_isPublic) then {
Expand All @@ -40,8 +38,6 @@ private _cacheRefuelCargo = createHashMap;
};
} forEach ("true" configClasses (configFile >> "CfgVehicles"));

TRACE_3("found",count _staticClasses,count _baseStaticClasses,count _baseDynamicClasses);
uiNamespace setVariable [QGVAR(cacheRefuelClassesStatic), compileFinal (_staticClasses createHashMapFromArray [])];
uiNamespace setVariable [QGVAR(cacheRefuelClassesBaseStatic), compileFinal (_baseStaticClasses createHashMapFromArray [])];
uiNamespace setVariable [QGVAR(cacheRefuelClassesBaseDynamic), compileFinal (_baseDynamicClasses createHashMapFromArray [])];
uiNamespace setVariable [QGVAR(cacheRefuelCargo), compileFinal _cacheRefuelCargo];
1 change: 0 additions & 1 deletion addons/refuel/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class CfgPatches {
};
};

#include "ACE_Refuel_Positions.hpp"
#include "ACE_Settings.hpp"
#include "Cfg3DEN.hpp"
#include "CfgEventHandlers.hpp"
Expand Down
Loading