Skip to content

Commit

Permalink
Merge pull request #64 from Bob-Murphy/unstable
Browse files Browse the repository at this point in the history
Merge unstable to master creating version 1.4c1.04
  • Loading branch information
Bob-Murphy authored Jul 31, 2019
2 parents eb49914 + 2a51408 commit 480bf7a
Show file tree
Hide file tree
Showing 20 changed files with 125 additions and 62 deletions.
2 changes: 1 addition & 1 deletion A3-Antistasi/AI/AAFKilledEH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if (side (group _killer) == teamPlayer) then
if ((player distance _victim < 300) and (captive player)) then {player setCaptive false};
};
};
if (count weapons _victim < 1) then
if (count weapons _victim < 1 && !(_victim getVariable ["isAnimal", false])) then
{
if (_sideX == Occupants) then
{
Expand Down
1 change: 1 addition & 0 deletions A3-Antistasi/AI/guardDog.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ _dog setVariable ["BIS_fnc_animalBehaviour_disable", true];
_dog disableAI "FSM";
_dog setBehaviour "CARELESS";
_dog setRank "PRIVATE";
_dog setVariable ["isAnimal", true, true];

while {alive _dog} do
{
Expand Down
15 changes: 13 additions & 2 deletions A3-Antistasi/CREATE/CIVinit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ _unit disableAI "AUTOTARGET";

_unit addEventHandler ["HandleDamage",
{
private _unit = _this select 0;
_dam = _this select 2;
_proy = _this select 4;
_injurer = _this select 3;
if(!isNil "_injurer" && isPlayer _injurer) then {
_unit setVariable ["injuredByPlayer", _injurer, true];
_unit setVariable ["lastInjuredByPlayer", time, true];
};
if (_proy == "") then
{
_injurer = _this select 3;
if ((_dam > 0.95) and (!isPlayer _injurer)) then {_dam = 0.9};
if ((_dam > 0.95) and (!isPlayer _injurer)) then {_dam = 0.9};
};
_dam
}
Expand All @@ -25,6 +30,12 @@ _EHkilledIdx = _unit addEventHandler ["killed",
{
_victim = _this select 0;
_killer = _this select 1;
if (time - (_victim getVariable ["lastInjuredByPlayer", 0]) < 120) then {
_killer = _victim getVariable ["injuredByPlayer", _killer];
};
if (isNull _killer) then {
_killer = _victim;
};
if (_victim == _killer) then
{
_nul = [-1,-1,getPos _victim] remoteExec ["A3A_fnc_citySupportChange",2];
Expand Down
2 changes: 2 additions & 0 deletions A3-Antistasi/Debugging/spawnDebuggingLoop.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ while {shouldRunDebuggingLoop} do {
diag_log "[Antistasi] Cleaning groups";
[teamPlayer] remoteExec ["A3A_fnc_deleteEmptyGroupsOnSide", 0];
[civilian] remoteExec ["A3A_fnc_deleteEmptyGroupsOnSide", 0];
[Occupants] remoteExec ["A3A_fnc_deleteEmptyGroupsOnSide", 0];
[Invaders] remoteExec ["A3A_fnc_deleteEmptyGroupsOnSide", 0];
_lastGroupCleanTime = serverTime;
};

Expand Down
45 changes: 31 additions & 14 deletions A3-Antistasi/JeroenArsenal/JNA/fn_arsenal_loadInventory.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,12 @@ _backpackItems = _inventory select 2 select 1;

//add containers
_containers = [_uniform,_vest,_backpack];
private _invCallArray = [{removeUniform player;player forceAddUniform _uniform;},//todo remove
{removeVest player;player addVest _vest;},
{removeBackpackGlobal player;player addBackpack _backpack;}];
private _removeContainerFuncs = [{removeUniform player;},{removeVest player;},{removeBackpackGlobal player;}];
private _addContainerFuncs = [
{player forceAddUniform (_this select 0);},
{player addVest (_this select 0);},
{player addBackpack (_this select 0);}
];
{
_item = _x;
if!(_item isEqualTo "")then{
Expand All @@ -324,20 +327,22 @@ private _invCallArray = [{removeUniform player;player forceAddUniform _uniform;}
IDC_RSCDISPLAYARSENAL_TAB_VEST,
IDC_RSCDISPLAYARSENAL_TAB_BACKPACK
] select _foreachindex;


_addContainerFunc = (_addContainerFuncs select _foreachindex);

call {
if ([_itemCounts select _index, _item] call jn_fnc_arsenal_itemCount == -1) exitWith {
call (_invCallArray select _foreachindex);
[_item] call _addContainerFunc;
};

if ([_availableItems select _index, _item] call jn_fnc_arsenal_itemCount > 0) then {
call (_invCallArray select _foreachindex);
[_item] call _addContainerFunc;
[_arrayTaken,_index,_item,_amount] call _addToArray;
[_availableItems,_index,_item,_amount] call _removeFromArray;
} else {
_oldItem = [_uniform_old,_vest_old,_backpack_old] select _foreachindex;
if !(_oldItem isEqualTo "") then {
call (_invCallArray select _foreachindex);
[_oldItem] call _addContainerFunc;
_arrayReplaced = [_arrayReplaced,[_item,_oldItem]] call jn_fnc_arsenal_addToArray;
[_arrayTaken,_index,_oldItem,1] call _addToArray;
} else {
Expand Down Expand Up @@ -407,11 +412,23 @@ private _invCallArray = [{removeUniform player;player forceAddUniform _uniform;}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Update global
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

private _lookupConfigName = {
private _class = param [0];
private _configs = "configName _x == _class" configClasses (configFile >> "CfgWeapons");
if (count _configs > 0) exitWith {
[_configs select 0] call BIS_fnc_displayName;
};
private _configs = "configName _x == _class" configClasses (configFile >> "CfgMagazines");
if (count _configs > 0) exitWith {
[_configs select 0] call BIS_fnc_displayName;
};
_class;
};

_arrayAdd = [_arrayPlaced, _arrayTaken] call _subtractArrays; //remove items that where not added
_arrayRemove = [_arrayTaken, _arrayPlaced] call _subtractArrays;

_arrayAdd call jn_fnc_arsenal_addItem;
diag_log "adadadadada";
diag_log _arrayTaken;
diag_log _arrayPlaced;
_arrayRemove call jn_fnc_arsenal_removeItem;
Expand All @@ -422,24 +439,24 @@ _arrayRemove call jn_fnc_arsenal_removeItem;
_reportTotal = "";
_reportReplaced = "";
{
_nameNew = _x select 0;
_nameOld = _x select 1;
_reportReplaced = _reportReplaced + _nameOld + " instead of " + _nameNew + "\n";
_nameNew = [_x select 0] call _lookupConfigName;
_nameOld = [_x select 1] call _lookupConfigName;
_reportReplaced = _reportReplaced + _nameOld + " has been kept, because there is no " + _nameNew + "\n";
} forEach _arrayReplaced;

if!(_reportReplaced isEqualTo "")then{
_reportTotal = ("I keep this items because i couldn't find the other ones:\n" + _reportReplaced+"\n");
_reportTotal = ("These items were not in the Arsenal, so the originals have been kept:\n" + _reportReplaced+"\n");
};

_reportMissing = "";
{
_name = _x select 0;
_name = [_x select 0] call _lookupConfigName;
_amount = _x select 1;
_reportMissing = _reportMissing + _name + " (" + (str _amount) + "x)\n";
}forEach _arrayMissing;

if!(_reportMissing isEqualTo "")then{
_reportTotal = (_reportTotal+"I couldn't find the following items:\n" + _reportMissing+"\n");
_reportTotal = (_reportTotal+"These items were not in the Arsenal:\n" + _reportMissing+"\n");
};

if!(_reportTotal isEqualTo "")then{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class Mission
{
class Intel
{
briefingName="A3-Antistasi Altis BLUEFOR 1.4c1.03";
briefingName="A3-Antistasi Altis BLUEFOR 1.4c1.04";
overviewText="Build FIA Army from scratch and defeat the AAF and CSAT forces in a whole map Dynamic Mission.";
resistanceWest=0;
startWeather=0;
Expand Down
2 changes: 1 addition & 1 deletion A3-Antistasi/Templates/A3-AATemplate.Altis/mission.sqm
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class Mission
{
class Intel
{
briefingName="A3-Antistasi Altis 1.4c1.03";
briefingName="A3-Antistasi Altis 1.4c1.04";
overviewText="Build FIA Army from scratch and defeat the AAF and CSAT forces in a whole map Dynamic Mission.";
resistanceWest=0;
startWeather=0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class Mission
{
class Intel
{
briefingName="A3-Antistasi Armia Krajowa Chernarus 1.4c1.03";
briefingName="A3-Antistasi Armia Krajowa Chernarus 1.4c1.04";
resistanceWest=0;
timeOfChanges=1800.0002;
startWeather=0.25;
Expand Down
2 changes: 1 addition & 1 deletion A3-Antistasi/Templates/A3-WotPTemplate.Tanoa/mission.sqm
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ class Mission
{
class Intel
{
briefingName="Antistasi - Warlords of the Pacific - 1.4c1.03";
briefingName="Antistasi - Warlords of the Pacific - 1.4c1.04";
overviewText="Build a Syndikat Army from scratch and defeat NATO and CSAT forces in a persistent mission with Tanoa as AO.";
resistanceWest=0;
timeOfChanges=1800.0002;
Expand Down
1 change: 1 addition & 0 deletions A3-Antistasi/buildHQ.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ if (petros != (leader group petros)) then
[petros] join groupPetros;
};
[petros,"remove"] remoteExec ["A3A_fnc_flagaction",0,petros];
petros switchAction "PlayerStand";
petros disableAI "MOVE";
petros disableAI "AUTOTARGET";
respawnTeamPlayer setMarkerPos getPos petros;
Expand Down
2 changes: 1 addition & 1 deletion A3-Antistasi/dialogs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class first_load {
w = 0.175015 * safezoneW;
h = 0.0560125 * safezoneH;
tooltip = "Loads the previous personal session";
action = "closeDialog 0;nul = [] execVM ""statSave\loadPlayer.sqf"";";
action = "closeDialog 0;nul = [] spawn A3A_fnc_loadPreviousSession;";
};
class HQ_button_Gstatic: RscButton
{
Expand Down
1 change: 1 addition & 0 deletions A3-Antistasi/functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ class A3A
{
class loadPlayer {file="statSave\loadPlayer.sqf";};
class savePlayer {file="statSave\savePlayer.sqf";};
class loadPreviousSession {file="statSave\loadPreviousSession.sqf";};
}

class Utility
Expand Down
21 changes: 13 additions & 8 deletions A3-Antistasi/init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@ if (isServer and (isNil "serverInitDone")) then {skipTime random 24};

if (!isMultiPlayer) then
{
//Init server parameters
gameMode = 1;
autoSave = false;
membershipEnabled = false;
memberOnlyMagLimit = 0;
switchCom = false;
tkPunish = false;
skillMult = 1;
minWeaps = 24;
civTraffic = 1;
limitedFT = false;

diag_log "Starting Antistasi SP";
call compile preprocessFileLineNumbers "initVar.sqf";//this is the file where you can modify a few things.
initVar = true;
Expand Down Expand Up @@ -45,15 +56,9 @@ if (!isMultiPlayer) then
serverInitDone = true;
diag_log "Antistasi SP. serverInitDone is true. Arsenal loaded";
_nul = [] execVM "modBlacklist.sqf";
autoSave = false;
membershipEnabled = false;
switchCom = false;
tkPunish = false;

distanceMission = if (hasIFA) then {2000} else {4000};
skillMult = 1;
minWeaps = 24;
civTraffic = 1;
limitedFT = false;

{
private _index = _x call jn_fnc_arsenal_itemType;
[_index,_x,-1] call jn_fnc_arsenal_addItem;
Expand Down
12 changes: 5 additions & 7 deletions A3-Antistasi/initServer.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@ limitedFT = if ("allowFT" call BIS_fnc_getParamValue == 1) then {true} else {fal

//Load Campaign ID if resuming game
if(loadLastSave) then {
campaignID = profileNameSpace getVariable ["ss_CampaignID",nil];
};
if(isNil "campaignID") then
{
campaignID = profileNameSpace getVariable ["ss_CampaignID",""];
} else {
campaignID = str(round((random(100000)) + random 10000));
profileNameSpace setVariable ["ss_CampaignID", campaignID];
};
};

publicVariable "campaignID";

_nul = call compile preprocessFileLineNumbers "initVar.sqf";
Expand Down Expand Up @@ -180,7 +178,7 @@ resourcecheck = [] execVM "resourcecheck.sqf";
[] execVM "Scripts\fn_advancedTowingInit.sqf";
savingServer = false;

[] call A3A_fnc_spawnDebuggingLoop;
[] spawn A3A_fnc_spawnDebuggingLoop;

//Enable performance logging
[] spawn {
Expand Down
3 changes: 2 additions & 1 deletion A3-Antistasi/initVar.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ waitUntil
if (scriptDone _getMissionPath) then {true} else
{
hint "Stuck on compiling missionPath, re-launch the mission.";
false;
}
};
hint "Done compiling missionPath";
Expand Down Expand Up @@ -604,7 +605,7 @@ if (!activeGREF) then
{
unlockedWeapons = ["LIB_PTRD","LIB_M2_Flamethrower","LIB_Binocular_GER","LIB_K98","LIB_M1895","LIB_FLARE_PISTOL"];//"LMG_03_F"
unlockedRifles = ["LIB_K98"];//standard rifles for AI riflemen, medics engineers etc. are picked from this array. Add only rifles.
unlockedMagazines = ["LIB_1Rnd_145x114","LIB_M2_Flamethrower_Mag","LIB_5Rnd_792x57","LIB_Pwm","LIB_Rg42","LIB_US_TNT_4pound_mag","LIB_7Rnd_762x38","LIB_1Rnd_flare_red","LIB_1Rnd_flare_green","LIB_1Rnd_flare_white","LIB_1Rnd_flare_yellow"];
unlockedMagazines = ["LIB_1Rnd_145x114","LIB_M2_Flamethrower_Mag","LIB_5Rnd_792x57","LIB_Pwm","LIB_Rg42","LIB_7Rnd_762x38","LIB_1Rnd_flare_red","LIB_1Rnd_flare_green","LIB_1Rnd_flare_white","LIB_1Rnd_flare_yellow"];
initialRifles = ["LIB_K98"];
unlockedAT = [];
};
Expand Down
46 changes: 30 additions & 16 deletions A3-Antistasi/moveHQObject.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,43 @@ _size = [_markerX] call A3A_fnc_sizeMarker;
_positionX = getMarkerPos _markerX;
if (_playerX distance2D _positionX > _size) exitWith {hint "This asset needs to be closer to it relative zone center to be able to be moved"};

_thingX setVariable ["objectBeingMoved", true];

_thingX removeAction _id;
_thingX attachTo [_playerX,[0,2,1]];

private _actionX = _playerX addAction ["Drop Here", {detach (_this select 3 select 0); player removeAction (_this select 2);}, [_thingX],0,false,true,"",""];

waitUntil {sleep 1; (_playerX != attachedTo _thingX) or (vehicle _playerX != _playerX) or (_playerX distance2D _positionX > (_size-3)) or !([_playerX] call A3A_fnc_canFight) or (!isPlayer _playerX)};

if (_playerX == attachedTo _thingX) then {
detach _thingX;
_playerX removeAction _actionX;
private _fnc_placeObject = {
params [["_thingX", objNull], ["_playerX", objNull], ["_dropObjectActionIndex", -1]];

if (isNull _thingX) exitWith {diag_log "[Antistasi] Error, trying to place invalid HQ object"};
if (isNull _playerX) exitWith {diag_log "[Antistasi] Error, trying to place HQ object with invalid player"};

if (!(_thingX getVariable ["objectBeingMoved", false])) exitWith {};

if (_playerX == attachedTo _thingX) then {
detach _thingX;
};

if (_dropObjectActionIndex != -1) then {
_playerX removeAction _dropObjectActionIndex;
};

_thingX setVectorUp surfaceNormal position _thingX;
_thingX setPosATL [getPosATL _thingX select 0,getPosATL _thingX select 1,0.1];

_thingX setVariable ["objectBeingMoved", false];
_thingX addAction ["Move this asset", "moveHQObject.sqf",nil,0,false,true,"","(_this == theBoss)"];
};

/*
for "_i" from 0 to (_playerX addAction ["",""]) do
{
_playerX removeAction _i;
};
*/
private _actionX = _playerX addAction ["Drop Here", {
(_this select 3) params ["_thingX", "_fnc_placeObject"];

[_thingX, player, (_this select 2)] call _fnc_placeObject;
}, [_thingX, _fnc_placeObject],0,false,true,"",""];

_thingX addAction ["Move this asset", "moveHQObject.sqf",nil,0,false,true,"","(_this == theBoss)"];
waitUntil {sleep 1; (_playerX != attachedTo _thingX) or (vehicle _playerX != _playerX) or (_playerX distance2D _positionX > (_size-3)) or !([_playerX] call A3A_fnc_canFight) or (!isPlayer _playerX)};

_thingX setPosATL [getPosATL _thingX select 0,getPosATL _thingX select 1,0];
_thingX setVectorUp surfaceNormal position _thingX;
[_thingX, _playerX, _actionX] call _fnc_placeObject;

if (vehicle _playerX != _playerX) exitWith {hint "You cannot move HQ assets while in a vehicle"};

Expand Down
6 changes: 5 additions & 1 deletion A3-Antistasi/onPlayerDisconnect.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ _owner = _this select 4;
_resourcesX = 0;
_hr = 0;

diag_log format ["[Antistasi] Player disconnected with id %1 and unit %2 on side %3", _uid, _unit, (side _unit)];

if (_unit == theBoss) then
{
{
Expand All @@ -15,6 +17,8 @@ if (_unit == theBoss) then
{
_uds = units _x;
{
//Once a player has disconnected, they no longer count as a player - so isPlayer doesn't filter them out.
if (_x isEqualTo _unit) exitWith {};
if (alive _x) then
{
_resourcesX = _resourcesX + (server getVariable (typeOf _x));
Expand Down Expand Up @@ -59,7 +63,7 @@ if (_unit == theBoss) then
if (group petros == group _unit) then {[] spawn A3A_fnc_buildHQ};
};
//{if (groupOwner _x ==)} forEach allGroups select {(side _x == civilian) and (!isPlayer leader _x)};
if (side group _unit == teamPlayer) then
if (side _unit == teamPlayer) then
{
if ((_hr > 0) or (_resourcesX > 0)) then {[_hr,_resourcesX] spawn A3A_fnc_resourcesFIA};
if (membershipEnabled and pvpEnabled) then
Expand Down
Loading

0 comments on commit 480bf7a

Please sign in to comment.