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

Add updates from community + Fix map reveal exploit #209

Merged
merged 6 commits into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 9 additions & 2 deletions A3A/addons/core/Params.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class Params
class limitedFT
{
title = $STR_params_allowFT;
values[] = {0,1};
texts[] = {$STR_params_allowFT_0, $STR_params_allowFT_1};
values[] = {0,1,2};
texts[] = {$STR_params_allowFT_0, $STR_params_allowFT_1,$STR_params_civ_traffic_none};
default = 0;
};
class civTraffic
Expand All @@ -49,6 +49,13 @@ class Params
texts[] = {$STR_params_civ_traffic_none,$STR_params_civ_traffic_low,$STR_params_civ_traffic_medium,$STR_params_civ_traffic_high};
default = 2;
};
class A3A_removeRestore
{
title = $STR_A3A_Params_removeRestore_title;
values[] = {0,1};
texts[] = {$STR_antistasi_dialogs_generic_button_no_text,$STR_antistasi_dialogs_generic_button_yes_text};
default = 0;
};
class globalCivilianMax
{
title = $STR_params_global_civilian_max;
Expand Down
3 changes: 3 additions & 0 deletions A3A/addons/core/Stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5618,6 +5618,9 @@
</Key>
</Container>
<Container name="A3A_selfRevive">
<Key ID="STR_A3A_Params_removeRestore_title">
<Original>Disable the "Restore nearby units" option on the vehicle box.</Original>
</Key>
<Key ID="STR_A3A_Params_selfReviveMethods_title">
<Original>Self-revive methods enabled</Original>
<Russian>Способы самовозрождения активированны</Russian>
Expand Down
13 changes: 10 additions & 3 deletions A3A/addons/core/functions/Ammunition/fn_arsenalManage.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ private _count = objNull;

private _allExceptNVs = _weapons + _explosives + _backpacks + _items + _optics + _helmets + _vests + _magazine;

private _categoriesToPublish = createHashMap;

[] call SCRT_fnc_common_fixCupRhsLaunchers;

{
Expand All @@ -64,7 +66,8 @@ private _allExceptNVs = _weapons + _explosives + _backpacks + _items + _optics +

if (_item in A3U_forbiddenItems && {getNumber (configFile >> "A3U" >> "forbiddenItems" >> _item >> "unlimited") isEqualTo 0}) exitWith {};

_item call A3A_fnc_unlockEquipment;
[_item, true] call A3A_fnc_unlockEquipment;
_categoriesToPublish insert [true, _categories, []];

private _name = switch (true) do {
case ("Magazines" in _categories): {getText (configFile >> "CfgMagazines" >> _item >> "displayName")};
Expand All @@ -81,7 +84,8 @@ private _allExceptNVs = _weapons + _explosives + _backpacks + _items + _optics +
if (!isNil "_weaponMagazine") then {
if (not(_weaponMagazine in unlockedMagazines)) then {
_updated = format ["%1%2<br/>",_updated,getText (configFile >> "CfgMagazines" >> _weaponMagazine >> "displayName")];
[_weaponMagazine] call A3A_fnc_unlockEquipment;
private _categories = [_weaponMagazine, true] call A3A_fnc_unlockEquipment;
_categoriesToPublish insert [true, _categories, []];
};
};
};
Expand Down Expand Up @@ -109,10 +113,13 @@ _sortedNVs sort true; // sort by count, ascending

while {_totalNV >= minWeaps} do {
private _nvToUnlock = (_sortedNVs deleteAt (count _sortedNVs - 1)) select 1;
[_nvToUnlock] call A3A_fnc_unlockEquipment;
private _categories = [_nvToUnlock, true] call A3A_fnc_unlockEquipment;
_categoriesToPublish insert [true, _categories, []];
_updated = format ["%1%2<br/>",_updated,getText (configFile >> "CfgWeapons" >> _nvToUnlock >> "displayName")];
_totalNV =_totalNV - minWeaps; // arguably wrong but doesn't matter in practice
};

// Publish the unlocked categories (once each)
{ publicVariable ("unlocked" + _x) } forEach keys _categoriesToPublish;

_updated
13 changes: 7 additions & 6 deletions A3A/addons/core/functions/Ammunition/fn_unlockEquipment.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
Params:
_className - Class of the equipment to unlock.

_noPublish - If true, don't broadcast the unlockedXXX arrays. For internal use.
_dontAddToArsenal - Avoid adding the item to the arsenal, and simply updates the appropriate variables. DO NOT USE UNLESS YOU HAVE A *VERY* GOOD REASON. Primarily used in save/loads.

Returns:
None
Array of categories for item
**/
#include "..\..\script_component.hpp"
FIX_LINE_NUMBERS()
params ["_className", ["_dontAddToArsenal", false]];
params ["_className", ["_noPublish", false], ["_dontAddToArsenal", false]];

private _categories = _className call A3A_fnc_equipmentClassToCategories;

Expand All @@ -26,8 +27,8 @@ if (!_dontAddToArsenal) then {
};

{
private _categoryName = _x;
//Consider making this pushBackUnique.
(missionNamespace getVariable ("unlocked" + _categoryName)) pushBack _className;
publicVariable ("unlocked" + _categoryName);
(missionNamespace getVariable ("unlocked" + _x)) pushBackUnique _className;
if (!_noPublish) then { publicVariable ("unlocked" + _x) };
} forEach _categories;

_categories;
13 changes: 8 additions & 5 deletions A3A/addons/core/functions/Base/fn_distance.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,14 @@ do
_teamplayer append (allUnitsUAV select { side group _x == teamPlayer });

// Players array is used to spawn civilians in cities and rebel garrisons, so ignore remote controlled and airborne units
_players = (allPlayers - entities "HeadlessClient_F") select {
private _veh = vehicle _x;
_x getVariable ["owner",objNull] == _x and _x == effectiveCommander _veh
and (_veh == _x or {!(_veh isKindOf "Air" and speed _veh > 50)})
};
// Players array is used to spawn civilians in cities and rebel garrisons, so ignore airborne units and translate remote-control
_players = [];
{
private _rp = _x getVariable ["owner", _x]; // real player unit in remote-control case
private _veh = vehicle _rp;
if (_rp != effectiveCommander _veh) then { continue };
if (_veh == _rp or {!(_veh isKindOf "Air" and speed _veh > 50)}) then { _players pushBack _rp };
} forEach (allPlayers - entities "HeadlessClient_F");
};

{
Expand Down
7 changes: 7 additions & 0 deletions A3A/addons/core/functions/Base/fn_garbageCleaner.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ A3A_buildingsToSave = A3A_buildingsToSave select {
deleteVehicle _x; false;
};

Debug("Moving dead solders out of vehicles...")
{
if !(isNull objectParent _x) then { moveOut _x };
} forEach allDeadMen;
Debug("Finished moving soldiers out of vehicles; executing garbage clean.")
sleep 0.5;

{ deleteVehicle _x } forEach allDead;
{ deleteVehicle _x } forEach (allMissionObjects "WeaponHolder");
{ deleteVehicle _x } forEach (allMissionObjects "WeaponHolderSimulated");
Expand Down
14 changes: 10 additions & 4 deletions A3A/addons/core/functions/Dialogs/fn_fastTravelRadio.sqf
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
private _markersX = markersX + [respawnTeamPlayer];

// private _titleStr = localize "STR_A3A_fn_dialogs_ftradio_title";
private _titleStr = "Fast Travel";
if (limitedFT == 2) exitWith {[_titleStr, "Fast travel is disabled for this server."] call A3A_fnc_customHint}; // [_titleStr, localize "STR_A3A_fn_dialogs_ftradio_no_param"]
// This needs a proper stringtable ^

if (!isNil "traderMarker") then {
_markersX pushBack traderMarker;
};
Expand All @@ -21,7 +26,7 @@ if (count hcSelected player == 1) then {
_groupX = group player;
};
private _checkForPlayer = false;
if (!_esHC and {limitedFT}) then {_checkForPlayer = true};
if (!_esHC and {(limitedFT == 1)}) then {_checkForPlayer = true};
private _boss = leader _groupX;

if (_boss != player and {!_esHC}) then {_groupX = player};
Expand Down Expand Up @@ -136,7 +141,7 @@ if (_positionTel distance getMarkerPos _base < 50) then {
};
};
private _exit = false;
if (limitedFT) then {
if (limitedFT == 1) then {
_vehicles = [];
{if (vehicle _x != _x) then {_vehicles pushBackUnique (vehicle _x)}} forEach units _groupX;
{if ((vehicle _x) in _vehicles) exitWith {_checkForPlayer = true}} forEach (call A3A_fnc_playableUnits);
Expand All @@ -147,11 +152,12 @@ if (_positionTel distance getMarkerPos _base < 50) then {
};

private _movedUnits = units _groupX;

private _ftUnits = [];
{
private _unit = _x;
if (!isPlayer _unit or {_unit == player}) then {
_unit allowDamage false;
_ftUnits pushBack _unit;
if (_unit != vehicle _unit) then {
if (driver vehicle _unit == _unit) then {
sleep 3;
Expand Down Expand Up @@ -196,7 +202,7 @@ if (_positionTel distance getMarkerPos _base < 50) then {
};

sleep 5;
{_x allowDamage true} forEach _movedUnits;
{_x allowDamage true} forEach _ftUnits;
} else {
[localize "STR_A3A_Dialogs_fast_travel_header", localize "STR_A3A_Dialogs_fast_travel_missclick"] call SCRT_fnc_misc_deniedHint;
};
Expand Down
13 changes: 8 additions & 5 deletions A3A/addons/core/functions/Save/fn_loadServer.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,24 @@ if (isServer) then {
//===========================================================================

//RESTORE THE STATE OF THE 'UNLOCKED' VARIABLES USING JNA_DATALIST
private _categoriesToPublish = createHashMap;
{
private _arsenalTabDataArray = _x;
private _unlockedItemsInTab = _arsenalTabDataArray select { _x select 1 == -1 } apply { _x select 0 };
{
[_x, true] call A3A_fnc_unlockEquipment;
private _categories = [_x, true, true] call A3A_fnc_unlockEquipment;
_categoriesToPublish insert [true, _categories, []];
} forEach _unlockedItemsInTab;
} forEach jna_dataList;

Info_1("Categories to publish: %1", keys _categoriesToPublish);

// Publish the unlocked categories (once each)
{ publicVariable ("unlocked" + _x) } forEach keys _categoriesToPublish;

//Check if we have radios unlocked and update haveRadio.
call A3A_fnc_checkRadiosUnlocked;

//Sort optics list so that snipers pick the right sight
// obsolete since rebelGear
//unlockedOptics = [unlockedOptics,[],{getNumber (configfile >> "CfgWeapons" >> _x >> "ItemInfo" >> "mass")},"DESCEND"] call BIS_fnc_sortBy;

// Set enemy roadblock allegiance to match nearest main marker
private _mainMarkers = markersX - controlsX - watchpostsFIA - roadblocksFIA - aapostsFIA - atpostsFIA - hmgpostsFIA;
{
Expand Down
8 changes: 7 additions & 1 deletion A3A/addons/core/functions/init/fn_cityinfo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,13 @@ while {visibleMap} do {
if (_siteX in hmgpostsFIA) then {
_textX = format [localize "STR_A3A_cityinfo_hmgempl",[_siteX] call A3A_fnc_garrisonInfo,_nameFaction];
};
[localize "STR_A3A_cityinfo_header", _textX] call A3A_fnc_customHint;
if (hideEnemyMarkers) then {
if (_siteX in markersImmune || {(sidesX getVariable [_siteX,sideUnknown]) == teamPlayer}) then {
[localize "STR_A3A_cityinfo_header", _textX] call A3A_fnc_customHint;
};
} else {
[localize "STR_A3A_cityinfo_header", _textX] call A3A_fnc_customHint;
};
};
positionTel = [];
};
Expand Down
2 changes: 1 addition & 1 deletion A3A/addons/core/functions/init/fn_initClient.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ _flagLight lightAttachObject [flagX, [0, 0, 4]];
_flagLight setLightAttenuation [7, 0, 0.5, 0.5];

vehicleBox allowDamage false;
vehicleBox addAction [format ["<img image='\A3\ui_f\data\igui\cfg\simpleTasks\types\use_ca.paa' size='1.6' shadow=2 /> <t>%1</t>", localize "STR_A3A_actions_restore_units"], A3A_fnc_vehicleBoxRestore,nil,0,false,true,"","(isPlayer _this) and (_this == _this getVariable ['owner',objNull]) and (side (group _this) == teamPlayer)", 4];
vehicleBox addAction [format ["<img image='\A3\ui_f\data\igui\cfg\simpleTasks\types\use_ca.paa' size='1.6' shadow=2 /> <t>%1</t>", localize "STR_A3A_actions_restore_units"], A3A_fnc_vehicleBoxRestore,nil,0,false,true,"","(isPlayer _this) and (_this == _this getVariable ['owner',objNull]) and (side (group _this) == teamPlayer) and !A3A_removeRestore", 4];
[vehicleBox] call HR_GRG_fnc_initGarage;
if (A3A_hasACE) then { [vehicleBox, VehicleBox] call ace_common_fnc_claim;}; //Disables ALL Ace Interactions
vehicleBox addAction [format ["<img image='a3\ui_f\data\igui\cfg\simpletasks\types\truck_ca.paa' size='1.6' shadow=2 /> <t>%1</t>", localize "STR_antistasi_actions_buy_vehicle"], {
Expand Down
19 changes: 15 additions & 4 deletions A3A/addons/core/functions/init/fn_initServer.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,24 @@ else
call A3A_fnc_initGarrisons;

// Do initial arsenal filling
private _categoriesToPublish = createHashMap;
private _addedClasses = createHashMap; // dupe proofing
{
if (_x isEqualType "") then { _x call A3A_fnc_unlockEquipment; continue };
_x params ["_class", "_count"];
private _arsenalTab = _class call jn_fnc_arsenal_itemType;
[_arsenalTab, _class, _count] call jn_fnc_arsenal_addItem;
_x params ["_class", ["_count", -1]];
if (_class in _addedClasses) then { continue };
_addedClasses set [_class, nil];

private _arsenalTab = _class call jn_fnc_arsenal_itemType;
jna_dataList#_arsenalTab pushBack [_class, _count]; // direct add to avoid O(N^2) issue

private _categories = _class call A3A_fnc_equipmentClassToCategories;
{ (missionNamespace getVariable ("unlocked" + _x)) pushBack _class } forEach _categories;
_categoriesToPublish insert [true, _categories, []];
} foreach FactionGet(reb,"initialRebelEquipment");

// Publish the unlocked categories (once each)
{ publicVariable ("unlocked" + _x) } forEach keys _categoriesToPublish;

Info("Initial arsenal unlocks completed");
call A3A_fnc_checkRadiosUnlocked;

Expand Down
2 changes: 1 addition & 1 deletion A3A/addons/core/functions/init/fn_initZones.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private _disabledTowns = getArray (_mapInfo/"disabledTowns");
{server setVariable [_x select 0,_x select 1]} forEach _townPopulations;
private _hardCodedPopulation = _townPopulations isNotEqualTo [];

private _cityConfigs = "(getText (_x >> ""type"") in [""NameCityCapital"",""Namecitycapital"", ""NameCity"",""Namecity"", ""NameVillage"",""Namevillage"", ""CityCenter"",""Citycenter""]) &&
private _cityConfigs = "(toLower getText (_x >> ""type"") in [""namecitycapital"",""namecity"",""namevillage"",""citycenter""]) &&
!(getText (_x >> ""Name"") isEqualTo """") && !((configName _x) in _disabledTowns)"
configClasses (configfile >> "CfgWorlds" >> worldName >> "Names");
if (toLowerANSI worldName isEqualTo "blud_vidda") then {
Expand Down
2 changes: 1 addition & 1 deletion A3A/addons/jeroen_arsenal/JNA/fn_arsenal_handleAction.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ _attachmentsContainers = [[],[],[]];
if!(isNil "_weaponAtt")then{

{
_atts = [_x select 1,_x select 2,_x select 3,_x select 5];
_atts = [_x select 1,_x select 2,_x select 3,_x select 6];
_atts = _atts - [""];
_attachments = _attachments + _atts;
} forEach _weaponAtt;
Expand Down
3 changes: 3 additions & 0 deletions A3A/addons/maps/MissionDescription/gameSettings.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
respawn = "BASE";
respawnDelay = 15;

// Player corpses preserved for 15min minimum
corpseRemovalMinTime = 900;

aiKills = 0;
disabledAI = 1;
Saving = 0;
Expand Down
2 changes: 1 addition & 1 deletion A3A/addons/scrt/Support/fn_support_lootHeli.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private _heli = _heliData select 0;
private _heliCrew = _heliData select 1;
private _groupHeli = _heliData select 2;

if (_heliType isEqualTo [] || {(_heliType canSlingLoad (A3A_faction_occ get "ammobox")) isEqualTo false}) exitWith {
if (_heliType isEqualTo []) exitWith {
["Support", "A helicopter is not available due to template issues. Apologies! You have been refunded."] call A3A_fnc_customHint;
[0,2000] remoteExec ["A3A_fnc_resourcesFIA",2];
};
Expand Down
3 changes: 0 additions & 3 deletions A3A/addons/ultimate/functions/init/fn_initZones.sqf
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
params [["_markersX", markersX]];

// private _hideEnemyMarkers = missionNamespace getVariable ["A3U_setting_hideEnemyMarkers",false];
if !(hideEnemyMarkers) exitWith {};



markersImmune = markersX select {
((sidesX getVariable [_x, sideUnknown]) isEqualTo resistance)
||
Expand Down