Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuel part2 #2207

Merged
merged 30 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
efa2997
rename spawnLight, added price to item, add callback
killerswin2 Nov 4, 2021
183e8b7
removed dev
killerswin2 Nov 4, 2021
e848631
update header
killerswin2 Nov 4, 2021
52ca8e5
changed spawned veh fuel
killerswin2 Nov 4, 2021
2804061
added nodes
killerswin2 Nov 4, 2021
899071f
final touches, changed hints, and nodes
killerswin2 Nov 4, 2021
9c8a073
changed vehicleFuelSource to array
killerswin2 Nov 5, 2021
9ae54e1
add selling fuel capped to remaining amount
killerswin2 Nov 5, 2021
9a2bcb9
removed fuel canister
killerswin2 Nov 5, 2021
999d8a7
Merge branch 'fuel' into fuelPart2
killerswin2 Nov 5, 2021
80dfb5c
changes for review
killerswin2 Nov 5, 2021
2987028
Merge branch 'unstable' into fuel
killerswin2 Nov 8, 2021
85ababb
Merge branch 'fuel' into fuelPart2
killerswin2 Nov 8, 2021
60cfe10
init work
killerswin2 Nov 22, 2021
bbf17d1
saved fuel
killerswin2 Nov 27, 2021
9ebfd9d
review changes
killerswin2 Dec 5, 2021
000b363
error checking
killerswin2 Dec 5, 2021
153b3e0
review change
killerswin2 Dec 6, 2021
d7cbe08
Merge branch 'fuel' into fuelPart2
killerswin2 Jan 8, 2022
f022940
added correct search
killerswin2 Jan 8, 2022
8f1e278
Merge branch 'unstable' into fuelPart2
killerswin2 Jan 9, 2022
cc3e720
added funnies, fixed readability
killerswin2 Jan 9, 2022
ece67e4
Merge branch 'fuelPart2' of https://github.com/killerswin2/A3-Antista…
killerswin2 Jan 9, 2022
a054a77
removed space
killerswin2 Jan 9, 2022
55ed80e
review changes
killerswin2 Jan 9, 2022
b87d527
updated save loop and loading
killerswin2 Jan 10, 2022
f44a3c0
added fuel types for supported maps
killerswin2 Jan 10, 2022
46f3831
Merge branch 'official-antistasi-community:unstable' into fuelPart2
killerswin2 Jan 10, 2022
7162c99
changes to saves
killerswin2 Jan 10, 2022
5e6874c
Merge branch 'fuelPart2' of https://github.com/killerswin2/A3-Antista…
killerswin2 Jan 10, 2022
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
18 changes: 14 additions & 4 deletions A3-Antistasi/Garage/fn_addVehicle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,21 @@ if (_class in [FactionGet(occ,"surrenderCrate"), FactionGet(inv,"surrenderCrate"
true
};

//Utility refund

//Utility refund and Fuel refund
if (_vehicle getVariable ['A3A_canGarage', false]) exitwith{
[_vehicle getVariable ['A3A_itemPrice', 0]] remoteExec ["A3A_fnc_resourcesPlayer", _client]; // later make this a function call for percentage of fuel remaining
["STR_HR_GRG_Feedback_addVehicle_Item_Stored"] remoteExec ["HR_GRG_fnc_Hint", _client];
deleteVehicle _vehicle;
if (_class in [FactionGet(reb,"vehicleFuelDrum"), FactionGet(reb,"vehicleFuelTank")]) then {
[floor (
[_vehicle] call A3A_fnc_remainingFuel *
(_vehicle getVariable ['A3A_itemPrice', 0])
)] remoteExec ["A3A_fnc_resourcesPlayer", _client];
["STR_HR_GRG_Feedback_addVehicle_Fuel_sold"] remoteExec ["HR_GRG_fnc_Hint", _client];
deleteVehicle _vehicle;
} else {
[_vehicle getVariable ['A3A_itemPrice', 0]] remoteExec ["A3A_fnc_resourcesPlayer", _client];
["STR_HR_GRG_Feedback_addVehicle_Item_Stored"] remoteExec ["HR_GRG_fnc_Hint", _client];
deleteVehicle _vehicle;
};
true
};

Expand Down
4 changes: 4 additions & 0 deletions A3-Antistasi/Stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3791,6 +3791,10 @@
<Original>Item stored</Original>
<English>Item stored</English>
</Key>
<Key ID="STR_HR_GRG_Feedback_addVehicle_Fuel_sold">
<Original>Fuel sold</Original>
<English>Fuel sold</English>
</Key>
<Key ID="STR_HR_GRG_Feedback_addVehicle_Distance">
<Original>You can't garage vehicles that are more than 25m away from you</Original>
<English>You can't garage vehicles that are more than 25m away from you</English>
Expand Down
1 change: 1 addition & 0 deletions A3-Antistasi/functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,5 +743,6 @@ class A3A
class buyItem {};
class attachedObjects {};
class dropObject {};
class remainingFuel {}
};
};
1 change: 1 addition & 0 deletions A3-Antistasi/functions/Save/fn_loadServer.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ if (isServer) then {
["membersX"] call A3A_fnc_getStatVariable;
["vehInGarage"] call A3A_fnc_getStatVariable;
["HR_Garage"] call A3A_fnc_getStatVariable;
["A3A_fuelAmountleftArray"] call A3A_fnc_getStatVariable;
["destroyedBuildings"] call A3A_fnc_getStatVariable;
["idlebases"] call A3A_fnc_getStatVariable;
["idleassets"] call A3A_fnc_getStatVariable;
Expand Down
34 changes: 33 additions & 1 deletion A3-Antistasi/functions/Save/fn_loadStat.sqf
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
Arguments:
0. <String> variable name or identifier for subroutine to run
1. <any> data that will be set
Return Value:
nil

Scope: Server
Environment: unscheduled
Public: yes
Dependencies:

Example:
[_varName,_varValue] call A3A_fnc_loadStat;
*/


//===========================================================================
//ADD VARIABLES TO THIS ARRAY THAT NEED SPECIAL SCRIPTING TO LOAD
/*specialVarLoads =
Expand Down Expand Up @@ -26,7 +43,7 @@ private _specialVarLoads = [
"garrison","tasks","smallCAmrk","membersX","vehInGarage","destroyedBuildings","idlebases",
"idleassets","chopForest","weather","killZones","jna_dataList","controlsSDK","mrkCSAT","nextTick",
"bombRuns","wurzelGarrison","aggressionOccupants", "aggressionInvaders",
"countCA", "attackCountdownInvaders", "testingTimerIsActive", "version", "HR_Garage"
"countCA", "attackCountdownInvaders", "testingTimerIsActive", "version", "HR_Garage","A3A_fuelAmountleftArray"
];

private _varName = _this select 0;
Expand Down Expand Up @@ -334,6 +351,21 @@ if (_varName in _specialVarLoads) then {
};
} forEach _varvalue;
};

if(_varname == 'A3A_fuelAmountleftArray') then {
//[position _x, [_x] call ace_refuel_fnc_getFuel]
A3A_fuelAmountleftArray = _varValue;
for "_i" from 0 to (count A3A_fuelAmountleftArray - 1) do {
private _nearFuelStations = nearestObjects [A3A_fuelAmountleftArray # _i # 0, A3A_fuelStationTypes, 1];
if (count _nearFuelStations == 0) then { continue };
private _fuelStation = _nearFuelStations#0;
if(A3A_hasACE) then {
[_fuelStation, A3A_fuelAmountleftArray # _i # 1] call ace_refuel_fnc_setFuel;
} else {
_fuelStation setFuelCargo (A3A_fuelAmountleftArray # _i # 1);
};
};
};
if(_varname == 'testingTimerIsActive') then
{
if(_varValue) then
Expand Down
14 changes: 14 additions & 0 deletions A3-Antistasi/functions/Save/fn_saveLoop.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,20 @@ _dataX = [];
_controlsX = controlsX select {(sidesX getVariable [_x,sideUnknown] == teamPlayer) and (controlsX find _x < defaultControlIndex)};
["controlsSDK",_controlsX] call A3A_fnc_setStatVariable;

// fuel rework
_fuelAmountleftArray = [];
{
if (A3A_hasACE) then {
private _keyPairsFuel = [position _x, [_x] call ace_refuel_fnc_getFuel];
_fuelAmountleftArray pushback _keyPairsFuel;
} else {
private _keyPairsFuel = [position _x, getFuelCargo _x];
_fuelAmountleftArray pushback _keyPairsFuel;
};

} forEach A3A_fuelStations;
["A3A_fuelAmountleftArray",_fuelAmountleftArray] call A3A_fnc_setStatVariable;

//Saving the state of the testing timer
["testingTimerIsActive", testingTimerIsActive] call A3A_fnc_setStatVariable;

Expand Down
30 changes: 30 additions & 0 deletions A3-Antistasi/functions/UtilityItems/fn_remainingFuel.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Author: [Killerswin2]
find the remaining fuel cargo and returns a precentage
Arguments:
0. <object> Object to find the remaining fuel cargo


Return Value:
<number> percentile remaining fuel 0 -> 1

Scope: Clients
Environment: Unscheduled
Public: yes
Dependencies:

Example:
[_veh] call A3A_fnc_remainingFuel
*/

params [["_vehicle", objNull, [objNull]]];

private _vehCfg = configFile/"CfgVehicles"/typeOf _vehicle;

if(A3A_hasACE) then {
private _vehicleMaxFuel = getNumber (_vehCfg >> "ace_refuel_fuelCargo");
if(_vehicleMaxFuel == 0) exitwith {0};
(_vehicle getVariable ["ace_refuel_currentFuelCargo"] / _vehicleMaxFuel);
} else {
getFuelCargo _vehicle;
};
22 changes: 22 additions & 0 deletions A3-Antistasi/functions/init/fn_initZones.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,26 @@ blackListDest = (markersX - controlsX - ["Synd_HQ"] - citiesX) select {
if (_idx == -1) then {true} else {false};
};



// fuel rework
("fuelStationTypes" call _fnc_mapInfo) params [["_fuelStationTypes", [], [[]]]];
if( "_fuelStationTypes" isEqualTo [] ) then {_fuelStationTypes = ["Land_Fuelstation_Feed_F", "Land_fs_feed_F", "Land_FuelStation_01_pump_F", "Land_FuelStation_01_pump_malevil_F", "Land_FuelStation_03_pump_F", "Land_FuelStation_02_pump_F"]};
A3A_fuelStationTypes = _fuelStationTypes;
A3A_fuelStations = nearestObjects [[worldSize/2, worldSize/2], _fuelStationTypes, worldSize];
A3A_fuelStations apply {
_mrkFinalFuel = createMarker [format ["Ant%1", mapGridPosition _x], position _x];
_mrkFinalFuel setMarkerShape "ICON";
_mrkFinalFuel setMarkerType "loc_Fuelstation";
_mrkFinalFuel setMarkerColor "ColorPink";
_mrkFinalFuel setMarkerText "fuel station";
if(A3A_hasACE) then {
[_x, 10000] call ace_refuel_fnc_setFuel; // only call on fuels that are not blacklisted and first zone init.
};
};



publicVariable "blackListDest";
publicVariable "markersX";
publicVariable "citiesX";
Expand All @@ -302,6 +322,8 @@ publicVariable "seaSpawn";
publicVariable "seaAttackSpawn";
publicVariable "defaultControlIndex";
publicVariable "detectionAreas";
publicvariable "A3A_fuelStations";
publicvariable "A3A_fuelStationTypes";

if (isMultiplayer) then {
[petros, "hint","Zones Init Completed"] remoteExec ["A3A_fnc_commsMP", -2]
Expand Down
5 changes: 5 additions & 0 deletions Map-Templates/Antistasi-Altis.Altis/Map/altisInfo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ switch (_filename) do {
case "climate": {
"arid";
};
case "fuelStationTypes":{
private _fuelStationTypes = ["Land_Fuelstation_Feed_F", "Land_fs_feed_F", "Land_FuelStation_01_pump_F", "Land_FuelStation_01_pump_malevil_F", "Land_FuelStation_03_pump_F", "Land_FuelStation_02_pump_F"];
//_fuelStationTypes
[_fuelStationTypes];
};
default {
Info("Map Info given unknown parameter");
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ switch (_filename) do {
case "climate": {
"arid";
};
case "fuelStationTypes":{
private _fuelStationTypes = ["Land_Fuelstation_Feed_F", "Land_fs_feed_F", "Land_FuelStation_01_pump_F", "Land_FuelStation_01_pump_malevil_F", "Land_FuelStation_03_pump_F", "Land_FuelStation_02_pump_F"];
//_fuelStationTypes
[_fuelStationTypes];
};
default {
Info("Map Info given unknown parameter");
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ switch (_filename) do {
case "climate": {
"tropical";
};
case "fuelStationTypes":{
private _fuelStationTypes = ["Land_vn_fuelstation_01_pump_f", "Land_vn_fuelstation_02_pump_f", "Land_vn_fuelstation_feed_f"];
//_fuelStationTypes
[_fuelStationTypes];
};
default {
Info("Map Info given unknown parameter");
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ switch (_filename) do {
case "climate": {
"temperate";
};
case "fuelStationTypes":{
private _fuelStationTypes = ["Land_A_FuelStation_Feed"];
//_fuelStationTypes
[_fuelStationTypes];
};
default {
Info("Map Info given unknown parameter");
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ switch (_filename) do {
case "climate": {
"arctic";
};
case "fuelStationTypes":{
private _fuelStationTypes = ["Land_A_FuelStation_Feed"];
//_fuelStationTypes
[_fuelStationTypes];
};
default {
Info("Map Info given unknown parameter");
};
Expand Down
4 changes: 4 additions & 0 deletions Map-Templates/Antistasi-Kunduz.Kunduz/Map/kunduzInfo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ switch (_filename) do {
case "climate": {
"arid";
};
case "fuelStationTypes":{
//_fuelStationTypes
[nil];
};
default {
Info("Map Info given unknown parameter");
};
Expand Down
5 changes: 5 additions & 0 deletions Map-Templates/Antistasi-Livonia.Enoch/Map/enochInfo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ switch (_filename) do {
case "climate": {
"temperate";
};
case "fuelStationTypes":{
private _fuelStationTypes = ["Land_Fuelstation_Feed_F", "Land_fs_feed_F", "Land_FuelStation_01_pump_F", "Land_FuelStation_01_pump_malevil_F", "Land_FuelStation_03_pump_F", "Land_FuelStation_02_pump_F"];
//_fuelStationTypes
[_fuelStationTypes];
};
default {
Info("Map Info given unknown parameter");
};
Expand Down
5 changes: 5 additions & 0 deletions Map-Templates/Antistasi-Malden.Malden/Map/maldenInfo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ switch (_filename) do {
case "climate": {
"arid";
};
case "fuelStationTypes":{
private _fuelStationTypes = ["Land_fs_feed_F","Land_FuelStation_01_pump_malevil_F","Land_FuelStation_Feed_F"];
//_fuelStationTypes
[_fuelStationTypes];
};
default {
Info("Map Info given unknown parameter");
};
Expand Down
5 changes: 5 additions & 0 deletions Map-Templates/Antistasi-Sahrani.sara/Map/saraInfo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ switch (_filename) do {
case "climate": {
"arid";
};
case "fuelStationTypes":{
private _fuelStationTypes = ["Land_Fuelstation_army", "Land_Benzina_schnell"];
//_fuelStationTypes
[_fuelStationTypes];
};
default {
Info("Map Info given unknown parameter");
};
Expand Down
5 changes: 5 additions & 0 deletions Map-Templates/Antistasi-Stratis.Stratis/Map/stratisInfo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ switch (_filename) do {
case "climate": {
"";
};
case "fuelStationTypes":{
private _fuelStationTypes = ["Land_FuelStation_Feed_F"];
//_fuelStationTypes
[_fuelStationTypes];
};
default {
Info("Map Info given unknown parameter");
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ switch (_filename) do {
case "climate": {
"arid";
};
case "fuelStationTypes":{
private _fuelStationTypes = ["Land_Ind_FuelStation_Feed_EP1"];
//_fuelStationTypes
[_fuelStationTypes];
};
default {
Info("Map Info given unknown parameter");
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ switch (_filename) do {
case "climate": {
"temperate";
};
case "fuelStationTypes":{
private _fuelStationTypes = ["Land_FuelStation_Feed_F", "Land_fs_feed_F", "Land_FuelStation_01_pump_malevil_F"];
//_fuelStationTypes
[_fuelStationTypes];
};
default {
Info("Map Info given unknown parameter");
};
Expand Down
7 changes: 6 additions & 1 deletion Map-Templates/Antistasi-Virolahti.vt7/Map/vt7Info.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ switch (_filename) do {
case "climate": {
"temperate";
};
case "fuelStationTypes":{
private _fuelStationTypes = ["Land_fs_feed_F", "Land_FuelStation_02_pump_F"];
//_fuelStationTypes
[_fuelStationTypes];
};
default {
Info("Map Info given unknown parameter");
};
};
};
5 changes: 5 additions & 0 deletions Map-Templates/Antistasi-WotP.Tanoa/Map/tanoaInfo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ switch (_filename) do {
case "climate": {
"tropical";
};
case "fuelStationTypes":{
private _fuelStationTypes = ["Land_FuelStation_02_pump_F", "Land_FuelStation_01_pump_F"];
//_fuelStationTypes
[_fuelStationTypes];
};
default {
Info("Map Info given unknown parameter");
};
Expand Down