forked from Giallustio/HeartsAndMinds
-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1352 from Vdauphin/Add-slot_persistant
Add: Slot persistence
- Loading branch information
Showing
15 changed files
with
272 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/playerConnected.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
/* ---------------------------------------------------------------------------- | ||
Function: btc_eh_fnc_playerConnected | ||
Description: | ||
Fire the event playerConnected. | ||
Parameters: | ||
Returns: | ||
Examples: | ||
(begin example) | ||
[] call btc_eh_fnc_playerConnected; | ||
(end) | ||
Author: | ||
Vdauphin | ||
---------------------------------------------------------------------------- */ | ||
|
||
params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"]; | ||
|
||
if (_name isEqualTo "__SERVER__") exitWith {}; | ||
|
||
[{ | ||
!isNull ((_this select 1) call BIS_fnc_getUnitByUID) | ||
}, { | ||
["btc_playerConnected", [(_this select 1) call BIS_fnc_getUnitByUID, _this]] call CBA_fnc_localEvent; | ||
}, _this, 4 * 60] call CBA_fnc_waitUntilAndExecute; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/slot/deserializeState.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
/* ---------------------------------------------------------------------------- | ||
Function: btc_slot_fnc_deserializeState | ||
Description: | ||
Deserialize player slot. | ||
Parameters: | ||
_previousPos - Position of the player. [Array] | ||
_dir - Direction of the player. [Number] | ||
_loadout - Loadout of the player. [Array] | ||
_flagTexture - Flag raised. [String] | ||
_isContaminated - Chemically contaminated. [Boolean] | ||
_medicalDeserializeState - Medical ACE state. [String] | ||
_vehicle - Vehicle occupied by player. [Object] | ||
_field_rations - Thirst and hunger player's. [Array] | ||
Returns: | ||
Examples: | ||
(begin example) | ||
(btc_slots_serialized getOrDefault [(keys btc_slots_serialized)#0, []]) remoteExecCall ["btc_slot_fnc_deserializeState", allPlayers#0]; | ||
(end) | ||
Author: | ||
Vdauphin | ||
---------------------------------------------------------------------------- */ | ||
|
||
[{!isNull player}, { | ||
params [ | ||
"_previousPos", | ||
"_dir", | ||
"_loadout", | ||
"_flagTexture", | ||
"_isContaminated", | ||
"_medicalDeserializeState", | ||
["_vehicle", objNull, [objNull]], | ||
["_field_rations", [], [[]]] | ||
]; | ||
|
||
if ( | ||
player distance ASLToAGL _previousPos > 50 || // Don't set loadout when near main base | ||
btc_p_autoloadout isEqualTo 0 | ||
) then { | ||
[{player setUnitLoadout _this;}, _loadout] call CBA_fnc_execNextFrame; | ||
}; | ||
if ((isNull _vehicle) || {!(player moveInAny _vehicle)}) then { | ||
player setPosASL _previousPos; | ||
}; | ||
player setDir _dir; | ||
player forceFlagTexture _flagTexture; | ||
[player, _medicalDeserializeState] call ace_medical_fnc_deserializeState; | ||
|
||
if (_isContaminated) then { | ||
player call btc_chem_fnc_damageLoop; | ||
}; | ||
|
||
_field_rations params [["_thirst", 0, [0]], ["_hunger", 0, [0]]]; | ||
player setVariable ["acex_field_rations_thirst", _thirst]; | ||
player setVariable ["acex_field_rations_hunger", _hunger]; | ||
|
||
}, _this] call CBA_fnc_waitUntilAndExecute; |
36 changes: 36 additions & 0 deletions
36
=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/slot/deserializeState_s.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
/* ---------------------------------------------------------------------------- | ||
Function: btc_slot_fnc_deserializeState_s | ||
Description: | ||
Deserialize player slot. | ||
Parameters: | ||
_player - Player. [Object] | ||
_slotName - Slot name use by the player. [String, Array] | ||
Returns: | ||
Examples: | ||
(begin example) | ||
[allPlayers#0, (keys btc_slots_serialized)#0] call btc_slot_fnc_deserializeState_s; | ||
(end) | ||
Author: | ||
Vdauphin | ||
---------------------------------------------------------------------------- */ | ||
|
||
params [ | ||
["_player", objNull, [objNull]], | ||
["_slotName", "", ["", []]] | ||
]; | ||
|
||
private _data = btc_slots_serialized getOrDefault [_slotName, []]; | ||
if (_data isEqualTo []) exitWith {}; | ||
if (_data select 4) then { | ||
if ((btc_chem_contaminated pushBackUnique _player) > -1) then { | ||
publicVariable "btc_chem_contaminated"; | ||
}; | ||
}; | ||
_data remoteExecCall ["btc_slot_fnc_deserializeState", _player]; |
Oops, something went wrong.